/* ============================================================
   Base — reset, typography, global a11y (Light Crisp)
   Tokens live in tokens.css, loaded before this file.
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--header-color);
  font-weight: 700;
  letter-spacing: -0.01em;
}

::selection { background: var(--accent-subtle); }

/* Square scrollbar — part of the machine-voice look */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-muted); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--border-color); }

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button, a, input, select, textarea {
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Skip link — first focusable element */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Shared keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
