:root {
  --bg: #030907;
  --bg-2: #07130f;
  --line: #1a3027;
  --text: #e6fff4;
  --muted: #93b5a6;
  --emerald: #34d399;
  --ice: #7dd3fc;
  --amber: #fcd34d;
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1160px;
  --sans: ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.sr, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { z-index: 30; top: 76px; left: 16px; width: auto; height: auto; clip: auto; padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 500; }
main:focus { outline: none; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--emerald); outline-offset: 4px; border-radius: 999px; }

/* nav */
.nav { position: fixed; inset: 0 0 auto; z-index: 20; border-bottom: 1px solid transparent; transition: background .3s, border-color .3s, backdrop-filter .3s; }
.nav::before { content: ""; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none; background: linear-gradient(rgb(3 9 7 / .9), transparent); transition: opacity .3s; }
.nav.solid { background: rgb(3 9 7 / .8); border-color: var(--line); backdrop-filter: blur(14px); }
.nav.solid::before { opacity: 0; }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; font-size: 18px; }
.brand svg { width: 32px; height: 32px; }
.links { display: flex; align-items: center; gap: 28px; font-size: 15px; color: #c5e3d6; }
.links a:hover { color: #fff; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px;
  font: 500 15px var(--sans); color: var(--bg); background: var(--text); border: 1px solid var(--text);
  transition: transform .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); background: #fff; }

/* hero */
.hero {
  position: relative; min-height: 100svh; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 84px var(--gutter) 32px;
}
#field { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 200px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }
.stage { position: relative; width: clamp(130px, min(22vw, 26vh), 224px); aspect-ratio: 1; margin-bottom: clamp(20px, 4vh, 40px); z-index: 1; }
.sweep {
  position: absolute; inset: -34%; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 56%, rgb(52 211 153 / .22) 95%, transparent 100%);
  -webkit-mask: radial-gradient(circle, #000 0 50%, transparent 70%);
  mask: radial-gradient(circle, #000 0 50%, transparent 70%);
  animation: spin 7s linear infinite;
}
.rings { position: absolute; inset: -50%; width: 200%; height: 200%; overflow: visible; pointer-events: none; }
.rings polygon { fill: none; stroke: var(--emerald); stroke-width: .35; opacity: .5; }
.rings .r2 { stroke-dasharray: 1.4 2.2; opacity: .32; transform-origin: 0 0; animation: spin 80s linear infinite reverse; }
.stage > svg.avatar { position: relative; width: 100%; height: 100%; overflow: visible; }
.eye { transform-box: fill-box; transform-origin: center; }
.hero .eye { animation: wake 1.3s .5s cubic-bezier(.2, .8, .2, 1) both; }
.blink { transform-box: fill-box; transform-origin: center; animation: blink 6s 3s infinite; }
.pupil { transition: transform .12s linear; }
.copy { position: relative; z-index: 1; }
.copy::before {
  content: ""; position: absolute; z-index: -1; inset: -56px -14vw -48px;
  background: radial-gradient(ellipse at center, rgb(3 9 7 / .94) 38%, transparent 74%);
}
h1 { font: 600 clamp(30px, min(8.6vw, 9.5vh), 86px)/1.02 var(--sans); letter-spacing: -.04em; }
h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--emerald), var(--ice) 55%, var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { max-width: 520px; margin: clamp(14px, 2.4vh, 24px) auto 0; font-size: clamp(18px, 2vw, 21px); color: #b6d6c8; text-wrap: balance; }
.cta { margin-top: clamp(20px, 3.6vh, 34px); }

/* sections */
section { position: relative; padding: clamp(56px, 6.5vw, 88px) 0; }
h2 { font: 600 clamp(32px, 5vw, 58px)/1.05 var(--sans); letter-spacing: -.035em; max-width: 20ch; text-wrap: balance; }

/* how it works */
.split { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(36px, 6vw, 88px); align-items: center; }
.steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 22px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); font: 500 14px ui-monospace, "SF Mono", Menlo, monospace; color: var(--emerald); }
.steps b { display: block; font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.steps span { color: var(--muted); font-size: 16px; }
.tree { position: relative; border: 1px solid var(--line); border-radius: 28px; background: var(--bg-2); overflow: hidden; }
.tree::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 0, rgb(52 211 153 / .14), transparent 55%); }
.tree svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.tree .lines path { fill: none; stroke: #2f5545; stroke-width: .4; stroke-linecap: round; }
.node { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); }
.node svg { width: 100%; height: 100%; overflow: visible; }
.js .tree .lines path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1s var(--d, 0s) ease-out; }
.js .tree.in .lines path { stroke-dashoffset: 0; }
.js .node { transform: translate(-50%, -50%) scale(.2); opacity: 0; transition: transform .7s var(--d, 0s) cubic-bezier(.2, 1.3, .3, 1), opacity .5s var(--d, 0s); }
.js .tree.in .node { transform: translate(-50%, -50%) scale(1); opacity: 1; }

/* castes */
.castes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 52px; }
.caste { padding: 20px 18px 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--bg-2); transition: border-color .3s; }
.caste:hover { border-color: var(--c); }
.caste svg { width: 88px; height: 88px; margin: 0 0 2px; overflow: visible; }
.caste h3 { font: 600 19px var(--sans); letter-spacing: -.01em; }
.caste p { margin-top: 8px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }

/* dial */
.dial-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 72px); margin-top: 48px; align-items: center; }
.swarm { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.slot { aspect-ratio: 1; display: grid; place-items: center; }
.slot > svg { grid-area: 1 / 1; width: 86%; transition: opacity .4s, transform .5s cubic-bezier(.2, 1.4, .3, 1); }
.slot .ghost { opacity: 1; transform: none; }
.ghost polygon { fill: none; stroke: #16372b; stroke-width: 2; stroke-linejoin: round; }
.js .slot:not(.on) > svg:not(.ghost) { opacity: 0; transform: scale(.4); }
.js .slot.on > svg:not(.ghost) { opacity: 1; transform: scale(1); }
html:not(.js) .readout { display: none; }
html:not(.js) .dial-grid { grid-template-columns: 1fr; }
html:not(.js) .swarm { max-width: 560px; margin-inline: auto; }
.readout h3 { font: 600 clamp(32px, 4.2vw, 48px)/1.1 var(--sans); letter-spacing: -.03em; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 28px 0 12px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--amber), var(--ice), var(--emerald)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--amber), var(--ice), var(--emerald)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #000; border: 5px solid var(--text); box-shadow: 0 0 0 6px rgb(230 255 244 / .12); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #000; border: 5px solid var(--text); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--emerald); }
input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--emerald); }

/* closing */
.closing { text-align: center; padding-bottom: clamp(80px, 12vw, 150px); overflow: hidden; }
.closing h2 { margin-inline: auto; max-width: 14ch; font-size: clamp(40px, 7vw, 88px); }
.closing p { margin-top: 18px; color: var(--muted); font-size: 18px; }
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }

/* reveal (only when JS is on, so the page is complete without it) */
.js .rv { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--d, 0s), transform .8s var(--d, 0s) cubic-bezier(.2, .8, .2, 1); }
.js .rv.in { opacity: 1; transform: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wake { from { transform: scaleY(.04); opacity: .4; } to { transform: scaleY(1); opacity: 1; } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }

@media (max-width: 980px) {
  .split, .dial-grid { grid-template-columns: 1fr; }
  .dial-grid .readout { order: -1; }
  .castes { grid-template-columns: repeat(2, 1fr); }
  .castes .caste:last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .links { gap: 8px; }
  .links a { padding: 12px 6px; }
  .castes { grid-template-columns: 1fr; gap: 10px; }
  .caste { display: grid; grid-template-columns: 64px 1fr; column-gap: 14px; align-items: center; padding: 14px 16px; }
  .caste svg { grid-row: 1 / 3; width: 64px; height: 64px; margin: 0; }
  .caste p { margin-top: 4px; }
  .swarm { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #field, .sweep { display: none; }
  .js .rv { opacity: 1; transform: none; }
  .js .node { opacity: 1; transform: translate(-50%, -50%); }
  .js .tree .lines path { stroke-dashoffset: 0; }
  .js .slot.on > svg:not(.ghost) { opacity: 1; transform: none; }
}
