/* The site's one stylesheet. No web fonts and no requests: the system's own faces, and
   the COLDWAVE marks drawn inline. Dark is the default and the showcase; light is a choice. */
:root {
  /* The COLDWAVE palette: near-black with a faint cold tint, frost blues, aurora teal used
     sparingly, ember only on the main button, snow-white text. Every pair meets WCAG AA. */
  --bg: #0a0b0e;
  --bg-2: #0e1014;
  --panel: #13161b;
  --line: #1d2128;
  --line-2: #2a2f38;
  --text: #e5e9f0;
  --muted: #a3acb9;
  --faint: #7d8693;
  --ice: #b8d4dc;
  --accent: #8fbcbb;
  --accent-fill: #88c0d0;
  --accent-ink: #0a0b0e;
  --accent-soft: rgba(136, 192, 208, 0.10);
  --cta: #e6a15c;
  --cta-ink: #14100a;
  --link: #81a1c1;
  --lapis: #88c0d0;
  --good: #a9c28f;
  --code-bg: #13161b;
  --code-text: #e5e9f0;
  --pre-bg: #0e1014;
  --pre-head: #111318;
  --pre-line: #1d2128;
  --pre-text: #e5e9f0;
  --pre-label: #a3acb9;
  --tok-c: #7b8697;
  --tok-s: #a9c28f;
  --tok-k: #81a1c1;
  --tok-n: #d8a47f;
  --tok-f: #88c0d0;
  --tok-t: #8fbcbb;
  --tok-p: #b59ac8;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --display: "SF Pro Display", "Inter Display", "Inter", -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1280px;
  --gutter: clamp(20px, 4vw, 48px);
  --top: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eceff4;
  --bg-2: #e5e9f0;
  --panel: #f5f7fa;
  --line: #d8dee9;
  --line-2: #c0c8d4;
  --text: #2b303b;
  --muted: #4c566a;
  --faint: #5c667a;
  --ice: #3b6a85;
  --accent: #2e6b6a;
  --accent-fill: #3a7f95;
  --accent-ink: #ffffff;
  --accent-soft: rgba(58, 127, 149, 0.10);
  --cta: #a85a17;
  --cta-ink: #ffffff;
  --link: #3b6a9a;
  --lapis: #3b6a9a;
  --good: #4f6b2b;
  --code-bg: #e5e9f0;
  --code-text: #2b303b;
  --pre-bg: #f5f7fa;
  --pre-head: #eceff4;
  --pre-line: #d8dee9;
  --pre-text: #2b303b;
  --pre-label: #4c566a;
  --tok-c: #5c667a;
  --tok-s: #4f6b2b;
  --tok-k: #3b6a9a;
  --tok-n: #9a4f1c;
  --tok-f: #285e74;
  --tok-t: #2e6b6a;
  --tok-p: #7a4f8a;
  --shadow: 0 12px 32px rgba(43, 48, 59, 0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 40; background: var(--bg); padding: 8px 12px; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* The top bar: one container shared with every section below it */
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  display: flex; align-items: center; gap: 24px; height: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 700 19px/1 var(--display); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.wordmark b { font-weight: inherit; color: var(--accent); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wordmark.drawn { display: inline-flex; align-items: center; gap: 10px; color: var(--ice); }
.wordmark.drawn .logo-mark-a { width: 26px; height: 26px; }
.wordmark.drawn .logo-wordmark { height: 15px; width: auto; }
.site-foot .wordmark.drawn .logo-mark-a { width: 18px; height: 18px; }
.site-foot .wordmark.drawn .logo-wordmark { height: 11px; }
.wordmark.lower { text-transform: lowercase; letter-spacing: -0.04em; font-weight: 800; }
.wordmark.upper { text-transform: uppercase; letter-spacing: 0.12em; font-size: 15px; font-weight: 800; }
.wordmark.caps { text-transform: uppercase; letter-spacing: -0.02em; font-weight: 800; }
.wordmark.light { text-transform: uppercase; letter-spacing: 0.34em; font-weight: 300; font-size: 15px; color: var(--ice); }
.wordmark.heavy { font-weight: 900; letter-spacing: -0.03em; }
.doors { display: flex; gap: 2px; }
.doors a { color: var(--muted); padding: 7px 12px; border-radius: 7px; font-size: 15px; font-weight: 500; }
.doors a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.search { position: relative; margin-left: auto; width: min(320px, 32vw); }
.search input {
  width: 100%; height: 38px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 15px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: 2px solid var(--accent-fill); outline-offset: -1px; }
.search kbd {
  position: absolute; right: 10px; top: 9px; font: 12px var(--mono); color: var(--faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px;
}
.results {
  position: absolute; right: 0; top: 46px; width: min(560px, calc(100vw - 32px));
  max-height: 70vh; overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.results li a { display: block; padding: 8px 12px; border-radius: 7px; color: var(--text); }
.results li a:hover, .results li a.on { background: var(--accent-soft); text-decoration: none; }
.results b { display: block; font-weight: 600; }
.results small { color: var(--muted); font-size: 13px; }
.results .none { padding: 10px 12px; color: var(--muted); }
.menu, .theme {
  flex: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 17px; cursor: pointer;
}
.menu { display: none; }
.get {
  flex: none; display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 8px;
  background: var(--cta); color: var(--cta-ink); font: 600 15px/1 var(--sans);
}
.get:hover { text-decoration: none; filter: brightness(1.08); }

/* Docs: sidebar, a 70ch article and its sections, in the same container as the top bar */
.frame {
  display: grid; grid-template-columns: 236px minmax(0, 1fr) 200px; gap: 48px;
  max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter);
}
.nav {
  position: sticky; top: var(--top); align-self: start; height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 32px 8px 48px 0; scrollbar-width: thin;
}
.group { margin-bottom: 24px; }
.group h2 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px 10px;
  font: 600 13px/1.3 var(--sans); letter-spacing: 0; color: var(--faint);
}
.badge { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.group ul { list-style: none; margin: 0; padding: 0; }
.group a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); font-size: 15px; line-height: 1.4; }
.group a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.group a[aria-current] { color: var(--text); background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent-fill); }

main { min-width: 0; padding: 48px 0 72px; }
article { max-width: 70ch; }
.toc { position: sticky; top: var(--top); align-self: start; padding: 48px 0 24px; font-size: 14px; }
.toc h2 { margin: 0 0 10px; font: 600 13px/1.3 var(--sans); color: var(--faint); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; color: var(--muted); line-height: 1.35; }
.toc a:hover { color: var(--text); text-decoration: none; }

/* Prose */
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.02em; position: relative; text-wrap: balance; }
h1 { font-size: clamp(36px, 4.2vw, 52px); font-weight: 750; margin: 0 0 20px; letter-spacing: -0.035em; }
h2 { font-size: 28px; font-weight: 700; margin: 56px 0 14px; }
h3 { font-size: 21px; font-weight: 650; margin: 36px 0 10px; }
h4 { font-size: 17px; margin: 24px 0 8px; }
.anchor { margin-left: 8px; color: var(--line-2); font-weight: 400; opacity: 0; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }
p, ul, ol { margin: 0 0 18px; }
li { margin: 5px 0; }
li > p { margin: 0 0 8px; }
article > p:first-of-type { font-size: 19px; line-height: 1.6; color: var(--muted); }
strong { color: var(--text); font-weight: 650; }
code {
  font: 0.86em/1.5 var(--mono); background: var(--code-bg); color: var(--code-text);
  padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere;
}
a code { color: var(--link); }
img { max-width: 100%; height: auto; }
article img { border-radius: 8px; border: 1px solid var(--line); }
figure { margin: 0 0 28px; }
figure img { display: block; }
figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.table { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--bg-2); font-weight: 600; color: var(--text); }
tr:last-child td { border-bottom: 0; }
blockquote { margin: 0 0 24px; padding: 14px 18px; border-left: 3px solid var(--line-2); background: var(--bg-2); border-radius: 0 8px 8px 0; }
blockquote > :last-child { margin-bottom: 0; }
blockquote.note, blockquote.tip { border-left-color: var(--lapis); }
blockquote.warning { border-left-color: #d9822b; }
blockquote.coming-next, blockquote.for-agents { border-left-color: var(--accent-fill); background: var(--accent-soft); }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* Code */
.code { position: relative; margin: 0 0 24px; border: 1px solid var(--pre-line); border-radius: 10px; background: var(--pre-bg); overflow: hidden; }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px;
  padding: 0 8px 0 16px; background: var(--pre-head); border-bottom: 1px solid var(--pre-line);
  font: 600 12.5px/1 var(--sans); color: var(--pre-label);
}
.code-head.bare { position: absolute; top: 0; right: 0; min-height: 0; padding: 6px; background: none; border: 0; }
pre { margin: 0; padding: 16px 18px; overflow-x: auto; background: var(--pre-bg); color: var(--pre-text); font: 14px/1.7 var(--mono); tab-size: 4; }
pre code { background: none; color: inherit; padding: 0; font: inherit; overflow-wrap: normal; }
pre .c { color: var(--tok-c); font-style: italic; }
pre .s { color: var(--tok-s); }
pre .k { color: var(--tok-k); }
pre .n { color: var(--tok-n); }
pre .f { color: var(--tok-f); }
pre .t { color: var(--tok-t); }
pre .p { color: var(--tok-p); }
pre .o { color: var(--tok-n); }
pre .v { color: var(--tok-t); }
button.copy {
  padding: 4px 10px; font: 600 12px/1.2 var(--sans); cursor: pointer;
  border: 1px solid var(--pre-line); border-radius: 6px; background: var(--pre-bg); color: var(--pre-label);
}
button.copy:hover { color: var(--pre-text); border-color: var(--pre-label); }
button.copy.done { color: var(--tok-s); }
.code-head.bare button.copy { opacity: 0; transition: opacity 0.15s; }
.code:hover .code-head.bare button.copy, .code-head.bare button.copy:focus { opacity: 1; }

/* A terminal session that types itself out once it is seen */
.terminal { --pre-bg: #0a0b0e; --pre-head: #0e1014; --pre-line: #1d2128; --pre-text: #e5e9f0; --pre-label: #a3acb9; --tok-k: #81a1c1; --tok-f: #88c0d0; --tok-n: #d8a47f; --tok-c: #7b8697; --tok-s: #a9c28f; --tok-t: #8fbcbb; background: var(--pre-bg); }
.terminal .code-head { justify-content: flex-start; gap: 14px; }
.terminal .code-head .copy { margin-left: auto; }
.lights { display: inline-flex; gap: 6px; }
.lights::before, .lights::after, .lights { content: ""; }
.lights { width: 46px; height: 10px; background:
  radial-gradient(circle at 5px 5px, #4a4f58 4.5px, transparent 5px),
  radial-gradient(circle at 23px 5px, #4a4f58 4.5px, transparent 5px),
  radial-gradient(circle at 41px 5px, #4a4f58 4.5px, transparent 5px); }
.terminal pre { min-height: 300px; font-size: 13px; }
.terminal .line { display: inline-block; }
.terminal .prompt { color: #8fbcbb; }
.terminal .out { color: #a3acb9; }
.terminal .ok, .terminal .out.ok { color: #a9c28f; }
.terminal .hash { color: #88c0d0; }
.terminal .caret { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 2px; vertical-align: -0.2em; background: #b8d4dc; }
@media (prefers-reduced-motion: no-preference) {
  .js .terminal .line { opacity: 0; }
  .js .terminal.seen .line.out { animation: appear 0.18s ease var(--d) both; }
  .js .terminal.seen .line.cmd { animation: type var(--t) steps(var(--n), end) var(--d) both; }
  .js .terminal.seen .caret { animation: blink 1s steps(2, start) 7s infinite; }
}
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes type { from { opacity: 1; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes blink { to { visibility: hidden; } }

/* Footers */
.stamp { margin-top: 40px; font-size: 13px; color: var(--faint); border-top: 1px dashed var(--line); padding-top: 12px; }
.page-foot { max-width: 70ch; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.page-foot .twin { margin: 18px 0 0; }
.page-foot .twin a { color: var(--faint); }
.pager { display: flex; gap: 16px; }
.pager:empty { display: none; }
.pager a { flex: 1; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.pager a:hover { border-color: var(--accent-fill); text-decoration: none; }
.pager span { display: block; font-size: 13px; color: var(--faint); }
.pager .next { text-align: right; }
.site-foot {
  display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: baseline; justify-content: space-between;
  max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding: 32px var(--gutter) 48px;
  border-top: 1px solid var(--line); color: var(--faint); font-size: 14px;
}
.site-foot p { margin: 0; }
.site-foot p img { vertical-align: -4px; margin-right: 6px; }
.site-foot strong { color: var(--text); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }
.site-foot .map {
  flex-basis: 100%; display: grid; gap: 32px 24px; grid-template-columns: repeat(8, minmax(0, 1fr));
  padding-bottom: 32px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}
.site-foot .map h2 { margin: 0 0 12px; font: 600 14px/1.3 var(--sans); letter-spacing: 0; color: var(--text); }
.site-foot .map ul { list-style: none; margin: 0; padding: 0; }
.site-foot .map li { margin: 0 0 7px; line-height: 1.35; }

/* ============ The landing page: darkness, chapters, instruments ============ */
body.landing .frame { display: block; max-width: none; padding: 0; }
body.landing .nav {
  position: fixed; inset: var(--top) auto 0 0; z-index: 25; width: min(340px, 100%); height: auto;
  padding: 24px 20px; background: var(--bg); border-right: 1px solid var(--line); display: none;
}
body.landing.open .nav { display: block; }
body.landing main { padding: 0; }
.home article { max-width: none; }
.home .page-foot { display: none; }
.home .anchor { display: none; }
.more { font-weight: 600; margin-right: 22px; }

/* HUD type: small tracked capitals, the language of the whole page */
.hud { margin: 0 0 24px; font: 500 11px/1.4 var(--sans); letter-spacing: 0.28em; text-transform: uppercase; color: var(--hud, var(--faint)); }

.button {
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px; border-radius: 3px;
  font: 500 14px/1 var(--sans); letter-spacing: 0.06em; color: var(--text); border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.button:hover { text-decoration: none; border-color: var(--text); }
.button.primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.button.primary:hover { filter: brightness(1.08); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.play-glyph { width: 0; height: 0; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

/* Scenes: a picture or a film edge to edge, the words in the container */
.open, .chapter { position: relative; isolation: isolate; overflow: hidden; color: #e5e9f0; background: #08090b; }
.scene-media { position: absolute; inset: 0; z-index: -1; }
.scene-media img, .scene-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-media::after { content: ""; position: absolute; inset: 0; }
.hero-video { opacity: 0; transition: opacity 1.5s ease; }
.hero-video.on { opacity: 1; }

/* The opening: darkness, the name, one line, one call */
.open { min-height: max(640px, calc(100svh - var(--top))); display: flex; flex-direction: column; justify-content: center; }
.open .scene-media::after { background:
  radial-gradient(70% 60% at 50% 55%, rgba(5, 8, 12, 0.35), rgba(5, 8, 12, 0.92) 75%),
  linear-gradient(to top, #05080c 0%, rgba(5, 8, 12, 0) 40%); }
.open .frames img { opacity: 0; }
.open .frames img:first-child { opacity: 1; }
.open-in { text-align: center; padding-top: 80px; padding-bottom: 40px; }
.open .hud { color: #7d8693; }
.name {
  margin: 0 auto 36px; font: 200 clamp(44px, 9vw, 150px)/1 var(--display); letter-spacing: 0.22em;
  text-indent: 0.22em; text-transform: uppercase; color: #dfe8ee;
}
.name .logo-wordmark { display: block; width: min(980px, 82vw); height: auto; margin: 0 auto; }
.submark { float: right; margin: 6px 0 0 24px; color: var(--accent); }
.submark .logo-mark-f { width: 56px; height: 56px; display: block; }
.tagline { max-width: 34ch; margin: 0 auto 48px; font-size: clamp(17px, 1.5vw, 21px); font-weight: 300; line-height: 1.55; color: #a3acb9; }
.open .actions { justify-content: center; }
.open .button { color: #e8f1f5; border-color: rgba(232, 241, 245, 0.3); }
.open .button.primary { color: var(--cta-ink); }
.open .credit { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0 auto; text-align: right; font-size: 12px; letter-spacing: 0.08em; color: #6f8290; }

/* Chapters: one game a screen; the light changes as you go down */
.chapter { min-height: max(620px, 100svh); display: flex; align-items: flex-end; }
.chapter-in { padding-top: 140px; padding-bottom: 96px; }
.chapter h2 { margin: 0 0 22px; font: 300 clamp(40px, 6vw, 92px)/1 var(--display); letter-spacing: -0.02em; color: #e5e9f0; max-width: 14ch; }
.chapter .say { max-width: 52ch; font-size: clamp(17px, 1.4vw, 20px); line-height: 1.55; color: #c3d0d8; margin-bottom: 30px; }
.fact { display: inline-flex; align-items: baseline; gap: 14px; margin: 0; padding-top: 16px; border-top: 1px solid rgba(232, 241, 245, 0.22); color: #9fb1bc; font-size: 14px; letter-spacing: 0.04em; }
.fact b { font: 300 30px/1 var(--display); letter-spacing: -0.01em; color: var(--chapter, #fff); }
.fact code { background: rgba(255, 255, 255, 0.08); color: inherit; }
.chapter.cold { --chapter: #88c0d0; --hud: #81a1c1; }
.chapter.cold .scene-media::after { background: linear-gradient(to top, rgba(3, 10, 18, 0.95) 0%, rgba(3, 10, 18, 0.55) 45%, rgba(3, 10, 18, 0.25) 100%), linear-gradient(to right, rgba(3, 10, 18, 0.7), transparent 65%); }
.chapter.dusk { --chapter: #d8a47f; --hud: #b89a82; background: #0e0b09; }
.chapter.dusk .scene-media::after { background: linear-gradient(to top, rgba(18, 9, 3, 0.95) 0%, rgba(18, 9, 3, 0.45) 45%, rgba(18, 9, 3, 0.15) 100%), linear-gradient(to right, rgba(18, 9, 3, 0.75), transparent 65%); }
.chapter.steel { --chapter: #e3c88a; --hud: #a3acb9; background: #0a0b0e; }
.chapter.steel .scene-media::after { background: linear-gradient(to top, rgba(10, 11, 14, 0.96) 0%, rgba(10, 11, 14, 0.7) 50%, rgba(10, 11, 14, 0.45) 100%); }
.split-scene { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 56px; align-items: end; }
.chapter .device {
  margin: 0; padding: 8px; border-radius: 26px; background: #020304;
  box-shadow: 0 0 0 1px #2a2f38;
}
.chapter .device img { display: block; width: 100%; aspect-ratio: 2622 / 1206; object-fit: cover; border-radius: 18px; }

@media (prefers-reduced-motion: no-preference) {
  .open .frames img { animation: frame 40s ease-in-out infinite both; }
  .open .frames img:first-child { opacity: 0; }
  .open .frames img:nth-child(2) { animation-delay: 20s; }
  .open-in > * { animation: rise 2.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .open-in .name { animation-duration: 3s; }
  .open-in .tagline { animation-delay: 0.5s; }
  .open-in .actions { animation-delay: 0.8s; }
  .chapter .scene-media video { animation: drift 60s ease-in-out infinite alternate both; }
}
@keyframes frame {
  0% { opacity: 0; transform: scale(1.0); }
  8% { opacity: 1; }
  50% { opacity: 1; }
  58% { opacity: 0; transform: scale(1.07); }
  100% { opacity: 0; transform: scale(1.07); }
}
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.09) translateY(-1.5%); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Instruments: the proof, as panels in the same HUD language */
.panels { padding: 140px 0 60px; background: var(--bg); }
.panels > .wrap > h2 { margin: 0 0 80px; font: 300 clamp(36px, 4.4vw, 60px)/1.05 var(--display); letter-spacing: -0.02em; }
.panel { position: relative; padding: 44px 0 96px; border-top: 1px solid var(--line); }
.panel::before { content: ""; position: absolute; top: -1px; left: 0; width: 64px; height: 1px; background: var(--accent-fill); }
.panel h3 { margin: 0 0 14px; font: 400 clamp(24px, 2.3vw, 32px)/1.2 var(--display); letter-spacing: -0.01em; }
.panel > p, .split-panel p { max-width: 62ch; color: var(--muted); }
.split-panel { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start; }
.panel .note { font-size: 14px; color: var(--faint); margin-top: 22px; }
.keys { font-size: 14px !important; color: var(--faint) !important; }

.lanes { display: grid; gap: 14px; padding: 26px 0 6px; }
.lane { display: grid; grid-template-columns: 140px minmax(0, 1fr) 180px; gap: 20px; align-items: center; }
.where { font: 600 12px/1.2 var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.track { position: relative; height: 26px; overflow: hidden; background: repeating-linear-gradient(to right, var(--line-2) 0 1px, transparent 1px 2%), var(--panel); }
.track::before { content: ""; position: absolute; inset: 0; width: 100%; background: linear-gradient(to right, transparent, color-mix(in srgb, var(--accent-fill) 40%, transparent)); }
.head { position: absolute; top: 0; bottom: 0; left: 100%; width: 1px; margin-left: -1px; background: var(--accent-fill); }
.sum { font-size: 13px; padding: 5px 9px; justify-self: start; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent-fill) 40%, transparent); border-radius: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .js .lanes .track::before { width: 0; }
  .js .lanes .head { left: 0; }
  .js .lanes .sum { opacity: 0; }
  .js .lanes.seen .track::before { animation: fill 3.4s cubic-bezier(0.4, 0, 0.6, 1) both; }
  .js .lanes.seen .head { animation: sweep 3.4s cubic-bezier(0.4, 0, 0.6, 1) both; }
  .js .lanes.seen .sum { animation: land 0.5s ease 3.4s both; }
}
@keyframes fill { from { width: 0; } to { width: 100%; } }
@keyframes sweep { from { left: 0; } to { left: 100%; } }
@keyframes land { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

.drive-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px; align-items: start; margin-top: 28px; }
.shot { margin: 0; }
.shot img { display: block; width: 100%; border-radius: 6px; border: 1px solid var(--line-2); }
.drive-grid .code { margin: 0; }
.drive-grid pre { font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.steps { list-style: none; counter-reset: step; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.steps li { counter-increment: step; margin: 0; padding: 18px 18px 0 0; color: var(--muted); font-size: 15px; }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; margin-bottom: 10px; font: 600 12px/1 var(--sans); letter-spacing: 0.2em; color: var(--accent); }
.steps b { color: var(--text); }

.demo { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); background: #000; }
.demo-start { position: absolute; inset: 0; display: block; }
.demo-start img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; filter: brightness(0.6) saturate(0.9); transition: filter 0.3s; }
.demo-start:hover img { filter: brightness(0.8); }
.demo-button {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 26px; border-radius: 4px; background: var(--cta); color: var(--cta-ink); font: 700 15px/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
}
.demo-start:hover { text-decoration: none; }
.demo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.design { list-style: none; margin: 8px 0 0; padding: 0; max-width: 72ch; }
.design li { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--muted); }

/* The way into the docs */
.docs-door { padding: 120px 0 140px; background: var(--bg); border-top: 1px solid var(--line); }
.docs-door h2 { margin: 0 0 48px; font: 300 clamp(36px, 4.4vw, 60px)/1.05 var(--display); letter-spacing: -0.02em; }
.doorway { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
.doorway li { margin: 0; border-bottom: 1px solid var(--line); }
.doorway a { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; padding: 22px 0; color: var(--muted); transition: padding 0.25s ease, color 0.25s; }
.doorway a:hover { text-decoration: none; color: var(--text); padding-left: 10px; }
.doorway b { font: 700 22px/1.2 var(--display); letter-spacing: -0.01em; color: var(--text); }

/* The reel */
.reel { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(5, 6, 8, 0.88); }
.reel[hidden] { display: none; }
.reel-box { position: relative; width: min(1280px, 100%); }
.reel-box video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; }
.reel-close { position: absolute; right: 0; top: -44px; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid #555; background: #111; color: #eee; font: 600 14px var(--sans); cursor: pointer; }

/* Narrower screens */
@media (max-width: 1240px) {
  .frame { grid-template-columns: 236px minmax(0, 1fr); }
  .toc { display: none; }
  .site-foot .map { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 20px; }
}
@media (max-width: 1100px) {
  .doors { display: none; }
  body.landing .menu { display: block; }
  .split-panel, .split-scene, .drive-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 860px) {
  .frame { display: block; }
  .menu { display: block; }
  .doors { display: none; }
  .top-in { gap: 10px; }
  .search { width: auto; flex: 1; }
  .nav {
    position: fixed; inset: var(--top) 0 0 0; z-index: 25; width: auto; height: auto;
    padding: 24px var(--gutter); background: var(--bg); display: none;
  }
  body.open .nav { display: block; }
  body.landing .nav { inset: var(--top) 0 0 0; width: auto; border: 0; }
  main { padding: 32px 0 56px; }
  h2 { font-size: 25px; }
  .open .credit { text-align: left; }
  .chapter { min-height: 560px; }
  .chapter-in { padding-top: 120px; padding-bottom: 64px; }
  .fact { flex-direction: column; gap: 6px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .lane { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .lane .track { grid-column: 1 / -1; grid-row: 2; }
  .sum { font-size: 12px; }
  .doorway a { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .panels, .docs-door { padding: 88px 0; }
  .site-foot .map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .terminal pre { min-height: 0; font-size: 11.5px; }
}
@media print {
  .top, .nav, .toc, .pager, .site-foot, button.copy, .reel { display: none; }
  .frame { display: block; }
}

/* The docs home: six doors, divided by rules rather than boxed */
.doors-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 40px; margin: 32px 0 16px; }
.door { padding: 22px 0 6px; border-top: 1px solid var(--line-2); }
.door h3 { margin: 0 0 6px; font-size: 22px; }
.door p { color: var(--muted); font-size: 16px; margin-bottom: 10px; }
.door ul { padding-left: 18px; margin-bottom: 12px; }
@media (max-width: 640px) {
  .doors-grid { grid-template-columns: minmax(0, 1fr); }
  .get { display: none; }
}
