:root {
  --bg: #0a0a0a;
  --bg-raised: #0d0d0d;
  --surface: #141414;
  --surface-2: #171717;
  --line: #1f1f1f;
  --line-2: #262626;
  --line-3: #333;
  --fg: #fafafa;
  --fg-2: #d4d4d4;
  --muted: #a3a3a3;
  --muted-2: #737373;
  --muted-3: #525252;
  --ok: #22c55e;
  --mono: 'Geist Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: Geist, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted-3); }
a:hover { color: #fff; text-decoration-color: var(--fg); }
::selection { background: #404040; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
img { max-width: 100%; }

.wrap { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
@media (max-width: 480px) { .wrap { padding-left: 16px; padding-right: 16px; } }

.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.h2 { margin: 0; font-weight: 600; font-size: 28px; letter-spacing: -0.03em; }
.lead { margin: 0; font-size: 16px; line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; font-size: 15px; padding: 12px 18px; border-radius: 8px; }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: #e5e5e5; color: var(--bg); }
.btn-ghost { border: 1px solid var(--line-3); color: var(--fg); padding: 11px 18px; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted-3); }

/* Header */
.header { position: sticky; top: 0; z-index: 10; background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.header .wrap { padding-top: 16px; padding-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 22px; width: auto; display: block; }
.brand .x { color: var(--muted-3); font-size: 16px; line-height: 1; }
.brand .name { font-weight: 600; font-size: 18px; line-height: 1; letter-spacing: -0.02em; }
.nav { display: flex; align-items: center; gap: 20px; font-size: 14px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--fg); }
.nav .repo { display: flex; align-items: center; gap: 8px; background: var(--fg); color: var(--bg); font-weight: 500; padding: 8px 14px; border-radius: 8px; }
.nav .repo:hover { background: #e5e5e5; color: var(--bg); }
@media (max-width: 640px) { .nav .hide-sm { display: none; } }

/* Hero */
.hero { padding-top: 96px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 28px; }
@media (max-width: 640px) { .hero { padding-top: 56px; } }
.eyebrow { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.hero h1 { margin: 0; font-weight: 600; font-size: clamp(40px, 7vw, 84px); line-height: 1; letter-spacing: -0.045em; max-width: 960px; text-wrap: balance; }
.hero .intro { margin: 0; font-size: 20px; line-height: 1.5; color: var(--muted); max-width: 680px; text-wrap: pretty; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.meta { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.meta > div { display: flex; flex-direction: column; gap: 6px; }
.meta .value { font-size: 17px; font-weight: 500; }
.meta .links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 17px; font-weight: 500; }

/* Video */
.video { padding-top: 24px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head .note { font-family: var(--mono); font-size: 13px; color: var(--muted-2); }
.frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line-2); }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Case */
.band { border-top: 1px solid var(--line); }
.band.raised { background: var(--bg-raised); }
.band > .wrap { padding-top: 72px; padding-bottom: 96px; }
.case-head { display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin-bottom: 40px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 48px; }
.stat { background: var(--bg); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 8px; }
.stat .num { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .what { font-size: 14px; line-height: 1.5; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 40px; }
.col { display: flex; flex-direction: column; gap: 14px; }
.col h3 { margin: 0; font-weight: 600; font-size: 20px; letter-spacing: -0.02em; }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.list li { font-size: 15px; line-height: 1.6; color: var(--muted); padding-left: 18px; position: relative; text-wrap: pretty; }
.list li::before { content: ''; position: absolute; left: 0; top: 0.7em; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-3); }
.list strong { color: var(--fg); font-weight: 500; }
.stack { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--mono); font-size: 13px; color: var(--fg-2); border: 1px solid var(--line-2); background: var(--surface); padding: 6px 10px; border-radius: 999px; }

/* Process */
.process { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 48px; align-items: start; }
.process-intro { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 96px; }
@media (max-width: 720px) { .process-intro { position: static; } }
.steps { grid-column: span 2; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
@media (max-width: 720px) { .steps { grid-column: auto; } }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 20px; }
.rail { display: flex; flex-direction: column; align-items: center; }
.rail .node { width: 14px; height: 14px; border-radius: 50%; background: var(--fg); margin-top: 6px; flex: none; }
.rail .node.done { background: var(--ok); }
.rail .line { width: 1px; flex: 1; background: #2a2a2a; margin-top: 8px; }
.step-body { display: flex; flex-direction: column; gap: 6px; padding-bottom: 36px; }
.step:last-child .step-body { padding-bottom: 0; }
.step-body .n { font-family: var(--mono); font-size: 12px; color: var(--muted-2); }
.step-body h3 { margin: 0; font-weight: 600; font-size: 20px; letter-spacing: -0.02em; }
.step-body p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 620px; text-wrap: pretty; }
.step-body .refs { font-family: var(--mono); font-size: 13px; color: var(--muted-2); display: flex; gap: 14px; flex-wrap: wrap; }
.step-body .refs a { color: var(--muted); }

/* Docs */
.docs { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .docs { grid-template-columns: minmax(0, 1fr); } }
.doc-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 88px; }
@media (max-width: 860px) { .doc-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; } }
.doc-nav button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit; font-size: 15px; padding: 10px 12px; border-radius: 8px; background: transparent; color: var(--muted); min-height: 44px; }
@media (max-width: 860px) { .doc-nav button { width: auto; white-space: nowrap; flex: none; } }
.doc-nav button:hover { background: var(--surface); color: var(--fg); }
.doc-nav button[aria-current='true'] { background: var(--surface-2); color: var(--fg); font-weight: 500; }
.doc-nav .num { font-family: var(--mono); font-size: 12px; color: var(--muted-3); }
.doc-nav button[aria-current='true'] .num { color: var(--muted-2); }
.doc { min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 40px clamp(18px, 4vw, 48px); min-height: 420px; }
.doc-tools { display: flex; justify-content: flex-end; margin: -16px 0 8px; }
.doc-tools a { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.doc-status { color: var(--muted-3); font-size: 15px; }

/* Rendered markdown */
.md { font-size: 16px; line-height: 1.7; color: var(--fg-2); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { color: var(--fg); font-weight: 600; line-height: 1.2; overflow-wrap: normal; }
.md h1 { margin: 0 0 20px; font-size: 36px; letter-spacing: -0.03em; }
.md h2 { margin: 44px 0 14px; font-size: 24px; letter-spacing: -0.03em; padding-top: 8px; }
.md h3 { margin: 32px 0 12px; font-size: 19px; letter-spacing: -0.01em; }
.md h4 { margin: 24px 0 10px; font-size: 16px; }
.md p { margin: 0 0 16px; text-wrap: pretty; }
.md ul, .md ol { margin: 0 0 16px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li > ul, .md li > ol { margin: 4px 0 0; }
.md strong { color: var(--fg); font-weight: 600; }
.md code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.md pre { margin: 0 0 20px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 16px 18px; overflow: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: #e5e5e5; }
.md pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.md blockquote { margin: 0 0 20px; padding: 12px 16px; border: 1px solid var(--line-2); background: #111; border-radius: 10px; color: var(--muted); font-size: 15px; }
.md blockquote p:last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 28px 0; }
.md .table { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; }
.md table { width: 100%; border-collapse: collapse; }
.md th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-3); font-weight: 500; color: var(--muted); font-size: 13px; background: #0f0f0f; }
.md td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; overflow-wrap: normal; min-width: 120px; }
.md tr:last-child td { border-bottom: 0; }
.md img { display: block; background: #fff; border-radius: 10px; padding: 12px; margin: 0 0 20px; }
.md details { margin: 0 0 20px; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 16px; }
.md details pre { margin: 12px 0 0; max-height: 560px; }
.md summary { cursor: pointer; color: var(--fg); }
.md .diagram { margin: 0 0 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; overflow-x: auto; }
.md .diagram svg { display: block; margin: 0 auto; max-width: none; height: auto; }
.md .diagram pre { margin: 0; border: 0; padding: 0; }

/* Footer */
.footer { border-top: 1px solid var(--line); }
.footer .wrap { padding-top: 32px; padding-bottom: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted-2); }
.footer img { height: 20px; width: auto; display: block; opacity: 0.7; }
