/* ============================================================
   base.css — fonts, reset, primitives, reveal system
   ============================================================ */

/* ---- Self-hosted fonts (subset woff2, latin + latin-ext) ---- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-italic.woff2") format("woff2");
  font-weight: 300 900; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-ext-italic.woff2") format("woff2");
  font-weight: 300 900; font-style: italic; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var-latin-ext.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400-latin-ext.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500-latin.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500-latin-ext.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-700-latin.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-700-latin-ext.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Size-adjusted fallbacks: font swap moves nothing (zero CLS from fonts) */
@font-face { font-family: "Fraunces Fallback"; src: local("Georgia"); size-adjust: 104%; }
@font-face { font-family: "Inter Fallback"; src: local("Arial"); size-adjust: 107%; }

/* ---- Reset & primitives ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  font-family: var(--font-body);
  font-size: var(--t-17);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, picture, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

a { color: rgb(var(--accent)); text-decoration: none; }
a:hover { color: rgb(var(--accent-bright)); }

::selection { background: rgb(var(--accent) / .35); color: rgb(var(--ink)); }

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

.skip-link {
  position: absolute; left: var(--s-16); top: -100px; z-index: 200;
  background: rgb(var(--accent)); color: rgb(var(--on-accent));
  font-weight: 600; font-size: var(--t-15);
  padding: var(--s-8) var(--s-16); border-radius: var(--r-pill);
  transition: top var(--d-200) var(--ease-out);
}
.skip-link:focus { top: var(--s-16); color: rgb(var(--on-accent)); }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s-24); }
@media (min-width: 768px) { .wrap { padding-inline: var(--s-32); } }

section { padding-block: var(--section-pad); position: relative; }
section[id], div[id] { scroll-margin-top: 84px; }

/* Kicker — mono label, the site's fact voice */
.kicker {
  font-family: var(--font-mono);
  font-size: var(--t-12);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: var(--s-12);
}
/* The signal color lives on a doubled selector (Phase 4 critique):
   section-copy rules like .section-head p / .ag-copy p (0,1,1) were
   outranking the plain .kicker class and muting kickers to ink-dim.
   DESIGN.md assigns kickers to cyan — everywhere, no exceptions. */
.kicker.kicker { color: rgb(var(--accent)); }
.kicker::before {
  content: ""; width: 28px; height: 1px; background: rgb(var(--accent) / .6);
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 560; line-height: 1.08; letter-spacing: -.01em; }
h2 { font-size: clamp(var(--t-32), 4.5vw, var(--t-44)); margin-bottom: var(--s-24); }
h2 .kicker, .section-head .kicker { margin-bottom: var(--s-16); }
.section-head { max-width: var(--prose); margin-bottom: var(--s-48); }
.section-head p { color: rgb(var(--ink-dim)); }

.lede { font-size: var(--t-20); line-height: 1.55; color: rgb(var(--ink)); }
.dim { color: rgb(var(--ink-dim)); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- THE reveal pattern (one pattern, everywhere — DESIGN.md) ----
   Rise 16px + fade, 520ms --ease-out, staggered 60ms within a group,
   revealed once. The .js class is set by an inline boot script before
   first paint, so no-JS visitors and crawlers see everything. */
.js [data-reveal] { opacity: 0; transform: translateY(16px); }
.js [data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity var(--d-520) var(--ease-out), transform var(--d-520) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}
/* Hero intro choreography: 800ms clock, 60ms steps (DESIGN.md) */
.js .hero [data-reveal] { transform: translateY(18px); }
.js .hero [data-reveal].in {
  transition-duration: var(--d-800);
  transition-delay: calc(var(--i, 0) * 60ms + 80ms);
}

/* Cursor spotlight (Chiang, recolored): cyan radial field, fine pointers only.
   Implemented in nav.js by moving --mx/--my on the .spotlight layer. */
.spotlight {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(560px circle at var(--mx, 50%) var(--my, -10%),
              rgb(var(--accent) / .07), transparent 65%);
  opacity: 0; transition: opacity var(--d-520) var(--ease-out);
}
body.spot-on .spotlight { opacity: 1; }
@media (pointer: coarse) { .spotlight { display: none; } }

/* Ambient depth: two very dim static radial fields, navy -> teal (DESIGN.md) */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 520px at 85% -5%, rgb(var(--accent-deep) / .20), transparent 60%),
    radial-gradient(760px 480px at -10% 42%, rgb(var(--accent-deep) / .12), transparent 60%);
}
main, footer, .site-head { position: relative; z-index: 2; }

/* ---- Reduced motion (DESIGN.md, complete) ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; }
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
  a, .btn, .card, .media-row, .social-btn { transition: opacity var(--d-120) linear !important; }
}
