/* ReleaseAPI Docs — design system
   One stylesheet. Light + dark themes driven by tokens; everything else reads tokens. */

@font-face { font-family: Inter; src: url("../fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url("../fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url("../fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url("../fonts/Inter-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: Inter; src: url("../fonts/Inter-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --brand: #00c791;
  --brand-strong: #007a56;
  --brand-ink: #006b4d;
  --brand-soft: rgba(0, 199, 145, 0.10);
  --brand-line: rgba(0, 168, 122, 0.35);
  --link: #007a56;

  --bg: #ffffff;
  --bg-soft: #f7f8f9;
  --bg-sunk: #f1f3f5;
  --panel: #ffffff;
  --line: #e7e9ec;
  --line-strong: #d5d9de;
  --text: #0e1116;
  --text-2: #3b424c;
  --muted: #646d78;
  --faint: #69717b;

  --code-bg: #0d1117;
  --code-head: #161b22;
  --code-line: rgba(255, 255, 255, 0.08);
  --code-text: #e6edf3;
  --code-muted: #8b949e;
  --inline-code-bg: #f3f4f6;
  --inline-code-text: #1f2937;
  --inline-code-line: #e5e7eb;

  --blue: #2563eb;   --blue-soft: rgba(37, 99, 235, 0.08);
  --amber: #b45309;  --amber-soft: rgba(217, 119, 6, 0.09);
  --red: #c2283c;    --red-soft: rgba(220, 38, 38, 0.08);
  --violet: #7c3aed; --violet-soft: rgba(124, 58, 237, 0.08);

  --m-get: #0a5fd1; --m-post: #007a56; --m-put: #9a5800; --m-patch: #7a3fe0; --m-delete: #c41f38;

  --header: 64px;
  --sidebar: 280px;
  --toc: 232px;
  --content: 760px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.18);
  --logo-dark: block; --logo-light: none;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #00e6a8;
  --brand-strong: #47efb8;
  --brand-ink: #70f2c7;
  --brand-soft: rgba(0, 230, 168, 0.10);
  --brand-line: rgba(0, 230, 168, 0.35);
  --link: #00e6a8;

  --bg: #0b0b0f;
  --bg-soft: #101016;
  --bg-sunk: #15151d;
  --panel: #111118;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f4f4f5;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #8a8a94;

  --code-bg: #08080c;
  --code-head: #0f0f15;
  --inline-code-bg: rgba(255, 255, 255, 0.06);
  --inline-code-text: #e4e4e7;
  --inline-code-line: rgba(255, 255, 255, 0.10);

  --blue: #60a5fa;   --blue-soft: rgba(96, 165, 250, 0.10);
  --amber: #fbbf24;  --amber-soft: rgba(251, 191, 36, 0.10);
  --red: #fb7185;    --red-soft: rgba(251, 113, 133, 0.10);
  --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, 0.10);

  --m-get: #4da3ff; --m-post: #00e6a8; --m-put: #fbbf24; --m-patch: #a78bfa; --m-delete: #fb7185;

  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 32px 80px rgba(0, 0, 0, 0.6);
  --logo-dark: none; --logo-light: block;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--brand-soft); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--brand); color: #04140e; padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 12px; }

/* Before JS boots, keep the article readable */
body:not(.ready) article.doc { max-width: var(--content); margin: 0 auto; padding: 32px 20px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--header);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); width: calc(var(--sidebar) - 34px); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand img { height: 20px; width: auto; }
.brand .logo-dark { display: var(--logo-dark); }
.brand .logo-light { display: var(--logo-light); }
.brand .mark { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line-strong); letter-spacing: 0.01em; }

.search-trigger {
  display: flex; align-items: center; gap: 10px;
  width: min(440px, 100%); height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--faint);
  font: inherit; font-size: 14px; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-trigger svg { flex-shrink: 0; }
.search-trigger span { flex: 1; }
kbd, .kbd {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; background: var(--panel); line-height: 1.5;
}
.top-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-links a, .icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.top-links a:hover, .icon-btn:hover { background: var(--bg-sunk); color: var(--text); text-decoration: none; }
.top-links a.cta { background: var(--text); color: var(--bg); margin-left: 6px; }
.top-links a.cta:hover { background: var(--text-2); color: var(--bg); }
.icon-btn { width: 36px; padding: 0; justify-content: center; }
.menu-btn { display: none; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  max-width: 1480px; margin: 0 auto;
}
.sidebar {
  position: sticky; top: var(--header);
  height: calc(100vh - var(--header));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 14px 40px 20px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.sidebar .nav-group { margin-top: 14px; }
.sidebar .nav-group:first-child { margin-top: 0; }
.sidebar .group {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 10px; border: 0; background: none; cursor: pointer; border-radius: 6px;
  font: 600 12px/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); text-align: left;
}
.sidebar .group:hover { color: var(--text-2); }
.sidebar .group .chev { margin-left: auto; transition: transform .15s; opacity: .7; }
.sidebar .nav-group.collapsed .chev { transform: rotate(-90deg); }
.sidebar .nav-group.collapsed .nav-items { display: none; }
.sidebar .gtag { font-size: 10px; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--brand-line); color: var(--brand-strong); background: var(--brand-soft); }
.sidebar .sub { margin: 10px 0 2px; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sidebar .ext-mark { color: var(--faint); font-size: 12px; }
.breadcrumb .crumb-sep { color: var(--faint); margin: 0 2px; }
.sidebar a.nav {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--text-2); font-size: 14.5px; line-height: 1.45;
}
.sidebar a.nav:hover { background: var(--bg-sunk); color: var(--text); text-decoration: none; }
.sidebar a.nav.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
:root[data-theme="dark"] .sidebar a.nav.active { color: var(--brand); }
.sidebar .tag { margin-left: auto; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 6px; }
.sidebar .ext { margin-top: 26px; padding: 14px 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 14px; }
.sidebar .ext a { color: var(--muted); }

main.main { min-width: 0; padding: 44px 56px 80px; overflow-x: clip; }
article.doc { max-width: var(--content); margin: 0 auto; }
article.doc.wide { max-width: 1040px; }

.toc { position: sticky; top: var(--header); height: calc(100vh - var(--header)); overflow-y: auto; padding: 44px 20px 40px 8px; font-size: 13.5px; }
.toc .label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.toc a { display: block; color: var(--muted); padding: 4px 0 4px 12px; border-left: 2px solid var(--line); line-height: 1.45; }
.toc a.h3 { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--brand-ink); border-left-color: var(--brand); font-weight: 500; }
:root[data-theme="dark"] .toc a.active { color: var(--brand); }
.toc .toc-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.toc .toc-foot a { border: 0; padding: 0; }

/* ---------- Typography ---------- */
.breadcrumb { display: flex; gap: 8px; align-items: center; font-size: 13.5px; font-weight: 500; color: var(--brand-strong); margin: 0 0 12px; }
:root[data-theme="dark"] .breadcrumb { color: var(--brand); }
.doc h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; margin: 0 0 14px; }
.doc .lede { font-size: 19px; line-height: 1.6; color: var(--text-2); margin: 0 0 32px; max-width: 680px; }
.doc h2 { font-size: 24px; line-height: 1.3; letter-spacing: -0.015em; font-weight: 650; margin: 56px 0 14px; padding-top: 8px; position: relative; }
.doc h3 { font-size: 18.5px; line-height: 1.4; letter-spacing: -0.01em; font-weight: 600; margin: 36px 0 10px; position: relative; }
.doc h4 { font-size: 15.5px; font-weight: 600; margin: 26px 0 8px; position: relative; }
.doc h4:hover .anchor { opacity: 1; }
.doc h2 + p, .doc h3 + p { margin-top: 0; }
.doc p, .doc li { color: var(--text-2); }
.doc p { margin: 0 0 18px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 20px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--faint); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }
.anchor { position: absolute; left: -24px; top: 50%; transform: translateY(-50%); opacity: 0; color: var(--faint); font-weight: 400; padding-right: 8px; }
.doc h2 .anchor { top: calc(50% + 4px); }
.doc h2:hover .anchor, .doc h3:hover .anchor { opacity: 1; }
.anchor:hover { color: var(--brand); text-decoration: none; }

.doc :not(pre) > code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--inline-code-bg); color: var(--inline-code-text);
  box-shadow: inset 0 0 0 1px var(--inline-code-line);
  padding: 0.1em 0.36em; border-radius: 5px; overflow-wrap: break-word;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.doc a code { color: inherit; }
.doc td code { white-space: nowrap; }
.doc td code.brk { white-space: normal; }
.doc .wrap code { white-space: normal; overflow-wrap: break-word; }
.doc td.wrap:first-child { min-width: 15rem; }

/* ---------- Callouts ---------- */
.callout {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px;
  margin: 24px 0; padding: 14px 18px;
  border: 1px solid var(--line); border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm); background: var(--blue-soft);
  font-size: 15px;
}
.callout::before { content: "i"; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; background: var(--blue); color: var(--bg); font: 700 12px/1 var(--sans); }
.callout > div > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 8px; }
.callout .title { display: block; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.callout.tip { border-left-color: var(--brand); background: var(--brand-soft); }
.callout.tip::before { content: "✓"; background: var(--brand-strong); }
.callout.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.callout.warn::before { content: "!"; background: var(--amber); }
.callout.danger { border-left-color: var(--red); background: var(--red-soft); }
.callout.danger::before { content: "!"; background: var(--red); }

/* ---------- Code ---------- */
.code {
  margin: 22px 0 26px;
  border-radius: var(--radius);
  background: var(--code-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
:root[data-theme="dark"] .code { border-color: var(--line-strong); }
.code-head {
  display: flex; align-items: center; gap: 10px;
  min-height: 42px; padding: 0 8px 0 14px;
  background: var(--code-head); border-bottom: 1px solid var(--code-line);
  color: var(--code-muted); font-size: 13px;
}
.code-head .title { font-family: var(--mono); font-size: 12.5px; color: var(--code-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-head .title .m { font-weight: 700; margin-right: 6px; }
.code-tabs { display: flex; gap: 2px; margin-left: -6px; overflow-x: auto; scrollbar-width: none; }
.code-tabs button {
  font: 500 12.5px var(--sans); color: var(--code-muted);
  background: none; border: 0; padding: 0 10px; height: 42px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.code-tabs button:hover { color: var(--code-text); }
.code-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: #00e6a8; }
.copy-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 9px; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--code-muted);
  font: 500 12px var(--sans); cursor: pointer;
}
.copy-btn:hover { color: #fff; border-color: var(--code-line); background: rgba(255,255,255,.04); }
.copy-btn.done { color: #00e6a8; }
.code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 13.25px; line-height: 1.7;
  color: var(--code-text); tab-size: 2;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.code pre code { font-family: inherit; background: none; color: inherit; padding: 0; white-space: pre; }
.code.scroll pre { max-height: 460px; }
.code .caption { padding: 10px 16px; border-top: 1px solid var(--code-line); color: var(--code-muted); font-size: 13px; background: var(--code-head); }

/* syntax tokens (code panels are always dark) */
.t-key { color: #7ee2c2; }
.t-str { color: #a5d6ff; }
.t-num { color: #ffb86b; }
.t-bool { color: #ff7b9c; }
.t-com { color: #8b949e; font-style: italic; }
.t-kw { color: #ff8fb1; }
.t-fn { color: #d2a8ff; }
.t-flag { color: #79c0ff; }
.t-var { color: #ffd479; }
.t-punc { color: #8b949e; }
.t-url { color: #e6edf3; }

/* method pills */
.m { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.m.get { color: var(--m-get); } .m.post { color: var(--m-post); } .m.put { color: var(--m-put); } .m.patch { color: var(--m-patch); } .m.delete { color: var(--m-delete); } .m.head { color: var(--m-get); }
.code .m.get { color: #4da3ff; } .code .m.post { color: #00e6a8; } .code .m.put { color: #fbbf24; } .code .m.patch { color: #a78bfa; } .code .m.delete { color: #fb7185; } .code .m.head { color: #4da3ff; }

/* ---------- Endpoint ---------- */
.endpoint {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px 0; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); font-family: var(--mono); font-size: 14px;
}
.endpoint .m { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); }
.endpoint code { color: var(--text); font-family: var(--mono); overflow-wrap: anywhere; }
.endpoint .desc { font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin-left: auto; }

.endpoints { margin: 20px 0 28px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.endpoints a, .endpoints div.row {
  color: var(--text);
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: baseline; gap: 12px;
  padding: 10px 16px; border-top: 1px solid var(--line); color: var(--text); font-size: 14px;
}
.endpoints > :first-child { border-top: 0; }
.endpoints a:hover { background: var(--bg-soft); text-decoration: none; }
.endpoints code { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.endpoints .what { color: var(--muted); font-size: 13.5px; text-align: right; }
.endpoints .head { padding: 10px 16px; background: var(--bg-soft); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); border-top: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 20px 0 28px; border: 1px solid var(--line); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.doc th { text-align: left; font-size: 12.5px; font-weight: 600; letter-spacing: .03em; color: var(--muted); background: var(--bg-soft); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.doc td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.doc tr:last-child td { border-bottom: 0; }
.doc td p { margin: 0 0 6px; } .doc td p:last-child { margin: 0; }

/* field lists (request/response attributes) */
.fields { margin: 18px 0 28px; border-top: 1px solid var(--line); }
.field { padding: 14px 0; border-bottom: 1px solid var(--line); }
.field-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 10px; margin-bottom: 4px; }
.field-head .name { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); }
.field-head .type { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.field p { margin: 0 0 6px; font-size: 15px; }
.field p:last-child { margin: 0; }
.field .enum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.field .fields { margin: 10px 0 0 4px; padding-left: 16px; border-top: 0; border-left: 2px solid var(--line); }
.field .fields .field:last-child { border-bottom: 0; }

.badge { display: inline-flex; align-items: center; font: 600 11px/1 var(--sans); letter-spacing: .03em; padding: 4px 7px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); text-transform: uppercase; }
.badge.req { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-soft); }
.badge.new { color: var(--brand-ink); border-color: var(--brand-line); background: var(--brand-soft); }
:root[data-theme="dark"] .badge.new { color: var(--brand); }
.badge.beta { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 35%, transparent); background: var(--violet-soft); }
.badge.dep { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, transparent); background: var(--amber-soft); }

/* ---------- Steps ---------- */
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 28px 0 32px; }
ol.steps > li { counter-increment: step; position: relative; padding: 0 0 26px 52px; margin: 0; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line-strong);
  font: 600 14px/1 var(--sans); color: var(--text);
}
ol.steps > li::after { content: ""; position: absolute; left: 15.5px; top: 40px; bottom: 6px; width: 1px; background: var(--line-strong); }
ol.steps > li:last-child::after { display: none; }
ol.steps > li > h3, ol.steps > li > h4, ol.steps > li > .step-title { margin: 3px 0 8px; font-size: 17px; font-weight: 600; color: var(--text); }

/* ---------- State flow ---------- */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 8px; margin: 22px 0 26px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
.flow .state { display: inline-flex; flex-direction: column; padding: 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.flow .state b { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text); }
.flow .state small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.flow .state.ok { border-color: var(--brand-line); background: var(--brand-soft); }
.flow .state.bad { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
.flow .state.wait { border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: var(--amber-soft); }
.flow .arrow { color: var(--faint); font-size: 16px; }
.flow .flow-step { display: inline-flex; align-items: center; gap: 8px; }
.flow * ~ .label { margin-top: 10px; }
.flow .label { width: 100%; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: -2px; }
.flow .branch { display: flex; flex-direction: column; gap: 8px; }

/* diagrams (inline SVG) */
.diagram { margin: 24px 0 30px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 560px; }
.diagram figcaption { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.diagram .box { fill: var(--panel); stroke: var(--line-strong); }
.diagram .box.hl { fill: var(--brand-soft); stroke: var(--brand-line); }
.diagram text { fill: var(--text); font-family: var(--sans); font-size: 13px; }
.diagram text.sub { fill: var(--muted); font-size: 11.5px; }
.diagram text.mono, .diagram tspan.mono { font-family: var(--mono); font-size: 12px; }
.diagram .edge { stroke: var(--faint); fill: none; stroke-width: 1.4; }
.diagram .edge.hl { stroke: var(--brand); }
.diagram .arrowhead { fill: var(--faint); }
/* diagram kit: status boxes, edges, sequence diagrams, bars, axes */
.diagram .box.ok { fill: var(--brand-soft); stroke: var(--brand-line); }
.diagram .box.warn { fill: var(--amber-soft); stroke: color-mix(in srgb, var(--amber) 45%, transparent); }
.diagram .box.bad { fill: var(--red-soft); stroke: color-mix(in srgb, var(--red) 45%, transparent); }
.diagram .box.info { fill: var(--blue-soft); stroke: color-mix(in srgb, var(--blue) 40%, transparent); }
.diagram .box.ghost { fill: none; stroke: var(--line-strong); stroke-dasharray: 5 4; }
.diagram .box.lane { fill: color-mix(in srgb, var(--text) 3%, transparent); stroke: var(--line); }
.diagram .edge.dash { stroke-dasharray: 5 4; }
.diagram .edge.bad { stroke: var(--red); }
.diagram .edge.warn { stroke: var(--amber); }
.diagram .edge.thick { stroke-width: 2.2; }
.diagram .arrowhead.hl { fill: var(--brand); }
.diagram .arrowhead.bad { fill: var(--red); }
.diagram .lifeline { stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 4 4; }
.diagram .activation { fill: var(--panel); stroke: var(--line-strong); }
.diagram .axis { stroke: var(--line-strong); stroke-width: 1.2; }
.diagram .tick { stroke: var(--line-strong); }
.diagram .grid { stroke: var(--line); }
.diagram .dot { fill: var(--brand-strong); }
.diagram .dot.warn { fill: var(--amber); }
.diagram .dot.bad { fill: var(--red); }
.diagram .dot.muted { fill: var(--faint); }
.diagram .seg-1 { fill: var(--brand); }
.diagram .seg-2 { fill: color-mix(in srgb, var(--brand) 60%, var(--bg)); }
.diagram .seg-3 { fill: color-mix(in srgb, var(--brand) 35%, var(--bg)); }
.diagram .seg-4 { fill: color-mix(in srgb, var(--blue) 55%, var(--bg)); }
.diagram .seg-5 { fill: color-mix(in srgb, var(--violet) 50%, var(--bg)); }
.diagram .seg-fee { fill: color-mix(in srgb, var(--text) 18%, var(--bg)); }
.diagram .seg-fee2 { fill: color-mix(in srgb, var(--text) 10%, var(--bg)); }
.diagram text.label { fill: var(--muted); font-size: 11.5px; }
.diagram text.strong { font-weight: 600; }
.diagram text.small { font-size: 11px; }
.diagram text.on-seg { fill: #04140e; font-size: 12px; font-weight: 600; }
.diagram text.ok { fill: var(--brand-strong); }
.diagram text.bad { fill: var(--red); }
.diagram text.warn { fill: var(--amber); }
.diagram .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.diagram .legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--brand); }
.diagram .legend .l-2::before { background: color-mix(in srgb, var(--brand) 60%, var(--bg)); }
.diagram .legend .l-3::before { background: color-mix(in srgb, var(--brand) 35%, var(--bg)); }
.diagram .legend .l-4::before { background: color-mix(in srgb, var(--blue) 55%, var(--bg)); }
.diagram .legend .l-5::before { background: color-mix(in srgb, var(--violet) 50%, var(--bg)); }
.diagram .legend .l-fee::before { background: color-mix(in srgb, var(--text) 18%, var(--bg)); }
.diagram .legend .l-warn::before { background: var(--amber); }
.diagram .legend .l-bad::before { background: var(--red); }

/* timeline (HTML): horizontal on wide screens, vertical on narrow */
ol.timeline { list-style: none; margin: 24px 0 30px; padding: 22px 20px 18px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
ol.timeline::before { content: ""; position: absolute; left: 28px; right: 28px; top: 35px; height: 2px; background: var(--line-strong); }
ol.timeline > li { position: relative; margin: 0; padding-top: 28px; min-width: 0; }
ol.timeline > li::before { content: ""; position: absolute; top: 7px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 2px solid var(--brand); box-sizing: border-box; }
ol.timeline > li.warn::before { border-color: var(--amber); }
ol.timeline > li.bad::before { border-color: var(--red); }
ol.timeline > li.ok::before { background: var(--brand); }
ol.timeline > li.muted::before { border-color: var(--faint); }
ol.timeline .when { display: block; font: 600 12px/1.3 var(--mono); color: var(--brand-strong); margin-bottom: 4px; }
:root[data-theme="dark"] ol.timeline .when { color: var(--brand); }
ol.timeline > li.warn .when { color: var(--amber); }
ol.timeline > li.bad .when { color: var(--red); }
ol.timeline b { display: block; font-size: 14px; color: var(--text); line-height: 1.35; }
ol.timeline small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
@media (max-width: 900px) {
  ol.timeline { grid-auto-flow: row; grid-auto-columns: auto; padding-left: 40px; }
  ol.timeline::before { left: 26px; right: auto; top: 26px; bottom: 26px; width: 2px; height: auto; }
  ol.timeline > li { padding-top: 0; }
  ol.timeline > li::before { left: -21px; top: 3px; }
}

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 22px 0 30px; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 18px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.card:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.card .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); margin-bottom: 6px; }
:root[data-theme="dark"] .card .ico { color: var(--brand); }
.card .ico svg { width: 18px; height: 18px; }
.card h3, .card .card-title { margin: 0; font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.card .more { margin-top: auto; padding-top: 8px; font-size: 13.5px; font-weight: 500; color: var(--brand-strong); }
:root[data-theme="dark"] .card .more { color: var(--brand); }

/* ---------- Split (prose + sticky code) ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; margin: 8px 0 24px; }
.split > .side { position: sticky; top: calc(var(--header) + 20px); }
.split > .side .code { margin-top: 0; }

/* ---------- Details ---------- */
details.more { margin: 16px 0 24px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
details.more > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 15px; color: var(--text); list-style: none; display: flex; align-items: center; gap: 10px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "›"; display: inline-block; transition: transform .15s; color: var(--faint); font-size: 18px; line-height: 1; }
details.more[open] > summary::before { transform: rotate(90deg); }
details.more > .body { padding: 0 18px 4px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- Definition list ---------- */
dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 18px 0 26px; }
dl.terms dt { font-weight: 600; color: var(--text); font-size: 15px; }
dl.terms dt code { font-size: 13px; }
dl.terms dd { margin: 0; color: var(--text-2); font-size: 15px; }

/* ---------- Hero (home) ---------- */
.hero { position: relative; padding: 18px 0 34px; margin-bottom: 18px; }
.hero::before {
  content: ""; position: absolute; inset: -60px -40px auto -40px; height: 340px; z-index: -1;
  background:
    radial-gradient(600px 220px at 15% 10%, var(--brand-soft), transparent 70%),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 0) 0 0 / 22px 22px;
  mask-image: radial-gradient(ellipse 60% 100% at 45% 0%, #000 25%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 60% 100% at 45% 0%, #000 25%, transparent 72%);
}
.hero h1 { font-size: clamp(34px, 5vw, 50px); letter-spacing: -0.035em; line-height: 1.08; max-width: 720px; }
.hero .lede { font-size: 20px; max-width: 640px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; font-weight: 600; font-size: 15px; border: 1px solid var(--line-strong); color: var(--text); background: var(--panel); }
.btn:hover { text-decoration: none; border-color: var(--brand-line); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #04140e; }
.btn.primary:hover { background: var(--brand); filter: brightness(0.94); color: #04140e; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); background: var(--panel); }
.pill code { font-size: 12px !important; }

/* ---------- Pager & footer ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.pager a:hover { border-color: var(--brand-line); text-decoration: none; }
.pager a.next { text-align: right; grid-column: 2; }
.pager small { color: var(--faint); font-size: 12.5px; }
.pager b { font-weight: 600; font-size: 15px; }
.page-foot { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; font-size: 13.5px; color: var(--faint); }
.page-foot a { color: var(--muted); }

/* ---------- API reference (openapi/index.html) ----------
   RapiDoc fills the viewport under the top bar and brings its own operation nav; the guide sidebar is a drawer.
   Colours and fonts are mapped onto RapiDoc's custom properties by docs.js (themeRapiDoc). */
.top-links a.current { color: var(--text); background: var(--bg-sunk); }
.api-page .menu-btn { display: inline-flex; }
.api-page .sidebar {
  position: fixed; top: var(--header); left: 0; bottom: 0; z-index: 45;
  width: min(320px, 86vw); height: auto; background: var(--bg);
  transform: translateX(-100%); transition: transform .2s ease, visibility .2s;
  visibility: hidden;
}
.api-page.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
.api-page .backdrop { position: fixed; inset: var(--header) 0 0 0; z-index: 44; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.api-page.nav-open .backdrop { opacity: 1; pointer-events: auto; }
.api-page .brand { width: auto; margin-right: 8px; }
.api-page .search-trigger { margin-left: auto; }
main.api-ref { height: calc(100vh - var(--header)); height: calc(100dvh - var(--header)); }
main.api-ref rapi-doc { display: block; width: 100%; height: 100%; }
.api-intro { max-width: var(--content); margin: 0 0 8px; font-size: 16px; line-height: 1.7; }
.api-intro .lede { margin-bottom: 8px; }
.api-intro h2 { margin: 40px 0 12px; padding-top: 0; }
.api-intro table { display: block; overflow-x: auto; margin: 0 0 18px; }
.api-intro td:last-child { min-width: 220px; }
.api-intro .api-note { font-size: 14px; color: var(--muted); }
.api-map .state b { font-family: var(--sans); font-size: 13.5px; }
.api-map .state small { font-size: 12.5px; }
.api-map .state small a { color: var(--link); }
rapi-doc::part(section-navbar) { border-right: 1px solid var(--line); }
rapi-doc::part(section-navbar-scroll) { scrollbar-width: thin; }
rapi-doc::part(btn) { border-radius: 8px; font-family: var(--sans); font-weight: 600; }
rapi-doc::part(textbox) { border-radius: 8px; }
rapi-doc::part(label-operation-method) { font-family: var(--mono); font-weight: 700; }
rapi-doc::part(section-overview-title) { letter-spacing: -0.025em; font-weight: 700; }

/* ---------- Search modal ---------- */
.search-modal { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; background: rgba(8, 10, 14, 0.5); backdrop-filter: blur(4px); }
.search-box { width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-box .input-row { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.search-box input { flex: 1; height: 56px; border: 0; outline: 0; background: none; color: var(--text); font: 17px var(--sans); }
.search-box .results { overflow-y: auto; padding: 8px; }
.search-box .results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.search-box .results a:hover { text-decoration: none; }
.search-box .results a.active { background: var(--brand-soft); }
.search-box .results .r-page { font-size: 12px; color: var(--faint); font-weight: 500; }
.search-box .results .r-title { font-weight: 600; font-size: 15px; }
.search-box .results .r-snip { font-size: 13.5px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-box .results mark { background: none; color: var(--brand-strong); font-weight: 600; }
:root[data-theme="dark"] .search-box .results mark { color: var(--brand); }
.search-box .results .empty { padding: 28px; text-align: center; color: var(--faint); }
.search-box .foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); background: var(--bg-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .toc { display: none; }
  .split { grid-template-columns: 1fr; }
  .split > .side { position: static; }
}
@media (max-width: 900px) {
  :root { --header: 58px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .brand { width: auto; }
  .brand .mark { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; margin-left: auto; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .top-links { margin-left: 0; }
  .top-links a:not(.keep) { display: none; }
  .sidebar {
    position: fixed; top: var(--header); left: 0; bottom: 0; z-index: 45;
    width: min(320px, 86vw); height: auto; background: var(--bg);
    transform: translateX(-100%); transition: transform .2s ease, visibility .2s;
    visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .backdrop { position: fixed; inset: var(--header) 0 0 0; z-index: 44; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  main.main { padding: 28px 18px 64px; }
  .anchor { display: none; }
  .endpoint .desc { margin-left: 0; width: 100%; }
  .endpoints a, .endpoints div.row { grid-template-columns: 56px minmax(0, 1fr); }
  .endpoints .what { grid-column: 2; text-align: left; }
  dl.terms { grid-template-columns: 1fr; gap: 2px; }
  dl.terms dd { margin-bottom: 12px; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .sidebar, .toc, .pager, .copy-btn, .backdrop { display: none !important; }
  .layout { display: block; }
  .code { break-inside: avoid; }
}

/* inline-code resets inside components */
.doc .endpoint code, .doc .endpoints code, .doc .code .caption code {
  background: none; padding: 0; border-radius: 0; color: inherit; font-size: inherit; white-space: normal;
}
.doc .code .caption code { color: var(--code-text); font-size: 12.5px; }
.doc .field .enum code, .doc .pill code { color: var(--text-2); background: var(--bg-sunk); border: 1px solid var(--line); }

/* At a glance: key facts at the top of long guides */
.glance { margin: 0 0 34px; padding: 18px 20px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
.glance > .glance-title { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.glance ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 28px; }
.glance li { position: relative; padding: 0 0 12px 18px; margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.glance li::before { content: ""; position: absolute; left: 0; top: 9px; width: 7px; height: 7px; border-radius: 2px; background: var(--brand); }

/* ---------- Typesetting ---------- */
.doc p, .doc li, .doc dd, .callout, .card p, .doc figcaption { text-wrap: pretty; }
.doc h1, .doc h2, .doc h3, .doc h4, .lede, .card h3 { text-wrap: balance; }
.doc { hanging-punctuation: first; }
.doc table { font-variant-numeric: tabular-nums; }
.doc td { hyphens: auto; -webkit-hyphens: auto; }
.doc td code, .doc th code { font-size: 0.84em; }
/* section rhythm: a hairline above each h2 separates the parts of long guides */
.doc > h2 { margin-top: 64px; padding-top: 30px; border-top: 1px solid var(--line); }
.doc > h2:first-of-type, .doc > .glance + h2, .doc.home > h2 { border-top: 0; padding-top: 8px; }
.doc > h2 .anchor { top: calc(50% + 15px); }
.doc h4 { font-size: 15.5px; font-weight: 600; color: var(--text); margin: 28px 0 8px; }
.doc li > p { margin-bottom: 8px; }
.doc ul ul, .doc ol ul { margin-top: 6px; margin-bottom: 6px; }
.doc strong code { font-weight: 600; }
/* links that are code: keep the link colour on the text */
.doc a > code { color: var(--link); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 25%, transparent); }
.doc .endpoint code, .doc .endpoints code, .doc .code .caption code, .doc .code-head code, .doc .field-head code { box-shadow: none; background: none; }

/* ---------- Typesetting refinements (from the per-page pass) ---------- */
.code pre { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.doc :not(pre) > code { font-variant-ligatures: none; }
.doc :not(pre) > code:not(.brk) { white-space: nowrap; }
.doc td:first-child > code.brk { white-space: nowrap; }
.doc td small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; }
dl.terms { grid-template-columns: minmax(7rem, 14rem) minmax(0, 1fr); }
dl.terms dt { overflow-wrap: anywhere; }
.field ul, .field ol { margin: 4px 0 6px; }
.field li { font-size: 15px; margin: 3px 0; }
.doc td.wrap:first-child { min-width: 12rem; }
.doc .pill code { box-shadow: none; background: none; border: 0; padding: 0; }
.endpoints a, .endpoints div.row { grid-template-columns: 64px minmax(0, 1.6fr) minmax(0, 1fr); }
ol.steps > li:last-child { padding-bottom: 0; }
ol.steps { margin-bottom: 36px; }
.glance li:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .code pre { font-size: 12px; }
  .doc td, .doc th { padding: 9px 10px; }
  .doc td { min-width: 8rem; }
}
@media (max-width: 900px) {
  dl.terms { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.terms dd { margin-bottom: 12px; }
}

/* ---------- Accessibility ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
main.main:focus { outline: none; }
.table-wrap:focus-visible, .code pre:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.code-tabs button:focus-visible, .copy-btn:focus-visible { outline: 2px solid #00e6a8; outline-offset: -2px; }
.sidebar .group:focus-visible, .sidebar a.nav:focus-visible, .toc a:focus-visible { outline-offset: -2px; }
/* a code that is the whole cell keeps its line; the table scrolls instead of splitting the code */
.doc td > code.brk:only-child { white-space: nowrap; }

@media (max-width: 600px) {
  .doc td:first-child > code.brk, .doc td code.brk { white-space: normal; }
}

/* ---------- Page tools: copy / view the page as Markdown ---------- */
.breadcrumb { flex-wrap: wrap; row-gap: 6px; }
.page-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.page-tools-row { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.page-tool {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel);
  color: var(--text-2); font: 500 12.5px/1 var(--sans); cursor: pointer; text-decoration: none;
}
.page-tool:hover { border-color: var(--brand-line); color: var(--text); text-decoration: none; }
.page-tool svg { width: 13px; height: 13px; }
.page-tool.done { color: var(--brand-ink); border-color: var(--brand-line); }
:root[data-theme="dark"] .page-tool.done { color: var(--brand); }
@media print { .page-tools, .page-tools-row { display: none; } }

/* ---------- Scroll cue for wide tables and diagrams ---------- */
.table-wrap.can-scroll, .diagram.can-scroll {
  background-image: linear-gradient(to left, color-mix(in srgb, var(--text) 10%, transparent), transparent 28px);
  background-repeat: no-repeat; background-position: right top; background-attachment: local, scroll;
  background-size: 28px 100%;
}
.diagram.can-scroll { background-color: var(--bg-soft); }
.table-wrap.can-scroll.at-end, .diagram.can-scroll.at-end { background-image: none; }
.table-wrap.can-scroll::before, .diagram.can-scroll::before {
  content: "Scroll sideways →"; display: block; position: sticky; left: 0;
  font: 500 11.5px/1 var(--sans); color: var(--muted); padding: 8px 12px 0;
}
.diagram.can-scroll::before { padding: 0 0 10px; }
.table-wrap.can-scroll.at-end::before, .diagram.can-scroll.at-end::before { visibility: hidden; }
/* diagram text never smaller than 12px in viewBox units */
.diagram text.small, .diagram text.label, .diagram text.sub { font-size: 12px; }

/* code tabs never slide under the copy button; on phones the button shrinks to its icon */
.code-head .code-tabs { flex: 1 1 auto; min-width: 0; }
.code-head .copy-btn { flex-shrink: 0; }
@media (max-width: 600px) { .code-head .copy-btn span { display: none; } .code-head .copy-btn { padding: 0 7px; } }
