/* ==========================================================================
   Reset and base typography

   Everything here is structural or accessibility-critical. The design lives in
   tokens.css and components.css — this file should need almost no changes
   between projects.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-height: 100svh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* `clip`, not `hidden`: `overflow-x: hidden` on body silently creates a
     scroll container and breaks `position: sticky` on descendants. */
  overflow-x: clip;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

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

img { height: auto; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; cursor: pointer; }

a {
  color: inherit;
  text-decoration-color: color-mix(in oklab, currentColor 32%, transparent);
  text-underline-offset: 0.24em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
}

a:hover { text-decoration-color: currentColor; }

ul, ol { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p { text-wrap: pretty; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-variant-ligatures: none;
}

/* Numerals that need to line up in a column — tables, stat rows. */
.tabular { font-variant-numeric: tabular-nums; }

::selection {
  background: color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--ink);
}

/* ---- focus ---------------------------------------------------------------
   A single, always-visible focus ring. Keyboard users get a strong indicator;
   mouse users never see it thanks to :focus-visible. Never delete this.     */
:focus { outline: none; }

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

.skip-link {
  position: fixed;
  top: var(--space-s);
  left: var(--space-s);
  z-index: 200;
  padding: 0.7rem 1.15rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur-base) var(--ease-spring);
}

.skip-link:focus-visible { transform: translateY(0); }

/* ---- utilities ---------------------------------------------------------- */
.u-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

/* ---- no-js fallback ------------------------------------------------------
   Scroll-reveal starts elements at opacity 0. `.no-js` is the only thing
   keeping them visible when scripting is unavailable OR when the module graph
   fails to boot (the inline bootstrap's watchdog restores this class). Both
   rules below are load-bearing — deleting either produces a blank page in a
   failure mode you will not see in testing.                                 */
.no-js [data-reveal] { opacity: 1; transform: none; }
.no-js [data-split] .split-word__inner { transform: none; }

/* ---- reduced motion ------------------------------------------------------
   Honour the OS setting properly: kill ambient animation entirely rather than
   merely speeding it up, and make every reveal start already-visible.       */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .split-word__inner { transform: none !important; }
}
