/* ─────────────────────────────────────────────────────────────
   Tokens. The 3D scene reads --bg, --block-edge and --accent from
   here, so changing a colour updates both layers.
   ───────────────────────────────────────────────────────────── */
:root {
  --bg: #080f1e;
  --fg: #dfe6f5;
  --fg-dim: #8794b0;
  --line: rgba(160, 180, 220, 0.22);
  --accent: #00d4ff;
  --block-edge: #7b9ff9;
  --scrim: rgba(8, 15, 30, 0.86);
  --flash-colour: #eef3ff;
  --atmo-light: rgba(220, 232, 255, 0.07);
  --atmo-shade: rgba(0, 0, 0, 0.28);

  /* One face, like igloo: small tracked uppercase for identifiers,
     light sentence case for the one line each room says. */
  --font: "Azeret Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --track-id: 0.14em;
  --gutter: clamp(16px, 4vw, 52px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e8ecf4; --fg: #121a2e; --fg-dim: #536079; --line: rgba(30, 45, 80, 0.2);
    --accent: #0079a3; --block-edge: #ffffff; --scrim: rgba(232, 236, 244, 0.9);
    --atmo-light: rgba(255, 255, 255, 0.5); --atmo-shade: rgba(40, 50, 80, 0.12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #e8ecf4; --fg: #121a2e; --fg-dim: #536079; --line: rgba(30, 45, 80, 0.2);
  --accent: #0079a3; --block-edge: #ffffff; --scrim: rgba(232, 236, 244, 0.9);
  --atmo-light: rgba(255, 255, 255, 0.5); --atmo-shade: rgba(40, 50, 80, 0.12);
  color-scheme: light;
}

/* ───────── base ───────── */
html.frame { overflow: hidden; height: 100%; }        /* ?frame debug mode */
html.frame body { height: 100%; overflow-y: auto; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scrollbar-color: var(--fg-dim) var(--bg); scrollbar-width: thin; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 300 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--bg); }
.accent { color: var(--accent); }
.hud-dim { color: var(--fg-dim); }

/* ───────── fixed layers ───────── */
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#callouts {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none; overflow: visible;
  font: 500 10px var(--font); letter-spacing: 0.04em;
}
#callouts line { stroke: var(--fg); stroke-opacity: 0.55; stroke-width: 0.75; }
#callouts .arc { fill: none; stroke: var(--accent); stroke-width: 1; }
#callouts circle { fill: var(--accent); }
#callouts text { fill: var(--fg); }
/* data room: the lines are string on a pin board */
#callouts[data-style="string"] line { stroke: var(--accent); stroke-opacity: 0.9; stroke-width: 1.6; }

/* igloo's colour pass darkens toward the bottom-left; a soft light sits top-right. */
.atmo {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse at 82% 12%, var(--atmo-light), transparent 55%),
    linear-gradient(45deg, var(--atmo-shade), transparent 60%);
}
/* the white light you step into through the front door */
.flash {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, var(--flash-colour) 30%, color-mix(in srgb, var(--flash-colour) 70%, var(--bg)) 100%);
  opacity: var(--flash, 0);
}
.no-webgl #scene, .no-webgl #callouts, .no-webgl .atmo, .no-webgl .flash { display: none; }
.no-webgl .inner { opacity: 1 !important; transform: none !important; }

/* ───────── HUD ───────── */
.hud {
  position: fixed; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px var(--gutter);
  font: 400 11px/1.5 var(--font);
  letter-spacing: var(--track-id);
  text-transform: uppercase;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-top { top: 0; }
.hud-bottom { bottom: 0; align-items: flex-end; }

.mark { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.mark-glyph {
  font: 500 20px/1 var(--font); letter-spacing: 0.02em; text-transform: none;
  white-space: pre; min-width: 7ch;
}
.mark:hover { color: var(--fg); }
.mark:hover .mark-glyph { color: var(--accent); }

.hud-nav { display: flex; gap: 4px 20px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.room-link { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; color: var(--fg-dim); }
.room-link:hover { color: var(--fg); }
.hud-btn {
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--fg);
  background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer;
}
.hud-btn:hover { color: var(--accent); }

.hud-progress { min-width: 180px; }
.hud-bar { margin-top: 8px; height: 1px; background: var(--line); width: 180px; }
#hud-bar-fill { display: block; height: 1px; width: 0; background: var(--accent); }
.hud-readout { display: flex; gap: 22px; margin: 0; }
.hud-readout div { display: flex; flex-direction: column; text-align: right; }
.hud-readout dt { color: var(--fg-dim); }
.hud-readout dd { margin: 0; }

/* ───────── stops ─────────
   Each stop is taller than the screen; its text stays pinned while the
   room is built, and fades with it (--vis is set from the scroll). */
main { position: relative; z-index: 2; }
.stop { position: relative; min-height: 165vh; padding: 0 var(--gutter); }
.stop.tall { min-height: 200vh; }
.hero { min-height: 270vh; }
.inner {
  position: sticky; top: 0;
  height: 100vh; max-width: 30rem;
  display: flex; flex-direction: column; justify-content: center;
  padding: 96px 0;
  opacity: var(--vis, 1);
  transform: translateY(calc((1 - var(--vis, 1)) * 14px));
  pointer-events: none;
}
.inner a, .inner .ls { pointer-events: auto; }
/* keeps the text readable where a room's wall runs behind it */
.inner::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0;
  left: calc(-1 * var(--gutter)); width: calc(100% + var(--gutter) * 2 + 8vw);
  background: linear-gradient(90deg, var(--scrim) 0%, color-mix(in srgb, var(--scrim) 70%, transparent) 55%, transparent);
  pointer-events: none;
}

.prompt { font: 400 12px var(--font); margin: 0; letter-spacing: 0.02em; }
.byline + .prompt { margin-top: 26px; }
.caret {
  display: inline-block; width: 0.6em; height: 1.1em; margin-left: 4px; vertical-align: -0.2em;
  background: var(--accent); animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

h1, h2 { text-wrap: balance; margin: 0; }
h1 {
  font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  max-width: 13ch;
  margin-bottom: 28px;
}
h2 {
  font-weight: 300;
  font-size: clamp(1.45rem, 2.7vw, 2.35rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  max-width: 20ch;
  margin-bottom: 22px;
}
.byline { margin: 0; max-width: 34ch; color: var(--fg-dim); font-size: 14px; }
.line { margin: 0 0 22px; font-size: 15px; max-width: 34ch; }
.tag {
  margin: 0; font: 400 11px/1.7 var(--font);
  letter-spacing: var(--track-id); text-transform: uppercase; color: var(--fg-dim);
  max-width: 44ch;
}
.scroll-hint {
  position: absolute; bottom: 92px; left: 0; margin: 0;
  font: 400 11px var(--font); letter-spacing: var(--track-id); text-transform: uppercase; color: var(--fg-dim);
}

/* `ls -lt` listing (talks) */
.ls { list-style: none; margin: 0 0 22px; padding: 0; font: 400 12px/1.5 var(--font); }
.ls li { display: grid; grid-template-columns: 8ch 1fr auto; column-gap: 16px; align-items: baseline; padding: 5px 0; }
.ls time { color: var(--fg-dim); }
.ls-name { color: var(--fg); overflow-wrap: anywhere; }
.ls-where { color: var(--fg-dim); text-align: right; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.ls li:hover .ls-name { color: var(--accent); }

/* bracket links: [ email ] */
.links { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0 0 26px; }
.bracket {
  position: relative; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 18px;
  font: 400 11px var(--font); letter-spacing: var(--track-id); text-transform: uppercase; text-decoration: none;
}
.bracket::before, .bracket::after {
  content: ""; position: absolute; top: 8px; bottom: 8px; width: 7px;
  border: 1px solid var(--fg-dim); transition: width .25s cubic-bezier(.2,.8,.2,1), border-color .25s;
}
.bracket::before { left: 0; border-right: 0; }
.bracket::after { right: 0; border-left: 0; }
.bracket:hover::before, .bracket:hover::after,
.bracket:focus-visible::before, .bracket:focus-visible::after { width: 12px; border-color: var(--accent); }
.bracket.primary { color: var(--accent); font-size: 13px; padding: 0 22px; }
.bracket.primary::before, .bracket.primary::after { border-color: var(--accent); }
.hud .bracket { min-height: 36px; }

/* ───────── small and portrait screens: the room sits above the text ───────── */
@media (max-width: 820px), (max-aspect-ratio: 21/20) {
  .room-link { display: none; }
  .hide-sm { display: none !important; }
  .hud-nav { flex-wrap: nowrap; gap: 14px; }
  .hud-btn .hud-dim { display: none; }
  .mark-glyph { font-size: 17px; min-width: 0; }
  .inner {
    justify-content: flex-end; max-width: none;
    padding: 0 0 92px;
  }
  .inner::before {
    content: ""; position: absolute; z-index: -1; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); top: auto; width: auto; bottom: 0; height: 58%;
    background: linear-gradient(transparent, var(--scrim) 38%);
  }
  .hero .inner { padding-bottom: 120px; }
  .scroll-hint { bottom: 82px; }
  .ls li { grid-template-columns: 8ch 1fr; }
  .ls-where { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; }
  .inner { transform: none; }
}
