:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --ink: #12163a;
  --muted: #565c80;
  --line: #d8dbeb;
  --accent: #4f56e8;
  --accent-ink: #ffffff;
  --accent-soft: #e9eafd;
  --ok: #0b8a74;
  --ok-soft: #ddf4ee;
  --warn: #8a5800;
  --warn-soft: #fcefd3;
  --code-bg: #12163a;
  --code-ink: #e8e9f5;
  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1020;
    --surface: #161935;
    --ink: #e9eaf6;
    --muted: #9ea3c4;
    --line: #2a2e55;
    --accent: #8d93ff;
    --accent-ink: #0e1020;
    --accent-soft: #222659;
    --ok: #52d4b6;
    --ok-soft: #12332e;
    --warn: #ebbf68;
    --warn-soft: #3a2d12;
    --code-bg: #090a17;
    --code-ink: #e9eaf6;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); padding: .1em .38em; border-radius: 5px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: 12px; }

.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }

/* Header */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; gap: 28px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 22px; margin-left: auto; }
.top nav a { color: var(--muted); text-decoration: none; font-size: .95rem; padding: .25rem 0; }
.top nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; font: 600 1rem var(--body); text-decoration: none; padding: .8rem 1.4rem; border-radius: 10px; border: 1.5px solid transparent; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.btn-sm { padding: .45rem .95rem; font-size: .9rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Hero */
.hero { padding: 88px 0 56px; }
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.6vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 15em;
}
.lead { font-size: 1.22rem; color: var(--muted); max-width: 40em; margin-top: 1.5rem; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.stack { margin-top: 1.25rem; font-size: .95rem; color: var(--muted); }

/* Blocks */
.block { padding: 56px 0; }
.block h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1.15; letter-spacing: -0.015em; }
.intro { color: var(--muted); margin-top: .6rem; max-width: 46em; }
.caveat { color: var(--muted); font-size: .92rem; margin-top: 1rem; max-width: 46em; }

/* Pipeline demo: the one memorable element */
.demo { margin-top: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sample-note { background: var(--warn-soft); color: var(--warn); font-size: .93rem; padding: .75rem 1.5rem; border-bottom: 1px solid var(--line); }
.demo-q { padding: 1.4rem 1.5rem 0; font-weight: 500; }
.demo-q span { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; }

.rail { display: none; position: relative; grid-template-columns: repeat(3, 1fr); padding: 1.6rem 1rem 0; }
.js .rail { display: grid; }
.rail-line { position: absolute; top: calc(1.6rem + 9px); left: calc(1rem + (100% - 2rem) / 6); width: calc((100% - 2rem) / 3 * 2); height: 2px; background: var(--line); }
.rail-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--stage) * 50%); background: var(--accent); transition: width .45s cubic-bezier(.3, .7, .2, 1); }
.rail [role="tab"] { position: relative; background: none; border: 0; padding: 0 .5rem 1.1rem; font: inherit; color: var(--muted); cursor: pointer; display: grid; justify-items: center; gap: .1rem; text-align: center; }
.rail [role="tab"] strong { color: var(--ink); font-family: var(--display); font-size: 1.1rem; margin-top: .45rem; }
.rail [role="tab"] small { font-size: .85rem; line-height: 1.35; max-width: 15em; }
.rail [role="tab"][aria-selected="true"] small { color: var(--ink); }
.node { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); z-index: 1; transition: background-color .3s, border-color .3s, box-shadow .3s; }
.rail [role="tab"].reached .node { background: var(--accent); border-color: var(--accent); }
.rail [role="tab"][aria-selected="true"] .node { box-shadow: 0 0 0 5px var(--accent-soft); }
.rail [role="tab"]:hover .node { border-color: var(--accent); }
.rail [role="tab"]:focus-visible { outline-offset: -2px; }

.pane { padding: 1.4rem 1.5rem 1.6rem; border-top: 1px solid var(--line); }
.pane + .pane { margin-top: 0; }
.js .pane[hidden] { display: none; }
.pane h3 { font-family: var(--display); font-size: 1.25rem; line-height: 1.25; }
.pane h4 { font-size: .95rem; margin-top: 1.2rem; font-weight: 600; }
.pane p { max-width: 62ch; }

.trace { margin-top: 1rem; background: var(--code-bg); color: var(--code-ink); border-radius: 10px; padding: .8rem 1rem; font-family: var(--mono); font-size: .85rem; display: grid; gap: .25rem; overflow-x: auto; }
.trace b { color: #8d93ff; font-weight: 400; margin-right: .75ch; }
.notes { margin-top: 1.2rem; display: grid; gap: 1rem; }
.notes li { border-left: 3px solid var(--line); padding-left: 1rem; }
.meta { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .05rem .55rem; border-radius: 999px; margin-right: .4rem; white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

.split { margin-top: 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem 2rem; }
.split dt { font-weight: 600; }
.split dd { color: var(--muted); max-width: 40ch; }

.report { margin-top: .4rem; }
.failed { margin-top: 1.1rem; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: .8rem 1rem; max-width: 62ch; }
.failed p { margin-top: .15rem; }
.failed code { background: transparent; padding: 0; }
.src { margin-top: .5rem; max-width: 62ch; }
.src li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.handoff { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px dashed var(--line); color: var(--muted); font-size: .95rem; }

/* Design rules: rows, not cards */
.design { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 3rem; align-items: start; }
.design-head { position: sticky; top: 96px; }
.rules > div { padding: 1.4rem 0; border-top: 1px solid var(--line); }
.rules > div:last-child { border-bottom: 1px solid var(--line); }
.rules dt { font-family: var(--display); font-weight: 700; font-size: 1.2rem; line-height: 1.25; }
.rules dd { color: var(--muted); margin-top: .4rem; max-width: 56ch; }

/* Screenshots */
.shots { margin-top: 1.75rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.shots img { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.shots figcaption { margin-top: .5rem; color: var(--muted); font-size: .92rem; }

/* Architecture */
.diagram { margin-top: 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.diagram svg { width: 100%; height: auto; display: block; font-family: var(--body); }
.diagram figcaption { color: var(--muted); font-size: .92rem; margin-top: .75rem; }
.diagram .box rect { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.diagram .tool rect { fill: var(--accent-soft); stroke: var(--accent); }
.diagram .agent rect { fill: var(--accent); }
.diagram .agent text { fill: var(--accent-ink); font-weight: 600; font-size: 17px; }
.diagram .box text { fill: var(--ink); font-size: 16px; font-weight: 600; }
.diagram .box .sub { fill: var(--muted); font-weight: 400; font-size: 13px; }
.diagram .edge path { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.diagram .note { fill: var(--muted); font-size: 12px; }

/* Status */
.status-grid { margin-top: 1.75rem; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 3rem; }
.status-grid h3 { font-family: var(--display); font-size: 1.2rem; margin-bottom: .6rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: .8rem 1rem .8rem 0; border-top: 1px solid var(--line); }
tr:last-child th, tr:last-child td { border-bottom: 1px solid var(--line); }
th { font-weight: 600; white-space: nowrap; width: 1%; padding-right: 1.5rem; }
td { color: var(--muted); }
.open li { padding: .7rem 0 .7rem 1.4rem; border-top: 1px solid var(--line); position: relative; color: var(--muted); }
.open li:last-child { border-bottom: 1px solid var(--line); }
.open li::before { content: ''; position: absolute; left: 0; top: 1.3em; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--warn); }

/* Run */
.steps { margin-top: 1.75rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; counter-reset: step; }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: .9rem; }
.steps h3 { font-family: var(--display); font-size: 1.15rem; }
.steps h3::before { content: counter(step) '. '; color: var(--accent); }
.steps p { color: var(--muted); margin-top: .35rem; font-size: .98rem; }
.code { position: relative; margin-top: 2rem; background: var(--code-bg); border-radius: 12px; }
.code pre { margin: 0; padding: 1.25rem 1.25rem 1.25rem 1.5rem; overflow-x: auto; }
.code code { background: transparent; color: var(--code-ink); font-size: .9rem; line-height: 1.8; padding: 0; }
.copy { position: absolute; top: .65rem; right: .65rem; background: transparent; color: var(--code-ink); border: 1px solid rgba(255,255,255,.28); border-radius: 8px; padding: .25rem .75rem; font: 500 .85rem var(--body); cursor: pointer; }
.copy:hover { border-color: #8d93ff; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2rem 0 3rem; color: var(--muted); font-size: .95rem; }
.foot-row { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.foot-row p:first-child { max-width: 58ch; }

/* Responsive */
@media (max-width: 920px) {
  .design, .status-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .design-head { position: static; }
  .steps { grid-template-columns: 1fr; gap: 1.25rem; }
  .top nav { display: none; }
  .top-row .btn { margin-left: auto; }
}
@media (max-width: 700px) {
  .wrap { width: calc(100% - 32px); }
  .diagram { overflow-x: auto; padding: 1rem; }
  .diagram svg { min-width: 640px; }
  .diagram figcaption { position: sticky; left: 0; }
  .hero { padding: 56px 0 32px; }
  .block { padding: 40px 0; }
  .shots, .split { grid-template-columns: 1fr; }
  .rail { padding-inline: .25rem; }
  .rail-line { left: calc(.25rem + (100% - .5rem) / 6); width: calc((100% - .5rem) / 3 * 2); }
  .rail [role="tab"] small { display: none; }
  .pane, .demo-q, .sample-note { padding-inline: 1rem; }
  th { white-space: normal; }
  table, tbody, tr, th, td { display: block; width: 100%; }
  th { padding: .8rem 0 0; border-top: 1px solid var(--line); }
  td { padding: .1rem 0 .8rem; border-top: 0; }
  tr:last-child th, tr:last-child td { border-bottom: 0; }
  tr:last-child td { border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rail-fill, .node, .btn { transition: none; }
}
