/*
  base.css
  Reset + global element defaults + accessibility baseline.
  No component-specific styling belongs here (see components.css).
  No page-specific layout belongs here (see pages/*.css).
  Depends on: tokens.css (must be loaded first).
*/

/* ============================================================
   RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  font-weight: var(--text-body-weight);
  line-height: var(--text-body-leading);
  letter-spacing: var(--text-body-tracking);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-primary);
}

p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
}

/* Body text never uses negative tracking (spec §4 Type Rules) —
   enforced here as the default; components/headings override
   tracking explicitly via their own type tokens only. */

/* ============================================================
   ACCESSIBILITY — Skip link
   First focusable element on every page (spec §10).
   Markup (added per-page in Milestone 4):
   <a href="#main-content" class="skip-link">Skip to main content</a>
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--color-accent-500);
  color: var(--color-text-primary);
  padding: 8px 16px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* ============================================================
   ACCESSIBILITY — Global focus ring
   Never remove outline; this is the only focus treatment used
   anywhere in the project (spec §10).
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-accent-500);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================================
   ACCESSIBILITY — Reduced motion
   Required global override (spec §6). Placed in base.css because
   it must apply to every animation project-wide, including any
   added by future components, not only utility-triggered ones.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
