/* Layout: a fixed WebGL lattice behind the whole page. Chapters scroll over it as
   text on scrimmed panels. Content is ordinary HTML and paints before any script. */

*,
*::before,
*::after { box-sizing: border-box; }
html {
  background: var(--paper); scroll-behavior: smooth; overflow-x: clip;
  /* anchor jumps and keyboard focus land clear of the sticky header and the scene controls.
     main.js measures both (--head-h, --hud-h); the fallbacks fit the header without scripts */
  scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--head-h, 4rem) + 0.75rem);
  scroll-padding-bottom: calc(var(--hud-h, 0px) + 0.75rem);
}
@media (max-width: 639px) {
  html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--head-h, 7rem) + 0.75rem); }
}
body {
  margin: 0;
  /* no background here: it would paint over the fixed canvas behind the page; html carries the ground */
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--accent-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
p { margin: 0 0 1rem; }
sub { line-height: 0; } /* keeps the subscript in Z_q from opening up its line */
.wrap { max-width: 72rem; margin: 0 auto; }
.label {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.skip-link {
  position: fixed; left: -9999px; top: 0.5rem; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.8rem;
}
.skip-link:focus { left: 0.5rem; }

/* the scene */
#scene {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  /* the large viewport: a touch browser's toolbar sliding in or out does not resize the canvas */
  height: 100lvh;
  z-index: -1; display: block; pointer-events: none;
}
/* the display above would otherwise beat the hidden attribute (no WebGL, or the context lost) */
#scene[hidden] { display: none; }
.no-webgl body,
body.no-webgl {
  background:
    linear-gradient(#232a33 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, #232a33 1px, transparent 1px) 0 0 / 40px 40px,
    var(--paper);
}

/* scene figure windows (portrait): on a screen taller than wide the text runs the full width, so
   each chapter keeps an empty window above its text and the scene puts that chapter's formation
   in it (lattice.js measures the gap). The hero's window sits above its label. The page gets
   longer; nothing is drawn over the text. No scene (no script, no WebGL, print): no windows. */
@media (max-aspect-ratio: 1/1) {
  .chapter[data-formation]::before { content: ""; display: block; height: min(48svh, 26rem); }
  .hero[data-formation]::after { content: ""; order: -1; flex: none; height: min(32svh, 17rem); }
}
@media print, (scripting: none) {
  .chapter[data-formation]::before,
  .hero[data-formation]::after { display: none; }
}
.no-webgl .chapter[data-formation]::before,
.no-webgl .hero[data-formation]::after { display: none; }

/* header: the backdrop runs the full width, as the footer's does; the content keeps to the page's
   72rem column. Links are at least 40px tall, so they are easy to hit on a touch screen. */
.site-head {
  --head-pad-l: calc(max(16px, env(safe-area-inset-left, 0px)) + max(0px, (100% - 72rem) / 2) + 0.75rem);
  --head-pad-r: calc(max(16px, env(safe-area-inset-right, 0px)) + max(0px, (100% - 72rem) / 2) + 0.75rem);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1.5rem;
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-right, 0px))) 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding: 0.45rem var(--head-pad-r) 0.45rem var(--head-pad-l);
  background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.brand { display: inline-flex; align-items: center; min-height: 40px; font-weight: 800; letter-spacing: 0.14em; color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.2rem; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.2rem; }
.site-nav a { display: inline-flex; align-items: center; min-height: 40px; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent-ink); }
/* the current page: an underline, which forced colours keep (a box-shadow would be dropped) */
.site-nav a[aria-current="page"] {
  color: var(--ink); text-decoration-line: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1px; text-underline-offset: 0.7em;
}
.site-nav a.nav-cta { min-height: 34px; padding: 0 0.7rem; color: var(--accent-ink); border: 1px solid var(--accent); }
.site-nav a.nav-cta:hover { background: var(--accent); color: var(--accent-on); }
/* phones: brand, Menu and "Get SOQ" on one row; the links fold into a panel under the header.
   Only when scripts run (main.js wires the button): without them the full nav shows and wraps. */
.nav-toggle { display: none; }
@media (max-width: 639px) {
  .site-nav a { min-height: 32px; }
}
/* without scripts the nav wraps to three rows, so the header scrolls away instead of covering
   a third of the screen */
@media (scripting: none) and (max-width: 639px) {
  .site-head { position: relative; }
  html { scroll-padding-top: 0.75rem; }
}
@media (scripting: enabled) and (max-width: 639px) {
  /* the row's content lines up with the page's 16px margin, and nothing in it shrinks or wraps */
  .site-head {
    --head-pad-l: max(16px, env(safe-area-inset-left, 0px)); --head-pad-r: max(16px, env(safe-area-inset-right, 0px));
    flex-wrap: nowrap; gap: 0 0.5rem;
  }
  .brand, .site-nav > * { flex-shrink: 0; white-space: nowrap; }
  .site-nav { flex-wrap: nowrap; gap: 0 0.5rem; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 0.55rem; min-height: 40px; padding: 0 0.75rem;
    font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ink);
    background: transparent; border: 1px solid #3a444f; cursor: pointer;
  }
  .nav-toggle:hover, .nav-toggle[aria-expanded="true"] { border-color: var(--accent); }
  .nav-icon { width: 14px; height: 10px; fill: currentColor; }
  .site-nav a.nav-cta { min-height: 40px; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; padding: 0.25rem var(--head-pad-r) 0.75rem var(--head-pad-l);
    background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .menu-open .nav-links { display: flex; }
  .nav-links li + li { border-top: 1px solid var(--rule); }
  .nav-links a { min-height: 48px; width: 100%; }
}
/* the narrowest phones (320-359 px): a little less spacing, so brand, Menu and "Get SOQ" fit */
@media (scripting: enabled) and (max-width: 359px) {
  .brand { letter-spacing: 0.1em; }
  .site-nav { letter-spacing: 0.08em; }
  .nav-toggle, .site-nav a.nav-cta { padding: 0 0.55rem; }
}

/* hero */
.hero { position: relative; min-height: min(86svh, 760px); display: flex; flex-direction: column; justify-content: center; padding-block: 3rem 4rem; }
/* the hero's backing: dark behind the text, clear over the scene. It reaches a little below the
   hero and dissolves downward, so it never ends on a line across the mark */
.hero::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: -8rem; left: 50%; width: 100vw; transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(11, 13, 16, 0.92) 0%, rgba(11, 13, 16, 0.82) 45%, rgba(11, 13, 16, 0) 84%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 16rem), transparent);
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 16rem), transparent);
  pointer-events: none;
}
/* where the end of the headline crosses the mark, a soft halo keeps each letter readable (3:1 or
   better for large text) without dimming the scene around it */
.hero h1 {
  font-size: var(--t-h1); line-height: 0.98; font-weight: 800; font-stretch: 118%;
  letter-spacing: -0.01em; margin: 1rem 0 1.4rem; max-width: 14ch; text-wrap: balance;
}
/* a drop-shadow on the whole heading, not a text-shadow: the kinetic copy is one box per letter,
   and each letter's text-shadow would darken the letter before it */
.hero h1, .chapter > h2 { filter: drop-shadow(0 0 0.08em rgba(11, 13, 16, 0.9)) drop-shadow(0 0 0.3em rgba(11, 13, 16, 0.6)); }
.hero .lead { font-size: var(--t-lead); color: var(--muted); max-width: 36rem; text-shadow: 0 0 0.6em var(--paper); }
/* chapter intros that sit on the scene outside a box get the same soft backing */
.chapter > .label, .glance > .label { text-shadow: 0 0 0.35em var(--paper), 0 0 1em var(--paper); }
.cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }
.btn {
  display: inline-block; padding: 0.8rem 1.3rem; text-decoration: none; font-weight: 700;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--accent); color: var(--accent-ink); background: transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { background: var(--accent); color: var(--accent-on); }
.btn.solid { background: var(--accent); color: var(--accent-on); }
.btn.solid:hover { background: var(--accent-ink); }

/* chapters */
/* generous room between chapters, so each one gets the screen to itself */
.chapter { padding-block: clamp(7rem, 18vh, 12rem); }
.panel { background: var(--scrim); border: 1px solid var(--rule); padding: clamp(1.5rem, 3.6vw, 3rem); max-width: 42rem; }
.panel.wide { max-width: 64rem; }
/* alternating chapters: the panel moves to the right, the formation to the left */
.chapter[data-side="right"] { overflow-x: clip; } /* the panel slides in from the right edge */
.chapter[data-side="right"] .panel { margin-left: auto; }
.chapter h2 { font-size: var(--t-h2); line-height: 1.05; font-weight: 800; font-stretch: 112%; margin: 0.7rem 0 1.2rem; text-wrap: balance; }
.chapter h2.narrow { max-width: 20ch; }
.quote { border-left: 2px solid var(--accent); padding-left: 1.1rem; font-size: 1.25rem; color: var(--ink); margin: 1.4rem 0 0; }
.specs { margin: 0; display: grid; border-top: 1px solid var(--rule); }
.spec { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 0.3rem 1.2rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.spec dt { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); padding-top: 0.2rem; }
.spec dd { margin: 0; font-variant-numeric: tabular-nums; }
/* prose after a spec list or a code pair needs room above it (captions keep their own) */
.specs + p:not(.fig),
.code-pair + p:not(.fig) { margin-top: 1.2rem; }
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
@media (min-width: 1000px) { .paths { max-width: 34rem; } }
.path { background: var(--scrim); border: 1px solid var(--rule); padding: 1.4rem; min-width: 0; }
.path h3 { margin: 0.3rem 0 0.5rem; font-size: 1.15rem; }
.path p { color: var(--muted); font-size: var(--t-small); margin-bottom: 0.8rem; }

/* the chain chapters: a counter in the label, and a terminal block */
.chapter-no b { color: var(--ink); font-weight: 600; margin: 0 0.3em; }
/* code blocks are figures with a caption; a block that still scrolls takes keyboard focus
   (tabindex), and a pair sits side by side only where both fit (27rem each, so no line is cut) */
.code-fig { margin: 1.2rem 0 0; min-width: 0; }
.code-fig > figcaption { display: block; margin: 0 0 0.5rem; }
.code {
  margin: 0; padding: 1rem 1.1rem; overflow-x: auto; background: var(--paper); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.78rem; line-height: 1.7; color: var(--ink); white-space: pre;
}
.code .c { color: var(--muted-2); }
.code .k { color: var(--accent-ink); }
.panel .specs { margin-top: 1.2rem; }
.code-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 27rem), 1fr)); gap: 0 1rem; }
/* phones: the lines wrap, so the install command and the stratum URLs show in full */
@media (max-width: 639px) {
  .code { font-size: 0.7rem; white-space: pre-wrap; overflow-wrap: anywhere; }
}

/* page transitions: same-origin navigations cross over with the header and scene controls held
   in place; the page content leaves upward and the next one rises in. Browsers without
   cross-document view transitions simply navigate. */
@view-transition { navigation: auto; }
.site-head { view-transition-name: site-head; }
.scene-hud { view-transition-name: scene-hud; }
::view-transition-old(root) { animation: vt-out 380ms var(--ease) both; }
::view-transition-new(root) { animation: vt-in 520ms var(--ease) 80ms both; }
::view-transition-group(site-head),
::view-transition-group(scene-hud) { animation-duration: 0s; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-24px); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* at a glance: four headline facts, the last one live from the explorer */
.glance { padding-block: 2rem 4rem; }
.glance > .label { display: block; margin: 0 0 1rem; font-weight: 400; }
.glance-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; background: var(--scrim); border: 1px solid var(--rule); padding: 1.3rem; transition: border-color var(--dur) var(--ease); }
.card:hover { border-color: var(--accent); }
.card strong { font-size: clamp(1.5rem, 2.5vw, 2.2rem); white-space: nowrap; line-height: 1.05; font-weight: 800; font-stretch: 118%; font-variant-numeric: tabular-nums; margin: 0.2rem 0; }
.card strong small { font-size: 0.5em; font-stretch: 100%; font-weight: 600; color: var(--muted); }
.card-note { color: var(--muted); font-size: var(--t-small); flex: 1; }
.card a { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 0.6rem; }
/* decorative marks after link text, with empty alt text so they are not read as part of the name */
.card a::after { content: " +"; content: " +" / ""; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 0.5em; border-radius: 50%; background: var(--accent); vertical-align: 0.08em; }
/* the live dot pulses only while block heights arrive (live-height.js adds .is-live to the card);
   before that, or if the explorer is unreachable, the dot holds still */
@media (prefers-reduced-motion: no-preference) { .card-live.is-live .live-dot { animation: live 2s ease-in-out infinite; } }
/* Pause holds the whole page still, the live dot included */
.scene-paused .live-dot { animation: none; }
@keyframes live { 50% { opacity: 0.3; } }
@media (max-width: 900px) { .glance-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* one column until "ML-DSA-44" fits its card at full size (it ran into the padding at 421-470 px) */
@media (max-width: 480px) { .glance-cards { grid-template-columns: minmax(0, 1fr); } }

/* start here: one row per step, a ruled grid of destination tiles */
.start { list-style: none; margin: 2rem 0 0; padding: 0; border: 1px solid var(--rule); background: var(--scrim); }
.start-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); border-top: 1px solid var(--rule); }
.start-row:first-child { border-top: 0; }
.start-step { padding: 1.4rem; border-right: 1px solid var(--rule); }
.start-step h3 { margin: 0.4rem 0 0.3rem; font-size: 1.35rem; font-weight: 800; font-stretch: 112%; }
.start-step p { margin: 0; color: var(--muted); font-size: var(--t-small); }
.start-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.start-tiles li { border-left: 1px solid var(--rule); min-width: 0; }
.start-tiles li:first-child { border-left: 0; }
/* a row of two: the second tile takes the third cell too, so no ruled cell is left empty */
.start-tiles li:nth-child(2):last-child { grid-column: span 2; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 0.25rem; height: 100%;
  padding: 1.3rem 2.6rem 1.3rem 1.3rem; text-decoration: none; color: var(--ink);
  transition: background var(--dur) var(--ease);
}
.tile::after { content: "↗"; content: "↗" / ""; position: absolute; top: 1rem; right: 1.1rem; color: var(--muted-2); transition: color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.tile:hover { background: rgba(217, 111, 50, 0.1); color: var(--ink); }
.tile:hover::after { color: var(--accent-ink); transform: translate(2px, -2px); }
.tile-name { font-weight: 800; font-stretch: 112%; font-size: 1.1rem; letter-spacing: 0.02em; text-transform: uppercase; }
.tile-kind { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 860px) {
  .start-row { grid-template-columns: minmax(0, 1fr); }
  .start-step { border-right: 0; border-bottom: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .start-tiles { grid-template-columns: minmax(0, 1fr); }
  .start-tiles li { border-left: 0; border-top: 1px solid var(--rule); }
  .start-tiles li:first-child { border-top: 0; }
  .start-tiles li:nth-child(2):last-child { grid-column: auto; }
}

.fig { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; line-height: 1.7; color: var(--muted-2); max-width: 40rem; margin: 1.4rem 0 0; }
/* captions of the scene (data-scene) are true only while it runs. main.js sets html.has-scene once
   it knows the scene can run; until then a caption holds its place unseen, so nothing moves when
   it appears. No scripts, no WebGL (body.no-webgl, also after a context loss), forced colours or
   print: no scene, no captions. Reduced motion keeps them: the scene shows each figure still. */
.fig[data-scene] { visibility: hidden; }
.has-scene .fig[data-scene] { visibility: visible; }
.no-webgl .fig[data-scene] { display: none; }
@media (scripting: none), (forced-colors: active), print { .fig[data-scene] { display: none; } }
/* a clause that describes motion ("scroll on and it breaks") shows only while the scene moves */
.scene-paused [data-motion] { display: none; }
@media (prefers-reduced-motion: reduce) { html:not(.scene-moving) [data-motion] { display: none; } }
/* a caption that sits on the scene rather than in a panel gets its own scrim, and room before
   the cards that follow it */
.fig.boxed { background: var(--scrim); border: 1px solid var(--rule); padding: 0.5rem 0.8rem; margin-bottom: 1.5rem; }
/* a sentence that sits on the scene outside a panel (the exchange notice, the other-pools line):
   body-size text on its own scrim, so the brightest formation behind it cannot wash it out */
.note { max-width: 40rem; margin: 1rem 0 0; padding: 0.9rem 1.1rem; background: var(--scrim); border: 1px solid var(--rule); color: var(--muted); }
/* boxes that hold text on the scene take a 90% backing instead of the 82% scrim (the same ground
   colour), so a bloom point passing behind a small grey caption or spec label cannot take it under
   4.5:1; the scene still shows through */
.panel, .path, .card, .start, .fig.boxed, .note { background: rgba(11, 13, 16, 0.9); }
@media (min-width: 1000px) { .paths + .note { max-width: 34rem; } }

/* footer */
footer.site-foot { border-top: 1px solid var(--rule); padding-block: 2.5rem 6rem; color: var(--muted-2); font-size: var(--t-small); background: var(--scrim); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
footer.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1.2rem 2.5rem; justify-content: space-between; }
footer.site-foot a { color: var(--muted); }
footer.site-foot p { margin: 0 0 0.6rem; }
footer.site-foot address { font-style: normal; }
.foot-links .dots + .dots { margin-top: 0.4rem; }
/* inline lists with a dot between items that never dangles: each item carries its dot in the gap
   before it, the list is pulled left by one gap, and its wrapper clips that strip, so the dot of an
   item that starts a line is cut away. The wrapper's 6px padding keeps focus rings unclipped.
   Links and address segments never break inside. */
.foot-about, .foot-links { overflow: hidden; padding: 6px; margin: -6px; }
.dots { list-style: none; margin: 0 0 0 -1.2em; padding: 0; display: flex; flex-wrap: wrap; row-gap: 0.3rem; }
.dots > li { position: relative; padding-left: 1.2em; }
.dots > li::before { content: ""; position: absolute; left: calc(0.6em - 1.5px); top: calc(0.8em - 1.5px); width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.dots a, .dots span { white-space: nowrap; }

/* scene controls: the figure on screen (as the captions name it), Detail and Pause. The name
   keeps a fixed width, so the box does not jump between chapters. */
.scene-hud {
  position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: flex; gap: 0.5rem; align-items: center;
  background: var(--scrim); border: 1px solid var(--rule); padding: 0.35rem 0.35rem 0.35rem 0.8rem;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--muted);
}
/* main.js sets --fig-ch to the longest figure name on the page */
.hud-fig { min-width: calc(var(--fig-ch, 26) * (1ch + 0.06em)); margin-right: 0.3rem; text-align: right; white-space: nowrap; }
.scene-hud button {
  display: inline-flex; align-items: center; gap: 0.5em; min-height: 30px;
  font: inherit; color: var(--ink); background: transparent; border: 1px solid #3a444f; padding: 0 0.65rem; cursor: pointer;
}
.scene-hud button:hover { border-color: var(--accent); color: var(--accent-ink); }
.hud-icon { width: 8px; height: 10px; fill: currentColor; }
#btnPause .i-play, #btnPause.is-paused .i-pause { display: none; }
#btnPause.is-paused .i-play { display: inline; }
.scene-hud[hidden] { display: none; }
/* phones and short landscape screens: one small Pause/Play button in the corner, nothing else */
@media (max-width: 639px), (max-height: 500px) {
  .scene-hud { padding: 0; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .hud-fig, #btnDetail { display: none; }
  #btnPause { width: 40px; height: 40px; justify-content: center; padding: 0; background: var(--scrim); }
  .hud-icon { width: 10px; height: 12px; }
  .hud-text {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
}

/* kinetic type: characters rise out of a mask */
/* kinetic type: characters rise out of a mask. The heading's real text is visually hidden beside
   the animated copy; a word never breaks inside (main.js splits it after its hyphens instead). */
.split-text {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.split .w { display: inline-block; white-space: nowrap; overflow: hidden; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.split .c { display: inline-block; transform: translateY(108%); }
.split.go .c { transform: none; transition: transform 950ms var(--ease); transition-delay: calc(var(--i) * 20ms + var(--d, 0ms)); }

/* cursor ring, desktop pointers only */
.cursor {
  position: fixed; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; z-index: 40; pointer-events: none;
  border: 1px solid var(--accent-ink); border-radius: 50%; opacity: 0;
  transition: width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease), background 0.25s, opacity 0.3s;
}
.cursor.on { opacity: 0.85; }
.cursor.hot { width: 68px; height: 68px; margin: -34px 0 0 -34px; background: rgba(217, 111, 50, 0.16); }

/* the hero drifts up as you leave it (--hp, set on .hero); each child fades only as it slides
   under the header (--fo, from its own position), and never while it holds focus */
.hero > * { transform: translateY(calc(var(--hp, 0) * -0.1px)); opacity: var(--fo, 1); }
.hero > :focus-within { opacity: 1; }
/* magnetic buttons: fine pointers only */
@media (hover: hover) and (pointer: fine) {
  .btn { will-change: transform; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 200ms var(--ease); }
}

/* entrances: only applied by JS, removed once seen, never left hidden */
.will-reveal { opacity: 0; }
.will-reveal.seen { opacity: 1; transition: opacity var(--dur) var(--ease); }
/* keyboard focus arriving in a chapter shows it at once */
.will-reveal:focus-within { opacity: 1; transition: none; }

/* text boxes in 3D: main.js sets a pose per box from where it sits in the viewport (rising in from
   depth tilted back, flat while read, tilting away as it leaves), and a lean toward the pointer.
   --hx/--hy are registered so the pointer lean eases instead of jumping. */
@property --hx { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --hy { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.tilt {
  transform: perspective(1400px) translate3d(0, var(--ty, 0px), var(--tz, 0px))
    rotateX(calc(var(--rx, 0deg) + var(--hy, 0deg))) rotateY(calc(var(--ry, 0deg) + var(--hx, 0deg)));
  opacity: var(--op, 1);
  transform-origin: var(--to, 50% 50%);
  transition: --hx 600ms var(--ease), --hy 600ms var(--ease), border-color var(--dur) var(--ease);
}
/* only a box in motion near the viewport holds a layer */
.tilt.moving { will-change: transform; }
/* flat (being read), or holding keyboard focus: no transform at all, so the text is drawn crisp
   and focus is never on a faded or tilted box */
.tilt.flat,
.tilt:focus-within { transform: none; opacity: 1; will-change: auto; }

@media (max-width: 640px) {
  .spec { grid-template-columns: minmax(0, 1fr); }
  .chapter { padding-block: 4.5rem; }
}
/* the hero headline is sized by the screen's height as well as its width, so a short or narrow
   screen still shows the lead and the buttons; phones and landscape phones lose some padding */
.hero h1 { font-size: clamp(2.2rem, min(8vw, 12svh), 6rem); }
@media (max-width: 639px) {
  .hero { padding-block: 1rem 3rem; }
  .hero > .label { letter-spacing: 0.1em; }
  .hero h1 { margin: 0.6rem 0 1rem; }
  .hero .lead { font-size: 1.125rem; line-height: 1.5; }
  .hero .cta { margin-top: 1rem; }
}
@media (max-height: 500px) {
  .hero { min-height: auto; padding-block: 1.5rem 2rem; }
  .hero .lead { font-size: 1.05rem; }
}

/* print: the text, in black on white, every box flat and visible, no scene, controls or header
   chrome; code wraps; external links print their address */
@media print {
  #scene, .scene-hud, .cursor, .nav-toggle, .skip-link { display: none !important; }
  html, body { background: #fff !important; color: #000; }
  .site-head, footer.site-foot { position: static; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; margin: 0; padding-inline: 0; }
  .nav-links { display: flex !important; position: static; }
  .will-reveal, .tilt, .hero > *, .split .c { opacity: 1 !important; transform: none !important; }
  .hero { min-height: 0; padding-block: 1rem; }
  .hero::before { display: none; }
  .hero h1, .chapter > h2 { filter: none; }
  .chapter { padding-block: 1.5rem; break-inside: auto; }
  .panel, .path, .card, .start, .note, .code { background: none !important; border-color: #999; }
  .chapter-no b, .quote, .tile, .start-step h3, .card strong { color: #000; }
  a, .label, .site-nav a, .tile-kind, .card-note, .path p, .start-step p, .hero .lead, .note, .spec dt, .code .c, .code .k, footer.site-foot { color: #222 !important; text-shadow: none; }
  .code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .btn { border-color: #000; background: none !important; color: #000 !important; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .card a::after { content: none; }
  .tile::after { content: none; }
  .tile[href^="http"]::after { position: static; display: block; content: attr(href); }
  h1, h2, h3 { break-after: avoid; }
  .path, .card, .start-row, .code-fig, .spec { break-inside: avoid; }
}

/* forced colours (Windows High Contrast): the user's palette, plain; no scene (main.js does not
   start it), no figure windows, no tilts, drifts or halos */
@media (forced-colors: active) {
  #scene, .scene-hud, .cursor { display: none !important; }
  .chapter[data-formation]::before, .hero[data-formation]::after { display: none; }
  .tilt, .hero > *, .split .c { transform: none !important; opacity: 1 !important; }
  .hero h1, .chapter > h2 { filter: none; }
  .live-dot { forced-color-adjust: none; background: CanvasText; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .split .c, .split.go .c { transform: none; transition: none; }
  .hero > * { transform: none; opacity: 1; }
  .cursor { display: none; }
  .will-reveal, .will-reveal.seen { opacity: 1; transition: none; }
  .tilt { transform: none; opacity: 1; will-change: auto; }
}
