:root {
  --bg: #0a0b0a;
  --fg: #d7ddd8;
  --mute: #8b948d;
  --dim: #4f5751;
  --line: #1b201c;
  --acc: #7cffb2;
  --neg: #ff6b6b;
  --grid: #111512;
  --grid-hi: #22302a;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 24px;
  --head: 48px;  /* 76px once the ticker row is showing */

  /* blueprint paper: 32px grid with a + mark every 4 cells */
  --plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cpath d='M64.5 59v11M59 64.5h11' stroke='%23252d27'/%3E%3C/svg%3E");
  --plus-hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cpath d='M64.5 57v15M57 64.5h15' stroke='%237cffb2' stroke-opacity='.55'/%3E%3C/svg%3E");
}
@media (max-width: 560px) { :root { --gutter: 16px; } }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--bg);
  background-image:
    var(--plus),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 128px 128px, 32px 32px, 32px 32px;
  color: var(--fg);
  font: 400 14px/1.7 var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
main, footer { position: relative; z-index: 1; }
::selection { background: var(--acc); color: var(--bg); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px dashed var(--acc); outline-offset: 3px; }

.wrap { max-width: 960px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.ps { color: var(--acc); }
.dim { color: var(--dim); }

.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* cursor spotlight: a brighter copy of the grid, masked to a circle around the pointer */
.spot {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    var(--plus-hi),
    linear-gradient(var(--grid-hi) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-hi) 1px, transparent 1px);
  background-size: 128px 128px, 32px 32px, 32px 32px;
  background-position: 0 var(--sy, 0px);
  -webkit-mask-image: radial-gradient(240px circle at var(--mx, -999px) var(--my, -999px), #000, transparent);
  mask-image: radial-gradient(240px circle at var(--mx, -999px) var(--my, -999px), #000, transparent);
  opacity: 0; transition: opacity .4s;
}
.spot.on { opacity: 1; }
@media (hover: none) { .spot { display: none; } }

/* corner brackets */
.br {
  --c: var(--dim);
  background:
    linear-gradient(var(--c), var(--c)) top left / 12px 1px,
    linear-gradient(var(--c), var(--c)) top left / 1px 12px,
    linear-gradient(var(--c), var(--c)) top right / 12px 1px,
    linear-gradient(var(--c), var(--c)) top right / 1px 12px,
    linear-gradient(var(--c), var(--c)) bottom left / 12px 1px,
    linear-gradient(var(--c), var(--c)) bottom left / 1px 12px,
    linear-gradient(var(--c), var(--c)) bottom right / 12px 1px,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 12px,
    rgba(10, 11, 10, .78);
  background-repeat: no-repeat;
}
.br:hover, .br:focus-within { --c: var(--acc); }

/* ── header ──────────────────────────────── */
.top {
  position: fixed; inset: 0 0 auto; z-index: 10;
  background: rgba(10, 11, 10, .78);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.bar {
  height: 48px; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 28px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; letter-spacing: .02em; white-space: nowrap; }
.mark { width: 20px; height: 20px; flex: none; fill: var(--acc); margin-bottom: 2px; }
/* the bars settle in one after another, like the hero's pile; hovering replays it */
.mark rect { transform-box: fill-box; transform-origin: 50% 100%; animation: settle .7s cubic-bezier(.2, .8, .2, 1) both; }
.mark rect:nth-child(1) { animation-delay: .05s; }
.mark rect:nth-child(2) { animation-delay: .15s; }
.mark rect:nth-child(3) { animation-delay: .25s; }
.mark rect:nth-child(4) { animation-delay: .35s; }
.mark rect:nth-child(5) { animation-delay: .45s; }
.logo:hover .mark rect { animation-name: settle-again; }
@keyframes settle { from { transform: scaleY(0); } }
@keyframes settle-again { from { transform: scaleY(0); } }
.bar nav { display: flex; gap: 22px; margin-left: auto; }
.bar nav a { color: var(--mute); transition: color .2s; }
.bar nav a:hover { color: var(--fg); }
kbd {
  font: inherit; font-size: 10px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 0 4px; margin-right: 6px;
}
.clock { display: flex; align-items: center; gap: 8px; color: var(--mute); font-variant-numeric: tabular-nums; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 8px var(--acc); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.ticker {
  height: 28px; overflow: hidden;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 11px; font-variant-numeric: tabular-nums;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.track { display: flex; width: max-content; white-space: nowrap; animation: marquee 160s linear infinite; }
.ticker:hover .track { animation-play-state: paused; }
.tk { margin-right: 40px; }
.tk b { font-weight: 400; color: var(--dim); margin-right: 8px; }
.tk i { font-style: normal; margin-left: 8px; }
.tk .up { color: var(--acc); }
.tk .dn { color: var(--neg); }
@keyframes marquee { to { transform: translateX(-25%); } }  /* track holds 4 copies */

/* ── hero ────────────────────────────────── */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 600px; overflow: hidden; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner { position: relative; padding-top: clamp(150px, 28vh, 320px); pointer-events: none; }
h1 {
  font-weight: 300;
  font-size: clamp(48px, 12.5vw, 136px);
  line-height: 1;
  letter-spacing: -.045em;
  margin: 0 0 30px -.05em;
  white-space: nowrap;
}
.tag { font-size: clamp(15px, 1.9vw, 19px); }
.sub { margin-top: 6px; color: var(--mute); font-size: 13px; }
.sub span { white-space: nowrap; }

/* ── sections ────────────────────────────── */
.block { padding-top: clamp(88px, 15vh, 150px); scroll-margin-top: var(--head); }
.prose { max-width: 62ch; font-size: 15px; }
.prose p + p { margin-top: 1em; }
.prose em { font-style: normal; color: var(--acc); }
.lead {
  max-width: 26ch; margin-bottom: 28px; text-wrap: balance;
  font-size: clamp(22px, 3vw, 32px); font-weight: 300; line-height: 1.3; letter-spacing: -.02em;
}
.k { font-size: 12px; color: var(--dim); }
.k b { font-weight: 400; color: var(--acc); }

/* the density surface is drawn full-bleed behind the about copy (to its right; below it on phones) */
.about { position: relative; min-height: 820px; display: flex; align-items: center; padding-bottom: 88px; }
.about-text { position: relative; z-index: 1; width: 100%; }
#surface { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }

/* scroll-driven: the panel pins while the section scrolls past */
.process { position: relative; height: 320vh; margin-top: clamp(88px, 15vh, 150px); }
.pin {
  position: sticky; top: var(--head);
  height: calc(100vh - var(--head)); height: calc(100svh - var(--head));
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: center;
}
.stages { display: grid; gap: 30px; }
.stage { opacity: .3; transition: opacity .4s; }
.stage.on { opacity: 1; }
.stage h3 { margin: 6px 0 6px; font-size: 18px; font-weight: 500; }
.stage p:last-child { max-width: 44ch; color: var(--mute); font-size: 13px; }
.morph { position: relative; height: min(56vh, 440px); }
.morph canvas { display: block; width: 100%; height: 100%; }
.rail { position: absolute; top: 0; bottom: 0; right: -18px; width: 1px; background: var(--line); }
.rail i { position: absolute; left: -1px; top: 0; width: 3px; height: 32px; background: var(--acc); }

.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pillars article { padding: 26px 24px 28px; }
.pillars h3 { margin: 12px 0 10px; font-size: 16px; font-weight: 500; }
.pillars p:last-child { color: var(--mute); font-size: 13px; }

.rules { list-style: none; max-width: 72ch; border-top: 1px solid var(--line); }
.rules li { display: grid; grid-template-columns: 56px 1fr; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rules li > span { color: var(--dim); }
.rules p { margin-top: 4px; color: var(--mute); font-size: 13px; }

.roles { list-style: none; max-width: 80ch; margin-top: 36px; border-top: 1px solid var(--line); }
.roles li { display: grid; grid-template-columns: 27ch 1fr; gap: 0 2ch; padding: 14px 0; border-bottom: 1px solid var(--line); }
.roles .r::before { content: '→ '; color: var(--acc); }
.roles .d { color: var(--mute); font-size: 13px; }
.note { margin-top: 28px; max-width: 62ch; color: var(--mute); }

.kv div { display: grid; grid-template-columns: 10ch 1fr; padding: 3px 0; font-size: 15px; }
.kv dt { color: var(--dim); }

.kv a, .note a, .term a, footer a { color: var(--acc); border-bottom: 1px solid rgba(124, 255, 178, .3); transition: border-color .2s; }
.kv a:hover, .note a:hover, .term a:hover, footer a:hover { border-color: var(--acc); }
.term {
  margin-top: 36px; height: 260px; overflow-y: auto;
  padding: 18px 20px;
  font-size: 13px; cursor: text;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.term p { white-space: pre-wrap; word-break: break-word; }
.prompt { display: flex; gap: 1ch; }
.prompt input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  color: var(--fg); font: inherit; caret-color: var(--acc);
}

footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-top: 140px; padding-bottom: 40px;
  font-size: 11px; color: var(--dim);
}
#uptime { font-variant-numeric: tabular-nums; }

/* ── entrance states (only when JS runs) ─── */
.js #word { visibility: hidden; }
.js #word.on { visibility: visible; }
.js .tag, .js .sub { opacity: 0; transform: translateY(6px); transition: opacity .7s, transform .7s; }
.hero.done .tag, .hero.done .sub { opacity: 1; transform: none; }
.hero.done .sub { transition-delay: .15s; }
.js .block { opacity: 0; transform: translateY(14px); transition: opacity .9s, transform .9s; }
.js .block.seen { opacity: 1; transform: none; }
.js .stagger > * { opacity: 0; transition: opacity .4s calc(var(--i, 0) * 90ms + .2s); }
.js .seen .stagger > * { opacity: 1; }

/* ── small screens ───────────────────────── */
@media (max-width: 860px) {
  .about { display: block; min-height: 0; padding-bottom: 420px; }
  .pin { grid-template-columns: 1fr; align-content: center; gap: 20px; }
  .morph { order: -1; height: 32vh; }
  .stages { gap: 14px; }
  .stage h3 { font-size: 15px; margin: 2px 0; }
  .stage p:last-child { font-size: 12px; }
  .rail { display: none; }
}
@media (max-width: 720px) {
  kbd { display: none; }
  .bar { gap: 12px; }
  .bar nav { gap: 12px; }
  .mark { width: 18px; height: 18px; }
  .logo { gap: 6px; }
  .pillars { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .clock { display: none; }
  .roles li { grid-template-columns: 1fr; gap: 4px; }
  .rules li { grid-template-columns: 40px 1fr; }
  .term { padding: 14px; font-size: 12px; }
}
@media (max-width: 380px) {
  .bar { font-size: 11px; }
  .bar nav { gap: 10px; }
}
@media (pointer: coarse) { .prompt input { font-size: 16px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── 404 ─────────────────────────────────── */
.nf { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.nf h1 { margin-top: 18px; }
.nf .tag a { color: var(--acc); }
.nf .tag a:hover { text-decoration: underline; }
