/* ===================================================================
   Intelligence API — Shared Documentation Styles
   Single source of truth for all docs pages.
   =================================================================== */

/* ----- Custom Properties (Light) ----- */
:root {
  --bg: #eef1ff;
  --ink: #10202b;
  --ink-soft: #486071;
  --accent: #5b6cff;
  --accent-strong: #4454dc;
  --accent-soft: rgba(91, 108, 255, 0.14);
  --warm: #8c7cff;
  --warm-soft: rgba(140, 124, 255, 0.14);
  --sidebar-width: 286px;
  --topbar-height: 72px;
  --border: rgba(16, 32, 43, 0.1);
  --panel: rgba(255, 255, 255, 0.84);
  --panel-muted: rgba(16, 32, 43, 0.04);
  --code-block-bg: #12202d;
  --code-block-text: #e2ece7;
  --tag-bg: rgba(91, 108, 255, 0.14);
  --tag-text: #5b6cff;
  --pro-bg: rgba(140, 124, 255, 0.16);
  --pro-text: #5f52d5;
  --green: #5b6cff;
  --red: #c2410c;
  --shadow: 0 24px 64px rgba(16, 32, 43, 0.12);
  --font-sans: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --page-glow-a: rgba(91, 108, 255, 0.18);
  --page-glow-b: rgba(140, 124, 255, 0.16);
  --page-grad-start: #f7f8ff;
  --page-grad-mid: #eef0ff;
  --page-grad-end: #e8ebff;
  --grid-line: rgba(16, 32, 43, 0.03);
  --grid-mask: rgba(0, 0, 0, 0.12);
  --topbar-border: rgba(16, 32, 43, 0.08);
  --topbar-bg: rgba(247, 250, 248, 0.84);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-shadow: 0 14px 28px rgba(16, 32, 43, 0.08);
  --nav-hover-bg: rgba(91, 108, 255, 0.12);
  --sidebar-toggle-bg: rgba(255, 255, 255, 0.88);
  --sidebar-toggle-border: rgba(16, 32, 43, 0.08);
  --sidebar-toggle-shadow: 0 18px 36px rgba(16, 32, 43, 0.14);
  --sidebar-backdrop: rgba(16, 32, 43, 0.36);
  --sidebar-bg: rgba(16, 32, 43, 0.92);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-heading: #f6fbf9;
  --sidebar-copy: rgba(226, 236, 231, 0.7);
  --sidebar-section-ink: rgba(226, 236, 231, 0.44);
  --sidebar-link: rgba(226, 236, 231, 0.74);
  --sidebar-link-active: #f7fbf9;
  --sidebar-link-bg: rgba(91, 108, 255, 0.18);
  --control-bg: rgba(255, 255, 255, 0.88);
  --control-soft-bg: rgba(255, 255, 255, 0.72);
  --control-shadow: 0 16px 28px rgba(16, 32, 43, 0.08);
  --hero-glow: rgba(91, 108, 255, 0.22);
  --hero-spot: rgba(140, 124, 255, 0.18);
  --hero-bg-start: rgba(91, 108, 255, 0.1);
  --hero-bg-end: rgba(255, 255, 255, 0.88);
  --hero-panel-bg-start: rgba(91, 108, 255, 0.1);
  --hero-panel-bg-end: rgba(255, 255, 255, 0.92);
  --hero-panel-border: rgba(16, 32, 43, 0.08);
  --metric-bg: rgba(255, 255, 255, 0.82);
  --card-hover-border: rgba(91, 108, 255, 0.24);
  --card-hover-shadow: 0 28px 56px rgba(16, 32, 43, 0.14);
  --section-accent-line: rgba(140, 124, 255, 0.45);
  --accent-line: rgba(91, 108, 255, 0.45);
  --code-inline-border: rgba(91, 108, 255, 0.16);
  --code-block-border: rgba(91, 108, 255, 0.12);
  --code-block-start: #152532;
  --code-block-end: #0f1b26;
  --code-block-inset: rgba(255, 255, 255, 0.04);
  --tag-required-bg: rgba(194, 65, 12, 0.12);
  --tag-required-text: #9a3412;
  --tag-optional-bg: rgba(91, 108, 255, 0.12);
  --tag-optional-text: #5b6cff;
  --endpoint-border: rgba(91, 108, 255, 0.14);
  --endpoint-bg: rgba(255, 255, 255, 0.82);
  --endpoint-shadow: 0 16px 28px rgba(16, 32, 43, 0.08);
  --table-head-bg: rgba(91, 108, 255, 0.08);
  --table-cell-bg: rgba(255, 255, 255, 0.88);
  --note-border: rgba(91, 108, 255, 0.16);
  --note-bg-start: rgba(91, 108, 255, 0.1);
  --note-bg-end: rgba(255, 255, 255, 0.84);
  --note-warn-border: rgba(140, 124, 255, 0.2);
  --note-warn-start: rgba(140, 124, 255, 0.1);
  --note-warn-end: rgba(255, 255, 255, 0.84);
  --lang-tab-border: rgba(16, 32, 43, 0.08);
  --lang-tab-bg: rgba(255, 255, 255, 0.74);
  --lang-tab-hover-border: rgba(91, 108, 255, 0.18);
  --lang-tab-hover-bg: rgba(91, 108, 255, 0.12);
  --divider: rgba(16, 32, 43, 0.08);
  --on-accent: #f5fbf9;
  --theme-toggle-bg: rgba(255, 255, 255, 0.72);
  --theme-toggle-border: rgba(16, 32, 43, 0.08);
  --theme-toggle-shadow: 0 14px 28px rgba(16, 32, 43, 0.08);
  --theme-toggle-label: var(--ink);
  --theme-icon-dark: #0b1220;
  --theme-icon-light: #f8fbff;
  --theme-icon-ring: rgba(125, 140, 168, 0.46);
  --theme-icon-divider: rgba(125, 140, 168, 0.58);
  --scroll-edge: rgba(16, 32, 43, 0.34);
}

/* ----- Custom Properties (Dark) ----- */
html[data-theme="dark"] {
  --bg: #09121b;
  --ink: #f3f7ff;
  --ink-soft: #a9bbcf;
  --accent: #8d9cff;
  --accent-strong: #bcc7ff;
  --accent-soft: rgba(141, 156, 255, 0.18);
  --warm: #b094ff;
  --warm-soft: rgba(176, 148, 255, 0.18);
  --border: rgba(169, 187, 207, 0.16);
  --panel: rgba(10, 18, 28, 0.84);
  --panel-muted: rgba(169, 187, 207, 0.08);
  --code-block-bg: #08111a;
  --code-block-text: #e6eef8;
  --tag-bg: rgba(141, 156, 255, 0.2);
  --tag-text: #d4dcff;
  --pro-bg: rgba(176, 148, 255, 0.22);
  --pro-text: #e0d2ff;
  --green: #8d9cff;
  --red: #ff9f6b;
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.4);
  --page-glow-a: rgba(91, 108, 255, 0.26);
  --page-glow-b: rgba(140, 124, 255, 0.2);
  --page-grad-start: #0b1220;
  --page-grad-mid: #0a1320;
  --page-grad-end: #081018;
  --grid-line: rgba(169, 187, 207, 0.06);
  --grid-mask: rgba(0, 0, 0, 0.4);
  --topbar-border: rgba(169, 187, 207, 0.12);
  --topbar-bg: rgba(8, 14, 22, 0.84);
  --nav-bg: rgba(15, 24, 37, 0.82);
  --nav-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
  --nav-hover-bg: rgba(141, 156, 255, 0.16);
  --sidebar-toggle-bg: rgba(15, 24, 37, 0.9);
  --sidebar-toggle-border: rgba(169, 187, 207, 0.12);
  --sidebar-toggle-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  --sidebar-backdrop: rgba(0, 0, 0, 0.56);
  --sidebar-bg: rgba(6, 11, 18, 0.96);
  --sidebar-border: rgba(169, 187, 207, 0.1);
  --sidebar-heading: #f3f7ff;
  --sidebar-copy: rgba(169, 187, 207, 0.76);
  --sidebar-section-ink: rgba(169, 187, 207, 0.52);
  --sidebar-link: rgba(196, 209, 223, 0.78);
  --sidebar-link-active: #f3f7ff;
  --sidebar-link-bg: rgba(141, 156, 255, 0.18);
  --control-bg: rgba(15, 24, 37, 0.88);
  --control-soft-bg: rgba(15, 24, 37, 0.78);
  --control-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  --hero-glow: rgba(141, 156, 255, 0.24);
  --hero-spot: rgba(176, 148, 255, 0.18);
  --hero-bg-start: rgba(91, 108, 255, 0.18);
  --hero-bg-end: rgba(12, 22, 35, 0.96);
  --hero-panel-bg-start: rgba(91, 108, 255, 0.18);
  --hero-panel-bg-end: rgba(12, 22, 35, 0.96);
  --hero-panel-border: rgba(169, 187, 207, 0.1);
  --metric-bg: rgba(18, 29, 44, 0.86);
  --card-hover-border: rgba(141, 156, 255, 0.34);
  --card-hover-shadow: 0 30px 64px rgba(0, 0, 0, 0.34);
  --section-accent-line: rgba(176, 148, 255, 0.5);
  --accent-line: rgba(141, 156, 255, 0.55);
  --code-inline-border: rgba(141, 156, 255, 0.24);
  --code-block-border: rgba(141, 156, 255, 0.16);
  --code-block-start: #0b1723;
  --code-block-end: #08111a;
  --code-block-inset: rgba(255, 255, 255, 0.03);
  --tag-required-bg: rgba(255, 159, 107, 0.16);
  --tag-required-text: #ffd2b8;
  --tag-optional-bg: rgba(141, 156, 255, 0.16);
  --tag-optional-text: #d4dcff;
  --endpoint-border: rgba(141, 156, 255, 0.2);
  --endpoint-bg: rgba(14, 24, 37, 0.88);
  --endpoint-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  --table-head-bg: rgba(141, 156, 255, 0.12);
  --table-cell-bg: rgba(13, 23, 35, 0.88);
  --note-border: rgba(141, 156, 255, 0.22);
  --note-bg-start: rgba(141, 156, 255, 0.12);
  --note-bg-end: rgba(14, 25, 38, 0.92);
  --note-warn-border: rgba(176, 148, 255, 0.24);
  --note-warn-start: rgba(176, 148, 255, 0.12);
  --note-warn-end: rgba(14, 25, 38, 0.92);
  --lang-tab-border: rgba(169, 187, 207, 0.12);
  --lang-tab-bg: rgba(15, 24, 37, 0.78);
  --lang-tab-hover-border: rgba(141, 156, 255, 0.2);
  --lang-tab-hover-bg: rgba(141, 156, 255, 0.16);
  --divider: rgba(169, 187, 207, 0.14);
  /* Dark, not light: in this theme the accent gradient runs from #8d9cff to
     #bcc7ff, and near-white text on it measured between 1.5:1 and 2.4:1. */
  --on-accent: #0b1220;
  --theme-toggle-bg: rgba(15, 24, 37, 0.82);
  --theme-toggle-border: rgba(169, 187, 207, 0.12);
  --theme-toggle-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  --theme-toggle-label: #f3f7ff;
  --theme-icon-ring: rgba(196, 209, 223, 0.54);
  --theme-icon-divider: rgba(196, 209, 223, 0.62);
  --scroll-edge: rgba(0, 0, 0, 0.8);
}

/* ----- Reset & Base ----- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Derived from the bar rather than restated, because the mobile bar is 132px
     and a fixed 112px put the target 20px *behind* it — a hash link scrolled to
     a heading the reader could not see. The +40 keeps the desktop value at the
     112px it has always been. */
  scroll-padding-top: calc(var(--topbar-height) + 40px);
  color-scheme: light;
  /* iOS inflates text in narrow blocks unless this is pinned, which silently
     widens code and table cells past the widths measured here. */
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink-soft);
  /* Prose here includes config keys, header names and URLs written as plain
     text — the changelog is authored in YAML, so anything can appear. Any one
     of them is wider than a phone's content column and would otherwise paint
     past it. Code blocks opt back out; they scroll instead. */
  overflow-wrap: break-word;
  background:
    radial-gradient(circle at 0 0, var(--page-glow-a), transparent 28rem),
    radial-gradient(circle at 100% 0, var(--page-glow-b), transparent 24rem),
    linear-gradient(180deg, var(--page-grad-start) 0%, var(--page-grad-mid) 54%, var(--page-grad-end) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, var(--grid-mask), transparent 70%);
}

/* Two locks, not one: shell-open is also what slides the mobile drawer out, so
   the search overlay taking it would open the drawer behind itself. */
body.shell-open,
body.search-open { overflow: hidden; }

/* ----- Links ----- */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

/* ----- Topbar ----- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 160;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--topbar-border);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar-brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--warm) 100%);
  box-shadow: 0 0 0 6px rgba(91, 108, 255, 0.14);
}

.topbar-brand span { color: var(--accent); }

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--topbar-border);
  border-radius: 999px;
  background: var(--nav-bg);
  box-shadow: var(--nav-shadow);
}

.topbar-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.topbar-nav a.active,
.topbar-nav a:hover {
  color: var(--ink);
  background: var(--nav-hover-bg);
}

/* ----- Theme Toggle ----- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 999px;
  background: var(--theme-toggle-bg);
  box-shadow: var(--theme-toggle-shadow);
  color: var(--theme-toggle-label);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.theme-toggle:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--theme-toggle-shadow);
}

.theme-toggle-glyph {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--accent-soft);
  border-radius: 999px;
}

.theme-toggle-glyph svg {
  display: block;
  width: 100%;
  height: 100%;
}

.theme-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ----- Sidebar (subpages) ----- */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 18px;
  z-index: 190;
  width: 42px;
  height: 42px;
  border: 1px solid var(--sidebar-toggle-border);
  border-radius: 14px;
  background: var(--sidebar-toggle-bg);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--sidebar-toggle-shadow);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 145;
  background: var(--sidebar-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 24px 14px 28px;
  overflow-y: auto;
  z-index: 150;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  backdrop-filter: blur(18px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.sidebar-brand {
  padding: 0 10px 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand h2 {
  color: var(--sidebar-heading);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sidebar-brand span {
  display: block;
  margin-top: 4px;
  color: var(--sidebar-copy);
  font-size: 13px;
}

.sidebar-section { margin-bottom: 14px; }

.sidebar-section-title {
  padding: 8px 10px 6px;
  color: var(--sidebar-section-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--sidebar-link);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--sidebar-link-active);
  background: var(--sidebar-link-bg);
  transform: translateX(2px);
}

.sidebar a.indent {
  padding-left: 24px;
  font-size: 13px;
}

.sidebar-overview {
  margin-bottom: 18px;
  padding: 0 10px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-overview a {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer {
  margin-top: 14px;
  padding: 14px 10px 0;
  border-top: 1px solid var(--sidebar-border);
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

.sidebar-footer-copy {
  color: var(--sidebar-copy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.sidebar-footer-link,
.sidebar-footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--sidebar-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--sidebar-link);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-footer-link {
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

.sidebar-footer-icon {
  width: 38px;
  justify-self: center;
  padding: 0;
}

.sidebar-footer-link:hover,
.sidebar-footer-icon:hover {
  color: var(--sidebar-link-active);
  background: var(--sidebar-link-bg);
  transform: translateY(-1px);
}

.sidebar-footer-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ----- Layout: Main (sidebar pages) ----- */
.main {
  margin-left: var(--sidebar-width);
  max-width: 1040px;
  padding: calc(var(--topbar-height) + 34px) 42px 96px;
}

/* ----- Layout: Page Shell (overview) ----- */
.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 32px 32px;
}

/* ----- Hero (subpage single-column) ----- */
.hero {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, var(--hero-spot), transparent 38%),
    linear-gradient(180deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 10ch;
  color: var(--ink);
  font-size: clamp(2.4rem, 4vw, 3.5rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero p {
  max-width: 68ch;
  margin-top: 14px;
  font-size: 17px;
  color: var(--ink-soft);
}

/* ----- Eyebrow ----- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent-line);
}

/* ----- Hero Actions ----- */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}

/* ----- Base URL, Version Pill, Support Link ----- */
/* Wraps rather than holding one line: the base URL plus the version pill is
   wider than a phone's content column, and the hero clips its overflow, so an
   unwrapped row lost the end of the URL entirely. */
.base-url {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 100%;
  overflow-wrap: anywhere;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--code-inline-border);
  border-radius: 18px;
  background: var(--control-bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  box-shadow: var(--control-shadow);
}

.version-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.support-link {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--control-soft-bg);
  color: var(--ink);
  font-weight: 600;
}

/* ----- Typography ----- */
h2 {
  margin: 46px 0 16px;
  padding-top: 6px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2:first-of-type { margin-top: 0; }

h3 {
  margin: 32px 0 12px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

h4 {
  margin: 24px 0 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

p { margin-bottom: 12px; }
strong { color: var(--ink); }
ul { margin-top: 12px; padding-left: 20px; }
li + li { margin-top: 8px; }

/* ----- Code ----- */
/* Inline code is where the unbreakable tokens live — header names, IPv6
   addresses, lookup names. A single one of those is wider than a phone's
   content column, and without a break opportunity it pushes its table cell,
   its table, and then the whole document sideways. */
code {
  padding: 2px 6px;
  border: 1px solid var(--code-inline-border);
  border-radius: 8px;
  background: var(--panel-muted);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-wrap: break-word;
}

pre {
  margin: 16px 0 22px;
  padding: 18px 20px;
  overflow-x: auto;
  /* Keep a sideways swipe inside the code block instead of handing it to the
     page once the block hits its end. */
  overscroll-behavior-x: contain;
  border: 1px solid var(--code-block-border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--code-block-start) 0%, var(--code-block-end) 100%);
  box-shadow: inset 0 1px 0 var(--code-block-inset);
  line-height: 1.58;
}

/* Code blocks scroll rather than wrap: a re-wrapped payload example is no
   longer the JSON the caller would send. */
pre code {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--code-block-text);
  font-size: 13px;
  overflow-wrap: normal;
}

.kw { color: #b9a6ff; }
.str { color: #c7e9b0; }
.num { color: #f4a261; }
.cmt { color: #6f8492; }
.url { color: #7dd3fc; }
.hdr { color: #8ee6d7; }
.flag { color: #f28482; }

/* ----- Code Block Copy ----- */
/* The wrapper and the button are injected by docs.js, so nothing here applies
   until the script runs — with JavaScript off the block keeps its own margin
   and padding and is simply selectable, as it was.

   The button sits in the wrapper rather than in the <pre>, because a <pre> is
   its own horizontal scroll container: a control inside one scrolls away with
   the code. The top padding is the block's, not the button's — reserving the
   room in the code box is the only way a long first line cannot pass under the
   control, since padding-right on a scroll container is only honoured at the
   end of the scrollable content. */
.code-block {
  position: relative;
  margin: 16px 0 22px;
}

.code-block > pre {
  margin: 0;
  padding-top: 46px;
}

.code-copy {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 5px 11px;
  /* Not themed: the code block is dark in light mode too, so a token that
     flipped with the theme would put dark text on a dark block. */
  border: 1px solid rgba(226, 236, 231, 0.22);
  border-radius: 999px;
  background: rgba(226, 236, 231, 0.08);
  color: var(--code-block-text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

/* Wide enough for the longest of the three labels, so confirming a copy does
   not resize the control under the pointer that just clicked it. */
.code-copy-label {
  display: inline-block;
  min-width: 7ch;
  text-align: center;
}

.code-copy:hover {
  border-color: rgba(226, 236, 231, 0.4);
  background: rgba(226, 236, 231, 0.16);
}

.code-copy.is-copied {
  border-color: rgba(199, 233, 176, 0.5);
  color: #c7e9b0;
}

/* The block is dark in both themes, so the accent outline the rest of the page
   uses is the one thing here that does not read against it. */
.code-copy:focus-visible {
  outline-color: var(--code-block-text);
}

/* ----- Search ----- */
.docs-search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 999px;
  background: var(--theme-toggle-bg);
  box-shadow: var(--theme-toggle-shadow);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.docs-search-trigger:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--theme-toggle-shadow);
}

.docs-search-trigger svg {
  width: 20px;
  height: 20px;
}

.docs-search {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.docs-search[hidden] { display: none; }

.docs-search-backdrop {
  position: absolute;
  inset: 0;
  background: var(--sidebar-backdrop);
}

/* Anchored near the top rather than centred: the reader is looking down a list
   of results, and a centred panel jumps position as the list grows. */
.docs-search-panel {
  position: relative;
  /* A percentage of the overlay, not of 100vw: vw counts the scrollbar the
     page still has under the panel, and the panel would overhang by its
     width. */
  width: min(640px, calc(100% - 32px));
  max-height: min(70vh, 560px);
  margin: min(12vh, 96px) auto 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.docs-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--divider);
  color: var(--ink-soft);
}

.docs-search-field svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.docs-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
}

.docs-search-input:focus { outline: none; }
.docs-search-input::placeholder { color: var(--ink-soft); }

.docs-search-results {
  margin: 0;
  padding: 6px 0 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.docs-search-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.docs-search-result.is-active { background: var(--accent-soft); }

.docs-search-result-label {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* The section a hit belongs to is the whole point of this over the browser's
   own find: `cache_hit` matches every one of the fourteen lookups, and only
   the scope says which. */
.docs-search-result-scope {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-align: right;
}

.docs-search-status,
.docs-search-hint {
  padding: 8px 12px 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.docs-search-status:empty { display: none; }

.docs-search-hint {
  border-top: 1px solid var(--divider);
  margin-top: 8px;
  padding-top: 10px;
}

/* Where a result landed. A row is highlighted through its cells: the table
   sets border-collapse: separate, so the cells are what paint. */
tr.is-search-hit > td,
h2.is-search-hit,
h3.is-search-hit,
h4.is-search-hit {
  background: var(--accent-soft);
  transition: background 0.4s ease;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ----- Tables ----- */
/* Every table is wrapped in .table-scroll. `width: 100%` on a table is only a
   floor: when the columns' own min-content widths add up to more than the
   container, the table grows past it and drags the document's scroll width
   with it. Wrapping means a reference table that cannot fit a phone scrolls
   inside its own box instead of making the whole page scroll sideways. */
.table-scroll {
  margin: 16px 0 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: 16px;
}

.table-scroll > table { margin: 0; }

/* Applied by docs.js only while the table really is wider than its container,
   so it reads as "there is more to the right" rather than as decoration on
   every table. An inset shadow is painted on the container, not the content,
   so it stays pinned to the edge as the table scrolls under it. */
.table-scroll.is-scrollable {
  box-shadow: inset -22px 0 18px -16px var(--scroll-edge);
}

table {
  width: 100%;
  margin: 16px 0 24px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

th {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--table-head-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

th:first-child,
td:first-child { border-left: 1px solid var(--border); }

th:last-child,
td:last-child { border-right: 1px solid var(--border); }

th:first-child { border-top-left-radius: 16px; }
th:last-child { border-top-right-radius: 16px; }

td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--table-cell-bg);
  vertical-align: top;
}

/* Cells deliberately do NOT get `overflow-wrap: anywhere`. It would lower each
   column's min-content to a single character, which does make wide tables fit
   a phone — by stacking `ips` as "ip/s" and `string[]` as "str/ing[/]". A
   field-reference table whose identifiers are unreadable is worse than one
   that scrolls, and .table-scroll already keeps that scrolling off the page. */

tbody tr:last-child td:first-child { border-bottom-left-radius: 16px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 16px; }

/* ----- Tags ----- */
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.tag-pro { background: var(--pro-bg); color: var(--pro-text); }
.tag-post { background: var(--tag-bg); color: var(--tag-text); }
.tag-required { background: var(--tag-required-bg); color: var(--tag-required-text); }
.tag-optional { background: var(--tag-optional-bg); color: var(--tag-optional-text); }

/* ----- Endpoint ----- */
.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--endpoint-border);
  border-radius: 18px;
  background: var(--endpoint-bg);
  font-family: var(--font-mono);
  font-size: 15px;
  box-shadow: var(--endpoint-shadow);
}

.endpoint .method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.endpoint .path { color: var(--ink); }

/* ----- Notes ----- */
.note {
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid var(--note-border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--note-bg-start) 0%, var(--note-bg-end) 100%);
  color: var(--ink);
}

.note-warn {
  border-color: var(--note-warn-border);
  background: linear-gradient(180deg, var(--note-warn-start) 0%, var(--note-warn-end) 100%);
}

/* ----- Risk Colors ----- */
.risk-clean { color: var(--green); font-weight: 700; }
.risk-low { color: #5b6cff; font-weight: 700; }
.risk-medium { color: #8c7cff; font-weight: 700; }
.risk-high { color: var(--red); font-weight: 700; }

/* ----- Lang Tabs ----- */
.lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 12px;
}

.lang-tab {
  padding: 9px 14px;
  border: 1px solid var(--lang-tab-border);
  border-radius: 999px;
  background: var(--lang-tab-bg);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.lang-tab:hover,
.lang-tab.active {
  color: var(--ink);
  border-color: var(--lang-tab-hover-border);
  background: var(--lang-tab-hover-bg);
}

.lang-panel { display: none; }
.lang-panel.active { display: block; }

/* ----- Checklist ----- */
.checklist {
  margin: 10px 0 18px 20px;
  font-size: 14px;
}

.checklist li + li { margin-top: 6px; }

/* ----- Plan price, CTA, Portal Link ----- */
.plan-price {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
  white-space: nowrap;
}

.plan-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
}

.portal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink);
  font-weight: 700;
}

.portal-link::after {
  content: "\2192";
  color: var(--accent);
}

/* ----- Changelog ----- */
.changelog-entry + .changelog-entry {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
}

.changelog-entry h3 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
}

.changelog-entry-meta {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ----- Focus ----- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle:focus-visible {
  outline-offset: 3px;
}

.sidebar a:focus-visible {
  outline-color: var(--sidebar-link-active);
}

/* ----- Docs Footer ----- */
/* Detail-page footer. Deliberately plain: a rule and two lines of muted text,
   not the panelled treatment the overview uses. Its only job is making the
   OpenAPI spec reachable from the pages people actually land on — the sidebar
   link is the primary route, this catches anyone who reads to the end. */
.page-footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 28px;
}

.page-footer p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.6;
}

.page-footer a {
  color: var(--accent);
  font-weight: 600;
}

.page-footer a:hover {
  text-decoration: underline;
}

.page-footer-meta {
  white-space: nowrap;
}

@media (max-width: 860px) {
  .page-footer {
    margin-top: 40px;
  }

  /* The support address is one unbreakable token wider than a small phone's
     content column, so it can't be held on one line there. */
  .page-footer-meta {
    white-space: normal;
  }
}

.docs-footer {
  padding: 0 32px 32px;
}

.docs-footer-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.docs-footer.docs-footer-overview .docs-footer-shell {
  max-width: 1116px;
}

/* Two groups — identity on the left, links on the right — rather than a fixed
   column track. The previous rule declared three columns and the markup grew to
   four children, so the last link wrapped onto a second row and sat under the
   copyright with a justify-self meant for a column it was no longer in. Flexing
   two groups means adding or removing a link cannot break the layout. */
.docs-footer-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--control-soft-bg) 100%);
  box-shadow: var(--control-shadow);
  backdrop-filter: blur(12px);
}

.docs-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.docs-footer-copy {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.docs-footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--code-inline-border);
  border-radius: 999px;
  background: var(--control-bg);
  box-shadow: var(--control-shadow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.docs-footer-link:hover {
  color: var(--ink);
  border-color: var(--accent-soft);
  background: var(--nav-hover-bg);
  transform: translateY(-1px);
}

.docs-footer-link-icon {
  width: 40px;
  padding: 0;
}

.docs-footer-link-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

@media (max-width: 860px) {
  .docs-footer {
    padding: 0 18px 24px;
  }

  .docs-footer-panel {
    flex-direction: column;
    padding: 18px;
    text-align: center;
  }

  .docs-footer-links {
    justify-content: center;
  }
}

/* ----- Print ----- */
/* ----- Reduced Motion ----- */
/* The smooth scroll here is not decoration: every sidebar link and every search
   result moves the whole document. Honour the preference for all of them at
   once rather than per feature. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .code-copy,
  .docs-search-trigger,
  tr.is-search-hit > td,
  h2.is-search-hit,
  h3.is-search-hit,
  h4.is-search-hit,
  .sidebar { transition: none; }
}

@media print {
  body::before,
  .topbar,
  .sidebar,
  .sidebar-toggle,
  .sidebar-backdrop,
  .code-copy,
  .docs-search,
  .docs-search-trigger,
  .theme-toggle { display: none !important; }

  /* The copy control is gone, so the room reserved for it is dead space. */
  .code-block > pre { padding-top: 18px; }

  body {
    background: #fff;
    color: #1a1a1a;
    font-size: 12px;
  }

  .main {
    margin-left: 0;
    padding: 0;
    max-width: none;
  }

  .page-shell {
    padding: 0;
    max-width: none;
  }

  .hero,
  .hero-card,
  .section-card,
  .service-card {
    border: 1px solid #ddd;
    box-shadow: none;
    background: #fff;
    break-inside: avoid;
  }

  pre {
    background: #f5f5f5;
    border: 1px solid #ddd;
    box-shadow: none;
  }

  pre code { color: #1a1a1a; }

  a { color: inherit; text-decoration: underline; }

  .docs-footer {
    padding: 0;
  }

  .docs-footer-panel {
    border: 1px solid #ddd;
    box-shadow: none;
    background: #fff;
  }
}

/* ----- Responsive: sidebar pages ----- */
@media (max-width: 1100px) {
  .main {
    padding-left: 28px;
    padding-right: 28px;
  }

}

@media (max-width: 860px) {
  /* The bar grows a second row for the nav, so the page-level offsets that
     read this variable follow it instead of being measured against a height
     the bar no longer has. The bar is then pinned to the same value below, so
     the variable cannot drift out of agreement with what is rendered and
     leave the first heading sitting under the bar. */
  :root { --topbar-height: 132px; }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Brand and theme toggle share the first row; the section nav spans the
     second. It used to be hidden outright, which left the overview — the one
     page with no sidebar — with no way to reach the other pages at all. */
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    height: var(--topbar-height);
    gap: 10px 12px;
    padding: 12px 18px;
  }

  /* Room for the fixed sidebar toggle is made on the brand, not on the bar:
     padding on the bar would indent the nav row too, and the nav needs the
     full width to hold four items without scrolling. The overview has no
     toggle and resets this. */
  .topbar-brand { margin-left: 52px; }

  .topbar-actions { display: contents; }

  /* Placed explicitly. Auto-placement puts the toggle after the full-width
     nav, which lands it on a third row. The search control is injected by
     docs.js, so its track is empty when the script has not run — an empty
     `auto` track is zero-wide and the toggle stays where it was. */
  .topbar .docs-search-trigger {
    grid-column: 2;
    grid-row: 1;
  }

  .topbar .theme-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  /* Both controls shrink so the brand keeps a usable share of the first row. */
  .topbar .theme-toggle,
  .topbar .docs-search-trigger {
    width: 40px;
    height: 40px;
  }

  /* The overlay sits above the bar, so there is nothing to clear: start near
     the top and give the results the rest of the screen. The ceiling is short
     of the viewport because the on-screen keyboard takes the lower half as
     soon as the input is focused. */
  .docs-search-panel {
    margin-top: 12px;
    max-height: 74vh;
  }

  .code-block > pre { padding-top: 42px; }

  .topbar-nav {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    /* Without this the nav's min-content is distributed across the two tracks
       it spans and widens the bar past the viewport, even though the nav
       itself scrolls. */
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .topbar-nav::-webkit-scrollbar { display: none; }

  .topbar-nav a {
    padding: 8px 12px;
    white-space: nowrap;
  }

  table { font-size: 13.5px; }

  th { padding: 10px 12px; }
  td { padding: 11px 12px; }

  pre {
    padding: 14px 15px;
    border-radius: 16px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    width: min(86vw, 320px);
  }

  body.shell-open .sidebar { transform: translateX(0); }
  body.shell-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  .main {
    margin-left: 0;
    padding: calc(var(--topbar-height) + 18px) 18px 64px;
  }

  .hero {
    padding: 24px;
    border-radius: 24px;
  }

  .hero h1 { max-width: none; }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .base-url,
  .support-link {
    width: 100%;
    justify-content: center;
  }

  /* A step down in size and padding keeps the base URL on one line at common
     phone widths. Below roughly 360px it still wraps, which is fine — it
     wraps inside its box rather than out of it. */
  .base-url {
    padding: 12px 13px;
    font-size: 12.5px;
  }
}
