/* ==========================================================================
   Base — reset, typography defaults, accessibility helpers
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-med) var(--ease), color var(--dur-med) var(--ease);
}

img, svg, video { max-width: 100%; display: block; }
button { font-family: inherit; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

h1, h2, h3, h4, p { margin: 0; }

::selection { background: color-mix(in oklch, var(--accent) 45%, transparent); color: var(--text); }

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

/* Page headings are given tabindex="-1" only so the router can move focus
   there for assistive tech after a route change — they're never reachable
   by pressing Tab, so no visible ring is needed for sighted keyboard users. */
[tabindex="-1"]:focus {
  outline: none;
}

/* Skip link — first focusable element, hidden until focused */
.skip-link {
  position: fixed;
  top: -60px;
  left: 12px;
  z-index: 1000;
  background: var(--accent);
  color: var(--accent-text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Respect reduced-motion preference everywhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* Thin, theme-aware scrollbar for horizontally-scrolling strips (nav, tags) */
.scroll-x {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); }
