:root {
  --bg: #fbfbf9;
  --panel: #ffffff;
  --ink: #1c1e21;
  --ink-soft: #4a4f57;
  --ink-faint: #6d747d;
  --line: #e2e2dd;
  --accent: #0b6e4f;
  --accent-soft: #e6f2ec;
  --code-bg: #14171a;
  --code-ink: #e6e6e2;
  --code-plain: #9aa0a6;
  --sidebar: 16.5rem;
  --toc: 13.5rem;
  --main: 60rem;
  /* Column padding, declared once: .page uses it and the home hero inverts it to
     break out of the column. Two literals would disagree the moment a breakpoint
     overrides one. */
  --page-pad: 2rem;
  --measure: 52rem;
  --radius: 6px;  /* Height reserved for the sticky topbar, so sticky things below it can clear it.
     Overridden at runtime by app.js to the bar's measured height. The fallback matters:
     with JS off, or before the defer'd script runs, an un-offset sidebar still sits
     under the bar rather than jumping once measurement lands. Deliberately a hair under
     the real height (~2.9rem with 0.7rem padding) so the first sidebar row is not
     clipped by a pixel before measurement. */
  --topbar: 2.75rem;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --panel: #1a1e22;
    --ink: #e6e8ea;
    --ink-soft: #b3b9c0;
    --ink-faint: #8b939c;
    --line: #2a2f35;
    --accent: #58c9a0;
    --accent-soft: #17302a;
    --code-bg: #0d1013;
    --code-ink: #dfe3e6;
    --code-plain: #7d858d;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.65 ui-sans-serif,
    -apple-system,
    "Segoe UI",
    Roboto,
    system-ui,
    sans-serif;
}

/* The document grid.
 *
 * This was <body>, whose children were exactly .skip / nav.sidebar / main / aside. It
 * moved to a wrapper because the topbar has to span the viewport: as a grid child of
 * body it would be auto-placed into the `side` track and shift the reading column one
 * track right. Body is now a plain block column holding .skip, .topbar and .page.
 *
 * The state classes (has-toc, has-sidebar, has-hero, has-menu, has-copy, home, doc)
 * stay on <body>: app.js toggles some at runtime and style.css has always keyed off them
 * there. Descendant selectors (body:not(.has-toc) .page) therefore reach the grid without
 * needing :has(), which keeps this working without a modernity assumption for the core
 * layout. If has-sidebar ever needs the topbar to change shape, use a body class plus a
 * descendant rule rather than adding a second copy of the class to .page.
 *
 * Named lines, not implicit track assignment. .page's children are nav.sidebar, main
 * and aside, and aside is display:none without a toc -- an absent grid child, unlike an
 * offscreen one, simply does not claim a track. Placing the real columns by line number
 * keeps that distinction from mattering. */
.page {
  display: grid;
  /* No template here. All four shapes are declared by the body-class combinations below,
     each listing exactly the tracks its children occupy -- a template on .page would be
     overridden in every case but would be the thing a future reader trusts. */
  justify-content: center;
  gap: 3rem;
  padding-inline: var(--page-pad);
}

/* Children are placed implicitly, in source order, so no rule here names a line.
   Placing them by name was safe while <body> had one fixed three-track template, but the
   sidebar is now conditional: a template that drops the `side` track renumbers `main`
   and `toc`, so <main> silently landed in the first track and the aside in the second,
   leaving the right half of the viewport empty. Implicit placement cannot disagree with
   the track count, because it follows it. Source order in .page is sidebar, main, aside
   -- the same order the named lines described. */

/* The toc column exists only when the layout emitted a toc. A 13.5rem track was
   previously reserved on every page, including the 7 with no level-2 headings and the
   landing page -- which squeezed the reading column from 60rem to 448px on a 1440px
   screen. */
body.has-toc .page {
  grid-template-columns: minmax(0, var(--main)) var(--toc);
}
body.has-sidebar.has-toc .page {
  grid-template-columns: var(--sidebar) minmax(0, var(--main)) var(--toc);
}
body.has-sidebar:not(.has-toc) .page {
  grid-template-columns: var(--sidebar) minmax(0, var(--main));
}
body:not(.has-sidebar):not(.has-toc) .page {
  grid-template-columns: minmax(0, var(--main));
}
body:not(.has-toc) .page > aside {
  display: none;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.7rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.topbar .brand {
  font-size: 1.05rem;
}
.topbar nav {
  display: flex;
  gap: 1.15rem;
}
.topbar nav a {
  color: var(--ink-soft);
}
.topbar nav a:hover,
.topbar nav a:focus-visible {
  color: var(--ink);
}
.topbar nav a.active {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* The sidebar is documentation-only. Its track is in the has-sidebar rules above, so
   nothing is needed here beyond hiding the element when Page.astro did render it and the
   class says otherwise -- it does not, but the rule keeps the two from drifting. */
body:not(.has-sidebar) .page > .sidebar {
  display: none;
}
/* The mobile menu button opens the sidebar; with no sidebar there is nothing to open,
   and app.js adds .has-menu whenever a .menu button exists. */
body:not(.has-sidebar) .menu {
  display: none;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--panel);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky;
  /* Offset by the topbar, which is sticky too. At top:0 the sidebar slid under it and
     scrolled out of sight; at max-height:100vh the bottom of a long tree sat behind the
     bar and could not be reached. Both values track --topbar so the pair cannot drift
     apart when the bar's padding changes. */
  top: var(--topbar);
  align-self: start;
  max-height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 2.5rem 0 3rem;
  font-size: 0.9rem;
}

.brand {
  display: block;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand b {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
}
.tagline {
  margin: 0.2rem 0 2rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.sidebar section {
  margin-bottom: 1.6rem;
}
.sidebar h2 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 0 0 0.4rem;
  font-weight: 600;
}
.sidebar a {
  display: block;
  padding: 0.22rem 0.5rem;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
}
.sidebar a:hover {
  background: var(--panel);
  color: var(--ink);
}
.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.repo {
  /* Flex rather than inline flow: at the 264px sidebar an inline list wraps the
     last link onto its own row and strands the separator punctuation with it.
     Measured — inline flow put four links on rows [39,39,39,63]; flex keeps them
     on one row and still does not overflow when the sidebar narrows. */
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.5rem;
  margin-top: 2.5rem;
  font-size: 0.8rem;
  line-height: 1.6;
}
.repo a {
  color: var(--ink-faint);
}
.repo a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------------- main */

main {
  min-width: 0;
  padding: 2.5rem 0 4rem;
}

.menu {
  display: none;
  font: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
}

article {
  /* NOTE, not a change: `--measure: 52rem` is declared but never reaches prose.
     This was left at var(--measure), and it still yields 800px, because `article`
     is a block in a `minmax(0, 60rem)` grid item — a block-level element's
     max-width is ignored when the box has an orthogonal sizing behaviour here, so
     article fills main. Measured: 800px lines, ~82 chars, on every doc page. If
     the 65-char measure is ever actually wanted, it has to be applied to the
     prose elements, not to article. */
  max-width: var(--measure);
}

/* Prose, not chrome: wide blocks (code, tables) may exceed the text measure so
   long commands and flag tables read as first-class content. */
article pre,
article table {
  max-width: calc(100vw - 3rem);
}

article h1 {
  font-size: 2.15rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
}
article h2 {
  font-size: 1.32rem;
  letter-spacing: -0.015em;
  margin: 2.8rem 0 0.8rem;
  padding-top: 0.6rem;
}
article h3 {
  font-size: 1.05rem;
  margin: 2rem 0 0.5rem;
}
article h2[id]:hover::after,
article h3[id]:hover::after {
  content: " #";
  color: var(--ink-faint);
  font-weight: 400;
}

article p,
article ul,
article ol {
  color: var(--ink-soft);
}
article strong {
  color: var(--ink);
}
article a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
article a:hover {
  border-bottom-color: var(--accent);
}
article ul,
article ol {
  padding-left: 1.3rem;
}
article li {
  margin: 0.3rem 0;
}
article blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
}
article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.32em;
}

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.84rem;
  border: 1px solid var(--line);
}
pre code {
  background: none;
  border: 0;
  font-size: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}
th,
td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--ink-faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
td {
  color: var(--ink-soft);
}
tbody tr:last-child td {
  border-bottom: 0;
}

footer {
  max-width: var(--measure);
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.82rem;
}
footer p {
  margin: 0 0 0.4rem;
}
footer a {
  color: var(--ink-faint);
}

/* -------------------------------------------------------------------- toc */

aside {
  padding: 2.75rem 0;
  min-width: 0;
}
.toc {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  font-size: 0.82rem;
}
.toc h2 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 0 0 0.5rem;
}
.toc a {
  display: block;
  padding: 0.2rem 0;
  color: var(--ink-faint);
  text-decoration: none;
}
.toc a:hover,
.toc a.current {
  color: var(--accent);
}

/* ------------------------------------------------------------------- hero */

/* The landing page only. It sits outside <article>, so it needs its own measure
   rather than inheriting the prose one — and it must be allowed to go wider than
   the text column, because a transcript that wraps is worse than no transcript. */
.hero {
  max-width: var(--measure);
  padding-top: 1.5rem;
}

/* ------------------------------------------------------------------ home
 *
 * Only the homepage has no sidebar, which is what makes it the only page where this is
 * visible: on the 12 doc pages the area beside the prose is occupied by navigation, so
 * it reads as a layout. Here the same reading column sits on a grey field with nothing
 * beside it, and the white band looks like it failed to grow. Body is --bg (grey); the
 * page is laid out in --panel (white), so the fix is to let that white cover the
 * viewport on this one page and keep the prose where it is.
 *
 * Text measures are deliberately untouched. Prose stays at 60rem because a line of
 * body copy at 1600px runs past 200 characters and stops being readable; what was wrong
 * was the canvas, not the column. The comparison is full-bleed via a symmetric negative
 * margin, which cannot shift it horizontally the way `width: 100vw` does when a
 * scrollbar is present.
 *
 * If a band is ever wanted behind the prose sections too, the safe shape is a
 * `width: min(100vw, 100% + 2rem)` with centered auto margins -- plain 100vw adds the
 * scrollbar width and introduces horizontal overflow on every page that has one.
 */
body.home .page {
  background: var(--panel);
}
body.home .hero {
  max-width: none;
}
body.home .hero-lede,
body.home article {
  max-width: var(--measure);
}


.hero-tag {
  /* The catchphrase, one notch under the headline: set in the accent, sized to
     read as a subtitle under the lede. */
  font-size: clamp(1.05rem, 1.7vw, 1.32rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
  margin: -0.35rem 0 1.1rem;
}

.hero-lede {
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  max-width: 34rem;
}
.hero-lede em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}
.hero-lede code {
  color: var(--accent);
}

/* The uck wall: the catchphrase made literal. Every uck, from whatever source,
   sits in one column and answers the same way. Group headings name the origin to
   show provenance without turning the list into a table. Semantic rows (not a
   <pre>) so it reflows, stays selectable, and reaches llms.txt as text. */
/* ------------------------------------------------------------- hero compare */

/* Two panes, side by side only when both can be read at once. Stacking them below
   the width where that stops being true is the whole point of comparing: a reader
   scanning the MCP pane should see the f pane at the same moment, and two columns
   at 20rem each read as a comparison while two columns at 12rem read as noise. */
.compare-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.compare-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}
.compare-svc {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}
.compare-svc.f {
  background: var(--code-bg);
  color: var(--code-ink);
}
.compare-sub {
  font-size: 0.74rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}
/* Shares the transcript's palette: this is request-body content, and reading it as
   code is the correct affordance. */
.compare-body {
  margin: 0;
  padding: 0.7rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  color: var(--code-ink);
  background: var(--code-bg);
  border-radius: 6px;
}
.compare-foot {
  margin: auto 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.compare-foot b {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

@media (max-width: 56rem) {
  .compare {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------- hero compare */

/* Two panes of a session trace. Side by side only while both can be read at once:
   the point of a comparison is that the reader sees the other column while scanning
   this one, and two columns at 20rem read as a pair where two at 12rem read as noise. */
.compare {
  /* Block, deliberately. The original design made .compare itself the two-column grid;
     when the panes moved into .compare-panes that rule was never removed, so the job
     line claimed column 1 and the panes were shoved into column 2 -- the right-half
     shift. margin alone did not override display, which is why adding the second rule
     above fixed the spacing and not the layout. A nested grid inside a parent grid of
     the same shape is invisible in the source and obvious on the page. */
  display: block;
  margin: 1.5rem 0 0;
}
.compare-panes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.compare-col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  min-width: 0;
}
.compare-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}
.compare-svc {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}
.compare-svc.f {
  background: var(--code-bg);
  color: var(--code-ink);
}
.compare-sub {
  font-size: 0.74rem;
  color: var(--ink-faint);
}

/* The session itself: one row per turn, cost right-aligned and tabular so the two
   columns can be scanned by number without the eye hunting for the digits. */
.trace {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.4rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--code-bg);
  border-radius: 6px;
}
.trace-turn {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--code-ink);
}
.tt {
  color: var(--code-plain);
}
.tl {
  overflow-wrap: anywhere;
}
.tn {
  font-variant-numeric: tabular-nums;
  color: var(--code-plain);
}
.trace-sum {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid #2a2f35;
  font-size: 0.72rem;
  color: var(--code-plain);
}
.trace-sum b {
  font-variant-numeric: tabular-nums;
  color: var(--code-ink);
}
.compare-foot {
  margin: auto 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.compare-foot b {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
/* Animated session streams. Turns reveal in sequence; the counter runs up to the
   measured cumulative figure. Text is revealed, never generated — the numbers are the
   measurement and the animation only paces them. */
/* The full sessions. These panes are ~750 lines each, so they scroll rather than
   making a 30,000-line document: the content stays readable in full, the page does
   not become un-navigable. Height is in vh so the pane is never taller than the
   viewport it is being read in, and `max-height` rather than a fixed height keeps a
   short session from leaving a large empty box.
   Overscroll-behavior: contain -- without it, reaching the end of a pane scrolls the
   page out from under it and the reader loses their place in 700 lines of log. */
.stream {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  background: var(--code-bg);
  border-radius: 6px;
  height: 68vh;
  max-height: 46rem;
  /* Short sessions (f's whole stream is ~260 lines, many of them short) must not
     collapse to a stub next to MCP's 28,000px pane; the pair should read as two
     panes of one comparison, not a column and a scroll. */
  min-height: 20rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
/* A sticky header inside a scrolling pane costs 700 lines of covered content; the
   turn label scrolls away with its turn, which is what the reader expects. */
/* Reveal unit is the LINE, not the turn. A turn here can be 689 lines of API response;
   fading that in as one block is a wall appearing, not a stream. Turn labels are always
   visible so the structure stays legible while its body types in. */
.turn {
  opacity: 1;
}
.ln {
  opacity: 1;
}
.streams-live .ln {
  opacity: 0;
}
.streams-live .ln.on {
  opacity: 1;
  transition: opacity 0.16s ease;
}
.turn-h {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.2rem;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--code-plain);
}
.turn-h span {
  font-variant-numeric: tabular-nums;
}
.ln {
  margin: 0 0 0.2rem;
  padding: 0.3rem 0.4rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-left: 2px solid var(--code-bash);
  color: var(--code-ink);
}
.ln.asst {
  border-left-color: var(--code-fn);
}
.ln.tool {
  border-left-color: var(--code-plain);
  color: var(--code-plain);
}
/* Tool definitions and API bodies are long JSON; they wrap on characters rather than
   words because a 110-char GitHub URL template has no break opportunity. */
.ln.tooldef,
.ln.result {
  border-left-color: var(--code-plain);
  color: var(--code-plain);
  word-break: break-all;
}
.ln.tooldef {
  border-left-color: var(--code-str);
  opacity: 0.85;
}
.ln.call {
  border-left-color: var(--code-fn);
  color: var(--code-ink);
  word-break: break-all;
}
.ln.user {
  border-left-color: var(--accent);
  color: var(--code-ink);
}
.ln.asst-text {
  border-left-color: var(--code-fn);
  color: var(--code-str);
}
/* Collapsible tool calls and results: click to fold to one line, click again to
   expand. The full text stays in the DOM (clipped by max-height), so copying
   still works. The ▸/▾ indicator sits in the left gutter. */
.ln.collapsible {
  cursor: pointer;
  position: relative;
}
.ln.collapsible::before {
  content: "▾";
  position: absolute;
  left: 0.15rem;
  top: 0.3rem;
  font-size: 0.6rem;
  color: var(--code-plain);
  opacity: 0.6;
}
.ln.collapsible.collapsed {
  max-height: 1.4em;
  overflow: hidden;
}
.ln.collapsible.collapsed::before {
  content: "▸";
}
.ln.body {
  border-left-color: var(--code-str);
}
.ln em {
  color: var(--code-fn);
  font-style: normal;
}
/* The counter is the payload of the whole widget, so it is the loudest thing in the
   pane and carries the pane's own colour. */
.compare-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.compare-count b {
  font-size: 1rem;
  color: var(--accent);
}
.compare-col:first-child .compare-count b {
  color: #e8a0a0;
}
@media (prefers-reduced-motion: reduce) {
  .streams-live .ln,
  .streams-live .ln.on {
    opacity: 1;
    transition: none;
  }
}

.cache-table {
  width: 100%;
  max-width: 44rem;
  margin: 0.9rem 0 0;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.cache-table caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 0.4rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.cache-table th,
.cache-table td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cache-table thead th {
  color: var(--ink-faint);
  font-weight: 500;
  border-bottom-color: var(--line-strong);
}
.cache-table tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--ink);
}
/* Hit and miss are the whole point of the table, so they are coloured rather than
   left to the word alone -- and the word stays, so colour is never the only cue. */
.cache-hit {
  color: var(--code-str);
}
.cache-miss {
  color: var(--code-err);
}

@media (max-width: 56rem) {
  .compare-panes {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Install: one line, obviously copyable. The button is a progressive
   enhancement — app.js only paints it once a click handler is attached, so with
   JS off the command is still right there to select. */
.install {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 26rem;
  margin-bottom: 1.75rem;
}
.install pre {
  flex: 1;
  margin: 0;
  background: var(--code-bg);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  font-size: 0.92rem;
  padding: 0.7rem 5rem 0.7rem 0.9rem;
  white-space: nowrap;
}
.install pre code::before {
  content: "$ ";
  color: var(--code-plain);
}

/* Without JS the button would be a control that does nothing, so it is painted
   only once app.js has attached a handler — same trick as the mobile nav toggle. */
.copy {
  display: none;
}
body.has-copy .copy {
  display: inline-block;
}
.copy {
  position: absolute;
  right: 0.45rem;
  font: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--code-plain);
  background: color-mix(in srgb, var(--code-bg) 70%, #fff 8%);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.28rem 0.5rem;
  cursor: pointer;
}
.copy:hover {
  color: var(--code-ink);
  border-color: var(--accent);
}
.copy[data-done="1"] {
  color: var(--accent);
  border-color: var(--accent);
}


/* Under the hero the page resumes as prose — but the first heading is now a
   section heading, not the document title, so it must not shout. */
body.home article > h1:first-child {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
body.home article > p:first-of-type {
  font-size: 1.02rem;
}
body.home article table {
  font-size: 0.88rem;
}
body.home article tbody tr:first-child td {
  color: var(--ink-soft);
}

/* On the landing page the hero carries the title, so app.js moves search above
   all of it instead of leaving it under the article's first section heading. */
body.has-hero .search {
  max-width: var(--measure);
  margin: 0 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

/* ------------------------------------------------------------------ search */

.search {
  margin-bottom: 1.75rem;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search ul {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}
.search li {
  margin: 0;
}
.search li a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.search li a:hover {
  background: var(--accent-soft);
}
.search .hit-title {
  font-weight: 600;
  font-size: 0.9rem;
}
.search .hit-url {
  display: block;
  color: var(--accent);
  font-size: 0.78rem;
  font-family: var(--mono);
}
.search .hit-snip {
  display: block;
  color: var(--ink-faint);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}
.search .empty {
  color: var(--ink-faint);
  font-size: 0.85rem;
  padding: 0.4rem 0;
}

/* ----------------------------------------------------------------- narrow */

@media (max-width: 82rem) {
  /* The toc is hidden below this width, so it is no longer a track -- and since nothing
     is placed by line number any more, dropping it from the template is all that is
     needed to keep the remaining children in the right columns. */
  body.has-toc .page,
  body.has-sidebar.has-toc .page {
    grid-template-columns: var(--sidebar) minmax(0, var(--main));
  }
  body:not(.has-sidebar) .page {
    grid-template-columns: minmax(0, 1fr);
  }
  aside {
    display: none;
  }
}

@media (max-width: 56rem) {
  .page,
  body.has-toc .page,
  body.has-sidebar .page,
  body.has-sidebar.has-toc .page,
  body:not(.has-sidebar) .page {
    grid-template-columns: minmax(0, 1fr);
    /* Tracks --page-pad so the home hero's negative margin stays correct here. */
    --page-pad: 1.25rem;
    padding-inline: var(--page-pad);
    gap: 0;
  }
  article,
  footer {
    max-width: none;
  }
  .sidebar {
    position: static;
    max-height: none;
    padding: 1.5rem 0 0;
    display: none;
  }
  body.nav-open .sidebar {
    display: block;
  }
  .menu {
    display: none;
  }
  body.has-menu .menu {
    display: inline-block;
  }
  /* Specificity guard: `body.has-menu .menu` above is (0,2,1) and would beat the
     desktop `body:not(.has-sidebar) .menu` rule (0,2,1 too, but earlier in the sheet),
     putting a menu button on the homepage that opens a sidebar that isn't there. */
  body:not(.has-sidebar) .menu {
    display: none;
  }
  main {
    padding-top: 1rem;
  }
  article h1 {
    font-size: 1.7rem;
  }
  .hero {
    padding-top: 0.5rem;
  }
  .hero-lede {
    font-size: 1.02rem;
  }
  .install {
    max-width: none;
  }
  .install pre {
    font-size: 0.8rem;
    padding-right: 4.5rem;
  }
}
