:root {
  --bg: #09070f;
  --fg: #f6f3fb;
  --fg-2: #b7b0c6;
  --fg-3: #7d768c;
  --line: rgba(246, 243, 251, 0.12);
  --red: #ff3358;
  --blue: #3b6dff;
  --purple: #b14bff;
  --grad: linear-gradient(105deg, var(--red) 0%, var(--purple) 48%, var(--blue) 100%);
  --sans: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1180px;
  --gut: clamp(1.1rem, 4vw, 2.4rem);
  --nav: 68px;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--nav) + 12px); }

body {
  margin: 0;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(255, 51, 88, 0.18), transparent 55%),
    radial-gradient(820px 460px at 100% 0%, rgba(59, 109, 255, 0.18), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
::selection { background: var(--purple); color: #09070f; }

.wrap {
  width: min(var(--max), 100%);
  margin-inline: auto;
  padding-inline: var(--gut);
}

.lbl {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  background: var(--fg);
  color: var(--bg);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus { top: 0.6rem; }

#bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 40;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--grad);
  pointer-events: none;
}

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--nav);
  display: flex;
  align-items: center;
}
.nav.solid {
  background: rgba(9, 7, 15, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; gap: 1rem; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brand i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grad);
}
.pill {
  margin-left: auto;
  display: flex;
  gap: 0.15rem;
  padding: 0.28rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 7, 15, 0.4);
  max-width: min(70vw, 520px);
  overflow-x: auto;
  scrollbar-width: none;
}
.pill::-webkit-scrollbar { display: none; }
.pill a {
  text-decoration: none;
  color: var(--fg-2);
  font-size: 0.88rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pill a:hover,
.pill a[aria-current="true"] {
  color: var(--fg);
  background: rgba(246, 243, 251, 0.08);
}

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(1.6rem, 5vh, 3rem);
}
#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: min(var(--max), 100%);
  margin-inline: auto;
  padding-inline: var(--gut);
}
.hero-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem 1.4rem;
  flex-wrap: wrap;
}
h1 {
  margin: 0.45rem 0 0.2rem;
  font-size: clamp(3.3rem, 11vw, 8.2rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.88;
}
.last {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.handle { margin: 0.2rem 0 1rem; }
.scrollcue { text-decoration: none; }
.scrollcue:hover { color: var(--fg); }

.statement { min-height: 190vh; }
.statement-pin {
  position: sticky;
  top: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
}
.stmt {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 4.15rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.16;
}
.w { color: rgba(246, 243, 251, 0.22); transition: color 0.35s ease; }
.w.on { color: var(--fg); }
.w.hi.on {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stmt-foot {
  margin-top: 1.4rem;
  max-width: 40rem;
  color: var(--fg-2);
  opacity: 0;
}
.stmt-foot p { margin: 0.35rem 0; }
.sign {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--fg);
}

.sec-head { padding-top: clamp(4rem, 10vh, 6.5rem); }
.sec-title {
  margin: 0.35rem 0 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
  font-weight: 600;
}
.sec-title em,
.fork-head em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chapter {
  padding-block: clamp(3.2rem, 8vh, 5.5rem);
  border-top: 1px solid var(--line);
}
.chapter-grid {
  display: grid;
  gap: 1.1rem 2rem;
  align-items: start;
}
.chapter-copy { min-width: 0; }
.plate,
.stage,
.viewer {
  border: 1px solid transparent;
  background:
    linear-gradient(#09070f, #09070f) padding-box,
    linear-gradient(135deg, rgba(255, 51, 88, 0.7), rgba(177, 75, 255, 0.45), rgba(59, 109, 255, 0.75)) border-box;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.plate {
  margin: 0;
  border-radius: 22px;
  overflow: hidden;
}
.plate svg { width: 100%; height: auto; }
.stage {
  position: relative;
  margin: 0;
  border-radius: 22px;
  overflow: hidden;
  min-width: 0;
}
.stage canvas {
  width: 100%;
  height: min(48vh, 440px);
  display: block;
  touch-action: none;
  cursor: grab;
  background: #09070f;
}
.stage canvas:active { cursor: grabbing; }
.stage-tools {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: flex;
  gap: 0.35rem;
}
.stage-tools button,
.chip {
  font-family: var(--mono);
  color: var(--fg);
  background: rgba(9, 7, 15, 0.72);
  border: 1px solid var(--line);
  cursor: pointer;
}
.stage-tools button {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.15rem;
  line-height: 1;
}
.stage-status {
  position: absolute;
  left: 0.9rem;
  top: 0.9rem;
  margin: 0;
}
.stage.is-ready .stage-status { display: none; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem;
  background: #09070f;
}
.chip {
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--fg-2);
}
.chip.on {
  color: #09070f;
  border-color: transparent;
  background: var(--grad);
  font-weight: 600;
}
.reel { margin-top: 1.5rem; }
.reel-mask {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.reel-mask::-webkit-scrollbar { display: none; }
.reel-track {
  display: flex;
  gap: 0.85rem;
  width: max-content;
}
.reel-loop .reel-track { animation: reel 46s linear infinite; }
.reel-loop .reel-mask { overflow: hidden; }
.reel-mask:hover .reel-track,
.reel-mask:focus-within .reel-track { animation-play-state: paused; }
.reel a { display: block; flex: none; }
.reel img {
  width: min(46vw, 250px);
  height: 320px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #100e16;
}
@keyframes reel { to { transform: translateX(-50%); } }
.orbit {
  transform-box: fill-box;
  transform-origin: center;
  animation: orbit 18s linear infinite;
}
.orbit-dot { animation: orbit 18s linear infinite; transform-origin: 160px 112px; }
.scan { animation: scan 4.2s ease-in-out infinite; }
.drop { animation: fuel 2.8s linear infinite; }
.drop.d2 { animation-delay: 0.8s; }
.drop.d3 { animation-delay: 1.5s; }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes scan {
  0%, 100% { transform: translateY(0); opacity: 0.2; }
  50% { transform: translateY(150px); opacity: 0.9; }
}
@keyframes fuel {
  0% { transform: translateY(0); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translateY(52px); opacity: 0; }
}
@media (min-width: 900px) {
  .chapter-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 440px); }
  .plate, .stage { position: sticky; top: calc(var(--nav) + 16px); }
}
@media (max-width: 899px) {
  .plate, .stage { order: -1; }
  .reel img { width: min(68vw, 240px); height: 280px; }
}
.chapter h2 {
  margin: 0.4rem 0 0.7rem;
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
  font-weight: 600;
}
.summary {
  margin: 0;
  max-width: 42rem;
  font-size: clamp(1.12rem, 2vw, 1.32rem);
  color: var(--fg);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.7rem;
  margin-top: 1.35rem;
  max-width: 44rem;
  align-items: start;
}
.stat {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0.95rem 0.9rem 0.85rem;
  border-radius: 18px;
  border: 1px solid transparent;
  background:
    linear-gradient(165deg, rgba(28, 22, 40, 0.96), rgba(9, 7, 15, 0.94)) padding-box,
    linear-gradient(135deg, rgba(255, 51, 88, 0.75), rgba(177, 75, 255, 0.4), rgba(59, 109, 255, 0.7)) border-box;
  box-shadow: inset 0 1px 0 rgba(246, 243, 251, 0.06);
}
.stat::before {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -48px;
  top: -58px;
  background: radial-gradient(circle, rgba(177, 75, 255, 0.28), transparent 68%);
  pointer-events: none;
}
.gauge {
  position: relative;
  width: 96px;
  height: 96px;
}
.stat-svg { width: 96px; height: 96px; filter: drop-shadow(0 0 8px rgba(177, 75, 255, 0.35)); }
.gauge .stat-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin: 0;
  gap: 0.15rem;
}
.stat-value {
  margin: 0.15rem 0 0;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-value span {
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.stat .lbl {
  position: relative;
  margin: 0.55rem 0 0;
  color: var(--fg-2);
}
.stat-dots { display: flex; flex-wrap: wrap; gap: 0.38rem; min-height: 1.2rem; position: relative; }
.stat-dots i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(177, 75, 255, 0.55);
  transform: scale(0);
  animation: stat-pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.stat-dots.ticks { align-items: flex-end; height: 28px; }
.stat-dots.ticks i {
  width: 6px;
  height: 22px;
  border-radius: 3px;
  box-shadow: none;
}
.stat-marks { display: flex; flex-wrap: wrap; gap: 0.35rem; position: relative; }
.stat-marks span {
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background:
    linear-gradient(#14121c, #14121c) padding-box,
    linear-gradient(105deg, rgba(255, 51, 88, 0.7), rgba(177, 75, 255, 0.55), rgba(59, 109, 255, 0.7)) border-box;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.stat-arc {
  stroke-dasharray: var(--circ);
  stroke-dashoffset: var(--circ);
  animation: stat-draw 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes stat-draw { to { stroke-dashoffset: var(--rest); } }
@keyframes stat-pop { to { transform: scale(1); } }
.list-label { margin: 1.4rem 0 0; }
.chapter ul {
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  max-width: 42rem;
}
.chapter li {
  position: relative;
  margin: 0.5rem 0;
  padding-left: 1rem;
  color: var(--fg-2);
}
.chapter li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grad);
}
.links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }
.links a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
}
.links a.primary {
  background: var(--grad);
  color: #09070f;
  border-color: transparent;
  font-weight: 600;
}
.links a:hover { border-color: rgba(177, 75, 255, 0.55); }

.viewer {
  margin-top: 1.5rem;
  height: min(72vh, 720px);
  border-radius: 22px;
  overflow: hidden;
}
.viewer iframe { width: 100%; height: 100%; border: 0; }
.frame-note { margin: 0.7rem 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
  padding-bottom: clamp(2rem, 6vh, 4rem);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 100%;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.05rem 1.1rem 1.15rem;
  background: linear-gradient(180deg, rgba(246, 243, 251, 0.035), transparent);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
a.card:hover {
  border-color: rgba(177, 75, 255, 0.5);
  transform: translateY(-2px);
}
.card h3 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.card p { margin: 0; color: var(--fg-2); font-size: 0.96rem; }
.go {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.fork { opacity: 0.82; }
.fork-head {
  margin: 0.4rem 0 0.3rem;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}
.fork-lead { margin: 0 0 1rem; color: var(--fg-2); }

#github .sec-head,
#bench .sec-head { padding-bottom: 1.2rem; }

.mq { overflow: hidden; margin-top: 1.6rem; }
.mq-track {
  display: flex;
  gap: 0.75rem;
  width: max-content;
  animation: ticker 48s linear infinite;
  padding-bottom: 0.4rem;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  white-space: nowrap;
  color: var(--fg-2);
}
.chip b {
  color: var(--fg);
  font-weight: 600;
  margin-right: 0.4rem;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

#bench .grid { padding-top: 0.2rem; }
.bench-card h3 { font-size: 1.15rem; }

.outro {
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
}
.outro::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 50%;
  background:
    radial-gradient(420px 220px at 18% 80%, rgba(255, 51, 88, 0.2), transparent 70%),
    radial-gradient(420px 220px at 82% 70%, rgba(59, 109, 255, 0.2), transparent 70%);
  pointer-events: none;
}
.outro-tx { position: relative; z-index: 1; padding-block: 4rem; }
.outro h2 {
  margin: 0.6rem 0 0.4rem;
  max-width: 14ch;
  font-size: clamp(2.8rem, 7vw, 6rem);
  letter-spacing: -0.05em;
  line-height: 0.95;
  font-weight: 600;
}
.email { margin: 1rem 0 0; }
.email a { color: var(--fg-2); }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  padding-block: 1.3rem 1.6rem;
  border-top: 1px solid var(--line);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 0.9rem 1.1rem; }
.foot a { color: var(--fg-2); text-decoration: none; }
.foot a:hover { color: var(--fg); }

.noscript { padding: 2rem 0 3rem; }

@media (max-width: 720px) {
  :root { --nav: 112px; }
  .nav { height: auto; }
  .nav-in {
    flex-wrap: wrap;
    row-gap: 0.45rem;
    padding-block: 0.65rem;
  }
  .pill {
    margin-left: 0;
    max-width: 100%;
    width: 100%;
  }
  .pill a {
    flex: 1;
    text-align: center;
    padding-inline: 0.35rem;
    font-size: 0.82rem;
  }
  .viewer { height: 62vh; }
  .hero-meta { flex-direction: column; }
  h1 { font-size: clamp(3rem, 16vw, 4.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .orbit, .orbit-dot, .scan, .drop, .reel-track, .stat-arc, .stat-dots i { animation: none; }
  .stat-arc { stroke-dashoffset: var(--rest); }
  .stat-dots i { transform: none; }
  .w { transition: none; }
  .mq-track { animation: none; flex-wrap: wrap; width: auto; }
  a.card:hover { transform: none; }
  .statement { min-height: auto; }
  .statement-pin { position: static; min-height: auto; padding-block: 4rem; }
  .stmt-foot { opacity: 1; }
}
