:root {
  --bg: #0b0c0a;
  --bg-2: #121410;
  --line: rgba(236, 235, 228, 0.12);
  --ink: #ecebe4;
  --ink-dim: rgba(236, 235, 228, 0.58);
  --lime: #c6ff3d;
  --ember: #ff6a3d;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(20px, 5vw, 72px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
em { font-style: italic; }
::selection { background: var(--lime); color: var(--bg); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em; }
.dim { color: var(--ink-dim); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px var(--pad);
  background: linear-gradient(to bottom, rgba(11, 12, 10, 0.85), rgba(11, 12, 10, 0));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.nav nav { display: flex; gap: 32px; font-size: 14.5px; color: var(--ink-dim); }
.nav nav a:hover { color: var(--ink); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.logo svg { fill: var(--lime); }
.logo em { font-family: var(--serif); font-weight: 400; font-size: 1.2em; color: var(--lime); margin-left: 3px; }
.logo.small { font-size: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 24px; border-radius: 999px; border: 1px solid var(--lime);
  background: var(--lime); color: #0b0c0a;
  font: 600 15px var(--sans); cursor: pointer; white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 40px -10px rgba(198, 255, 61, 0.6); }
.btn-small { padding: 9px 16px; font-size: 13.5px; }
.btn-ghost { background: transparent; color: var(--lime); }
.btn-ghost:hover { background: var(--lime); color: #0b0c0a; }
.link { font-size: 15px; color: var(--ink-dim); border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px;
  padding: 120px var(--pad) 56px;
  overflow: hidden; cursor: crosshair;
  border-bottom: 1px solid var(--line);
}
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-copy { position: relative; z-index: 2; max-width: 760px; pointer-events: none; }
.hero-copy a { pointer-events: auto; }
.hero-copy::before {
  content: ""; position: absolute; inset: -80px -120px -80px -200px; z-index: -1;
  background: radial-gradient(closest-side, rgba(11, 12, 10, 0.88), rgba(11, 12, 10, 0));
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 12.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim);
  margin-bottom: 28px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(198, 255, 61, 0); opacity: 0.6; } 0%, 100% { box-shadow: 0 0 0 0 rgba(198, 255, 61, 0.5); } }

h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: 0.98; text-wrap: balance; }
h1 { font-size: clamp(54px, 9.2vw, 136px); }
h2 { font-size: clamp(40px, 5.6vw, 80px); }
h1 em, h2 em { color: var(--lime); }
.lede { max-width: 520px; margin: 28px 0 36px; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-dim); }
.cta-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }

.hud {
  position: relative; z-index: 2; width: 280px; cursor: default;
  padding: 20px; border: 1px solid var(--line); border-radius: 18px;
  background: rgba(18, 20, 16, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-family: var(--mono); font-size: 12px;
}
.hud-hint { color: var(--lime); margin-bottom: 16px; line-height: 1.4; }
.hud-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.hud-stats dt { color: var(--ink-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.hud-stats dd { font-size: 20px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hud-slider { display: block; margin: 16px 0; }
.hud-slider span { display: flex; justify-content: space-between; color: var(--ink-dim); margin-bottom: 10px; }
.hud-slider output { color: var(--ink); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--lime); border: 0; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--lime); border: 0; }
.hud-btn {
  width: 100%; padding: 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 106, 61, 0.5); background: transparent; color: var(--ember);
  font: 500 12px var(--mono); transition: background 0.2s, color 0.2s;
}
.hud-btn:hover { background: var(--ember); color: #0b0c0a; }

/* ---------- ticker ---------- */
.ticker { overflow: hidden; border-bottom: 1px solid var(--line); padding: 18px 0; }
.ticker-track { display: flex; gap: 28px; width: max-content; animation: slide 28s linear infinite; font: 400 28px var(--serif); font-style: italic; color: var(--ink-dim); }
.ticker-track i { font-style: normal; color: var(--lime); }
@keyframes slide { to { transform: translateX(-33.333%); } }

/* ---------- sections ---------- */
.section { padding: clamp(80px, 11vw, 160px) var(--pad); border-bottom: 1px solid var(--line); }
.tag { font: 500 12.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--lime); margin-bottom: 22px; }
.sub { max-width: 520px; margin-top: 24px; color: var(--ink-dim); }
.section-head { margin-bottom: clamp(40px, 6vw, 72px); }

/* loop */
.loop-grid { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); align-items: start; }
.steps { list-style: none; counter-reset: s; }
.steps li {
  counter-increment: s; position: relative;
  padding: 18px 0 18px 54px; border-top: 1px solid var(--line);
  opacity: 0.4; transition: opacity 0.35s ease;
}
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before {
  content: "0" counter(s); position: absolute; left: 0; top: 22px;
  font: 500 12px var(--mono); color: var(--ink-dim); transition: color 0.35s;
}
.steps li b { display: block; font: 400 30px/1.1 var(--serif); }
.steps li span { display: block; max-height: 0; overflow: hidden; color: var(--ink-dim); font-size: 15px; transition: max-height 0.4s ease, margin 0.4s ease; }
.steps li.on { opacity: 1; }
.steps li.on::before { color: var(--lime); }
.steps li.on b { color: var(--lime); font-style: italic; }
.steps li.on span { max-height: 80px; margin-top: 6px; }

.stage-wrap { border: 1px solid var(--line); border-radius: 22px; background: var(--bg-2); padding: clamp(16px, 2.4vw, 28px); }
.stage-meta { display: flex; gap: 24px; flex-wrap: wrap; font: 400 12.5px var(--mono); color: var(--ink-dim); margin-bottom: 18px; }
.stage-meta b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.stage {
  position: relative; height: clamp(240px, 34vw, 400px);
  background-image: linear-gradient(to top, var(--line) 1px, transparent 1px);
  background-size: 100% 25%;
}
.bar { position: absolute; left: 0; bottom: 0; height: 100%; display: flex; align-items: flex-end; padding: 0 2px; transition: transform 0.16s ease, opacity 0.3s ease; }
.bar i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--ink); opacity: 0.85; transition: height 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s ease, opacity 0.3s; }
.bar.out i { opacity: 0.28; }
.bar.pivot i { background: var(--lime); opacity: 1; }
.bar.elite i { background: var(--lime); opacity: 1; }
.bar.dead i { background: var(--ember); opacity: 0.5; }
.bar.gone i { height: 0 !important; }
.bar.born i { background: var(--ember); opacity: 1; }
.stage-axis { display: flex; justify-content: space-between; margin-top: 12px; font: 400 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); }

/* why */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.card { padding: 32px 28px 40px; border-right: 1px solid var(--line); transition: background 0.3s ease; }
.card:last-child { border-right: 0; }
.card:hover { background: var(--bg-2); }
.card-n { display: block; font: italic 400 44px/1 var(--serif); color: var(--lime); margin-bottom: 56px; }
.card h3 { font: 600 19px/1.25 var(--sans); letter-spacing: -0.01em; margin-bottom: 12px; }
.card p { color: var(--ink-dim); font-size: 15.5px; }

/* genome */
.genome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: clamp(32px, 6vw, 96px); align-items: center; }
.genome .section-head { margin-bottom: 0; }
.genome .btn { margin-top: 36px; }
.genome-card { border: 1px solid var(--line); border-radius: 22px; background: var(--bg-2); overflow: hidden; font-family: var(--mono); font-size: 13.5px; }
.genome-top, .genome-foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 22px; }
.genome-top { border-bottom: 1px solid var(--line); }
.genome-foot { border-top: 1px solid var(--line); color: var(--ink-dim); min-height: 52px; }
.genes { list-style: none; }
.genes li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 13px 22px; border-left: 2px solid transparent; transition: background 0.5s ease, border-color 0.5s ease; }
.genes li + li { border-top: 1px dashed var(--line); }
.genes .k { color: var(--ink-dim); flex: none; }
.genes .v { text-align: right; }
.genes del { color: var(--ink-dim); margin-right: 10px; }
.genes li.mut { background: rgba(255, 106, 61, 0.1); border-left-color: var(--ember); }
.genes li.mut .v ins { color: var(--ember); text-decoration: none; }

/* join */
.join { text-align: center; display: flex; flex-direction: column; align-items: center; background: radial-gradient(60% 70% at 50% 100%, rgba(198, 255, 61, 0.09), transparent 70%); }
.join h2 { font-size: clamp(52px, 8.5vw, 128px); }
.join .sub { margin-bottom: 40px; }
.join-form { display: flex; gap: 8px; width: min(100%, 520px); padding: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); transition: border-color 0.2s; }
.join-form:focus-within { border-color: var(--lime); }
.join-form input { flex: 1; min-width: 0; padding: 0 18px; background: transparent; border: 0; outline: 0; color: var(--ink); font: 400 16px var(--sans); }
.join-form input::placeholder { color: var(--ink-dim); }
.join-msg { min-height: 20px; margin-top: 18px; color: var(--lime); }
.join-msg.err { color: var(--ember); }

.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 28px var(--pad); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card:nth-child(2) { border-right: 0; }
  .card:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .genome { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .nav nav { display: none; }
  .hero { grid-template-columns: 1fr; align-items: end; padding-top: 100px; }
  .hero-copy::before { inset: -60px -40px; }
  .hud { width: 100%; }
  .hud-hint { display: none; }
  .loop-grid { grid-template-columns: 1fr; }
  .loop-grid .stage-wrap { order: -1; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .card { border-right: 0; border-bottom: 1px solid var(--line); }
  .card:last-child { border-bottom: 0; }
  .card-n { margin-bottom: 28px; }
  .join-form { flex-direction: column; border-radius: 22px; }
  .join-form input { padding: 14px 16px; }
  .genes li { flex-direction: column; gap: 4px; }
  .genes .v { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track, .pulse { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar, .bar i { transition: none; }
}
