/* apiflow docs — the SAME token set the product's own pages use, so the site and the tool are one
   product rather than two. Source of truth: packages/cli/src/view/theme.ts (DARK / :root).
   The three status colours are the product's three confidence colours, on purpose: shipped reads as
   `exact`, upcoming as `guess`, reference as `inferred`. */

:root {
  --bg:#f4f7fb; --surface:#fff; --surface-2:#f7f9fc; --surface-3:#eaf0f8;
  --ink:#0d1526; --ink-2:#3c4a60; --muted:#64748b; --line:#dfe6ef; --line-2:#c6d2e2;
  --exact:#059669; --inferred:#2563eb; --guess:#c2740a; --dead:#dc2626; --brand:#0360FB;
  --tint-exact:rgba(5,150,105,.10); --tint-inferred:rgba(37,99,235,.09);
  --tint-guess:rgba(194,116,10,.11); --tint-brand:rgba(3,96,251,.09);
  --shadow:0 1px 2px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.06);
  --sans:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:#070b14; --surface:#101827; --surface-2:#0b111d; --surface-3:#18243a;
    --ink:#e8eef8; --ink-2:#b3c1d6; --muted:#7d8da5; --line:#1e2a3e; --line-2:#2c3d58;
    --exact:#34d399; --inferred:#60a5fa; --guess:#fbbf24; --dead:#f87171; --brand:#5b93ff;
    --tint-exact:rgba(52,211,153,.14); --tint-inferred:rgba(96,165,250,.14);
    --tint-guess:rgba(251,191,36,.14); --tint-brand:rgba(91,147,255,.16);
    --shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.4);
  }
}

* { box-sizing:border-box; }

html { scroll-behavior:smooth; }

body {
  margin:0; background:var(--bg); color:var(--ink);
  font:16px/1.65 var(--sans); -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

.skip { position:absolute; left:-9999px; }
.skip:focus { left:12px; top:12px; z-index:10; background:var(--surface); color:var(--ink);
  padding:8px 12px; border:1px solid var(--line); border-radius:8px; }

/* ---------- header ---------- */

.top {
  position:sticky; top:0; z-index:5;
  display:flex; align-items:center; gap:24px; flex-wrap:wrap;
  padding:12px max(20px, calc(50% - 470px));
  background:var(--bg);
  background:color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.wordmark { display:inline-flex; align-items:center; gap:9px; color:var(--ink);
  text-decoration:none; font-weight:650; letter-spacing:-.01em; font-size:16px; }
.wordmark .mark { width:22px; height:22px; color:var(--brand); flex:none; }
.top nav { display:flex; gap:20px; margin-left:auto; flex-wrap:wrap; }
.top nav a { color:var(--muted); text-decoration:none; font-size:14.5px; }
.top nav a:hover { color:var(--ink); }
.top nav a.ext::after { content:"↗"; font-size:11px; margin-left:3px; opacity:.7; }

/* ---------- layout ---------- */
/* Two widths, and only two: prose sits at a reading measure, everything that is a figure — a table, a
   recorded transcript, the section rules — spans the full column. Per-element `ch` measures look like
   a mistake, because `74ch` of a 22px heading is 250px wider than 74ch of body text. */

main { padding:0 max(20px, calc(50% - 470px)) 96px; --measure:calc(720px); }
main > * { max-width:var(--measure); }
main > h1, main > h2, main > h3, main > hr,
main > .cards, main > .pager, main > table, main > .table-wrap,
main > pre, main > .highlight, main > div[class*="language-"], main > .wide { max-width:940px; }

/* ---------- prose ---------- */

h1 { font-size:clamp(28px,4.2vw,38px); line-height:1.15; letter-spacing:-.025em;
  font-weight:680; margin:40px 0 12px; }
h2 { font-size:22px; letter-spacing:-.015em; font-weight:650; margin:52px 0 10px;
  padding-top:22px; border-top:1px solid var(--line); }
h3 { font-size:17px; font-weight:650; margin:32px 0 6px; }
p, ul, ol { margin:0 0 18px; color:var(--ink-2); }
li { margin:0 0 6px; }
strong { color:var(--ink); font-weight:640; }
a { color:var(--brand); text-decoration:none; border-bottom:1px solid transparent; }
a:hover { border-bottom-color:currentColor; }
hr { border:0; border-top:1px solid var(--line); margin:40px 0; }

blockquote { margin:24px 0; padding:2px 0 2px 18px; border-left:3px solid var(--brand);
  color:var(--ink); font-size:17px; }
blockquote p:last-child { margin-bottom:0; }

/* ---------- code ---------- */

code { font-family:var(--mono); font-size:.875em; }
:not(pre) > code { background:var(--surface-3); color:var(--ink);
  padding:.12em .38em; border-radius:5px; white-space:nowrap; }

/* --surface-2 is one percent away from --bg in the light palette: correct for a panel inside the app
   chrome, invisible as a code block on a page. A block needs to read as a block. */
pre { background:var(--surface); border:1px solid var(--line-2); border-radius:12px;
  padding:16px 18px; overflow-x:auto; margin:0 0 20px; box-shadow:var(--shadow); }
pre code { font-size:13.5px; line-height:1.6; background:none; padding:0; color:var(--ink-2);
  white-space:pre; }
/* The bottom margin belongs to the OUTER wrapper: on a painted block, a margin on the inner
   .highlight paints a strip of dead background below the last line. */
.highlight { margin:0 0 20px; }
.highlight pre { margin:0; }
div[class*="language-"] { margin:0 0 20px; }
div[class*="language-"] .highlight { margin:0; }

/* A console block is the signature element of this site: these are recordings, not examples. Rouge's
   console lexer tags the prompt `.gp` and the output `.go`, so the terminal look needs no javascript. */
/* Rouge wraps the block in two divs; painting the outer one without the radius squares the corners
   off behind the rounded pre. */
div[class*="language-"] { border-radius:12px; overflow:hidden; }
.language-console pre, div.language-console { background:#0a0f1a; border-color:#1c2740; }
@media (prefers-color-scheme: light) {
  .language-console pre { background:#0d1526; border-color:#0d1526; }
}
.language-console pre code { color:#c3d0e4; }
.language-console .gp { color:#5b93ff; font-weight:600; user-select:none; }
.language-console .go { color:#9fb0c9; }
/* apiflow prints markdown, so its `##` headings reach rouge as comments — they are output, and read
   as the strongest line in the block rather than as something dimmed. */
.language-console .c, .language-console .c1, .language-console .cm { color:#e8eef8; font-weight:600; }
.language-console .nt, .language-console .nv, .language-console .s2,
.language-console .o, .language-console .w { color:#c3d0e4; }
.language-console .s2 { color:#8fd6a9; }

/* ---------- diagrams ---------- */
/* Hand-authored SVG rather than mermaid, for one reason: a build-time mermaid render cannot follow the
   reader's theme (rehype-mermaid's inline-svg strategy has no dark option at all), and the subject of
   this product IS a graph. Every colour below is a token, so one file is correct in both themes with
   no javascript and no browser at build time.
   cm:edge contract -> docs/_includes/diagrams — the class vocabulary is shared with every .svg there:
   dg-node/focus/file/dashed/guess, dg-edge/arrow, dg-col/name/path/note/edgelabel/pill, dg-left. */

figure.diagram { margin:0 0 24px; max-width:940px; }
/* A diagram that shrinks to fit a phone is a diagram nobody can read: below the min-width it scrolls
   inside its own box instead, the same rule the transcripts follow. */
figure.diagram .scroll { overflow-x:auto; border:1px solid var(--line); border-radius:12px;
  background:var(--surface); padding:18px 20px; }
figure.diagram svg.dg { display:block; width:100%; min-width:560px; height:auto; }
figure.diagram figcaption { margin:10px 2px 0; font-size:13.5px; color:var(--muted); }

.dg text { font-family:var(--sans); }
.dg-col { font-size:10.5px; font-weight:650; letter-spacing:.09em; fill:var(--muted); text-anchor:middle; }
.dg-name { font-size:14.5px; font-weight:640; fill:var(--ink); text-anchor:middle; }
.dg-path { font-size:11px; fill:var(--muted); text-anchor:middle; }
.dg-note { font-size:12px; fill:var(--muted); text-anchor:end; }
.dg-edgelabel { font-size:11.5px; fill:var(--muted); text-anchor:middle; }
.dg-pilltext { font-size:10.5px; font-weight:700; letter-spacing:.05em; text-anchor:middle; }
.dg-mono { font-family:var(--mono); font-size:13px; }
.dg-left { text-anchor:start; }
.dg-t-guess { fill:var(--guess); }
.dg-t-dead { fill:var(--dead); }

.dg-node { fill:var(--surface-2); stroke:var(--line-2); stroke-width:1.2; }
.dg-focus { fill:var(--tint-brand); stroke:var(--brand); }
.dg-file { fill:var(--tint-inferred); stroke:var(--inferred); }
.dg-guess { fill:var(--tint-guess); stroke:var(--guess); }
.dg-dashed { fill:none; stroke:var(--dead); stroke-dasharray:5 4; opacity:.75; }
.dg-pill { fill:none; stroke-width:1.2; }
.dg-pill-guess { stroke:var(--guess); fill:var(--tint-guess); }
.dg-edge { fill:none; stroke:var(--line-2); stroke-width:1.6; }
/* The marker itself lives once in the layout: two diagrams on one page cannot each define #dg-tip. */
.dg-arrow { marker-end:url(#dg-tip); }
.dg-tip { fill:var(--line-2); }

/* ---------- tables ---------- */

.table-wrap { overflow-x:auto; margin:0 0 24px; }
table { width:100%; border-collapse:collapse; font-size:14.5px; margin:0 0 24px;
  border:1px solid var(--line); border-radius:12px; overflow:hidden; }
thead th { background:var(--surface-2); text-align:left; font-size:11.5px; font-weight:650;
  text-transform:uppercase; letter-spacing:.07em; color:var(--muted);
  padding:10px 14px; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:11px 14px; border-bottom:1px solid var(--line); color:var(--ink-2);
  vertical-align:top; }
tbody tr:last-child td { border-bottom:0; }
tbody tr:hover td { background:var(--surface-2); }
td code { white-space:nowrap; }

/* ---------- status pills ---------- */

.pill { display:inline-block; font:600 11.5px/1 var(--mono); letter-spacing:.04em;
  text-transform:uppercase; padding:5px 9px; border-radius:999px; border:1px solid; }
.pill.shipped   { color:var(--exact);    background:var(--tint-exact);    border-color:var(--exact); }
.pill.upcoming  { color:var(--guess);    background:var(--tint-guess);    border-color:var(--guess); }
.pill.reference { color:var(--inferred); background:var(--tint-inferred); border-color:var(--inferred); }

.pagehead { margin:36px 0 0; }
.statusline { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin:0;
  font-size:14px; color:var(--muted); }
.statusline strong { color:var(--guess); }
.pagehead + h1 { margin-top:14px; }

/* ---------- home ---------- */

main.home h1 { margin-top:56px; font-size:clamp(34px,5.4vw,50px); }
.lede { font-size:21px; line-height:1.45; color:var(--ink); max-width:37rem; letter-spacing:-.01em; }
/* The three node kinds in the product's own mono, not in link blue — the page already spends blue on
   links, and a coloured phrase that is not clickable is a promise the page does not keep. */
.lede em { font-style:normal; font-family:var(--mono); font-size:.88em; color:var(--ink);
  white-space:nowrap; letter-spacing:0; }
.sub { font-size:16.5px; color:var(--muted); max-width:62ch; }

.cards { display:grid; gap:14px; grid-template-columns:repeat(2,minmax(0,1fr)); margin:0 0 28px; }
.card { display:block; padding:16px 18px; border:1px solid var(--line); border-radius:12px;
  background:var(--surface); color:inherit; box-shadow:var(--shadow); transition:border-color .15s; }
.card:hover { border-color:var(--brand); }
.card .pill { margin-bottom:10px; }
.card h3 { margin:0 0 5px; font-size:16px; }
.card p { margin:0; font-size:14px; color:var(--muted); }

/* ---------- pager ---------- */

.pager { display:flex; gap:12px; margin:64px 0 0; padding-top:24px;
  border-top:1px solid var(--line); max-width:940px; }
.pager a { flex:1; padding:14px 16px; border:1px solid var(--line); border-radius:12px;
  background:var(--surface); color:var(--ink); font-weight:600; font-size:15px; }
.pager a:hover { border-color:var(--brand); }
.pager a span { display:block; font:500 11.5px/1 var(--mono); text-transform:uppercase;
  letter-spacing:.07em; color:var(--muted); margin-bottom:6px; }
.pager .next { text-align:right; }

/* ---------- footer ---------- */

.bot { border-top:1px solid var(--line); padding:26px max(20px, calc(50% - 470px)) 48px;
  color:var(--muted); font-size:14px; background:var(--surface-2); }
.bot p { margin:0 0 8px; color:var(--muted); }
.bot a { color:var(--ink-2); }
.bot .fine { max-width:72ch; font-size:13px; }

/* ---------- small screens ---------- */

@media (max-width:820px) {
  .cards { grid-template-columns:1fr; }
}

@media (max-width:640px) {
  body { font-size:15.5px; }
  .top { gap:12px; padding:10px 16px; }
  .top nav { gap:14px; margin-left:0; width:100%; }
  main { padding:0 16px 64px; }
  .bot { padding:22px 16px 40px; }
  .pager { flex-direction:column; }
  h2 { margin-top:40px; }
}
