/* fonts, self-hosted (Geist Mono and Instrument Serif, SIL Open Font License). Geist Mono is
   one variable file per subset; symbols2 holds the box-drawing glyphs the atlas uses */
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/geist-mono-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/geist-mono-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/geist-mono-symbols2.woff2) format("woff2"); unicode-range: U+2000-2001, U+2004-2008, U+200A, U+23B8-23BD, U+2500-259F; }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-italic-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-italic-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #000;
  --rule: rgba(255, 255, 255, 0.08);
  --ink: #efe6da;
  --dim: rgba(239, 230, 218, 0.52);
  --faint: rgba(239, 230, 218, 0.34);
  --rose: #a54657;
  --fire: #ff8c26;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --hud: 56px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font-family: var(--mono); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 1px solid var(--rose); outline-offset: 3px; }
::selection { background: rgba(165, 70, 87, 0.55); color: #fff; }
a { color: inherit; }

/* ---- stage: the film, the overlays riding on it ---- */
#stage {
  position: fixed; inset: 0; overflow: hidden; background: #000;
  transform-origin: 100% 50%; transition: transform 0.8s var(--ease);
  touch-action: none; overscroll-behavior: none;
}
#film { position: absolute; left: 0; top: 0; display: block; pointer-events: none; opacity: 0; transition: opacity 0.6s; }
body.ready #film { opacity: 1; }
#overlays { position: absolute; inset: 0; pointer-events: none; }
.beat-ov { position: absolute; inset: 0; }
.beat-ov:focus { outline: none; }

/* an overlay: placed by transform each frame, top-left on its world anchor */
.ov { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform, opacity; pointer-events: none; opacity: 0; user-select: text; }
.ov.on { pointer-events: auto; }
.ov.on a, .ov.on button { pointer-events: auto; }
.ov.hidden a, .ov.hidden button { pointer-events: none; }

/* the standard project block (ctx.copyBlock) */
.block { width: min(36ch, 82vw); }
.block > * { margin: 0; transition: none; }
.block .kicker { font: 400 11px/1.4 var(--mono); letter-spacing: 0.04em; color: var(--dim); }
.block .headline { font: 400 clamp(28px, 3.4vw, 44px) / 1.02 var(--serif); letter-spacing: -0.01em; margin: 8px 0 10px; color: var(--ink); }
.block .line { font: 400 12.5px/1.6 var(--mono); color: rgba(239, 230, 218, 0.74); }
.block .number { font: 400 11.5px/1.5 var(--mono); color: var(--ink); margin-top: 12px; padding-left: 10px; border-left: 1px solid var(--rose); }
.block .hint { font: 400 11px/1.4 var(--mono); color: var(--faint); margin-top: 12px; }
.block .hint .seg { white-space: nowrap; }
.block .links { font: 400 11.5px/1.4 var(--mono); margin-top: 12px; color: var(--dim); }
.block .links a { color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(239, 230, 218, 0.25); padding-bottom: 1px; }
.block .links a:hover { color: var(--fire); border-color: var(--fire); }

/* the name: Instrument Serif, hot as it takes over from the glyph letters, cooling to cream */
.name {
  --heat: 0;
  font: italic 400 clamp(48px, min(12.4vh, 15vw), 124px) / 0.94 var(--serif);
  letter-spacing: -0.015em; margin: 0; white-space: nowrap;
  color: color-mix(in oklab, #ffcf9a calc(var(--heat) * 100%), var(--ink));
  text-shadow: 0 0 calc(var(--heat) * 34px) rgba(255, 140, 60, calc(var(--heat) * 0.6));
}

/* ghost text: invisible, exactly over glyph text in the canvas, so it can be selected and read */
.ghost {
  position: absolute; white-space: pre; color: transparent; font-family: var(--mono); font-weight: 500;
  letter-spacing: 0; pointer-events: auto; user-select: text; overflow: visible;
}
.ghost::selection { color: transparent; background: rgba(165, 70, 87, 0.5); }
.ghost.off { left: -10000px !important; top: 0 !important; pointer-events: none; }

#hint {
  position: absolute; left: 50%; bottom: calc(var(--hud) + 22px); transform: translateX(-50%); margin: 0; white-space: nowrap;
  font: 400 11px var(--mono); letter-spacing: 0.04em; color: rgba(239, 230, 218, 0.5);
  opacity: 0; transition: opacity 0.8s; pointer-events: none;
}
#hint.on { opacity: 1; }

#skip {
  position: fixed; top: 18px; right: clamp(16px, 2.4vw, 32px); z-index: 12;
  font: 400 11px var(--mono); letter-spacing: 0.04em; color: rgba(239, 230, 218, 0.82); text-decoration: none;
  padding: 6px 0; border-bottom: 1px solid rgba(239, 230, 218, 0.36);
  opacity: 0; pointer-events: none; transition: opacity 0.6s;
}
body.ready.first #skip, #skip:focus-visible { opacity: 1; pointer-events: auto; }
#skip:hover { color: var(--ink); }

/* ---- hud ---- */
#hud {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--hud); z-index: 10;
  display: flex; align-items: center; gap: clamp(10px, 1.6vw, 22px); padding: 0 clamp(14px, 1.6vw, 22px);
  border-top: 1px solid var(--rule); background: rgba(0, 0, 0, 0.92); font: 400 11px var(--mono); color: var(--dim);
}
#hud button { all: unset; cursor: pointer; color: var(--ink); padding: 6px 0; letter-spacing: 0.02em; white-space: nowrap; }
#hud button:hover { color: #fff; }
#hud button:focus-visible, #hud .scrub:focus-visible { outline: 1px solid var(--rose); outline-offset: 4px; }
#hud .src[aria-pressed="true"] { color: var(--rose); }
#hud .src .short { display: none; }
#hud .play { min-width: 3.4em; }
#hud .chapter { min-width: 11em; color: var(--ink); }
#hud .time { font-variant-numeric: tabular-nums; min-width: 13em; text-align: right; }
#hud .scrub { position: relative; flex: 1; height: 100%; cursor: pointer; touch-action: none; }
#hud .track, #hud .fill { position: absolute; top: 50%; height: 1px; left: 0; }
#hud .track { right: 0; background: rgba(255, 255, 255, 0.14); }
#hud .fill { background: var(--rose); }
#hud .head { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4px 0 0 -4.5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px #000; pointer-events: none; }
#hud .tick { position: absolute; top: 50%; width: 9px; height: 15px; margin: -7px 0 0 -4.5px; padding: 0 !important; }
#hud .tick::before { content: ""; position: absolute; left: 4px; top: 4px; width: 1px; height: 7px; background: rgba(255, 255, 255, 0.3); }
#hud .tick span { position: absolute; left: 50%; transform: translateX(-50%); font-size: 10px; letter-spacing: 0.03em; white-space: nowrap; color: rgba(239, 230, 218, 0.72); transition: color 0.3s; }
#hud .tick.up span { bottom: 15px; }
#hud .tick.dn span { top: 15px; }
#hud .tick.past::before { background: var(--rose); }
#hud .tick.past span { color: rgba(239, 230, 218, 0.86); }
#hud .tick.now span { color: var(--ink); }
#hud .tick:hover span { color: #fff; }

/* ---- view source split ---- */
#source {
  position: fixed; left: 0; top: 0; bottom: var(--hud); width: 44vw; z-index: 9;
  display: flex; flex-direction: column; background: #030303; border-right: 1px solid var(--rule);
  transform: translateX(-100%); transition: transform 0.8s var(--ease); visibility: hidden;
}
body.split #source { transform: none; visibility: visible; }
body.split #stage { transform: scale(0.56); }
#source header { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 16px; border-bottom: 1px solid var(--rule); }
#source .tabs { display: flex; gap: 18px; }
#source .tab { all: unset; cursor: pointer; font: 400 11px var(--mono); color: var(--dim); padding: 12px 0 11px; border-bottom: 1px solid transparent; }
#source .tab.on { color: var(--ink); border-bottom-color: var(--rose); }
#source .live { font: 400 10.5px var(--mono); color: rgba(255, 170, 100, 0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
#source pre {
  margin: 0; flex: 1; overflow: auto; padding: 14px 0 40vh;
  font: 400 11px/1.7 var(--mono); color: #a59d93; tab-size: 2;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
#source code { display: inline-block; min-width: 100%; font: inherit; }
#source .line { display: block; padding: 0 24px 0 0; white-space: pre; }
#source .line::before { content: attr(data-n); display: inline-block; width: 3.6em; padding-right: 1.4em; margin-right: 0.6em; text-align: right; color: rgba(255, 255, 255, 0.16); position: sticky; left: 0; background: #030303; }
#source .line.hot { background: rgba(255, 140, 60, 0.07); }
#source .line.hot::before { background: #0c0805; color: rgba(255, 160, 90, 0.55); box-shadow: inset -1px 0 0 rgba(255, 140, 60, 0.4); margin-right: 0; }
#source .c { color: #5f5852; font-style: italic; }
#source .s { color: #e3c79c; }
#source .n { color: #ff9d57; }
#source .K { color: #ffd08a; }
#source .k { color: #c08a78; }
#source .f { color: #f3e6d2; }

/* ---- the plain page (reduced motion) ---- */
#static[hidden] { display: none; }
body.static { overflow: auto; height: auto; }
body.static #stage, body.static #hud, body.static #source, body.static #skip { display: none; }
#static { max-width: 760px; margin: 0 auto; padding: 56px 16px 96px; }
#static .chapter { padding: 40px 0; border-top: 1px solid var(--rule); }
#static header.chapter { border-top: 0; padding-top: 0; }
#static h1 { font: italic 400 clamp(48px, 12vw, 96px) / 0.95 var(--serif); margin: 0 0 12px; letter-spacing: -0.015em; }
#static h2 { font: 400 clamp(28px, 6vw, 40px) / 1.05 var(--serif); margin: 8px 0 12px; }
#static .sr, .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#static .kicker { font: 400 11px/1.4 var(--mono); letter-spacing: 0.04em; color: var(--dim); margin: 0; }
#static .sub, #static .line { font: 400 13px/1.65 var(--mono); color: rgba(239, 230, 218, 0.74); margin: 0; }
#static .number { font: 400 12px/1.5 var(--mono); margin: 14px 0 0; padding-left: 10px; border-left: 1px solid var(--rose); }
#static .links { font: 400 12px var(--mono); margin: 14px 0 0; color: var(--dim); }
#static a { color: var(--ink); text-decoration-color: rgba(239, 230, 218, 0.3); text-underline-offset: 3px; }
#static a:hover { color: var(--fire); }
#static .toc, #static .markers, #static .contact, #static .index { list-style: none; padding: 0; margin: 18px 0 0; font: 400 12.5px/1.7 var(--mono); }
#static .toc { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--dim); }
#static .markers li { padding: 6px 0; color: rgba(239, 230, 218, 0.74); }
#static .markers b { font-weight: 500; color: var(--ink); }
#static .markers li.mini { font-size: 11.5px; padding-left: 18px; color: var(--dim); }
#static .contact button { all: unset; cursor: pointer; border-bottom: 1px solid rgba(239, 230, 218, 0.3); }
#static .index li { border-bottom: 1px solid var(--rule); }
#static .index a { display: block; padding: 14px 0; text-decoration: none; }
#static .index .t { display: block; font: 400 26px/1.1 var(--serif); }
#static .index .d { display: block; color: var(--dim); font-size: 12px; margin-top: 4px; }
.noscript { padding: 24px 16px; }

/* ---- small screens ---- */
@media (max-width: 700px) {
  #hud .chapter, #hud .tick span { display: none; }
  #hud .tick.now span { display: block; }
  #hud .time { min-width: 0; font-size: 10px; }
  #hud { gap: 10px; padding: 0 12px; }
  #hud .src .long { display: none; }
  #hud .src .short { display: inline; }
  #source { width: 100vw; }
  body.split #stage { transform: scale(0.001); }
  .block .headline { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  #stage, #source, #film { transition: none; }
}

/* ---- a transparent link or button laid over glyph text (desk, diagnostics) ---- */
.ov.ghost-link { background: none; border: 0; padding: 0; margin: 0; font: 500 10px/1 var(--mono); letter-spacing: 0; color: transparent; white-space: pre; cursor: pointer; }
.ov.ghost-link::selection { color: transparent; background: rgba(165, 70, 87, 0.5); }
