/* ================================================================
   INK & SIGNAL — layout and components. Colour + font tokens live in themes.css.
   Human = ink (warm, imperfect). Machine = signal (hairline, mono).
   --p (0 → 1) is story progress: the page warms from cold signal to lamp-lit ink.
   ================================================================ */
:root {
  --gutter: clamp(16px, 4vw, 56px);
  --rail-x: clamp(10px, 1.6vw, 22px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--bg-cold);
  background-color: color-mix(in oklab, var(--bg-cold), var(--bg-warm) calc(var(--p) * 100%));
  color: var(--text);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html.read, html.read body { height: auto; overflow-x: hidden; overflow-y: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
::selection { background: var(--verm); color: var(--on-verm); }
:focus-visible { outline: 1px solid var(--teal); outline-offset: 4px; border-radius: 4px; }

.mono { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 400; }

/* ---------- atmosphere ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.lamp {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(75% 65% at 92% 112%, color-mix(in oklab, var(--amber) calc(var(--p) * 34%), transparent), transparent 70%),
    radial-gradient(55% 45% at 4% -8%, color-mix(in oklab, var(--teal) calc((1 - var(--p)) * 11%), transparent), transparent 70%);
}
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- rail ---------- */
.rail { position: fixed; z-index: 5; left: var(--rail-x); top: 84px; bottom: 84px; width: 40px; margin-left: -20px; pointer-events: none; }
.rail svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rail path { fill: none; vector-effect: non-scaling-stroke; }
.rail-track { stroke: var(--faint); stroke-width: 1; }
.rail-ink { stroke: var(--teal); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.ticks { position: absolute; inset: 0; }
.tick {
  position: absolute; left: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  border: 1px solid var(--faint); background: var(--bg-cold); pointer-events: auto; transition: background .4s, border-color .4s, transform .3s;
}
.tick.done { background: var(--verm); border-color: var(--verm); }
.tick:hover { transform: scale(1.5); }
.tick span { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); white-space: nowrap; opacity: 0; transition: opacity .25s; color: var(--muted); }
.tick:hover span, .tick:focus-visible span { opacity: 1; }
body[data-view="gate"] .rail { opacity: .35; }

/* ---------- HUD ---------- */
.hud { position: fixed; left: 0; right: 0; z-index: 35; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 var(--gutter) 0 calc(var(--rail-x) + 26px); pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top { top: 0; height: 68px; padding-top: env(safe-area-inset-top); }
.hud-bottom { bottom: 0; height: 68px; padding-bottom: env(safe-area-inset-bottom); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--verm); box-shadow: 0 0 0 4px color-mix(in oklab, var(--verm) 20%, transparent); }
.hud-right { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--faint); border-radius: 999px; padding: 3px; backdrop-filter: blur(10px); background: color-mix(in oklab, var(--bg-cold) 55%, transparent); }
.seg button { padding: 6px 11px; border-radius: 999px; color: var(--muted); transition: color .25s, background .25s; font-size: 11px; }
.seg button.on { background: var(--text); color: var(--bg-cold); }
.seg button:not(.on):hover { color: var(--text); }
#langSeg button { font-family: var(--f-body); font-size: 12px; letter-spacing: 0; text-transform: none; }
#langSeg button[data-lang="ta"] { font-family: 'Noto Sans Tamil', var(--f-body); }
#langSeg button[data-lang="hi"] { font-family: 'Noto Sans Devanagari', var(--f-body); }
#langSeg button[data-lang="te"] { font-family: 'Noto Sans Telugu', var(--f-body); }
#langSeg .ls { display: none; }
.seg[hidden] { display: none; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--faint); display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { color: var(--text); }

.chapter-btn { color: var(--muted); display: inline-flex; gap: 10px; align-items: center; }
.chapter-btn:hover { color: var(--text); }
.chapter-btn::before { content: ''; width: 18px; height: 1px; background: currentColor; }
.hint { margin: 0; color: var(--muted); opacity: .8; text-align: center; flex: 1; font-size: 10px; }
.hint kbd { font-family: var(--f-mono); border: 1px solid var(--faint); border-radius: 4px; padding: 1px 5px; margin: 0 2px; color: var(--text); }
.hint .paused { color: var(--verm); }
.nav { display: flex; align-items: center; gap: 10px; }
.count { color: var(--muted); min-width: 56px; text-align: right; }
.nav-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--faint); display: grid; place-items: center; transition: border-color .3s, background .3s, opacity .3s; }
.nav-btn:hover { border-color: var(--text); }
.nav-btn:disabled { opacity: .25; cursor: default; }
#autobar { position: fixed; left: 0; right: 0; bottom: 0; height: 2px; z-index: 36; pointer-events: none; }
#autobar i { display: block; height: 100%; background: var(--verm); transform-origin: 0 50%; transform: scaleX(0); }

body[data-view="gate"] .hud-bottom, body[data-view="gate"] #modeSeg, body[data-view="gate"] #autobar { opacity: 0; pointer-events: none; }
body[data-view="gate"] #menuBtn { display: none; }
.menu-btn { color: var(--text); }
body[data-mode="read"] .nav, body[data-mode="read"] #autobar { display: none; }
body:not([data-mode="auto"]) #autobar { opacity: 0; }

/* ---------- stage & beats ---------- */
#stage { position: fixed; inset: 0; z-index: 10; }
.beat {
  position: absolute; inset: 0; visibility: hidden; opacity: 0;
  display: flex; align-items: center;
  padding: 92px var(--gutter) 96px calc(var(--rail-x) + clamp(40px, 7vw, 120px));
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
}
.beat::-webkit-scrollbar { display: none; }
.beat-inner { width: 100%; max-width: 1180px; margin: auto 0; }

html.read #stage { position: relative; }
html.read .beat { position: relative; inset: auto; visibility: visible; opacity: 1; min-height: 100svh; overflow: visible; }

.eyebrow { color: var(--teal); margin: 0 0 clamp(18px, 3vh, 32px); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.eyebrow::before { content: ''; width: 7px; height: 7px; border: 1px solid currentColor; transform: rotate(45deg); }

/* Display type: each unit carries its own Fraunces axes so it can morph from signal to ink */
.display {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.3rem, 5.6vw, 5.4rem);
  line-height: 1.04;
  letter-spacing: var(--display-track);
  margin: 0;
  max-width: 17ch;
  text-wrap: balance;
}
.display.xl { font-size: clamp(2.6rem, 7.4vw, 7.4rem); max-width: 15ch; }
.display.big { font-size: clamp(2rem, 4.6vw, 4.4rem); max-width: 22ch; }
.display.md { font-size: clamp(2rem, 4.2vw, 3.8rem); max-width: 22ch; }
html:not([lang="en"]) .display { line-height: 1.32; letter-spacing: 0; max-width: 22ch; font-size: clamp(1.9rem, 4.4vw, 4.2rem); }
html:not([lang="en"]) .display.xl { font-size: clamp(2.1rem, 5.6vw, 5.4rem); }
html:not([lang="en"]) .display.big { font-size: clamp(1.7rem, 3.6vw, 3.4rem); }
.w { display: inline-block; white-space: nowrap; }
.u {
  display: inline-block;
  --soft: 100; --wonk: 1; --wght: 420;
  font-variation-settings: "SOFT" var(--soft), "WONK" var(--wonk), "wght" var(--wght);
}
html:not([lang="en"]) .u { font-weight: 500; }
.display em, .hl-word { font-style: italic; color: var(--verm); }

.lede { font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: var(--muted); max-width: 54ch; margin: clamp(20px, 3.4vh, 36px) 0 0; line-height: 1.6; }
.key-hint { margin-top: 48px; color: var(--muted); display: inline-flex; gap: 10px; align-items: center; }
.key-hint b { color: var(--verm); font-weight: 400; }

/* quote */
.quote {
  font-family: var(--f-display); font-style: var(--quote-style); font-weight: 300;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-size: clamp(1.7rem, 3.6vw, 3.3rem); line-height: 1.22; margin: 0; max-width: 26ch;
  text-wrap: pretty;
}
html:not([lang="en"]) .quote { font-style: normal; line-height: 1.5; font-size: clamp(1.4rem, 2.8vw, 2.5rem); }
.attrib { color: var(--muted); margin-top: 28px; display: flex; gap: 12px; align-items: center; }
.attrib::before { content: ''; width: 28px; height: 1px; background: var(--verm); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 36px); margin-top: clamp(28px, 5vh, 56px); }
.stat { border-top: 1px solid var(--faint); padding-top: 18px; }
.num { font-family: var(--f-display); font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 144; font-weight: 300; font-size: clamp(2.6rem, 5.4vw, 5rem); line-height: 1; letter-spacing: -.03em; color: var(--text); white-space: nowrap; }
.num .suf { color: var(--verm); font-size: .5em; letter-spacing: 0; margin-left: .08em; }
.stat p { color: var(--muted); margin: 12px 0 0; max-width: 28ch; font-size: 14.5px; }
.src { display: inline-block; margin-top: 10px; color: var(--teal); text-decoration: none; text-transform: none; letter-spacing: .02em; font-size: 10px; line-height: 1.4; border-bottom: 1px solid transparent; }
.src:hover { border-color: currentColor; }
.chain li .src { margin-top: 8px; }
.foot { margin-top: clamp(28px, 4vh, 44px); color: var(--muted); opacity: .75; max-width: 70ch; text-transform: none; letter-spacing: .02em; line-height: 1.7; font-size: 10.5px; }

/* decision */
.choices { display: flex; gap: 14px; margin-top: clamp(30px, 5vh, 52px); flex-wrap: wrap; }
.choice {
  position: relative; min-width: 160px; padding: 18px 26px; border-radius: 999px; border: 1px solid var(--faint);
  display: inline-flex; align-items: center; justify-content: space-between; gap: 22px;
  font-family: var(--f-display); font-size: 1.5rem; font-variation-settings: "SOFT" 100, "WONK" 1;
  transition: border-color .3s, background .3s, color .3s, opacity .3s;
}
html:not([lang="en"]) .choice { font-family: var(--f-body); font-size: 1.25rem; }
.choice kbd { font-family: var(--f-mono); font-size: 10px; border: 1px solid var(--faint); border-radius: 4px; padding: 2px 6px; color: var(--muted); }
.choice:hover { border-color: var(--text); }
.choice.yes.sel { background: var(--verm); border-color: var(--verm); color: var(--on-verm); }
.choice.no.sel { background: transparent; border-color: var(--teal); color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.choice.sel kbd { border-color: currentColor; color: inherit; }
.answered .choice:not(.sel) { opacity: .4; }
.echo { min-height: 3.4em; margin-top: 26px; opacity: 0; font-family: var(--f-display); font-style: var(--quote-style); font-variation-settings: "SOFT" 100, "WONK" 1; font-size: clamp(1.1rem, 1.7vw, 1.5rem); color: var(--text); max-width: 46ch; }
.answered .echo { opacity: 1; }
.echo::before { content: '— '; color: var(--verm); }
.echo:empty::before { content: ''; }

/* gaps */
.gap-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin-top: clamp(26px, 4.5vh, 48px); background: var(--hair); border: 1px solid var(--hair); border-radius: 18px; overflow: hidden; }
.gap { background: color-mix(in oklab, var(--bg-cold) 86%, transparent); padding: 18px 18px 20px; min-height: 148px; position: relative; }
.gap .n { color: var(--teal); }
.gap h3 { font-family: var(--f-display); font-weight: 400; font-variation-settings: "SOFT" 30, "WONK" 0; font-size: 1.3rem; margin: 10px 0 6px; line-height: 1.15; }
.gap p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.gap.hl { background: color-mix(in oklab, var(--verm) 16%, var(--bg-cold)); }
.gap.hl .n { color: var(--verm); }
.gap.hl h3 { font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; color: var(--verm); }
.gap.hl p { color: var(--text); }

/* chain */
.chain { list-style: none; padding: 0; margin: clamp(28px, 5vh, 56px) 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: c; }
.chain li { position: relative; padding: 22px 26px 0 0; border-top: 1px solid var(--faint); }
.chain li::after { content: ''; position: absolute; top: -5px; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.chain li:last-child::after { background: var(--verm); }
.chain li .mono { color: var(--teal); }
.chain li p { font-family: var(--f-display); font-size: clamp(1.15rem, 1.8vw, 1.6rem); line-height: 1.25; margin: 10px 0 0; font-variation-settings: "SOFT" 50; }
.chain li:last-child p { color: var(--verm); font-style: italic; }
.chain-line { position: absolute; top: -1px; left: 0; height: 1px; width: 100%; background: var(--teal); transform-origin: 0 50%; }

/* shift */
.shift { margin-top: clamp(26px, 4.5vh, 50px); display: grid; gap: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1.4fr); align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--hair); }
.row .from { position: relative; color: var(--muted); justify-self: start; font-size: 12px; }
.strike { position: absolute; left: -4px; right: -4px; top: 50%; height: 1px; background: var(--verm); transform-origin: 0 50%; }
.arrow { height: 1px; background: var(--faint); position: relative; }
.arrow i { position: absolute; inset: 0; background: var(--teal); transform-origin: 0 50%; }
.arrow::after { content: ''; position: absolute; right: -1px; top: -4px; border: 4.5px solid transparent; border-left: 7px solid var(--teal); border-right: 0; }
.row .to { font-family: var(--f-display); font-size: clamp(1.5rem, 3vw, 2.7rem); line-height: 1.1; font-variation-settings: "SOFT" 100, "WONK" 1; }

/* solutions */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: clamp(20px, 3.6vh, 34px); }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--faint); color: var(--muted); font-size: 13px; transition: all .25s; }
.chip:hover { color: var(--text); border-color: var(--text); }
.chip.on { background: var(--text); color: var(--bg-cold); border-color: var(--text); }
.chip kbd { display: none; }
.sol-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; position: relative; }
.sol { border: 1px solid var(--faint); border-radius: 16px; padding: 18px; background: var(--card); backdrop-filter: blur(6px); min-height: 150px; display: flex; flex-direction: column; gap: 8px; }
.sol.off { display: none; }
.sol .mono { color: var(--teal); }
.sol h3 { font-family: var(--f-display); font-weight: 400; font-variation-settings: "SOFT" 60, "WONK" 0; font-size: 1.32rem; line-height: 1.15; margin: 0; }
html:not([lang="en"]) .sol h3 { font-size: 1.12rem; line-height: 1.4; }
.sol p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1; }
.aud { display: flex; gap: 6px; flex-wrap: wrap; }
.aud span { font-family: var(--f-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--hair); padding: 3px 6px; border-radius: 4px; }
.sol:nth-child(1), .sol:nth-child(4) { border-color: color-mix(in oklab, var(--verm) 45%, transparent); }

/* principles */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 80px); margin-top: clamp(28px, 5vh, 54px); }
.col h3 { margin: 0 0 12px; color: var(--teal); }
.col.watch h3 { color: var(--verm); }
.col ul { list-style: none; padding: 0; margin: 0; }
.col li { padding: 13px 0; border-top: 1px solid var(--hair); font-size: clamp(1rem, 1.4vw, 1.18rem); }
.col.hold li { font-family: var(--f-display); font-size: clamp(1.25rem, 2vw, 1.7rem); font-variation-settings: "SOFT" 100, "WONK" 1; line-height: 1.2; }
.col.watch li { color: var(--muted); }

/* summary */
.sum { display: grid; grid-template-columns: 220px 1fr; gap: clamp(24px, 4vw, 64px); align-items: center; margin-top: clamp(26px, 4vh, 46px); }
.sum-vis svg { width: 100%; height: auto; overflow: visible; }
.sum-list { list-style: none; margin: 0; padding: 0; }
.sum-list li { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-top: 1px solid var(--hair); font-size: 15px; }
.sum-list b { font-weight: 400; min-width: 4ch; text-align: right; }
.sum-list .y b { color: var(--verm); }
.sum-list .n b { color: var(--teal); }
.sum-list .none { color: var(--muted); }

/* cta */
.cta-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: clamp(30px, 5vh, 50px); }
.cta-btn {
  display: inline-flex; align-items: center; gap: 14px; padding: 20px 30px; border-radius: 999px; text-decoration: none;
  font-size: 1.05rem; border: 1px solid var(--faint); transition: background .3s, color .3s, border-color .3s;
}
.cta-btn.primary { background: var(--verm); color: var(--on-verm); border-color: var(--verm); }
.cta-btn:not(.primary):hover { border-color: var(--text); }
.cta-btn svg { flex: none; }
.contact-line { margin-top: 26px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 22px; }
.contact-line a { text-decoration: none; border-bottom: 1px solid var(--faint); }
.contact-line a:hover { color: var(--text); border-color: var(--verm); }
.credit { margin-top: clamp(36px, 7vh, 80px); color: var(--muted); opacity: .6; text-transform: none; letter-spacing: .02em; font-size: 10px; }

/* ---------- wipe ---------- */
#wipe { position: fixed; inset: 0; z-index: 15; background: var(--verm); clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); pointer-events: none; display: grid; place-items: center; }
.wipe-label { color: var(--on-verm); font-size: clamp(12px, 1.4vw, 15px); letter-spacing: .3em; opacity: 0; }

/* ---------- gate ---------- */
#gate { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; padding: 90px var(--gutter) 60px calc(var(--rail-x) + clamp(40px, 7vw, 120px)); overflow-y: auto; }
.gate-inner { width: 100%; max-width: 1180px; }
.kicker { color: var(--teal); margin: 0 0 28px; }
.gate-title { max-width: 20ch; font-size: clamp(2.1rem, 5vw, 4.8rem); }
.doors { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 14px; margin-top: clamp(36px, 7vh, 72px); }
.door {
  position: relative; text-align: left; padding: 26px 26px 28px; border-radius: 20px; border: 1px solid var(--faint);
  background: color-mix(in oklab, var(--bg-cold) 70%, transparent); backdrop-filter: blur(8px);
  display: grid; gap: 6px; min-height: 190px; align-content: end; transition: border-color .35s, background .35s;
}
.door:hover, .door:focus-visible { border-color: var(--verm); background: color-mix(in oklab, var(--verm) 10%, var(--bg-cold)); outline: none; }
.door-key { position: absolute; top: 20px; left: 24px; color: var(--muted); border: 1px solid var(--faint); border-radius: 4px; padding: 2px 7px; }
.door-glyph { position: absolute; top: 14px; right: 22px; font-size: 26px; color: var(--teal); transition: transform .4s, color .3s; }
.door:hover .door-glyph, .door:focus-visible .door-glyph { color: var(--verm); transform: translateX(4px); }
.door-t { font-family: var(--f-display); font-size: clamp(1.4rem, 2.2vw, 1.9rem); line-height: 1.15; font-variation-settings: "SOFT" 100, "WONK" 1; }
.door-s { color: var(--muted); font-size: 14.5px; }
.gate-hint { color: var(--muted); margin-top: 26px; opacity: .7; }
body:not([data-view="gate"]) #gate { visibility: hidden; }

/* landing → choice */
.landing[hidden], .choose[hidden] { display: none; }
.land-title { font-size: clamp(3rem, 9vw, 9rem); max-width: 12ch; line-height: .98; }
html:not([lang="en"]) .land-title { font-size: clamp(2.4rem, 7vw, 6.6rem); line-height: 1.2; }
.land-sub { margin-top: clamp(22px, 4vh, 40px); }
.land-hint { margin-top: clamp(36px, 7vh, 70px); color: var(--muted); display: inline-flex; gap: 10px; align-items: center; }
.land-hint b { color: var(--verm); font-weight: 400; display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
.land-hint:hover { color: var(--text); }
@keyframes nudge { 50% { transform: translateX(6px); } }
html:not([lang="en"]) .land-hint { text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 13px; }
.door.rec { border-color: color-mix(in oklab, var(--verm) 55%, transparent); }
.door-badge { position: absolute; top: 20px; left: 62px; color: var(--verm); border: 1px solid color-mix(in oklab, var(--verm) 50%, transparent); border-radius: 4px; padding: 2px 7px; font-size: 9.5px; }
html:not([lang="en"]) .door-badge { text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 11px; }

/* ---------- cards: always readable, hoverable, and walkable with arrows ---------- */
.pt { transition: filter .35s ease, background-color .35s ease, box-shadow .35s ease, border-color .35s ease; outline: none; }
.walking .pt:not(.pt-on):not(:hover):not(:focus-visible) { filter: opacity(.62); }
.gap.pt:hover, .gap.pt:focus-visible, .gap.pt-on { background: color-mix(in oklab, var(--verm) 10%, var(--bg-cold)); box-shadow: inset 0 0 0 1px var(--verm); }
.gap.hl.pt-on, .gap.hl:hover { background: color-mix(in oklab, var(--verm) 22%, var(--bg-cold)); }
.sol.pt:hover, .sol.pt:focus-visible, .sol.pt-on, .stat.pt:hover, .stat.pt:focus-visible, .stat.pt-on { border-color: var(--verm); box-shadow: 0 0 0 1px var(--verm), 0 18px 50px -24px color-mix(in oklab, var(--verm) 60%, transparent); }
.stat.pt { border-top-width: 1px; padding: 18px 14px 14px; margin: 0 -14px; border-radius: 4px; }
.chain li.pt, .row.pt, .col li.pt { border-radius: 2px; }
.chain li.pt:hover, .chain li.pt:focus-visible, .chain li.pt-on,
.row.pt:hover, .row.pt:focus-visible, .row.pt-on,
.col li.pt:hover, .col li.pt:focus-visible, .col li.pt-on { background: linear-gradient(90deg, color-mix(in oklab, var(--verm) 13%, transparent), transparent 85%); box-shadow: inset 2px 0 0 var(--verm); }
.row.pt, .col li.pt { padding-left: 12px; }
.chain li.pt { padding-left: 12px; }
.chain li.pt::after { left: 12px; }
.col.watch li.pt-on, .col.watch li.pt:hover { color: var(--text); }

/* ---------- kiosk (/?kiosk=1) ---------- */
#kioskQr, #attractHint { display: none; }
body.kiosk #modeSeg, body.kiosk #themeBtn, body.kiosk .key-hint { display: none; }
body.kiosk #kioskQr {
  display: grid; position: fixed; z-index: 34; right: var(--gutter); bottom: 86px; width: 132px; gap: 8px;
  padding: 10px; border-radius: 16px; border: 1px solid var(--faint);
  background: color-mix(in oklab, var(--bg-cold) 80%, transparent); backdrop-filter: blur(10px);
  transition: width .5s ease;
}
#kioskQr .qbox { background: #fff; border-radius: 10px; padding: 8px; aspect-ratio: 1; }
#kioskQr .qbox svg { width: 100%; height: 100%; display: block; }
#kioskQr .cap { margin: 0; color: var(--muted); font-size: 9px; text-align: center; line-height: 1.4; }
#kioskQr .q-wa, #kioskQr .cap-wa { display: none; }
body.kiosk-cta #kioskQr { width: 220px; border-color: var(--verm); }
body.kiosk-cta #kioskQr .q-site, body.kiosk-cta #kioskQr .cap-site { display: none; }
body.kiosk-cta #kioskQr .q-wa, body.kiosk-cta #kioskQr .cap-wa { display: block; }
body[data-view="gate"] #kioskQr { opacity: .9; }
@media (min-width: 761px) { body.kiosk .beat { padding-right: calc(var(--gutter) + 160px); } }
body.kiosk.attract #attractHint {
  display: block; position: fixed; z-index: 36; left: 50%; bottom: 84px; transform: translateX(-50%); margin: 0;
  padding: 10px 18px; border-radius: 999px; background: var(--verm); color: var(--on-verm); white-space: nowrap;
  animation: breathe 2.4s ease-in-out infinite;
}
html:not([lang="en"]) body.kiosk.attract #attractHint { text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 13px; }
body.kiosk.attract .hud-bottom .hint { visibility: hidden; }
@keyframes breathe { 50% { opacity: .55; } }
@media (max-width: 760px) { body.kiosk #kioskQr { display: none; } }

/* ---------- ☰ menu ---------- */
#menu { position: fixed; inset: 0; z-index: 40; background: color-mix(in oklab, var(--bg-cold) 93%, transparent); backdrop-filter: blur(14px); display: flex; align-items: center; padding: 80px var(--gutter) 60px calc(var(--rail-x) + clamp(40px, 7vw, 120px)); overflow-y: auto; }
#menu[hidden] { display: none; }
.menu-inner { width: 100%; max-width: 1100px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: clamp(28px, 6vw, 90px); align-items: start; position: relative; }
#menuList { list-style: none; padding: 0; margin: 0; counter-reset: m; }
#menuList button { width: 100%; display: grid; grid-template-columns: 52px 1fr auto; align-items: baseline; gap: 16px; text-align: left; padding: 11px 0; border-top: 1px solid var(--hair); }
#menuList .mt { font-family: var(--f-display); font-size: clamp(1.3rem, 2.5vw, 2.1rem); font-variation-settings: "SOFT" 100, "WONK" 1; line-height: 1.1; transition: color .25s, transform .35s; }
#menuList button:hover .mt, #menuList button:focus-visible .mt { color: var(--verm); transform: translateX(8px); }
#menuList .mono { color: var(--teal); }
#menuList .cur .mt { color: var(--verm); }
.menu-side { display: grid; gap: 6px; padding-top: 34px; }
.m-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid transparent; text-decoration: none; text-align: left; font-size: 15px; transition: border-color .25s, background .25s; }
.m-item:hover, .m-item:focus-visible { border-color: var(--faint); background: var(--card); outline: none; }
.m-item kbd { margin-left: auto; font-family: var(--f-mono); font-size: 10px; border: 1px solid var(--faint); border-radius: 4px; padding: 1px 6px; color: var(--muted); }
.m-ic { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1px solid var(--faint); display: grid; place-items: center; color: var(--verm); font-size: 14px; }
#mRestart { border-color: color-mix(in oklab, var(--verm) 40%, transparent); }
.m-item[hidden], .m-row[hidden], .m-confirm[hidden] { display: none; }
.m-confirm { padding: 14px; border-radius: 14px; border: 1px solid var(--verm); background: color-mix(in oklab, var(--verm) 10%, var(--bg-cold)); }
.m-confirm p { margin: 0 0 12px; font-size: 15px; }
.m-confirm-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.m-yes, .m-no { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--faint); font-size: 14px; }
.m-yes { background: var(--verm); border-color: var(--verm); color: var(--on-verm); font-weight: 600; }
.m-no:hover { border-color: var(--text); }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.m-row > .mono { color: var(--muted); }
#mLangSeg button { font-family: var(--f-body); font-size: 12px; letter-spacing: 0; text-transform: none; }
#mLangSeg .ls { display: none; }
.m-theme { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--faint); font-size: 13px; }
.m-theme .dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(90deg, var(--text) 50%, transparent 50%); border: 1px solid var(--text); }
.menu-close { position: absolute; top: -48px; right: 0; color: var(--text); }
@media (pointer: coarse) { .key-only { display: none !important; } }

/* ---------- Steer primer ---------- */
#primer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); background: color-mix(in oklab, var(--bg-cold) 46%, transparent); }
#primer[hidden] { display: none; }
.primer-card { width: min(460px, 100%); border-radius: 22px; border: 1px solid var(--faint); background: color-mix(in oklab, var(--bg-cold) 92%, var(--text) 4%); backdrop-filter: blur(16px); box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); padding: 18px 20px 18px; }
.primer-top { display: flex; justify-content: space-between; align-items: center; color: var(--teal); }
.primer-skip { color: var(--muted); font: inherit; letter-spacing: inherit; text-transform: inherit; padding: 6px 2px; }
.primer-skip:hover { color: var(--text); }
.primer-skip[hidden] { display: none; }
.primer-demo { height: 92px; margin: 10px 0 6px; border-radius: 14px; border: 1px solid var(--hair); background: var(--card); display: grid; place-items: center; position: relative; overflow: hidden; }
.primer-title { font-family: var(--f-display); font-weight: 400; font-variation-settings: "SOFT" 100, "WONK" 1; font-size: 1.5rem; line-height: 1.15; margin: 12px 0 6px; }
html:not([lang="en"]) .primer-title { font-family: var(--f-body); font-weight: 600; font-size: 1.2rem; line-height: 1.4; }
.primer-body { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.primer-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.primer-dots { display: flex; gap: 6px; }
.primer-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.primer-dots i.done { background: var(--teal); }
.primer-dots i.on { background: var(--verm); width: 18px; border-radius: 3px; }
.primer-do { flex: 1; color: var(--verm); text-align: right; font-size: 10px; }
html:not([lang="en"]) .primer-do { text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 12px; }
.primer-next { padding: 10px 18px; border-radius: 999px; background: var(--verm); color: var(--on-verm); font-weight: 600; font-size: 14px; flex: none; }
#spot { position: fixed; z-index: 59; border-radius: 999px; pointer-events: none; opacity: 0; box-shadow: 0 0 0 2px var(--verm), 0 0 0 9px color-mix(in oklab, var(--verm) 22%, transparent); transition: opacity .3s, left .4s, top .4s, width .4s, height .4s; animation: spot 1.6s ease-in-out infinite; }
#spot.on { opacity: 1; }
@keyframes spot { 50% { box-shadow: 0 0 0 2px var(--verm), 0 0 0 16px color-mix(in oklab, var(--verm) 6%, transparent); } }
/* demos */
.d-keys { display: flex; align-items: center; gap: 8px; }
.d-keys kbd, .d-pill, .d-burger { font-family: var(--f-mono); font-size: 13px; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--faint); display: grid; place-items: center; color: var(--text); background: var(--bg-cold); box-shadow: 0 3px 0 var(--faint); }
.d-keys kbd.wide { min-width: 88px; }
.d-keys .hot { border-color: var(--verm); color: var(--verm); animation: press 1.4s ease-in-out infinite; }
.d-keys.small { position: absolute; right: 14px; bottom: 12px; }
.d-keys.small kbd { height: 30px; min-width: 30px; font-size: 11px; }
.d-or { color: var(--muted); }
.d-nav { display: flex; gap: 6px; }
.d-nav i { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--faint); display: grid; place-items: center; font-style: normal; }
.d-nav i.hot { border-color: var(--verm); color: var(--verm); animation: press 1.4s ease-in-out infinite; }
.d-pill { font-family: var(--f-body); border-radius: 999px; padding: 0 16px; }
@keyframes press { 0%, 60%, 100% { transform: translateY(0); box-shadow: 0 3px 0 var(--faint); } 30% { transform: translateY(3px); box-shadow: 0 0 0 var(--faint); } }
.d-cards { display: flex; gap: 8px; }
.d-cards i { width: 46px; height: 58px; border-radius: 8px; border: 1px solid var(--faint); background: var(--bg-cold); animation: walk 4s steps(1) infinite; }
.d-cards i:nth-child(2) { animation-delay: -3s; }
.d-cards i:nth-child(3) { animation-delay: -2s; }
.d-cards i:nth-child(4) { animation-delay: -1s; }
@keyframes walk { 0% { border-color: var(--verm); box-shadow: 0 0 0 1px var(--verm); opacity: 1; } 25%, 100% { border-color: var(--faint); box-shadow: none; opacity: .55; } }
.d-cards.touch { animation: slide 4s ease-in-out infinite; }
.d-cards.touch i { width: 70px; }
@keyframes slide { 0%, 20% { transform: translateX(118px); } 30%, 45% { transform: translateX(40px); } 55%, 70% { transform: translateX(-38px); } 80%, 100% { transform: translateX(-116px); } }
.d-phone { width: 54px; height: 84px; border-radius: 12px; border: 1px solid var(--faint); position: relative; overflow: hidden; display: grid; gap: 6px; padding: 10px 8px; align-content: start; }
.d-phone b { height: 8px; border-radius: 3px; background: var(--faint); animation: lift 1.8s ease-in-out infinite; }
@keyframes lift { 0%, 30% { transform: translateY(0); } 70%, 100% { transform: translateY(-40px); opacity: 0; } }
.d-finger { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in oklab, var(--verm) 70%, transparent); box-shadow: 0 0 0 6px color-mix(in oklab, var(--verm) 18%, transparent); }
.d-finger.up { left: calc(50% - 11px); animation: fup 1.8s ease-in-out infinite; }
.d-finger.side { top: calc(50% - 11px); animation: fside 1.8s ease-in-out infinite; }
@keyframes fup { 0% { top: 70%; opacity: 0; } 15% { opacity: 1; } 70% { top: 12%; opacity: 1; } 100% { top: 12%; opacity: 0; } }
@keyframes fside { 0% { left: 70%; opacity: 0; } 15% { opacity: 1; } 70% { left: 22%; opacity: 1; } 100% { left: 22%; opacity: 0; } }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(180px, 300px) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: center; margin-top: clamp(10px, 2vh, 20px); }
.about-photo { margin: 0; position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 5; border: 1px solid var(--faint); background: var(--card); }
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.92) contrast(1.02); }
.about-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, color-mix(in oklab, var(--verm) 22%, transparent)); mix-blend-mode: multiply; pointer-events: none; }
.about-name { max-width: 16ch; }
.about-title { color: var(--teal); margin: 14px 0 0; text-transform: none; letter-spacing: .04em; font-size: 12px; }
html:not([lang="en"]) .about-title { font-family: var(--f-body); font-size: 14px; letter-spacing: 0; }
.about-bio { color: var(--muted); max-width: 62ch; margin: 16px 0 0; font-size: clamp(.98rem, 1.2vw, 1.08rem); line-height: 1.65; }
.about-bio:first-of-type { margin-top: 22px; }
.about-li { margin-top: 24px; padding: 13px 22px; font-size: .98rem; }
.about-li:hover { border-color: var(--text); }

/* ---------- contact page extras ---------- */
.cta-more { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.mini-btn { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--faint); color: var(--muted); font-size: 14px; text-decoration: none; transition: color .25s, border-color .25s; }
.mini-btn span[aria-hidden] { color: var(--verm); }
.mini-btn:hover, .mini-btn:focus-visible { color: var(--text); border-color: var(--text); }
body.kiosk .cta-pdf, body.kiosk .cta-share, body.kiosk #mThemeRow, body.kiosk #mPdf { display: none; }

/* ---------- Read mode: pages settle (soft snap) and offer a "next" cue ---------- */
html.read { scroll-snap-type: y proximity; }
html.read .beat { scroll-snap-align: start; }
.next-cue { display: none; }
html.read .next-cue { display: grid; place-items: center; position: absolute; left: 50%; bottom: 26px; margin-left: -21px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--faint); color: var(--muted); animation: cue 2.2s ease-in-out infinite; }
html.read .next-cue:hover { color: var(--text); border-color: var(--text); }
@keyframes cue { 50% { transform: translateY(5px); } }

/* ---------- phone carousels: cards become slides within the slide ---------- */
.car-nav { display: none; }

/* ---------- cursor ---------- */
#cursor { position: fixed; z-index: 100; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; mix-blend-mode: difference; pointer-events: none; opacity: 0; }
@media (pointer: fine) { body.has-cursor, body.has-cursor button, body.has-cursor a { cursor: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .gap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .gap { min-height: 0; padding: 14px; }
  .sol-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chain { grid-template-columns: 1fr 1fr; row-gap: 28px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hud-top { height: 58px; }
  .hud-bottom { height: 64px; }
  .hud { padding-left: calc(var(--rail-x) + 18px); }
  #modeSeg button { padding: 5px 8px; }
  #langSeg button { padding: 5px 7px; font-size: 11px; }
  .brand { font-size: 0; gap: 0; }
  .hint { display: none; }
  #langSeg .lf { display: none; }
  #langSeg .ls { display: inline; }
  .hud-right { gap: 6px; }
  .beat, #gate, #menu { padding: 78px 16px 92px calc(var(--rail-x) + 24px); align-items: flex-start; }
  .beat-inner { margin: 4vh 0 auto; }
  .stats { grid-template-columns: 1fr; gap: 18px; }
  .gap-grid { grid-template-columns: 1fr; }
  .gap h3 { font-size: 1.12rem; margin-top: 4px; }
  .sol-grid { grid-template-columns: 1fr; }
  .sol { min-height: 0; }
  .chain { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .arrow { display: none; }
  .cols { grid-template-columns: 1fr; }
  .sum { grid-template-columns: 1fr; }
  .sum-vis { max-width: 170px; }
  .doors { grid-template-columns: 1fr; }
  .door { min-height: 0; padding: 54px 20px 20px; }
  .gate-hint { display: none; }
  .choice { min-width: 0; flex: 1; }
  .cta-btn { width: 100%; justify-content: center; }

  /* once the journey starts, the top bar keeps only brand, language and ☰ (mode lives in the menu) */
  body:not([data-view="gate"]) #modeSeg, body:not([data-view="gate"]) #themeBtn { display: none; }

  /* carousels: one centred card, neighbours peeking in */
  .car {
    display: flex !important; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-left: calc(-1 * (var(--rail-x) + 24px)); margin-right: -16px;
    padding: 4px 7.5vw 6px; scroll-padding-inline: 7.5vw;
    background: none !important; border: 0 !important; border-radius: 0 !important; overflow-y: visible;
  }
  .car::-webkit-scrollbar { display: none; }
  .car > * { flex: 0 0 85vw; scroll-snap-align: center; scroll-snap-stop: always; }
  .car > .off { display: none; }
  .gap-grid.car .gap { border: 1px solid var(--hair); border-radius: 16px; min-height: 170px; }
  .stats.car .stat { margin: 0; padding: 18px 16px 16px; border: 1px solid var(--faint); border-radius: 16px; background: var(--card); }
  .chain.car li { padding: 20px 18px 18px; border: 1px solid var(--faint); border-radius: 16px; background: var(--card); }
  .chain.car li::after { top: 20px; left: auto; right: 18px; }
  .chain.car li.pt { padding-left: 18px; }
  .chain.car .chain-line { display: none; }
  .cols.car .col { padding: 16px; border: 1px solid var(--faint); border-radius: 16px; background: var(--card); }
  .sol-grid.car .sol { min-height: 190px; }
  .car-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
  .car-dots { display: flex; gap: 5px; flex-wrap: wrap; }
  .car-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); transition: width .3s, background .3s; }
  .car-dots i.on { width: 18px; border-radius: 3px; background: var(--verm); }
  .car-count { color: var(--muted); }

  /* about: photo on top */
  .about { grid-template-columns: 1fr; gap: 20px; }
  .about-photo { width: 150px; border-radius: 16px; }
  .about-li { width: auto; }

  /* menu: one column, actions first */
  .menu-inner { grid-template-columns: 1fr; gap: 18px; }
  .menu-side { order: -1; padding-top: 0; }
  .menu-close { top: -50px; }
  #menuList .mt { font-size: 1.25rem; }
  #mLangSeg .lf { display: none; }
  #mLangSeg .ls { display: inline; }

  #primer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* the bars sit on a fade of the page colour, so long pages scroll cleanly underneath */
  .hud-top, .hud-bottom { --hud-bg: color-mix(in oklab, var(--bg-cold), var(--bg-warm) calc(var(--p) * 100%)); }
  .hud-top { background: linear-gradient(var(--hud-bg) 55%, transparent); }
  body:not([data-view="gate"]) .hud-bottom { background: linear-gradient(transparent, var(--hud-bg) 45%); }
  .chapter-btn { display: none; }
  .hud-bottom { justify-content: flex-end; }
  .count { white-space: nowrap; }
  .mini-btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 420px) {
  #langSeg button { padding: 5px 7px; }
  #themeBtn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
