/* ============================================================================
   base.css — reset, document defaults, focus-visible ring, skip link,
   sr-only utility, and the GLOBAL reduced-motion contract (design-systems §1.5).
   References tokens.css only — no hardcoded hex.
   ============================================================================ */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-ground);
  color: var(--color-text);
  font: var(--type-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* theme cross-fade; stilled under reduced-motion below */
  transition: background-color var(--dur-base) var(--ease-inout),
              color var(--dur-base) var(--ease-inout);
}

img, picture, svg, video { display: block; max-width: 100%; }

h1, h2, h3, p, ol, ul, figure, blockquote { margin: 0; }

a { color: var(--accent); }

button { font: inherit; color: inherit; cursor: pointer; }

/* ── Focus visibility (keyboard) ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
/* Don't show the ring for pointer interactions that also set focus */
:focus:not(:focus-visible) { outline: none; }

/* ── Skip-to-content link ────────────────────────────────────────────────── */
.skip {
  position: absolute;
  left: var(--space-3);
  top: -100%;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--color-panel);
  color: var(--color-text-high);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  font: var(--type-ui);
  text-decoration: none;
}
.skip:focus { top: var(--space-3); }

/* ── Screen-reader-only utility ──────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive helper (hide secondary nav on small screens) ─────────────── */
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* ── Global reduced-motion contract (design-systems §1.5) ────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
