
/* headforward. Layout: a tinted hero band (ink-dark in dark mode) holding the one command and a live trace, then a light working page:
   playground, ways to run it, install, limits. Redline motif: cut text is struck in red. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #141a26;
  --muted: #5b6577;
  --line: #d8dde6;
  --accent: #0b7a6e;
  --accent-ink: #ffffff;
  --cut: #c4322b;
  --cut-bg: #fbe5e3;
  --band: #e3f3ef;
  --band-ink: #0b1d1c;
  --band-muted: #46625e;
  --band-line: #c3e0d9;
  --band-accent: #0b7a6e;
  --band-cut: #c4322b;
  --band-raise: #ffffff;
  --band-btn: #d2ebe5;
  --band-btn-ink: #0b1d1c;
  --trace-bg: #ffffff;
  --trace-fg: #23403c;
  --trace-dim: #6c8783;
  --trace-track: #d5e9e4;
  --term-bg: #151b29;
  --term-fg: #dfe5f2;
  --term-dim: #8a94ab;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sunk: #eaeef5;
  --accent-soft: #dcf1ec;
  --keep: #13804f;
  --keep-bg: #dcf3e7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131c; --surface: #171d2a; --ink: #e8ecf4; --muted: #98a2b6; --line: #2a3243;
    --accent: #5ed3bf; --accent-ink: #08110f; --cut: #ff8a80; --cut-bg: #3a1d1f;
    --term-bg: #0a0d14; color-scheme: dark;
    --sunk: #121723; --accent-soft: #133631; --keep: #6ad6a0; --keep-bg: #15301f;
    --band: #061210; --band-ink: #ecf6f3; --band-muted: #93b3ad; --band-line: #17302c; --band-accent: #63d8c4; --band-cut: #ff8f86; --band-raise: #0f2421; --band-btn: #1d3c37; --band-btn-ink: #ecf6f3; --trace-bg: #081614; --trace-fg: #cde3de; --trace-dim: #6d8f89; --trace-track: #1e3a35;
  }
}
:root[data-theme="dark"] {
  --bg: #0f131c; --surface: #171d2a; --ink: #e8ecf4; --muted: #98a2b6; --line: #2a3243;
  --accent: #5ed3bf; --accent-ink: #08110f; --cut: #ff8a80; --cut-bg: #3a1d1f;
  --term-bg: #0a0d14; color-scheme: dark;
    --sunk: #121723; --accent-soft: #133631; --keep: #6ad6a0; --keep-bg: #15301f;
    --band: #061210; --band-ink: #ecf6f3; --band-muted: #93b3ad; --band-line: #17302c; --band-accent: #63d8c4; --band-cut: #ff8f86; --band-raise: #0f2421; --band-btn: #1d3c37; --band-btn-ink: #ecf6f3; --trace-bg: #081614; --trace-fg: #cde3de; --trace-dim: #6d8f89; --trace-track: #1e3a35;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--body); }
.in {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
h2 { font-weight: 800; font-size: clamp(1.6rem, 3.4vw, 2.2rem); letter-spacing: -0.015em; line-height: 1.1; }
h3 { font-weight: 800; font-size: 1.15rem; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.9em; }
.eyebrow { font: 600 0.75rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.lede { max-width: 62ch; color: var(--muted); font-size: 1.08rem; }
button { font-family: var(--body); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hero band */
.hero { background: var(--band); color: var(--band-ink); }
.hero .in { padding-block: 56px 64px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero .copy { display: grid; gap: 22px; min-width: 0; }
.hero .eyebrow { color: var(--band-accent); }
.hero h1 { font-weight: 800; font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 0.98; letter-spacing: -0.03em; }
.hero h1 s { color: var(--band-cut); font-weight: 500; text-decoration-thickness: 0.07em; }
.hero p { color: var(--band-muted); font-size: 1.1rem; max-width: 50ch; }
.cmd { display: flex; align-items: center; gap: 10px; background: var(--band-raise); border: 1px solid var(--band-line); border-radius: 10px; padding: 6px 6px 6px 16px; min-width: 0; }
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; color: var(--band-ink); font-size: 0.95rem; }
.cmd code b { color: var(--band-accent); font-weight: 600; }
.cmd button, .term .copy { font-weight: 600; font-size: 0.8rem; background: var(--band-btn); color: var(--band-btn-ink); border: 0; padding: 8px 12px; border-radius: 7px; cursor: pointer; flex: none; }
.term .copy { background: #1d3c37; color: #ecf6f3; } /* code blocks stay dark in both themes */
.agents { display: flex; flex-wrap: wrap; gap: 8px; }
.agents span { font: 500 0.8rem var(--mono); color: var(--band-muted); border: 1px solid var(--band-line); padding: 4px 10px; border-radius: 99px; }

.trace { background: var(--trace-bg); border: 1px solid var(--band-line); border-radius: 12px; font: 400 0.82rem/1.7 var(--mono); color: var(--trace-fg); overflow: hidden; min-width: 0; }
.trace .top { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--band-line); color: var(--band-muted); font-size: 0.75rem; }
.trace .body { padding: 14px; overflow-x: auto; }
.trace .row { display: grid; grid-template-columns: 7.5ch 1fr; gap: 12px; white-space: nowrap; }
.trace .k { color: var(--band-accent); }
.trace .dim { color: var(--trace-dim); }
.trace .bar { height: 6px; border-radius: 3px; background: var(--trace-track); margin: 10px 0 4px; overflow: hidden; }
.trace .bar i { display: block; height: 100%; width: 28%; background: var(--band-accent); border-radius: 3px; }
.trace .big { font: 800 1.9rem/1 var(--display); color: var(--band-ink); }

/* Main */
main .in { padding-block: 64px 72px; display: grid; gap: 72px; }
section { display: grid; gap: 20px; min-width: 0; }
.head { display: grid; gap: 10px; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.facts div { background: var(--surface); padding: 20px; display: grid; gap: 8px; align-content: start; }
.facts p { color: var(--muted); font-size: 0.95rem; }

/* Playground */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font-weight: 600; font-size: 0.85rem; border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.panes { display: grid; grid-template-columns: 1fr 1fr; }
.pane { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-head { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px 0; font: 600 0.72rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pane-head .n { font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }
textarea, .out { width: 100%; min-height: 340px; max-height: 60vh; overflow: auto; margin: 0; padding: 12px 16px 16px; border: 0; background: transparent; color: var(--ink); font: 400 0.85rem/1.6 var(--mono); resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere; }
textarea:focus { outline: none; }
.pane:focus-within .pane-head { color: var(--accent); }
.out del { color: var(--cut); background: var(--cut-bg); text-decoration-color: var(--cut); }
.stats { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 14px 16px; border-top: 1px solid var(--line); }
.stat { display: grid; }
.stat b { font: 800 1.6rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.78rem; color: var(--muted); }
.stat.big b { color: var(--accent); }
.stats .spacer { flex: 1; }
.btn { font-weight: 600; font-size: 0.9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 14px; border-radius: 8px; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.note { font-size: 0.82rem; color: var(--muted); }
.tool .note { padding: 0 16px 14px; }

/* Ways to run */
.ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.way { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 20px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.way p { color: var(--muted); font-size: 0.95rem; }
.term { position: relative; background: var(--term-bg); color: var(--term-fg); border-radius: 10px; padding: 12px 14px; font: 400 0.8rem/1.65 var(--mono); overflow-x: auto; white-space: pre; }
.term.has-copy { padding-right: 76px; }
.term .c { color: var(--term-dim); }
.term .copy { position: absolute; top: 7px; right: 7px; font-size: 0.72rem; padding: 6px 10px; }

.steps { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; counter-increment: s; }
.steps li::before { content: counter(s); font: 600 0.8rem/28px var(--mono); text-align: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); }
.steps li > div { display: grid; gap: 8px; min-width: 0; }
details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
details pre { margin: 0; padding: 0 16px 16px; max-height: 420px; overflow: auto; font: 400 0.78rem/1.5 var(--mono); }
.limits { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--muted); max-width: 75ch; }
.limits b { color: var(--ink); font-weight: 600; }

@media (max-width: 900px) {
  .hero .in { grid-template-columns: 1fr; gap: 36px; padding-block: 40px 48px; }
  .ways, .facts { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .panes { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  textarea, .out { min-height: 220px; }
}
@media (prefers-reduced-motion: no-preference) {
  .trace .bar i { animation: fill 1.4s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes fill { from { width: 100%; } }
}

/* Site chrome (landing + docs) */
body { margin: 0; }
.topnav { background: var(--band); color: var(--band-ink); border-bottom: 1px solid var(--band-line); position: sticky; top: 0; z-index: 10; }
.topnav .in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.topnav a { color: var(--band-muted); text-decoration: none; font-weight: 500; font-size: 0.92rem; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--band-ink); }
.topnav .logo { display: inline-flex; align-items: center; gap: 10px; font: 800 1.15rem var(--display); color: var(--band-ink); letter-spacing: -0.01em; }
.topnav .logo .mark { flex: none; }
.topnav .links { display: flex; gap: 20px; flex-wrap: wrap; }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.site-foot .in { display: flex; gap: 20px; flex-wrap: wrap; padding-block: 24px; }
.site-foot a { color: var(--muted); }

/* Docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-block: 40px 72px; }
.docs nav.toc { position: sticky; top: 72px; align-self: start; display: grid; gap: 4px; font-size: 0.92rem; }
.docs nav.toc b { font: 600 0.72rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
.docs nav.toc b:first-child { margin-top: 0; }
.docs nav.toc a { color: var(--ink); text-decoration: none; padding: 3px 0; }
.docs nav.toc a:hover { color: var(--accent); }
.doc { max-width: 74ch; display: grid; gap: 14px; min-width: 0; }
.doc h1 { font: 800 clamp(2rem, 4vw, 2.6rem)/1.05 var(--display); letter-spacing: -0.02em; margin: 0; }
.doc h2 { margin-top: 36px; scroll-margin-top: 80px; }
.doc h3 { margin-top: 14px; scroll-margin-top: 80px; }
.doc p, .doc li { color: var(--ink); }
.doc ul, .doc ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.doc a { color: var(--accent); }
.doc :not(pre) > code { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.doc pre { background: var(--term-bg); color: var(--term-fg); border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 0; font: 400 0.84rem/1.6 var(--mono); }
.doc .tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.doc th, .doc td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { background: var(--surface); font-weight: 600; }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }
.callout { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 16px; color: var(--muted); }
@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; gap: 24px; }
  .docs nav.toc { position: static; display: flex; flex-wrap: wrap; gap: 6px 14px; }
  .docs nav.toc b { width: 100%; margin: 6px 0 0; }
}

/* Theme switch */
.theme-btn { font: 500 0.85rem var(--body); background: transparent; color: var(--band-muted); border: 1px solid var(--band-line); border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.theme-btn:hover { color: var(--band-ink); }
.topnav .links { align-items: center; }

/* Landing additions */
.hero .first { font-size: 0.88rem; color: var(--band-muted); }
.hero .first code { color: var(--band-ink); overflow-wrap: anywhere; }
.hero .first a { color: var(--band-accent); }
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.res { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 12px; align-content: start; }
.res-head { display: flex; align-items: baseline; gap: 8px; }
.res-head b { font: 800 2.4rem/1 var(--display); color: var(--accent); font-variant-numeric: tabular-nums; }
.res-head span { color: var(--muted); font-size: 0.9rem; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.res p { color: var(--muted); font-size: 0.93rem; }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pair { display: grid; gap: 10px; align-content: start; min-width: 0; }
.pair > p { color: var(--muted); font-size: 0.92rem; }
.ba { position: relative; min-width: 0; }
.ba pre { margin: 0; background: var(--term-bg); color: var(--term-fg); border-radius: 10px; padding: 30px 14px 12px; font: 400 0.76rem/1.55 var(--mono); overflow-x: auto; }
.ba .tag { position: absolute; top: 8px; left: 14px; font: 600 0.66rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #8a94ab; }
.ba .tag.after { color: #63d8c4; }
.faq { display: grid; gap: 8px; max-width: 80ch; }
.faq details p { padding: 0 16px 14px; color: var(--muted); }
.faq code { font-size: 0.85em; }
@media (max-width: 900px) {
  .results, .compare { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topnav .links { gap: 14px; }
  .topnav .links a[href="/docs/#cli"] { display: none; }
  .topnav .in { flex-wrap: nowrap; }
}

main section { scroll-margin-top: 72px; }

/* Routes, comparison and gateway chain */
.way .tag { justify-self: start; font: 600 0.7rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.way p code, .lede code, .limits code, .chain p code, .faq code { background: var(--sunk); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table.matrix { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 620px; }
.matrix th, .matrix td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: 0; }
.matrix thead th { font: 600 0.72rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--sunk); }
.matrix tbody th { font-weight: 600; }
.yes, .no, .part { display: inline-flex; align-items: center; gap: 6px; font: 600 0.78rem var(--mono); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.yes { color: var(--keep); background: var(--keep-bg); }
.no { color: var(--muted); background: var(--sunk); }
.part { color: var(--accent); background: var(--accent-soft); }
.chain { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 24px; }
.hops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hop { position: relative; display: grid; gap: 6px; align-content: start; padding: 16px 18px; border: 1px solid var(--line); background: var(--bg); min-width: 0; }
.hop:first-child { border-radius: 12px 0 0 12px; }
.hop:last-child { border-radius: 0 12px 12px 0; }
.hop + .hop { border-left: 0; }
.hop + .hop::before { content: ""; position: absolute; left: -9px; top: 50%; width: 16px; height: 16px; background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); z-index: 1; }
.hop b { font: 700 1rem var(--display); }
.hop code { font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.hop span { font-size: 0.82rem; color: var(--muted); }
.hop.lt { background: var(--accent-soft); border-color: var(--accent); }
.hop.lt b { color: var(--accent); }
.chain-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chain-cols > div { display: grid; gap: 10px; align-content: start; min-width: 0; }
.chain-cols p { color: var(--muted); font-size: 0.95rem; }
.topnav .logo .mark .tile { fill: var(--band-ink); }
.topnav .logo .mark .head { stroke: var(--band); }
.topnav .logo .mark .cut { fill: var(--band-cut); }
@media (max-width: 960px) {
  .hops { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hop, .hop:first-child, .hop:last-child { border-radius: 12px; border-left: 1px solid var(--line); }
  .hop.lt { border-left-color: var(--accent); }
  .hop + .hop::before { display: none; }
}
@media (max-width: 760px) { .chain-cols { grid-template-columns: 1fr; } .chain { padding: 18px; } }
@media (max-width: 420px) { .hops { grid-template-columns: 1fr; } }
