/* MARKUP MACHINE landing: a drafting sheet over a fixed WebGL canvas. Tokens + fonts come from /shared/base.css. */

/* Geist Mono arrows (U+2190–21FF): the shared latin subset has no "→"; same family, extra unicode-range */
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/geist-mono-arrows-var.woff2') format('woff2'); unicode-range: U+2190-21FF; }

body.landing { background: var(--ink); }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: pan-y; outline: none; }
#gl.grab { cursor: grab; } #gl.grabbing { cursor: grabbing; } #gl.point { cursor: pointer; }

/* scroll space: the canvas is fixed, this section only provides the 6 viewport heights of scroll */
/* scroll space: a 620vh section; the drawing sheet (.stage) is sticky inside it, so it pins for ~5 viewports and then
   scrolls away whole, before the footer, instead of being cut by it */
.assembly { position: relative; z-index: 1; height: 620vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; z-index: 1; }
.assembly .steps, .assembly .nogl-fig, .assembly .nogl-links, .assembly .nogl-head { display: none; }
#foot { position: relative; z-index: 5; background: var(--ink); }

/* ── drawing frame ───────────────────────────────────── */
.frame { position: absolute; z-index: 2; pointer-events: none; inset: calc(var(--nav-h) + 10px) 10px calc(10px + var(--mbar-h)) 10px; border: 1px solid var(--line); opacity: 0; transition: opacity .8s var(--ease); }
.frame::before, .frame::after { content: ''; position: absolute; left: 0; right: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 12.5%); }
.frame::before { top: 0; } .frame::after { bottom: 0; }
.zones { position: absolute; display: flex; font: 500 9px/1 var(--mono); color: var(--faint); letter-spacing: .1em; }
.zones-x { left: 0; right: 0; top: 8px; } .zones-x span { flex: 1; text-align: center; }
.zones-y { top: 0; bottom: 0; left: 6px; flex-direction: column; } .zones-y span { flex: 1; display: flex; align-items: center; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.ld { fill: none; stroke: var(--steel); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ld-on { stroke: var(--text); }
.ld-b { stroke: var(--steel); }
.ld-dot { fill: var(--steel); opacity: 0; }
.ld-dot.on { fill: var(--text); }

/* ── HUD layer ───────────────────────────────────────── */
.hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .8s var(--ease); }
.hud > * { pointer-events: auto; }
html.live .hud, html.live .frame { opacity: 1; }

.kicker { font: 500 10.5px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 0 0 14px; display: flex; gap: 10px; align-items: center; }
.kicker .pn { border: 1px solid var(--line-2); padding: 3px 6px; color: var(--text); }

.intro { position: absolute; left: clamp(28px, 4vw, 64px); top: calc(var(--nav-h) + clamp(36px, 8vh, 90px)); width: min(580px, 41vw); transition: opacity .35s, transform .35s var(--ease); }
.intro h1 { font-size: clamp(36px, 3.6vw, 54px); line-height: .93; margin: 0 0 18px; text-wrap: balance; }
.intro .lede { color: var(--dim); max-width: 46ch; font-size: 13px; }
.intro .lede b { color: var(--text); font-weight: 500; }
.intro .lede b.c-tick { color: var(--tick); } .intro .lede b.c-burn { color: var(--burn); }
.intro-cta { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 14px; }
.intro-ca { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 11px; max-width: 100%; }
.intro-ca .mm-ca-addr { color: var(--dim); }
.hint { margin: 26px 0 0; font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--steel); display: flex; align-items: center; gap: 12px; }
.hint i { width: 1px; height: 38px; background: var(--steel); position: relative; }
.hint i::before, .hint i::after { content: ''; position: absolute; left: -4px; width: 9px; height: 1px; background: var(--steel); }
.hint i::before { top: 0; } .hint i::after { bottom: 0; }
.hint i { animation: hint 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes hint { 0% { transform: scaleY(.2); } 60%, 100% { transform: scaleY(1); } }
.intro.off { opacity: 0; transform: translateY(-14px); pointer-events: none; visibility: hidden; transition: opacity .35s, transform .35s var(--ease), visibility 0s .35s; }

/* callout blocks */
.callouts { position: absolute; inset: 0; pointer-events: none; }
.co { position: absolute; left: 0; top: 0; width: 318px; background: rgba(13, 14, 15, .88); border: 1px solid var(--line-2); padding: 0 0 4px; opacity: 0; visibility: hidden; transition: opacity .28s var(--ease), visibility 0s .28s; will-change: transform; pointer-events: none; }
.co.on { opacity: 1; visibility: visible; transition: opacity .28s var(--ease); pointer-events: auto; }
.co header, .card header { display: flex; align-items: center; gap: 10px; padding: 10px 12px 9px; border-bottom: 1px solid var(--line); }
.co-n { flex: none; width: 26px; height: 26px; border: 1px solid var(--text); border-radius: 50%; display: grid; place-items: center; font: 500 12px/1 var(--mono); }
.co h3, .card h3 { font: 800 26px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; margin: 0; flex: 1; }
.co-t { margin: 10px 12px 8px; color: var(--dim); font-size: 12px; line-height: 1.55; }
.co-t code { font-size: 11px; }
.co-kv { margin: 0 12px 6px; }
.co-kv > div { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 12px; }
.co-kv dt { color: var(--dim); white-space: nowrap; }
.co-kv dt::after { content: ''; }
.co-kv > div::before { content: ''; order: 1; flex: 1; border-bottom: 1px dotted var(--line-2); transform: translateY(-3px); min-width: 12px; }
.co-kv dd { order: 2; margin: 0; color: var(--text); text-align: right; white-space: nowrap; }
.co-kv .tick dd { color: var(--tick); } .co-kv .burn dd { color: var(--burn); } .co-kv .v dd { color: var(--text); font-weight: 500; }

/* balloons */
.bal { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--steel); background: var(--ink); color: var(--dim); font: 500 11px/1 var(--mono); display: grid; place-items: center; opacity: 0; visibility: hidden; will-change: transform; }
.bal.vis { visibility: visible; }
.bal:hover { color: var(--text); border-color: var(--text); }

/* vault labels */
.vlabel { position: absolute; left: 0; top: 0; font: 500 10px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); white-space: nowrap; pointer-events: none; transform: translate(-50%, -100%); padding-bottom: 6px; }
.vlabel-ghost { color: var(--text); border-bottom: 1px dashed var(--text); padding: 0 0 4px; }
.vlabel-drag { color: var(--steel); }
#vl-plinth { color: var(--text); font-size: 12px; }

/* parts list + title block (bottom-right, drafting convention) */
.sheetbox { position: absolute; right: 10px; bottom: calc(10px + var(--mbar-h)); width: 340px; background: rgba(13, 14, 15, .9); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.bom { display: grid; font-size: 11px; }
.bom-h, .bom-r { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; height: 26px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.bom-h { font: 500 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); height: 24px; }
.bom-h span, .bom-r span { padding: 0 10px; }
.bom-h span:first-child, .bom-r .bom-n { border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; justify-content: center; padding: 0; }
.bom-r { color: var(--dim); transition: background .2s, color .2s; }
.bom-r:hover { color: var(--text); background: var(--panel); }
.bom-r .bom-p { text-transform: uppercase; letter-spacing: .06em; }
.bom-r .bom-v { color: var(--text); }
.bom-r.on { color: var(--ink); background: var(--text); }
.bom-r.on .bom-v { color: var(--ink); }
.tblock { display: grid; grid-template-columns: 1.3fr .8fr .8fr .8fr; font-size: 11px; }
.tblock > div { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 10px; min-width: 0; }
.tblock > div:nth-child(3), .tblock > div:nth-child(7) { border-right: 0; }
.tb-name { grid-column: 1 / 3; display: flex; flex-direction: column; justify-content: center; }
.tb-name b { font: 800 22px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.tb-name span { color: var(--faint); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; margin-top: 3px; }
.tb-c small { display: block; font-size: 9px; letter-spacing: .14em; color: var(--faint); text-transform: uppercase; }
.tb-c b { font-weight: 500; }
.tb-mode b.preview { color: var(--dim); } .tb-mode b.live { color: var(--tick); } .tb-mode b.offline { color: var(--dim); }
.tblock > div:nth-child(n+4) { border-bottom: 0; }

/* scroll scale (right edge ruler) */
.scale { position: absolute; right: 22px; top: calc(var(--nav-h) + 40px); height: 34vh; width: 10px; pointer-events: none;
  background: repeating-linear-gradient(180deg, var(--line-2) 0 1px, transparent 1px calc(100% / 8)), linear-gradient(var(--line-2), var(--line-2)) right / 1px 100% no-repeat; }
.scale i { position: absolute; right: -2px; width: 14px; height: 2px; background: var(--tick); top: 0; transform: translateY(0); will-change: transform; }

/* sound toggle (bottom-left of the sheet) */
.sound { position: absolute; left: 22px; bottom: calc(22px + var(--mbar-h)); display: flex; align-items: flex-end; gap: 2px; height: 22px; font: 500 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
.sound i { width: 2px; height: 5px; background: var(--steel); }
.sound i:nth-child(2) { height: 9px; } .sound i:nth-child(3) { height: 13px; }
.sound span { margin-left: 8px; }
.sound[aria-pressed="true"] { color: var(--text); } .sound[aria-pressed="true"] i { background: var(--tick); animation: eq .9s ease-in-out infinite alternate; }
.sound[aria-pressed="true"] i:nth-child(2) { animation-delay: -.3s; } .sound[aria-pressed="true"] i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { from { transform: scaleY(.4); } to { transform: scaleY(1); } }
.sound i { transform-origin: bottom; }

/* outro */
.outro { position: absolute; left: clamp(28px, 4vw, 64px); top: calc(var(--nav-h) + clamp(36px, 8vh, 90px)); width: min(440px, 32vw); opacity: 0; visibility: hidden; transform: translateY(14px); transition: opacity .35s, transform .35s var(--ease), visibility 0s .35s; }
.outro.on { opacity: 1; visibility: visible; transform: none; transition: opacity .45s, transform .45s var(--ease); }
.outro h2 { font-size: clamp(36px, 3.6vw, 56px); margin: 0 0 18px; }
.loop { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); counter-reset: l; }
.loop li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; counter-increment: l; }
.loop li b { font: 600 18px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.loop li b::before { content: counter(l, decimal-leading-zero) '  '; font: 500 10px/1 var(--mono); color: var(--faint); letter-spacing: .1em; }
.loop li span { color: var(--dim); text-align: right; }

/* phone card */
.card { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--mbar-h)); background: rgba(13, 14, 15, .94); border: 1px solid var(--line-2); display: none; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s var(--ease); pointer-events: none; }
.card.on { opacity: 1; transform: none; pointer-events: auto; }
.card header { padding: 8px 10px 7px; }
.card .co-n { width: 22px; height: 22px; font-size: 11px; }
.card h3 { font-size: 22px; }
.card-i { font: 500 10px/1 var(--mono); color: var(--faint); letter-spacing: .1em; }
.card .co-t { margin: 8px 10px 4px; font-size: 11.5px; line-height: 1.5; }
.card .co-kv { margin: 0 10px 6px; } .card .co-kv > div { padding: 2px 0; font-size: 11.5px; }

/* ── gate ────────────────────────────────────────────── */
.gate { position: fixed; inset: 0; z-index: 30; display: none; pointer-events: none; }
html.gating .gate { display: block; }
html.gating body { overflow: hidden; }
.gate > * { pointer-events: auto; }
.gate-k { position: absolute; left: 50%; top: calc(var(--nav-h) + 6vh); transform: translateX(-50%); margin: 0; font: 500 10.5px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.gate-k .pn { border: 1px solid var(--line-2); padding: 3px 6px; color: var(--text); }
.gate-key { position: absolute; left: 0; top: 0; width: 10px; height: 10px; border-radius: 0; background: transparent; cursor: pointer; outline: none; }
.gate-key:focus, .gate-key:focus-visible { outline: none; }
.gate-ring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.gate-ring polygon { fill: none; stroke: var(--tick); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0; transition: opacity .15s; }
.gate-key:focus-visible + .gate-ring polygon { opacity: 1; }
.gate-foot { position: absolute; left: 50%; bottom: calc(7vh + var(--mbar-h)); transform: translateX(-50%); text-align: center; width: min(560px, calc(100vw - 32px)); }
.gate-title { font-size: clamp(34px, 4.6vw, 60px); margin: 0 0 10px; }
.gate-hint { color: var(--dim); font-size: 12px; margin: 0 auto 16px; max-width: 46ch; }
.gate-row { display: flex; justify-content: center; gap: 20px; }
.gate-skip, .gate-sound { font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--steel); padding: 8px 4px; }
.gate-skip:hover, .gate-sound:hover { color: var(--text); }
.gate.off { opacity: 0; transition: opacity .5s var(--ease); pointer-events: none; }
.gate.off > * { pointer-events: none; }

/* the nav is visible from the start; the drawing chrome fades in after the gate */
html.gating .frame, html.gating .hud { opacity: 0; }

/* ── simulation (preview only): a visitor-started run with made-up numbers, always marked ── */
.sim-btn { display: inline-flex; align-items: center; gap: 9px; height: 32px; padding: 0 12px; border: 1px dashed var(--text); color: var(--text); font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.sim-btn i { width: 0; height: 0; border-left: 7px solid var(--tick); border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.sim-btn:hover { border-style: solid; color: var(--tick); }
.co-act { margin: 4px 12px 10px; }
.sim-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 4px 0 0; }
.sim-cta span { flex: 1 1 220px; color: var(--dim); font-size: 11px; line-height: 1.45; }
.sim-cta[hidden], .co-act[hidden] { display: none; }
html.sim .sim-cta, html.sim .co-act { display: none; }
.co-sim { display: none; font: 500 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); background: var(--text); padding: 3px 5px; }
.is-sim .co-sim { display: inline-block; }
.is-sim .co-kv dd, .bom.is-sim .bom-v, html.sim .loop li span, html.sim .tb-mode b { text-decoration: underline dashed var(--steel); text-underline-offset: 3px; }
.tb-mode b.sim { color: var(--text); }
.simbadge { position: absolute; left: 26px; top: calc(var(--nav-h) + 26px); z-index: 6; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 6px 0 12px; background: var(--ink); border: 1px dashed var(--text); font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.simbadge[hidden] { display: none; }
.simbadge i { width: 7px; height: 7px; background: var(--text); animation: simblink 1s steps(2) infinite; }
.simbadge b { font-weight: 500; color: var(--text); }
.simbadge span { color: var(--dim); }
.simbadge button { height: 22px; padding: 0 8px; border: 1px solid var(--line-2); color: var(--dim); font: inherit; letter-spacing: inherit; }
.simbadge button:hover { color: var(--text); border-color: var(--text); }
@keyframes simblink { 50% { opacity: .15; } }
.ld-ring { fill: none; stroke: var(--text); stroke-width: 1; opacity: 0; }

/* ── responsive ──────────────────────────────────────── */
@media (max-width: 1180px) {
  .sheetbox { width: 300px; }
  .co { width: 290px; }
}
@media (max-width: 899px) {
  /* phones: the intro / outro sit in the bottom band (where the part card lives), the drawing above */
  .intro, .outro { left: 10px; right: 10px; width: auto; top: auto; bottom: calc(10px + var(--mbar-h)); background: rgba(13, 14, 15, .94); border: 1px solid var(--line-2); padding: 12px 12px 10px; }
  .intro .kicker, .outro .kicker { margin-bottom: 8px; font-size: 9.5px; }
  .intro h1 { font-size: clamp(26px, 7.4vw, 34px); margin-bottom: 10px; }
  .intro .lede, .intro-ca { display: none; }
  .intro-cta { margin: 10px 0 0; gap: 6px; }
  .intro-cta .btn-lg { height: 38px; padding: 0 12px; font-size: 11px; }
  .hint { position: absolute; right: 12px; bottom: 16px; margin: 0; font-size: 9px; }
  .hint i { height: 22px; }
  .outro h2 { font-size: 28px; margin-bottom: 8px; }
  .outro .loop li { padding: 4px 0; font-size: 11px; }
  .outro .loop li b { font-size: 15px; }
  .sheetbox, .scale, .zones, .co { display: none; }
  .frame { inset: calc(var(--nav-h) + 6px) 6px calc(6px + var(--mbar-h)) 6px; }
  .frame::before, .frame::after { display: none; }
  .card { display: block; }
  .sound { top: calc(var(--nav-h) + 14px); bottom: auto; left: auto; right: 16px; }
  .bal { width: 22px; height: 22px; font-size: 10px; }
  .vlabel-ghost { font-size: 8.5px; letter-spacing: .1em; text-align: center; border-bottom: 0; padding: 0; }
  .vlabel-ghost span { display: block; border-bottom: 1px dashed var(--text); padding: 1px 0; }
  .simbadge { left: 12px; top: calc(var(--nav-h) + 12px); height: 28px; font-size: 9.5px; gap: 7px; }
  .simbadge span { display: none; }
  .sim-cta span { display: none; }
  .co-act { margin: 2px 10px 8px; }
}
@media (max-width: 899px) { .intro .hint { display: none; } }

@media (max-width: 600px) { .gate-k { white-space: normal; width: calc(100vw - 32px); justify-content: center; text-align: center; font-size: 9.5px; flex-wrap: wrap; } }

/* ── no WebGL / no JS: a plain readable page with the drawing as an image ── */
html:not(.js) .gate, html.nogl .gate, html:not(.js) .stage, html.nogl .stage { display: none !important; }
html:not(.js) .assembly, html.nogl .assembly { height: auto; pointer-events: auto; padding: calc(var(--nav-h) + 24px) var(--gutter) 40px; max-width: 1100px; margin: 0 auto; }
html:not(.js) .assembly .steps, html.nogl .assembly .steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0; list-style: none; padding: 0; margin: 24px 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
html:not(.js) .steps li, html.nogl .steps li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px; }
html:not(.js) .steps h2, html.nogl .steps h2 { font-size: 26px; display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
html:not(.js) .steps h2 span, html.nogl .steps h2 span { width: 26px; height: 26px; border: 1px solid var(--text); border-radius: 50%; display: grid; place-items: center; font: 500 12px/1 var(--mono); }
html:not(.js) .steps p, html.nogl .steps p { color: var(--dim); }
html:not(.js) .assembly .nogl-fig, html.nogl .assembly .nogl-fig { display: block; border: 1px solid var(--line); max-width: 640px; margin: 0 auto; }
html:not(.js) .assembly .nogl-fig img, html.nogl .assembly .nogl-fig img { width: 100%; height: auto; }
html:not(.js) .assembly .nogl-links, html.nogl .assembly .nogl-links { display: flex; gap: 8px; }
html:not(.js) .assembly .nogl-head, html.nogl .assembly .nogl-head { display: block; margin: 0 0 24px; }
.nogl-head h1 { max-width: 16ch; }

@media (prefers-reduced-motion: reduce) {
  .hint i, .sound i { animation: none !important; }
  .co, .bal, .intro, .outro, .card, .hud, .frame { transition: none !important; }
}

/* dev: ?poster renders the bare drawing (fallback image) */
html.poster .hud, html.poster .leaders, html.poster .mm-nav, html.poster .mm-mbar, html.poster .frame { display: none !important; }
