/* base.css (foundation, F-C): reset, focus, skip link, .sr-only, and the html-class contract (spec 3.6, 5.8).
   Cascade: tokens, fonts, site-tokens, base, type, layout, fx, chrome, lenis, scenes/*.
   html classes:  (none) no-JS = static layout, composed frames shown, tracks at natural height
                  js        cinematic allowed (set by the head guard)        static    reduced motion, same as no-JS
                  fx-fail   failsafe or boot error: collapse to no-JS         fx-ready  first swarm frame drawn
                  gl-fail   no WebGL2: composed frames stay, DOM motion still runs
   Every selector that turns cinematic behaviour on is scoped by html.js:not(.fx-fail):not(.static). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--pill-h, 56px) + 32px); /* the fixed pill (16px gap, its height, 16px gap): an anchor or a focused title always lands clear of it */
  background: var(--bg, var(--bone));
  color: var(--fg, var(--on-bone));
  --bg: var(--bone); --fg: var(--on-bone); --mut: var(--on-bone-dim); --line: var(--line-bone); --acc: var(--signal);
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: clip;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--t-body, 1rem);
  line-height: 1.5;
  font-weight: 420;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; }
::selection { background: var(--signal); color: var(--on-signal); }

:focus-visible { outline: 2px solid var(--acc, var(--signal)); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
/* On ink the ultramarine ring alone is thin against bone-filled controls: an inner ink ring separates it from the element. */
body [data-theme=ink] :focus-visible { box-shadow: 0 0 0 3px var(--ink); }

.skip {
  position: fixed; left: 16px; top: -120px; z-index: 100;
  padding: .7rem 1.1rem; border-radius: 999px;
  background: var(--signal); color: var(--on-signal);
  font-family: var(--font-mono); font-size: var(--t-data, .72rem); letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
}
.skip:focus { top: 16px; }

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

/* The swarm canvas: one fixed full-viewport layer between section backgrounds and scene content. */
#swarm {
  display: none;
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0; transition: opacity .35s linear;
}
html.js:not(.fx-fail):not(.static) #swarm { display: block; }
html.fx-ready:not(.gl-fail) #swarm { opacity: 1; }

/* Composed static frames. Default (no-JS, static, fx-fail): an ordinary image after the copy.
   Cinematic: a poster filling its stage behind the content until the first swarm frame, then gone. */
.composed { display: block; width: 100%; height: auto; }
.gl-only, .js-only { display: none; }
html.js:not(.fx-fail):not(.static) .js-only { display: block; }
html.fx-ready:not(.gl-fail) .gl-only { display: block; }

html.js:not(.fx-fail):not(.static) .composed {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none;
  transition: opacity .35s linear, visibility 0s linear .35s;
}
html.js.fx-ready:not(.fx-fail):not(.static):not(.gl-fail) .composed { opacity: 0; visibility: hidden; }

/* Hero H1 holds hidden only until its split is ready (the scene adds .is-ready). The animation is a last-resort
   release so a scene that never loads cannot leave the headline blank. It exists only on the cinematic path. */
html.js:not(.fx-fail):not(.static) [data-h1-hold]:not(.is-ready) {
  opacity: 0;
  animation: hold-release 0s linear 3.2s forwards;
}
@keyframes hold-release { to { opacity: 1; } }

/* Reduced motion: native anchor jumps, no cross-document transition. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  @view-transition { navigation: none; }
}

@media print {
  #swarm, .seam, .nav-pill, .rail, .menu, .skip { display: none !important; }
  .composed { position: static !important; opacity: 1 !important; visibility: visible !important; height: auto !important; }
  .track { height: auto !important; }
  .stage { position: static !important; height: auto !important; }
}
