:root {
  --bg: #0A0A0A;
  --surface: #121212;
  --ink: #F2F2EE;
  --muted: #9B9B95;
  --accent: #C8FF4D;
  --accent-soft: rgba(200, 255, 77, .10);
  --line: rgba(255, 255, 255, .09);

  --font-sans: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px; --s8: 128px;
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px;
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .04) inset;
  --shadow-md: 0 24px 60px -20px rgba(0, 0, 0, .8);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 180ms;
  --t-slow: 700ms;
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* faint dot grid that fades out toward the bottom */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
}
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s3); }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s2);
}
.eyebrow .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 10px; vertical-align: 1px; box-shadow: 0 0 12px var(--accent); }
.accent { color: var(--accent); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s2); top: var(--s2); background: var(--accent); color: var(--bg); padding: var(--s1) var(--s2); border-radius: var(--r-sm); z-index: 100; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(10, 10, 10, .72);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--font-mono); font-weight: 600; font-size: 15px; text-decoration: none; letter-spacing: -.01em; }
.logo .caret { display: inline-block; width: 8px; height: 16px; background: var(--accent); margin-left: 3px; vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav ul { list-style: none; display: flex; gap: var(--s1); margin: 0; padding: 0; }
.nav a.link {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s2);
  text-decoration: none; font-size: 14px; color: var(--muted);
  transition: color var(--t-fast) var(--ease);
}
.nav a.link::after {
  content: ""; position: absolute; left: var(--s2); right: var(--s2); bottom: 10px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 300ms var(--ease);
}
.nav a.link:hover, .nav a.link[aria-current="page"] { color: var(--ink); }
.nav a.link:hover::after, .nav a.link[aria-current="page"]::after { transform: scaleX(1); }

/* ---------- hero ---------- */
.hero { padding: var(--s8) 0 var(--s7); }
.hero h1 {
  font-size: clamp(48px, 9vw, 128px);
  line-height: .95;
  letter-spacing: -.045em;
  font-weight: 600;
  margin: 0 0 var(--s4);
  max-width: 12ch;
}
.hero .lede { font-size: clamp(18px, 2vw, 22px); color: var(--muted); max-width: 46ch; margin: 0; }
.hero .lede strong { color: var(--ink); font-weight: 500; }

/* ---------- sections ---------- */
section { padding: var(--s7) 0; }
.rule { border-top: 1px solid var(--line); }
h2 { font-size: clamp(30px, 4vw, 48px); letter-spacing: -.035em; line-height: 1.05; font-weight: 600; margin: 0 0 var(--s3); }
h3 { font-size: 20px; letter-spacing: -.02em; margin: 0 0 var(--s1); font-weight: 600; }
p { margin: 0 0 var(--s2); }
.muted { color: var(--muted); }
.prose { max-width: 62ch; }
.prose p { color: var(--muted); }
.prose p strong { color: var(--ink); font-weight: 500; }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s6); align-items: start; }

/* terminal card */
.term {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14px;
}
.term-bar { display: flex; gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.term-body { padding: var(--s3); line-height: 1.9; }
.term-body .k { color: var(--muted); display: inline-block; min-width: 9ch; }
.term-body .prompt { color: var(--accent); }
.term-body .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* featured link band */
.feature {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s4); align-items: end;
  padding: var(--s6); border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft), transparent 55%), var(--surface);
  text-decoration: none; position: relative; overflow: hidden;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.feature:hover { border-color: rgba(200, 255, 77, .45); transform: translateY(-2px); }
.feature .big {
  font-family: var(--font-mono); font-size: clamp(36px, 7vw, 88px); font-weight: 500;
  letter-spacing: -.04em; line-height: 1; color: var(--accent); margin: 0 0 var(--s2);
}
.feature .arrow {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.feature:hover .arrow { background: var(--accent); color: var(--bg); }

.soon { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.chip {
  font-family: var(--font-mono); font-size: 13px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 999px; padding: 6px 14px;
}

/* ---------- numbers page ---------- */
.base-switch {
  display: inline-flex; padding: 4px; gap: 4px; margin-top: var(--s4);
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.base-switch button {
  font: 500 13px var(--font-mono); letter-spacing: .06em; color: var(--muted);
  background: transparent; border: 0; border-radius: 999px; padding: 0 18px; min-height: 44px; cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.base-switch button:hover { color: var(--ink); }
.base-switch button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }

.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.group-head h2 { margin: 0; }
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s4);
  padding: var(--s4) 0; border-bottom: 1px solid var(--line); position: relative;
}
.row::before {
  content: ""; position: absolute; left: 0; top: -1px; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 500ms var(--ease);
}
.row:hover::before { transform: scaleX(1); }
.num {
  font-family: var(--font-mono); font-weight: 500;
  font-size: clamp(24px, 3.6vw, 40px); letter-spacing: -.03em; line-height: 1.15;
  overflow-wrap: anywhere; transition: color var(--t-fast) var(--ease);
}
.row:hover .num { color: var(--accent); }
.num.small { font-size: clamp(16px, 2vw, 20px); letter-spacing: 0; line-height: 1.5; }
.row h3 { margin-bottom: 6px; }
.row p { color: var(--muted); margin: 0; font-size: 16px; }
.row code, .prose code {
  font-family: var(--font-mono); font-size: .88em; color: var(--ink);
  background: rgba(255, 255, 255, .06); padding: 1px 6px; border-radius: 4px;
}
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: 6px; display: block; }

/* 32-bit band */
.band { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bits { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 4px; margin: var(--s5) 0 var(--s2); }
.bit {
  aspect-ratio: 1 / 1.6; border-radius: 4px; display: grid; place-items: center;
  font: 500 clamp(9px, 1.3vw, 15px) var(--font-mono);
  background: rgba(255, 255, 255, .04); color: var(--muted); border: 1px solid var(--line);
  transition: background 300ms var(--ease), color 300ms var(--ease), transform 300ms var(--ease);
}
.bit.on { background: var(--accent); color: var(--bg); border-color: transparent; }
.bit.sign { border-color: rgba(255, 90, 90, .55); }
.bits-legend { display: flex; justify-content: space-between; font: 12px var(--font-mono); color: var(--muted); gap: var(--s2); flex-wrap: wrap; }
.band-readout { font-family: var(--font-mono); font-size: clamp(28px, 6vw, 72px); letter-spacing: -.04em; line-height: 1; margin: 0; }
.band-controls { display: flex; gap: var(--s1); flex-wrap: wrap; margin-top: var(--s3); }
.btn {
  font: 500 13px var(--font-mono); color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 0 18px; min-height: 44px; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }

/* ---------- footer ---------- */
footer { padding: var(--s6) 0 var(--s8); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ---------- reveal animations ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 90ms; }
.reveal[data-delay="2"] { transition-delay: 180ms; }
.reveal[data-delay="3"] { transition-delay: 270ms; }

/* ---------- Flappy Bit widget ---------- */
.fb {
  position: fixed; right: var(--s3); bottom: var(--s3); z-index: 30;
  width: 260px; background: rgba(18, 18, 18, .92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md);
  overflow: hidden; font-family: var(--font-mono);
  transition: width 300ms var(--ease), border-color var(--t-fast) var(--ease);
}
.fb:hover { border-color: rgba(200, 255, 77, .35); }
.fb-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 14px; height: 40px; font-size: 12px; color: var(--muted); }
.fb-head b { color: var(--ink); font-weight: 500; }
.fb-toggle {
  width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--r-sm);
  display: grid; place-items: center; font: 16px var(--font-mono);
}
.fb-toggle:hover { color: var(--accent); background: rgba(255, 255, 255, .05); }
.fb canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; cursor: pointer; border-top: 1px solid var(--line); touch-action: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.fb canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.fb.closed { width: auto; border-radius: 999px; cursor: pointer; }
.fb.closed canvas { display: none; }
.fb.closed .fb-head { gap: 6px; padding: 0 4px 0 16px; height: 44px; }
.fb-head > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb.closed .fb-score { display: none; }
.fb .fb-play { display: none; color: var(--accent); }
.fb.closed .fb-play { display: inline; }

@media (max-width: 860px) {
  .split, .row, .feature { grid-template-columns: 1fr; }
  .row { gap: var(--s2); }
  .feature { padding: var(--s4); }
  .hero { padding: var(--s7) 0 var(--s6); }
  section { padding: var(--s6) 0; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 max(var(--s2), env(safe-area-inset-left)) 0 max(var(--s2), env(safe-area-inset-right)); }
  .hero { padding: var(--s6) 0 var(--s5); }
  .hero h1 { margin-bottom: var(--s3); }
  section { padding: var(--s5) 0; }
  .term { font-size: 13px; }
  .term-body { padding: var(--s2) var(--s3); }
  .row { padding: var(--s3) 0; }
  .group-head { margin-bottom: var(--s3); }
  /* 32 bits become two rows of 16 so each cell is tappable */
  .bits { grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 4px; margin-top: var(--s4); }
  .bit { aspect-ratio: 1 / 1.35; font-size: 12px; border-radius: 3px; }
  .bits-legend { display: none; }
  .band-readout { font-size: clamp(26px, 8.5vw, 40px); }
  .band-controls .btn { flex: 1 1 auto; }
  footer { padding-bottom: calc(var(--s7) + env(safe-area-inset-bottom)); }
  .fb { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: min(320px, calc(100vw - 24px)); }
  .fb.closed { width: auto; }
  .nav a.link { padding: 0 12px; }
  .nav a.link::after { left: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- news page ---------- */
.story { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--s4); padding: var(--s5) 0; border-bottom: 1px solid var(--line); }
.story-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; line-height: 1.8; }
.story-meta .cat { color: var(--accent); display: block; }
.story h3 { font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -.025em; line-height: 1.2; margin-bottom: var(--s2); }
.story p { color: var(--muted); max-width: 64ch; }
.story .src { font: 13px var(--font-mono); color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.story .src:hover { color: var(--accent); border-color: var(--accent); }
.take {
  margin-top: var(--s3); padding: var(--s2) var(--s3); max-width: 64ch;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  font-size: 15px; color: var(--muted);
}
.take b { font: 500 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 4px; }
.take.filled { border-style: solid; border-color: rgba(200, 255, 77, .35); background: var(--accent-soft); color: var(--ink); }
.chip-link { color: var(--ink); text-decoration: none; border-style: solid; transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); min-height: 44px; display: inline-flex; align-items: center; }
.chip-link:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 860px) {
  .story { grid-template-columns: 1fr; gap: var(--s2); padding: var(--s4) 0; }
  .story-meta .cat { display: inline; margin-right: 10px; }
}
