/* Kandi — the Knowledge Tree: the landing page's styles. Fonts, tokens and wordmark are in css/brand.css (loaded first). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 84px; overflow-x: clip; }
@media (prefers-reduced-motion: no-preference) { html:not([data-motion="off"]) { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.6 var(--sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, .mono-s { font-family: var(--mono); }
:not(pre) > code { font-size: .86em; background: var(--tint); padding: .08em .36em; border-radius: 5px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.04; letter-spacing: -.02em; text-wrap: balance; font-weight: 620; }
h2 { font-size: clamp(1.85rem, 3.7vw, 3rem); }
h3 { font-size: 1.15rem; letter-spacing: -.01em; line-height: 1.15; }
p { margin: 0; }
::selection { background: var(--tint); color: var(--text); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; left: 12px; top: 10px; z-index: 100; transform: translateY(-160%);
  background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: var(--r-control);
  font-weight: 600; text-decoration: none;
}
.skip:focus { transform: none; }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }

/* ---------- eyebrow: mono label after Kandi's datum mark (a datum line, a bore, a node) ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font: 500 .78rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text);
}
.eyebrow::before {
  content: ""; flex: none; width: 13px; height: 13px;
  background:
    linear-gradient(var(--marker), var(--marker)) 0 1px / 13px 2px no-repeat,
    linear-gradient(var(--marker), var(--marker)) 5.5px 1px / 2px 8px no-repeat,
    radial-gradient(circle, var(--marker) 2.1px, transparent 2.6px) 6.5px 10px / 0 0 no-repeat;
  background:
    linear-gradient(var(--marker), var(--marker)) 0 1px / 13px 2px no-repeat,
    linear-gradient(var(--marker), var(--marker)) 5.5px 1px / 2px 8px no-repeat,
    radial-gradient(circle at 6.5px 10.4px, var(--marker) 2.1px, transparent 2.7px);
}
.lead { color: var(--muted); font-size: clamp(1.05rem, 1.45vw, 1.2rem); line-height: 1.6; max-width: 40rem; }
.fine { color: var(--muted); font-size: .9rem; line-height: 1.55; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .74rem 1.25rem; border-radius: var(--r-control); border: 1px solid transparent;
  font: 600 1rem/1.3 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text); text-decoration: none; }
.btn-small { padding: .44rem .9rem; font-size: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; }
.btn-row.center { justify-content: center; }
.arrow-link { font-weight: 600; white-space: nowrap; }
.arrow-link::after { content: " →"; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}
.bar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: baseline; gap: .7rem; color: var(--text); text-decoration: none; }
.main-nav {
  display: flex; align-items: center; gap: .3rem; padding: .3rem; border: 1px solid var(--border);
  border-radius: var(--r-control); background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.main-nav > a { color: var(--muted); text-decoration: none; font-size: .9rem; padding: .32rem .82rem; border-radius: 6px; transition: background-color .2s, color .2s; }
.main-nav > a:hover { background: var(--surface-2); color: var(--text); }
.main-nav > a[aria-current="true"] { background: var(--surface-2); color: var(--text); }
.nav-tools { display: none; }
.tools { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--r-control);
  border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.js .icon-btn[hidden] { display: inline-grid; }
html:not(.js) .icon-btn { display: none; }
#theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .i-sun { display: inline; }
:root[data-theme="dark"] #theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .i-sun { display: inline; }
  :root:not([data-theme="light"]) #theme-toggle .i-moon { display: none; }
}
#motion-toggle .i-play { display: none; }
#motion-toggle[aria-pressed="true"] .i-play { display: inline; fill: currentColor; stroke: none; }
#motion-toggle[aria-pressed="true"] .i-pause { display: none; }
.signin { color: var(--text); font-size: .9rem; font-weight: 500; text-decoration: none; padding: .4rem .5rem; border-radius: 6px; }
.signin:hover { text-decoration: underline; }
.menu-btn { display: none !important; }

/* ---------- the scene ---------- */
.scene { position: fixed; inset: 0; height: 100lvh; z-index: 0; pointer-events: none; }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-poster { position: absolute; inset: 0; background: no-repeat 70% 50% / cover; }
html:not(.js) .scene-poster, .scene-failed .scene-poster { background-image: url("../img/poster-light.webp"); }
@media (prefers-color-scheme: dark) {
  html:not(.js) .scene-poster { background-image: url("../img/poster-dark.webp"); }
  :root:not([data-theme="light"]).scene-failed .scene-poster { background-image: url("../img/poster-dark.webp"); }
}
:root[data-theme="dark"].scene-failed .scene-poster { background-image: url("../img/poster-dark.webp"); }
html:not(.js) .scene canvas { display: none; }
html:not(.js) .ask-switch { display: none; }
html:not(.js) .ask-ex + .ask-ex { border-top: 1px solid var(--code-rule); }
.scene.covered { visibility: hidden; }

main { position: relative; z-index: 1; }

/* ---------- hero ---------- */
.hero { overflow-x: clip; min-height: min(calc(100svh - 64px), 980px); display: flex; align-items: center; padding: clamp(2.5rem, 6vh, 5rem) 0 clamp(2rem, 5vh, 4rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: clamp(2rem, 4vw, 4rem); align-items: end; }
.hero-copy { position: relative; }
.hero-copy::before { /* a quiet wash of paper so the copy never sits on busy lines */
  content: ""; position: absolute; inset: -2.5rem -3rem -2rem -40vw; z-index: -1;
  background: radial-gradient(ellipse at 30% 50%, var(--bg) 52%, color-mix(in srgb, var(--bg) 0%, transparent) 78%);
}
.hero h1 {
  margin: 1.1rem 0 1.25rem; font-size: clamp(2.9rem, 6.2vw, 5.9rem); line-height: .94; letter-spacing: -.028em;
  font-weight: 640; max-width: 9.5ch; font-variation-settings: "opsz" 96;
}
.hero .lead { max-width: 33rem; margin-bottom: 1.7rem; }
.hero-note { margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.coords { list-style: none; margin: 1.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; font: 400 .8rem/1.4 var(--mono); color: var(--muted); }
.coords b { color: var(--text); font-weight: 500; }

/* the dark panel: an assistant asking Kandi (same in both themes) */
.ask {
  background: var(--code-bg); color: var(--code-text); border: 1px solid var(--code-border); border-radius: var(--r-panel);
  box-shadow: 0 18px 48px rgba(8, 14, 12, .22); overflow: hidden; align-self: end; max-width: 29rem; justify-self: end; width: 100%;
}
.ask-bar { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--code-rule); font: 400 .78rem/1 var(--mono); color: var(--code-muted); }
.ask-bar .dot, .code-res .dot { width: 7px; height: 7px; border-radius: 50%; background: #5fe0b2; box-shadow: 0 0 0 3px rgba(95, 224, 178, .16); }
.ex-tag { border: 1px solid rgba(242, 162, 124, .6); color: #f2a27c; padding: .2rem .45rem; border-radius: 5px; letter-spacing: .1em; text-transform: uppercase; font-size: .68rem; }
.ask-switch { margin-left: auto; display: flex; gap: .3rem; }
.ask-pick {
  width: 28px; height: 26px; border-radius: 6px; border: 1px solid var(--code-rule); background: transparent; color: var(--code-muted);
  font: 500 .75rem/1 var(--mono); cursor: pointer;
}
.ask-pick[aria-pressed="true"] { color: var(--code-text); border-color: rgba(127, 214, 184, .55); background: rgba(127, 214, 184, .1); }
.ask-pick:focus-visible { outline-color: #7fd6b8; }
.ask-ex { padding: 1.15rem 1.2rem 1.25rem; }
.js .ask-ex[hidden] { display: none; }
.ask-q { font-size: 1.06rem; line-height: 1.45; color: #f1f5f2; margin-bottom: .95rem; min-height: 3em; }
.typed.typing::after { content: ""; display: inline-block; width: .5em; height: 1.05em; vertical-align: -.15em; margin-left: 2px; background: #7fd6b8; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.ask-steps { list-style: none; margin: 0 0 .9rem; padding: .7rem .85rem; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid var(--code-rule); font: 400 .8rem/1.7 var(--mono); color: var(--code-muted); }
.ask-steps .tool { color: var(--code-k); }
.ask-steps .tool::before { content: "→ "; color: var(--code-muted); font-family: var(--sans); }
.ask-steps .res { color: var(--code-s); font-weight: 500; }
.ask-a { font-size: .95rem; line-height: 1.55; color: var(--code-text); }
.ask-a b { color: #fff; font-weight: 600; }
.ask-a code { background: rgba(255, 255, 255, .07); color: var(--code-k); }
.ask .rd-a { color: var(--code-k); font-weight: 600; }
.ask .rd-b { color: var(--code-v); font-weight: 600; }
.ask-src { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: 400 .74rem/1 var(--mono); padding: .38rem .55rem; border-radius: 6px; border: 1px solid var(--code-rule); color: var(--code-muted); background: rgba(255, 255, 255, .03); }
.ask-src .chip::before { content: ""; display: inline-block; width: .5em; height: .5em; margin: 0 .5em 0 .05em; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; vertical-align: .18em; }
.js .ask .step-hide { opacity: 0; transform: translateY(6px); }
.ask .ask-steps li, .ask .ask-a, .ask .ask-src { transition: opacity .45s var(--ease), transform .45s var(--ease); }

/* ---------- facts strip ---------- */
.facts-sec { padding: 0 0 1rem; }
.facts {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--border); background: var(--card-glass);
}
.facts li { padding: 1.4rem 1.4rem 1.5rem; border-left: 1px solid var(--border); display: grid; gap: .55rem; align-content: start; }
.facts li:first-child { border-left: 0; }
.facts b { font-size: clamp(1.12rem, 1.7vw, 1.4rem); font-weight: 640; letter-spacing: -.02em; line-height: 1.15; }
.facts span { font: 400 .78rem/1.5 var(--mono); color: var(--muted); }

/* ---------- story chapters ---------- */
.story { position: relative; padding-top: clamp(3rem, 8vh, 6rem); }
.kicker { margin-bottom: 0; }
.chapter { min-height: 165svh; padding-top: 10svh; display: flex; flex-direction: column; }
.chapter > .wrap { flex: 1; display: flex; flex-direction: column; }
.chapter:last-child { min-height: 190svh; }
.card-ch {
  position: sticky; top: calc(64px + 16svh); max-width: 25.5rem; padding: 1.5rem 1.6rem 1.45rem;
  background: var(--card-glass); border: 1px solid var(--border); border-radius: 20px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.ch-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.ch-n { font: 500 .78rem/1 var(--mono); letter-spacing: .1em; color: var(--muted); }
.card-ch h2 { font-size: clamp(1.7rem, 2.7vw, 2.3rem); margin-bottom: .9rem; }
.card-ch p:not(.ch-meta) { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.card-ch p + p.fine { margin-top: .75rem; font-size: .86rem; }
.card-ch .rd-a, .reading .rd-a { color: var(--read-a); font-weight: 650; }
.card-ch .rd-b { color: var(--read-b); font-weight: 650; }
.legend { list-style: none; margin: 1rem 0 0; padding: .85rem 0 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .45rem 1rem; font: 400 .76rem/1.3 var(--mono); color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .45rem; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid var(--border-strong); }
.sw-pdf { background: var(--scene-paper); box-shadow: inset 0 -3px 0 var(--scene-ink); }
.sw-xls { background: var(--scene-paper); box-shadow: inset 0 -3px 0 var(--scene-acc); }
.sw-doc { background: var(--scene-issue); border-color: transparent; border-radius: 50%; }
.sw-ink { background: var(--scene-node); border-color: transparent; border-radius: 50%; }
.sw-acc { background: var(--scene-acc); border-color: transparent; border-radius: 50%; }
.sw-hub { background: transparent; border: 2px solid var(--scene-hub); border-radius: 50%; }

/* ---------- the content sheet that slides over the scene ---------- */
.sheet {
  position: relative; background: var(--sheet-bg); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-sheet);
  border-top: 1px solid var(--border);
}
.sec { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.sec-soft { background: var(--surface-2); border-block: 1px solid var(--border); }
.sec-head { max-width: 48rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.sec-head h2, .split h2 { margin: 1rem 0 1rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.split.flip > :first-child { order: 0; }
.split > * { min-width: 0; }

/* feature cells joined by hairlines */
.cells {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--r-panel); overflow: hidden;
}
.cell { background: var(--bg); padding: 1.7rem 1.6rem 1.6rem; display: grid; grid-template-rows: auto auto 1fr auto; gap: .55rem; transition: background-color .3s var(--ease); }
.cell:hover { background: var(--surface); }
.ico { width: 32px; height: 32px; fill: none; stroke: var(--accent-text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .55rem; }
.cell p { color: var(--muted); font-size: .95rem; line-height: 1.55; }
.spec { font: 400 .76rem/1.4 var(--mono); color: var(--text); padding-top: .7rem; margin-top: .3rem; border-top: 1px dashed var(--border-strong); }

/* product tour */
.tour-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
.tour-tabs [role="tab"] {
  text-align: left; display: grid; gap: .25rem; padding: .9rem 1rem; border-radius: var(--r-card); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.tour-tabs [role="tab"]:hover { border-color: var(--border-strong); }
.tour-tabs [role="tab"][aria-selected="true"] { border-color: var(--accent); background: var(--tint); }
.tour-tabs .n { font: 500 .74rem/1 var(--mono); color: var(--accent-text); }
.tour-tabs b { font-weight: 640; font-size: 1.02rem; }
.tour-tabs .d { color: var(--muted); font-size: .84rem; line-height: 1.35; }
html:not(.js) .tour-tabs { display: none; }
html:not(.js) .tour-panel + .tour-panel { margin-top: 2rem; }
.frame { margin: 0; border: 1px solid var(--border); border-radius: var(--r-frame); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-frame); }
.frame-bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; border-bottom: 1px solid var(--border); background: var(--surface-2); font: 400 .76rem/1 var(--mono); color: var(--muted); }
.frame-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.frame-bar span { margin-left: .6rem; }
.frame img { width: 100%; background: #f4f4f2; }
.frame figcaption { padding: .75rem 1rem; font-size: .88rem; color: var(--muted); border-top: 1px solid var(--border); }

/* provenance */
.checks { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: .8rem; }
.checks li { position: relative; padding-left: 1.85rem; line-height: 1.5; }
.checks li::before { content: ""; position: absolute; left: .2rem; top: .34em; width: .5rem; height: .85rem; border: solid var(--accent-text); border-width: 0 2.4px 2.4px 0; transform: rotate(42deg); }
.tag { display: inline-block; font: 500 .76rem/1.25 var(--mono); padding: .14rem .5rem; border-radius: 999px; background: var(--tint); color: var(--accent-text); white-space: nowrap; }
.tag-differ { background: color-mix(in srgb, var(--marker) 14%, var(--surface)); color: var(--marker-text); }
.reading { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 1.4rem; box-shadow: var(--shadow-frame); }
.reading-head { display: grid; grid-template-columns: 1fr auto; gap: .4rem .8rem; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.reading-head h3 { font-size: 1.2rem; }
.reading-head .mono-s { grid-column: 1 / -1; font-size: .76rem; color: var(--muted); }
.reads { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.read { border-radius: var(--r-card); padding: 1rem 1rem .9rem; border: 1px solid var(--border); border-top: 3px solid var(--read-a); background: var(--bg); }
.read-b { border-top-color: var(--read-b); }
.read h4 { font-size: .95rem; margin-bottom: .75rem; line-height: 1.3; }
.read h4 span { display: block; font: 400 .72rem/1.4 var(--mono); color: var(--read-b); margin-top: .2rem; letter-spacing: 0; }
.read dl { margin: 0; display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); gap: .38rem .6rem; font-size: .9rem; }
.read dt { color: var(--muted); font: 400 .76rem/1.6 var(--mono); }
.read dd { margin: 0; }
.read dd b { font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.read-a dd b { color: var(--read-a); }
.read-b dd b { color: var(--read-b); }
.typew { font-family: var(--mono); font-size: .84rem; }
.reading-foot { margin-top: 1rem; font-size: .88rem; color: var(--muted); }

/* assistants */
.chips { list-style: none; margin: 1.5rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.chips li { font: 400 .8rem/1 var(--mono); padding: .42rem .6rem; border-radius: var(--r-control); border: 1px solid var(--border-strong); background: var(--surface); }
.rules { margin: 0 0 1.8rem; padding: 0; list-style: none; counter-reset: r; display: grid; gap: .7rem; }
.rules li { counter-increment: r; position: relative; padding-left: 2.3rem; color: var(--muted); line-height: 1.5; font-size: .97rem; }
.rules li::before { content: counter(r, decimal-leading-zero); position: absolute; left: 0; top: .1rem; font: 500 .74rem/1.6 var(--mono); color: var(--accent-text); }
.code { background: var(--code-bg); color: var(--code-text); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--code-border); }
.code-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .62rem 1rem; border-bottom: 1px solid var(--code-rule); font: 400 .78rem/1.3 var(--mono); color: var(--code-muted); }
.copy { font: 500 .74rem/1 var(--mono); color: var(--code-text); background: transparent; border: 1px solid var(--code-rule); border-radius: 6px; padding: .36rem .6rem; cursor: pointer; }
.js .copy[hidden] { display: inline-block; }
html:not(.js) .copy { display: none; }
.copy:focus-visible { outline-color: #7fd6b8; }
.code pre { margin: 0; padding: 1.1rem 1.2rem 1.3rem; overflow-x: auto; font: 400 .86rem/1.6 var(--mono); tab-size: 2; }
.code pre:focus-visible { outline-offset: -3px; }
.code.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code .k { color: var(--code-k); } .code .s { color: var(--code-s); } .code .v { color: var(--code-v); } .code .c { color: var(--code-c); } .code .f { color: var(--code-f); }
.code-note { border-top: 1px solid var(--code-rule); padding: .7rem 1rem; font: 400 .78rem/1.5 var(--mono); color: var(--code-muted); }
.code-res { display: flex; align-items: center; gap: .6rem; }
.code-res b { color: var(--code-s); font-weight: 500; }

/* tables */
.table-wrap { margin-top: 1.8rem; border: 1px solid var(--border); border-radius: var(--r-card); overflow-x: auto; background: var(--surface); }
table.data { border-collapse: collapse; width: 100%; font-size: .93rem; }
.data th, .data td { padding: .72rem .9rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.data thead th { background: var(--surface-2); font: 500 .74rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.data th:first-child { text-align: left; white-space: normal; }
.data tbody th { font-weight: 500; }
.data tbody tr:last-child > * { border-bottom: 0; }
.data td.us { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--accent-text); font-weight: 650; }
.table-note { margin-top: .8rem; font-size: .85rem; color: var(--muted); }

/* numbers */
.nums { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.nums li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 1.25rem 1.3rem 1.2rem; display: grid; gap: .25rem; align-content: start; }
.nums b { font-size: clamp(1.9rem, 3vw, 2.6rem); font-weight: 680; letter-spacing: -.045em; line-height: 1; font-variant-numeric: tabular-nums; font-variation-settings: "opsz" 72; }
.nums span { font-weight: 600; font-size: 1rem; margin-top: .45rem; }
.nums small { font: 400 .76rem/1.45 var(--mono); color: var(--muted); margin-top: .2rem; }

/* finale */
.finale { padding-top: clamp(3rem, 7vw, 5rem); }
.fin { text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem; border: 1px solid var(--border); border-radius: var(--r-band); background: var(--surface); position: relative; overflow: hidden; }
.fin .lead { margin: 0 auto 1.8rem; }
.fin h2 { margin: 1rem auto; max-width: 18ch; }
.fin .fine { margin-top: 1.4rem; }
.fin::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 30px; margin-left: -1px; background: var(--marker); }
.fin::after { content: ""; position: absolute; top: 28px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--marker); }

/* footer */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; font-size: .93rem; }
.foot { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.foot-brand p:last-child { color: var(--muted); max-width: 24rem; margin-top: .8rem; }
.wm-foot { font-size: 1.7rem; }
.foot-h { font: 500 .74rem/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.site-footer ul a { color: var(--text); text-decoration: none; }
.site-footer ul a:hover { color: var(--accent-text); text-decoration: underline; }
.foot-base { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }

/* ---------- quiet reveals (only when JS runs and motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js:not([data-motion="off"]) .rv { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
  html.js:not([data-motion="off"]) .rv.in { opacity: 1; transform: none; }
  html.js:not([data-motion="off"]) .hero-copy > *, html.js:not([data-motion="off"]) .ask { animation: rise .9s var(--ease) both; }
  html.js:not([data-motion="off"]) .hero-copy > :nth-child(2) { animation-delay: .06s; }
  html.js:not([data-motion="off"]) .hero-copy > :nth-child(3) { animation-delay: .12s; }
  html.js:not([data-motion="off"]) .hero-copy > :nth-child(n+4) { animation-delay: .18s; }
  html.js:not([data-motion="off"]) .ask { animation-delay: .28s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { .typed.typing::after { animation: none; } }

/* ---------- 1100 and below ---------- */
@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, .95fr); }
  .wm-sub { display: none; }
  .nums { grid-template-columns: repeat(3, 1fr); }
}
/* ---------- 980: nav becomes a menu ---------- */
@media (max-width: 980px) {
  .js .menu-btn { display: inline-grid !important; }
  .js .main-nav {
    display: none; position: absolute; right: 16px; top: 70px; min-width: 240px; flex-direction: column; align-items: stretch;
    padding: .5rem; gap: .15rem; background: var(--bg); border-radius: 16px; border: 1px solid var(--border-strong); box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
  }
  .js .main-nav.open { display: flex; }
  .js .main-nav > a { font-size: 1rem; padding: .7rem .9rem; border-radius: 10px; color: var(--text); }
  .js .nav-tools { display: flex; border-top: 1px solid var(--border); margin-top: .3rem; padding: .5rem .4rem .2rem; }
  .nav-signin { color: var(--text); padding: .4rem .5rem; }
  .signin { display: none; }
  html:not(.js) .bar { height: auto; flex-wrap: wrap; padding: .7rem 0; }
  html:not(.js) .main-nav { order: 3; width: 100%; flex-wrap: wrap; justify-content: center; }
  .cells { grid-template-columns: repeat(2, 1fr); }
  .tour-tabs { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.flip > :first-child { order: 0; }
}
@media (max-width: 900px) {
  .hero { min-height: 0; }
  .hero-grid { grid-template-columns: 1fr; align-items: start; }
  .ask { justify-self: start; max-width: 36rem; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts li:nth-child(3) { border-left: 0; }
  .facts li:nth-child(n+3) { border-top: 1px solid var(--border); }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}
/* ---------- phones: the scene owns the upper half of the screen, cards sit below ---------- */
@media (max-width: 700px) {
  body { font-size: 16px; }
  .bar { height: 58px; }
  .tools .btn-small { padding: .42rem .7rem; font-size: .84rem; }
  .hero { padding-top: 2rem; }
  .hero h1 { font-size: clamp(2.7rem, 13vw, 3.6rem); max-width: 10ch; }
  .hero-copy::before { inset: -1.5rem -2rem; background: radial-gradient(ellipse at 40% 45%, var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent) 85%); }
  .coords { flex-direction: column; gap: .35rem; }
  .ask-q { min-height: 4.4em; }
  .chapter { min-height: 150svh; padding-top: 45svh; }
  .chapter:last-child { min-height: 170svh; }
  .chapter > .wrap { justify-content: flex-end; }
  .card-ch { top: auto; bottom: 12px; padding: 1.1rem 1.15rem 1.1rem; border-radius: 16px; }
  .card-ch h2 { font-size: 1.5rem; margin-bottom: .6rem; }
  .card-ch p:not(.ch-meta) { font-size: .93rem; line-height: 1.5; }
  .card-ch p + p.fine { font-size: .8rem; }
  .ch-meta { margin-bottom: .7rem; }
  .legend { margin-top: .7rem; padding-top: .6rem; gap: .35rem .8rem; }
  .cells { grid-template-columns: 1fr; }
  .cell { padding: 1.35rem 1.2rem 1.3rem; }
  .tour-tabs { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; gap: .5rem; padding-bottom: .3rem; margin-inline: -16px; padding-inline: 16px; }
  .tour-tabs [role="tab"] { flex: 0 0 auto; scroll-snap-align: start; padding: .6rem .85rem; }
  .tour-tabs .d { display: none; }
  .reads { grid-template-columns: 1fr; }
  .reading { padding: 1.1rem; }
  .nums { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .nums li { padding: 1rem; }
  .nums b { font-size: 1.85rem; }
  .data th, .data td { padding: .6rem .7rem; }
}
@media (max-width: 560px) {
  .tools .btn-small { display: none; }
  .hero .eyebrow { letter-spacing: .08em; line-height: 1.35; }
  .facts { grid-template-columns: 1fr; }
  .facts li { border-left: 0 !important; border-top: 1px solid var(--border); padding: 1rem .2rem; }
  .facts li:first-child { border-top: 0; }
  #theme-toggle, #motion-toggle { width: 36px; height: 36px; }
}
@media (max-width: 400px) {
  .tools { gap: .35rem; }
  .wm { font-size: 1.35rem; }
}
@media print { .scene, .site-header, .tools { display: none; } }
