/* ============================================================================
   base.css — reset, typography, layout primitives, ambient layers, reveal.
   ========================================================================= */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* reserve the sticky bar from first paint so it costs nothing in CLS */
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
  transition: background-color .3s linear, color .3s linear;
}
@media (min-width: 900px) { body { padding-bottom: 0 } }

img, svg, video { max-width: 100%; display: block }
a { color: inherit; text-decoration: none }
h1, h2, h3, h4, p, figure { margin: 0 }
ul, ol { margin: 0; padding: 0 }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer }

:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: 3px;
  border-radius: 6px;
}
:root[data-theme="light"] :focus-visible,
:root:not([data-theme="dark"]) :focus-visible { outline-color: var(--accent) }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :focus-visible { outline-color: var(--cta) }
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 70;
  padding: 11px 16px; border-radius: 11px;
  background: var(--cta); color: var(--cta-ink);
  font: 800 14px/1 var(--font);
  transition: top .18s var(--ease-out);
}
.skip:focus { top: 12px }

/* ---------------------------------------------------------------- type --- */
.eyebrow {
  font: 700 clamp(10.5px, 1.05vw, 12px)/1 var(--font-mono);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
}
.serif { font-family: var(--font-serif); font-style: italic }
/* text-wrap: balance stops headings dropping a single word onto its own line.
   Unsupported browsers simply ignore it and wrap as before. */
.h1 { font-size: clamp(38px, 7.4vw, 80px); line-height: .98; font-weight: 800; letter-spacing: -.038em; text-wrap: balance }
.h2 { font-size: clamp(28px, 4.4vw, 50px); line-height: 1.04; font-weight: 800; letter-spacing: -.032em; text-wrap: balance }
.h3 { font-size: clamp(19px, 2vw, 25px); line-height: 1.2;  font-weight: 700; letter-spacing: -.018em; text-wrap: balance }
.lede { font-size: clamp(15.5px, 1.5vw, 19px); line-height: 1.55; color: var(--tx-2); text-wrap: pretty }
p, li, blockquote { text-wrap: pretty }
.small { font-size: 13px; line-height: 1.5; color: var(--tx-3) }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' }
.strike { color: var(--tx-3); text-decoration: line-through; text-decoration-thickness: 2px }

/* -------------------------------------------------------------- layout --- */
.shell { width: var(--shell); margin-inline: auto }
section { position: relative; z-index: 1; scroll-margin-top: calc(var(--nav-h) + 14px) }
.band { padding: clamp(64px, 9vw, 132px) 0 }
.band-tight { padding: clamp(44px, 6vw, 80px) 0 }
.band-alt { background: var(--bg-alt) }

.head { max-width: 660px; margin-bottom: clamp(34px, 4vw, 54px) }
.head .eyebrow { display: block; margin-bottom: 15px }
.head .lede { margin-top: 16px }
.head-c { margin-inline: auto; text-align: center }

.grid { display: grid; gap: clamp(13px, 1.5vw, 18px) }
.g2 { grid-template-columns: 1fr }
.g3 { grid-template-columns: 1fr }
.g4 { grid-template-columns: repeat(2, 1fr) }
@media (min-width: 720px) { .g2 { grid-template-columns: repeat(2, 1fr) } .g3 { grid-template-columns: repeat(3, 1fr) } }
@media (min-width: 980px) { .g4 { grid-template-columns: repeat(4, 1fr) } }

/* ----------------------------------------------------- ambient layers --- */
#pollen { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .85 }
/* Hard gate. The JS also refuses to start below 900px, but a resize can race it
   and a stuck canvas is a real battery cost on the phones most of this traffic
   arrives on. CSS always wins. */
@media (max-width: 899px) { #pollen, #spot { display: none !important } }

.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

#spot {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity .5s linear;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), var(--glow-2), transparent 70%);
}

#progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--cta));
}

/* -------------------------------------------------------------- reveal ---
   Progressive enhancement. Content is visible by default; the hidden start
   state only applies once JS has confirmed IntersectionObserver support and
   that reduced motion is not requested. If the script never runs, the page
   still reads normally.                                                     */
html.reveal .rv {
  opacity: 0; transform: translateY(20px);
  transition: opacity .62s var(--ease), transform .62s var(--ease);
  transition-delay: calc(var(--d, 0) * 70ms);
}
html.reveal .rv.in { opacity: 1; transform: none }

/* ------------------------------------------------- motion kill switch --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  #pollen, #spot { display: none }
}
