/* ───────────────────────────────────────────────────────────────
   featurekit docs — shared stylesheet
   Palette is kept in sync with ../index.html (marketing site), and with
   notifkit's docs, so the devkitshq sites read as one family.
   ─────────────────────────────────────────────────────────────── */

:root {
  --bg: #09090B;
  --bg-2: #0C0D10;
  --bg-glass: rgba(11, 12, 16, 0.72);
  --panel: #121317;
  --panel-2: #191B20;
  --border: #26282F;
  --border-soft: #1B1D23;

  --text: #ECEDEF;
  --muted: #878C96;
  --faint: #565B65;

  --accent: #6CF0A6;
  --accent-dim: rgba(108, 240, 166, 0.10);
  --accent-line: rgba(108, 240, 166, 0.30);

  --warn: #F0C36C;
  --warn-dim: rgba(240, 195, 108, 0.10);
  --warn-line: rgba(240, 195, 108, 0.30);

  --danger: #F0846C;
  --danger-dim: rgba(240, 132, 108, 0.10);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --display: "Space Grotesk", "Inter", sans-serif;

  --topbar-h: 56px;
  --sidebar-w: 272px;
  --toc-w: 208px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { 
  scroll-behavior: smooth;
  color-scheme: dark; 
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}


::selection { background: var(--accent); color: #04130B; }

a { color: inherit; text-decoration: none; transition: color .18s; }

/* ── Topbar ─────────────────────────────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
}

.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.logo .br { color: var(--accent); }
.logo .tag {
  font-weight: 500;
  color: var(--muted);
}
.logo .tag::before { content: "/"; color: var(--faint); margin-right: 7px; }

.topbar-spacer { flex: 1; }

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
  font-size: 14px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
}
.topnav a:hover { color: var(--text); }
.topnav a[aria-current="page"] { color: var(--text); }

/* GitHub star button. The count stays hidden until the API answers, so a
   failed or rate-limited fetch leaves a plain "Star" button, never a 0. */
.gh-star {
  display: inline-flex;
  align-items: stretch;
  font-family: var(--mono);
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  color: var(--text);
  transition: border-color .15s;
}
.gh-star:hover { border-color: var(--accent-line); }
.gh-star-l {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  background: var(--panel);
}
.gh-star-l svg { width: 14px; height: 14px; fill: currentColor; flex: none; }
.gh-star-n {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.gh-star-n[hidden] { display: none; }
.gh-star:hover .gh-star-n { color: var(--accent); }

/* ── Skip Link ──────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -60px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 12px;
  z-index: 1000;
  font-weight: 600;
  border-radius: 0 0 8px 0;
}
.skip-link:focus-visible {
  top: 0;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Page actions: copy page / view as markdown / open in AI ──────── */

.page-actions {
  position: relative;
  display: flex;
  white-space: nowrap;
}

.pa-copy, .pa-toggle {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  transition: color .15s;
}

.pa-toggle {
  padding: 4px 0 4px 6px;
  font-size: 11px;
}

.pa-copy:hover, .pa-toggle:hover, .pa-toggle[aria-expanded="true"] {
  color: var(--text);
}

.pa-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 110;
}

.pa-item {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  padding: 7px 9px;
  border-radius: 5px;
  cursor: pointer;
}
.pa-item:hover { background: var(--panel-2); color: var(--accent); }

.nav-toggle {
  display: none;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}

/* ── Layout ─────────────────────────────────────────────────── */

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1440px;
  margin: 0 auto;
  padding-top: var(--topbar-h);
}

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 12px 60px 20px;
  border-right: 1px solid var(--border-soft);
}

.nav-group { margin-bottom: 26px; }

.nav-title {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 8px;
  padding-left: 11px;
}

.nav-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 1px;
}
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }

/* Collapsible sidebar sub-groups. Native <details>, so expanding works with
   JavaScript off and the disclosure state is keyboard-operable for free. */
.nav-sub { margin-bottom: 2px; }

.nav-sub > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
  list-style: none;
}
/* The default marker is a different glyph per engine, so draw our own. */
.nav-sub > summary::-webkit-details-marker { display: none; }
.nav-sub > summary::before {
  content: "";
  width: 0;
  height: 0;
  flex-shrink: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  opacity: .55;
  transition: transform .15s ease;
}
.nav-sub[open] > summary::before { transform: rotate(90deg); }
.nav-sub > summary:hover { background: var(--panel); color: var(--text); }
.nav-sub > summary:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: -2px;
}

/* Indented to sit under the disclosure triangle rather than under the group. */
.nav-sub .nav-link {
  padding-left: 28px;
  font-size: 13px;
}

/* ── Content ────────────────────────────────────────────────── */

.main {
  flex: 1;
  min-width: 0;
  padding: 44px 44px 120px;
}

.content { max-width: 780px; }

.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* Wraps .eyebrow (left) + .page-actions (right), injected by docs.js just
   above the H1 — the "copy page" control lives with the page, not the
   global topbar, so it scrolls and scales with the content column. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  row-gap: 10px;
  margin-bottom: 12px;
}

.content h1 {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.02em;
  margin-bottom: 16px;
  text-wrap: balance;
}

.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 40px;
  max-width: 62ch;
}

.content h2 {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 56px 0 14px;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
  text-wrap: balance;
}

.content h3 {
  font-family: var(--display);
  font-size: 16.5px;
  font-weight: 600;
  margin: 34px 0 10px;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
  text-wrap: balance;
}

.content h4 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 8px;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}

.content p { margin-bottom: 18px; color: var(--muted); }
.content strong { color: var(--text); font-weight: 600; }
.content em { color: var(--muted); }

.content a:not(.btn):not(.card):not(.prev):not(.next):not(.src-link) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}
.content a:not(.btn):not(.card):not(.prev):not(.next):not(.src-link):hover { text-decoration-color: var(--accent); }

.content ul, .content ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
}
.content li { margin-bottom: 7px; }
.content li::marker { color: var(--faint); }

/* Pre-flight checklists — "before you call it done" sections. */
.content ul.checks {
  list-style: none;
  padding-left: 0;
}
.content ul.checks li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 9px;
}
.content ul.checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .42em;
  width: 13px;
  height: 7px;
  border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(-45deg);
}

.content hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 48px 0;
}

/* ── Code ───────────────────────────────────────────────────── */

/* No nowrap here. A long span — a whole tool call in a transcript, a
   `user: { id: …, email: … }` mid-sentence — outgrew the 780px column and
   scrolled the whole page sideways. Wrapping at spaces costs nothing: a
   bare identifier has none, so it still comes out on one line, and
   break-word only splits a token that would overflow on its own. */
.content :not(pre) > code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--panel);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--text);
  white-space: normal;
  overflow-wrap: break-word;
}

.codeblock {
  position: relative;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-2);
  overflow: hidden;
}

.codeblock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
}
.codeblock-lang {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
}
.codeblock-file {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.codeblock-head .sp { flex: 1; }

.copy-btn {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  transition: color .15s;
}
.copy-btn:hover { color: var(--text); }
.copy-btn.done { color: var(--accent); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Tabbed code blocks (SDK / HTTP) ─────────────────────────────
   Authored as <div class="tabs"> with one <pre><code data-tab="…">
   per variant. docs.js turns them into a tablist; without JS every
   variant simply renders in sequence, still readable. */
.tabs { margin: 20px 0; }

.codeblock-tabs {
  display: flex;
  gap: 16px;
  margin-right: 4px;
  align-self: stretch;
}

.tab-btn {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -8px;
  padding: 0 0 7px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--muted); }
.tab-btn[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab-btn:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

.codeblock pre[hidden] { display: none; }

.codeblock pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}
.codeblock pre code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  background: transparent !important;
  padding: 0;
  border: none;
}
.hljs { background: transparent !important; }

/* ── Steps ──────────────────────────────────────────────────── */

.steps {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 0 0 34px 46px;
  margin: 0;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step::after {
  content: "";
  position: absolute;
  left: 14px; top: 32px; bottom: 4px;
  width: 1px;
  background: var(--border-soft);
}
.step:last-child::after { display: none; }

.step > h3 {
  margin: 2px 0 8px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
}
.step > h3 .why {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--faint);
  margin-top: 3px;
}

/* Which process a step runs in — server, your app, or a one-off ops task. */
.where {
  display: inline-block;
  vertical-align: middle;
  margin-left: 9px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--faint);
  white-space: nowrap;
}
.where.server {
  color: #7AA2F7;
  border-color: rgba(122, 162, 247, .38);
  background: rgba(122, 162, 247, .08);
}
.where.app {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-dim);
}
.where.ops {
  color: #F0C36C;
  border-color: rgba(240, 195, 108, .38);
  background: rgba(240, 195, 108, .08);
}

/* ── Callouts ───────────────────────────────────────────────── */

/* An aside, not a panel: a rule on the left, the label as a short heading.
   Only the rule's colour says how much it matters. */
.callout {
  margin: 24px 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--border);
  font-size: 14.5px;
  line-height: 1.65;
  min-width: 0;
}
.callout .ic {
  display: block;
  margin-bottom: 4px;
  font-family: var(--sans);
  font-weight: 600;
  color: var(--text);
}
.callout p { margin: 0; color: var(--muted); }
.callout p + p { margin-top: 8px; }
/* A code block inside a callout scrolls within it rather than widening it. */
.callout .codeblock { margin: 10px 0 2px; max-width: 100%; }
.callout .codeblock:last-child { margin-bottom: 0; }
.callout.warn { border-left-color: var(--warn); }
.callout.gotcha { border-left-color: var(--danger); }

/* ── Tables ─────────────────────────────────────────────────── */

.table-wrap {
  margin: 26px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  overflow-x: auto;
  box-shadow: 0 4px 24px -6px rgba(0, 0, 0, 0.45);
}

.table-wrap::-webkit-scrollbar {
  height: 6px;
}
.table-wrap::-webkit-scrollbar-track {
  background: var(--bg-2);
}
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  line-height: 1.6;
  min-width: 520px;
  text-align: left;
}

thead {
  background: var(--panel);
}

th {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th:not(:last-child) {
  border-right: 1px solid rgba(38, 40, 47, 0.5);
}

tbody tr {
  transition: background .15s ease;
}

tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-soft);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

tbody tr:hover {
  background: rgba(108, 240, 166, 0.035);
}

td {
  padding: 13px 18px;
  color: var(--muted);
  vertical-align: middle;
}

td:not(:last-child) {
  border-right: 1px solid rgba(38, 40, 47, 0.35);
}

td:first-child {
  color: var(--text);
  font-weight: 500;
}

.content td code, .content th code {
  white-space: nowrap;
  font-size: 12px;
}

.content td strong {
  color: var(--text);
}

/* ── Feature & TCO Comparison Tables ───────────────────────── */

@media (min-width: 1100px) {
  .content:has(.cmp-table) {
    max-width: 880px;
  }
}

@media (min-width: 1280px) {
  .content:has(.cmp-table) {
    max-width: 960px;
  }
}

table.cmp-table {
  table-layout: fixed;
  width: 100%;
  min-width: 680px;
}

table.cmp-table th {
  vertical-align: top;
  white-space: normal;
  line-height: 1.4;
}

/* Col 1: Capability / Dimension — compact (~20%), top-aligned, clean typography */
table.cmp-table th:first-child,
table.cmp-table td:first-child {
  width: 20%;
  min-width: 145px;
  max-width: 175px;
  padding: 13px 14px;
  vertical-align: top;
}

table.cmp-table th:first-child {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

table.cmp-table td:first-child {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 600;
}

table.cmp-table td:first-child strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

/* Col 2 (Competitor) & Col 3 (featurekit): Generous ~40% space each */
table.cmp-table th:nth-child(2),
table.cmp-table td:nth-child(2),
table.cmp-table th:nth-child(3),
table.cmp-table td:nth-child(3) {
  width: 40%;
  vertical-align: top;
  padding: 13px 18px;
  font-size: 13px;
  line-height: 1.6;
}

table.cmp-table td code {
  white-space: normal;
  word-break: break-word;
  font-size: 12px;
}

table.cmp-table td:nth-child(2) {
  color: var(--muted);
}

table.cmp-table td:nth-child(3) {
  color: #DDE2EC;
  background: rgba(108, 240, 166, 0.015);
}

table.cmp-table td:nth-child(3) strong {
  color: #FFFFFF;
}

table.cmp-table tbody tr:hover td:nth-child(3) {
  background: rgba(108, 240, 166, 0.04);
}

/* ── Diagrams ───────────────────────────────────────────────── */

figure.dgm-wrap {
  margin: 28px 0;
  padding: 20px 18px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-2);
  overflow-x: auto;
}
figure.dgm-wrap svg { display: block; width: 100%; height: auto; min-width: 520px; }
figure.dgm-wrap figcaption {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--faint);
}
figure.dgm-wrap figcaption b { color: var(--muted); font-weight: 600; }

/* SVG primitives (inline SVG inherits these) */
.dgm .box { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
.dgm .box.hl { fill: rgba(108, 240, 166, .06); stroke: var(--accent-line); }
.dgm .box.dim { fill: var(--bg-2); stroke: var(--border-soft); }
.dgm .store { fill: var(--panel-2); stroke: var(--border); stroke-width: 1; }
.dgm .lane { fill: none; stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 3 4; }

.dgm text { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.dgm .t-title { fill: var(--text); font-size: 11.5px; font-weight: 600; }
.dgm .t-sub { fill: var(--faint); font-size: 9.5px; }
.dgm .t-accent { fill: var(--accent); font-size: 9.5px; }
.dgm .t-warn { fill: var(--warn); font-size: 9.5px; }
.dgm .t-danger { fill: var(--danger); font-size: 9.5px; }
.dgm .t-lane {
  fill: var(--faint); font-size: 11px;
}

.dgm .flow { fill: none; stroke: var(--faint); stroke-width: 1.2; }
.dgm .flow.hl { stroke: var(--accent); stroke-width: 1.4; }
.dgm .flow.soft { stroke: var(--border); stroke-dasharray: 4 4; }
.dgm .flow.bad { stroke: var(--danger); stroke-dasharray: 4 3; }
.dgm .arrow-head { fill: var(--faint); }
.dgm .arrow-head-hl { fill: var(--accent); }
.dgm .arrow-head-bad { fill: var(--danger); }

/* Diagrams drawn at 1:1 with readable type: names and notes in the body face,
   stream and table names in mono because they are identifiers. */
figure.dgm-wrap svg.dgm-v2 { min-width: 640px; }
.dgm-v2 .nd { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
.dgm-v2 .nd.hl { stroke: var(--accent-line); }
.dgm-v2 .nd.out { fill: none; stroke-dasharray: 4 3; }
.dgm-v2 .rg { fill: none; stroke: var(--border); stroke-width: 1; }
.dgm-v2 .ed { fill: none; stroke: var(--faint); stroke-width: 1.25; }
.dgm-v2 .ed.hl { stroke: var(--accent); }
.dgm-v2 .ed.ret { stroke-dasharray: 4 3; }
.dgm-v2 .mk { fill: var(--faint); }
.dgm-v2 .mk.hl { fill: var(--accent); }
.dgm-v2 .nm { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--text); }
.dgm-v2 .nt { font-family: var(--sans); font-size: 12px; fill: var(--muted); }
.dgm-v2 .lb { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.dgm-v2 .cd { font-family: var(--mono); }
.dgm-v2 .nm.cd { font-size: 12.5px; }
.dgm-v2 .nt.cd { font-size: 11.5px; }
.dgm-v2 .ed.bad { stroke: var(--danger); }
.dgm-v2 .ed.warn { stroke: var(--warn); stroke-dasharray: 4 3; }
.dgm-v2 .mk.bad { fill: var(--danger); }
.dgm-v2 .mk.warn { fill: var(--warn); }
.dgm-v2 .bad-t { fill: var(--danger); }
.dgm-v2 .warn-t { fill: var(--warn); }
.dgm-v2 .hl-t { fill: var(--accent); }
.dgm-v2 .zone { fill: var(--warn-dim); stroke: var(--warn-line); stroke-width: 1; }
.dgm-v2 .zone.out { fill: none; stroke-dasharray: 4 3; }
.dgm-v2 .axis { fill: none; stroke: var(--border); stroke-width: 1; }
/* Narrow diagrams keep their drawn width and scroll inside the figure on phones. */
figure.dgm-wrap svg.dgm-v2.fixed { width: auto; min-width: 0; max-width: none; }

/* ── Cards ──────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  column-gap: 32px;
  margin: 20px 0 24px;
}
a.card {
  display: block;
  padding: 14px 0 16px;
  border-top: 1px solid var(--border-soft);
}
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a.card .card-t {
  display: block;
  font-family: var(--display);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  transition: color .15s;
}
a.card:hover .card-t { color: var(--accent); }
a.card .card-d { display: block; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* ── Page footer nav ────────────────────────────────────────── */

.page-nav {
  display: flex;
  gap: 12px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
}
.page-nav a {
  flex: 1;
  padding: 4px 0;
}
.page-nav a:hover .ttl { color: var(--accent); }
.page-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.page-nav .dir {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
  display: block;
  margin-bottom: 4px;
}
.page-nav .ttl { font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--text); transition: color .15s; }
.page-nav a.next { text-align: right; }

/* ── On-page TOC ────────────────────────────────────────────── */

.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 44px);
  width: var(--toc-w);
  flex-shrink: 0;
  max-height: calc(100vh - var(--topbar-h) - 80px);
  overflow-y: auto;
  padding: 0 20px 40px 0;
}
.toc-title {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 10px;
}
.toc a {
  display: block;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--faint);
  padding: 4px 0 4px 11px;
  border-left: 1px solid var(--border-soft);
}
.toc a:hover { color: var(--muted); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc a.lvl-3 { padding-left: 22px; font-size: 12px; }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .toc { display: none; }
}

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 90;
    width: 260px;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { padding: 32px 20px 100px; }
  .content h1 { font-size: 30px; }
  .lede { font-size: 15.5px; margin-bottom: 30px; }
  .page-nav { flex-direction: column; }
  .page-nav a.next { text-align: left; }
}

@media (max-width: 420px) {
  .pa-copy span.pa-full { display: none; }
}

/* ── Source link ───────────────────────────────────────────────
   Used on the Examples page to point at an example's directory on
   GitHub. Sits under the prose, reads as a destination rather than
   an inline reference, so it is deliberately not underlined like a
   normal .content link. */
/* Link to an example's source: an ordinary text link with the GitHub mark */
.content a.src-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  transition: color .15s;
}
.content a.src-link svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.content a.src-link .path { font-family: var(--mono); font-size: 13px; color: var(--text); }
.content a.src-link:hover,
.content a.src-link:hover .path { color: var(--accent); }

/* Cookbook scaffold. Each worked example runs through the same four beats, so
   the label is a small rail rather than another heading level: h2/h3 feed the
   table of contents, and twenty examples' worth of sub-headings would swamp it. */
.content .ex-step {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 24px 0 8px;
}

.content .ex-step + p,
.content .ex-step + pre,
.content .ex-step + ul,
.content .ex-step + ol {
  margin-top: 0;
}

/* ── API reference ──────────────────────────────────────────── */

.content .ep-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 10px; }
.content .ep-line .ep-path { font-size: 14px; color: var(--text); background: none; padding: 0; overflow-wrap: anywhere; }
.ep-m {
  display: inline-block;
  min-width: 52px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
}
.ep-m.ep-get { color: var(--accent); border-color: var(--accent-line); }
.ep-m.ep-post, .ep-m.ep-put, .ep-m.ep-patch { color: var(--warn); border-color: var(--warn-line); }
.ep-m.ep-delete { color: var(--danger); border-color: var(--danger); }
.content .ep-auth { font-size: 14px; }
.content .ep-status { margin-bottom: 10px; }
.content .ep-case { margin: 18px 0 8px; color: var(--muted); }
.content .ep-case .ep-code { margin-right: 6px; font-weight: 600; }
.content .ep-code-2 { color: var(--accent); }
.content .ep-code-4 { color: var(--warn); }
.content .ep-code-5 { color: var(--danger); }
.content .ep-case + pre { margin-top: 0; }
.ep-common { margin: 22px 0 6px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.ep-common > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.ep-common > summary:hover { color: var(--text); }
.ep-common > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.codeblock-caption { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.codeblock-caption .ep-code { margin-right: 6px; padding: 0; background: none; font-weight: 600; }
