/* Greyscale everywhere. The only colour on the page lives inside the 3D avatar. */
:root {
  --bg: #0a0a0a;
  --bg-2: #121212;
  --line: #222;
  --line-2: #3a3a3a;
  --fg: #ededed;      /* 16.6:1 */
  --fg-2: #b8b8b8;    /* body, 9.6:1 */
  --mute: #8a8a8a;    /* labels, 5.6:1 */

  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --display: "Doto", var(--mono);
  --pad: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.65 var(--mono);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 90;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,.014) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.45) 100%);
}
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
code { font-family: var(--mono); color: var(--fg); background: #1a1a1a; padding: 1px 6px; font-size: .92em; }
main { overflow-x: clip; } /* full-bleed backdrop + glow pool must never cause sideways scroll */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--pad); }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px var(--pad);
  font-size: 13px;
  background: linear-gradient(var(--bg) 20%, rgba(10,10,10,0));
}
.nav a { text-decoration: none; color: var(--mute); padding: 12px 2px; transition: color .2s; }
.nav a:hover, .nav-brand { color: var(--fg); }
.nav nav { display: flex; gap: 24px; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  max-width: 1400px; margin: 0 auto;
  padding: 72px var(--pad) 48px;
  gap: 24px;
}
.stage {
  grid-column: 2; grid-row: 1;
  position: relative;
  height: min(84svh, 860px);
  cursor: grab;
  touch-action: pan-y;
}
.stage:active { cursor: grabbing; }
.stage canvas {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 1px rgba(255,255,255,.35)) drop-shadow(0 0 28px rgba(255,255,255,.10));
}
.stage-hint {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  font: 500 11px var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--mute); white-space: nowrap; pointer-events: none;
}

.intro { grid-column: 1; grid-row: 1; position: relative; z-index: 1; max-width: 30rem; }
/* text arrives while the icon is still "loading" */
/* a soft dark pool so the hex dump never fights the copy */
.intro::before {
  content: ""; position: absolute; z-index: -1; inset: -90px -120px;
  background: radial-gradient(closest-side, rgba(10,10,10,.94) 55%, rgba(10,10,10,0));
  pointer-events: none;
}
.intro > * { animation: rise .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms + 250ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } }

/* ---------- hero backdrop: hex dump + dithered glow ---------- */
.hero { isolation: isolate; }
.bg {
  position: absolute; z-index: -1;
  inset: 0 calc((100vw - 100%) / -2);
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
          mask-image: linear-gradient(#000 70%, transparent);
}
.bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bg-glow { image-rendering: pixelated; }
.probe {
  position: absolute; z-index: 2; left: 0; top: 0;
  font: 500 10px var(--mono); letter-spacing: .1em; color: var(--mute);
  pointer-events: none; white-space: nowrap;
  opacity: 0; transition: opacity .2s;
}
.probe::before { content: ""; position: absolute; left: -14px; top: 4px; width: 9px; height: 1px; background: var(--mute); }
.hero.probing .probe { opacity: 1; }
@media (pointer: coarse) { .probe { display: none; } }
.name {
  margin: 0 0 12px -.04em;
  font: 900 clamp(76px, 10vw, 156px)/.82 var(--display);
  letter-spacing: -.02em;
  text-shadow: 0 0 2px rgba(255,255,255,.55), 0 0 22px rgba(255,255,255,.22), 0 0 60px rgba(255,255,255,.08);
  animation: rise .8s var(--ease) calc(var(--i, 0) * 110ms + 250ms) both, flicker 7s steps(1) 3s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: .82; } 42% { opacity: 1; }
  43.5% { opacity: .6; } 44% { opacity: 1; }
  78% { opacity: .9; } 78.6% { opacity: 1; }
}
.role { margin: 0 0 26px; color: var(--fg-2); font-size: 14px; letter-spacing: .02em; }
.bio { margin: 0 0 32px; color: var(--fg-2); max-width: 44ch; text-wrap: pretty; }

.ctas { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line-2);
  text-decoration: none; font-size: 14px; font-weight: 500;
  overflow: hidden;
  transition: color .2s, border-color .2s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--fg);
  transform: scaleX(0); transform-origin: left;
  transition: transform .26s steps(6);
}
.btn:hover { color: var(--bg); border-color: var(--fg); }
.btn:hover::before { transform: scaleX(1); }
.btn-solid { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn-solid::before { background: #fff; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; align-items: start; padding-top: 56px; gap: 0; }
  .stage { grid-column: 1; grid-row: 1; height: min(100vw, 520px); margin: 0 calc(var(--pad) * -1); }
  .intro { grid-row: 2; }
  .stage-hint { bottom: 2%; }
}

/* ---------- story ---------- */
.story, .stack { padding-block: clamp(56px, 9vw, 110px) 0; max-width: 860px; }
.h2 {
  font: 800 clamp(26px, 3.4vw, 40px)/1 var(--display);
  margin: 0 0 26px;
  color: var(--fg);
}
.chapters { list-style: none; margin: 0; padding: 0; }
.chapters li {
  display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 28px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.chapters .when {
  font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--mute); padding-top: 6px;
}
.chapters p { margin: 0; color: var(--fg-2); max-width: 64ch; text-wrap: pretty; }
.chapters b { color: var(--fg); font-weight: 600; }
.chapters .now .when { color: var(--fg); }
.chapters .now .when::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; background: var(--fg); vertical-align: 1px; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chapters a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--line-2);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .2s, background .2s;
}
.chapters a:hover { text-decoration-color: var(--fg); text-decoration-style: solid; }
.chapters a.tw::after { content: "↗"; font-size: .75em; margin-left: 2px; color: var(--mute); }
@media (max-width: 640px) { .chapters li { grid-template-columns: 1fr; } }

.follow {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  margin-top: 8px; padding: 22px 0 0;
  border-top: 1px solid var(--line);
}
.follow p { margin: 0; color: var(--mute); font-size: 14px; }

/* tweet preview */
.tweet-card {
  position: absolute; left: 0; top: 0; z-index: 80;
  width: 340px; padding: 14px 16px;
  background: #101010; border: 1px solid var(--line-2);
  box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.4);
  font-size: 13px; line-height: 1.55; color: var(--fg-2);
  pointer-events: none;
  opacity: 0; translate: 0 6px; transition: opacity .16s, translate .2s var(--ease);
}
.tweet-card.on { opacity: 1; translate: 0 0; }
.tc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tc-head img { image-rendering: pixelated; border: 1px solid var(--line-2); }
.tc-head span { display: flex; flex-direction: column; line-height: 1.25; }
.tc-head b { color: var(--fg); font-weight: 600; }
.tc-head i { font-style: normal; color: var(--mute); font-size: 12px; }
.tc-head .tc-x { margin-left: auto; color: var(--fg); font-size: 15px; }
.tweet-card p { margin: 0 0 12px; }
.tc-foot { display: flex; justify-content: space-between; color: var(--mute); font-size: 12px; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- stack ---------- */
.stack { position: relative; }
.decompose { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.tiles li { cursor: pointer; outline: none; }
.tiles li:focus-visible .tile-name { color: var(--fg); text-decoration: underline; }
.tile svg { transition: opacity .12s; }
.tiles li.decomposed .tile svg { opacity: 0; }
.tiles li.decomposed .tile-name { color: var(--fg); }
.decode {
  position: relative; margin: 14px 0 0; height: 30px;
  border-left: 1px solid var(--line-2);
}
.decode::before {
  content: "›"; position: absolute; left: 8px; top: 50%; transform: translateY(-52%);
  color: var(--mute); font-size: 13px;
}
.stack-note { margin: 0 0 26px; color: var(--fg-2); max-width: 56ch; }
.stack-note.small { margin: 34px 0 18px; color: var(--mute); font-size: 13px; }
.tiles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px 22px; }
.tiles li { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 84px; }
.tile { display: block; width: 64px; height: 64px; transition: transform .25s steps(4); }
.tile svg { width: 100%; height: 100%; display: block; image-rendering: pixelated; filter: drop-shadow(4px 4px 0 rgba(0,0,0,.65)); }
.tile-name { font-size: 12px; color: var(--mute); text-align: center; }
.tiles.in li { animation: pop .5s steps(5) both; animation-delay: calc(var(--i) * 80ms); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.6); } }
.forgot .tile { width: 40px; height: 40px; opacity: .8; }
.forgot li { width: 64px; }
.forgot .tile-name { font-size: 11px; text-decoration: line-through; text-decoration-color: var(--line-2); }

[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }

/* ---------- footer ---------- */
.foot { padding: clamp(72px, 12vw, 140px) var(--pad) 32px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
#sign { width: min(100%, 980px); display: block; }
.fine { margin: 0; font-size: 12px; color: var(--mute); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
