/* DATADOC docs type system (best-of-options picks):
   H1/H2/H3 (bold)     -> Quantico 700 (techno sans w/ true bold; Neue Montreal fallback)
   Body/Nav/UI/Tables  -> Source Sans 3/Pro (only true UI text face in options; Satoshi fallback)
   Code/CLI/meta       -> JetBrains Mono (kept: no monospace exists in the options) */
@import url('https://fonts.cdnfonts.com/css/pp-neue-montreal');
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@300,400,500,700,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Quantico:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,700;1,400&display=swap');

:root {
  --bg: #050505;
  --surface: #151515;
  --surface-raised: #1d1d1d;
  --surface-soft: #101010;
  --border: #2c2c2c;
  --border-strong: #414141;
  --text: #f5f5f5;
  --muted: #a5a5a5;
  --subtle: #777;
  --accent: #bfff62;
  --accent-soft: rgba(191, 255, 98, .12);
  --warning: #f3c969;
  --danger: #ff8e8e;
  --info: #9ccaff;
  --radius: 12px;
  --header-height: 66px;
  --topic-height: 48px;
  --content-width: 1460px;
  /* 1. Headings (bold): Quantico, Neue Montreal fallback */
  --font-display: "Quantico", "PP Neue Montreal", "Neue Montreal", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* 2. Body / navigation / UI / tables: Source Sans 3/Pro first, Satoshi fallback */
  --font-sans: "Source Sans 3", "Source Sans Pro", "Satoshi", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* 3. Code / CLI / technical metadata: JetBrains Mono */
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--bg);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--subtle);
}

@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
html { scroll-behavior: smooth; }
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
section[id], h1[id], h2[id], h3[id] { scroll-margin-top: 116px; }
button, input, select { font: inherit; }
button { color: inherit; }
::selection { background: var(--accent); color: #000; }
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
pre, code, table { max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: rgba(5, 5, 5, .96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
.header-nav { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.header-nav::-webkit-scrollbar { display: none; }
.header-nav a, .header-action {
  padding: 7px 12px;
  border-radius: 8px;
  color: #d9d9d9;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.header-nav a:hover, .header-nav a.active { background: var(--surface-raised); color: #fff; }
.header-tools { display: flex; justify-content: flex-end; align-items: center; gap: 10px; min-width: 0; }
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 220px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-sans);
}
.search-box:focus-within { border-color: #777; background: var(--surface-raised); }
.search-box svg { width: 16px; height: 16px; flex: 0 0 auto; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font-family: var(--font-sans); font-size: 13px; }
.search-box input::placeholder { color: var(--subtle); }
.search-box input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.version-badge { color: var(--subtle); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.menu-button { display: none; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 8px 10px; min-height: 40px; min-width: 44px; }

.topic-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  height: var(--topic-height);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: rgba(5, 5, 5, .96);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
  mask-image: linear-gradient(to right, #000 92%, transparent 100%);
}
.topic-bar::-webkit-scrollbar { display: none; }
.topic-bar a { height: 100%; display: inline-flex; align-items: center; border-bottom: 2px solid transparent; color: var(--muted); font-family: var(--font-sans); font-size: 13px; font-weight: 500; white-space: nowrap; transition: color 0.15s ease, border-color 0.15s ease; }
.topic-bar a:hover, .topic-bar a.active { color: #fff; border-bottom-color: var(--accent); }

.docs-frame {
  display: grid;
  grid-template-columns: 242px minmax(0, 850px) 220px;
  gap: 54px;
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 36px 28px 90px;
  animation: fadeInSlide 0.4s ease-out forwards;
}
.sidebar, .right-rail { align-self: start; position: sticky; top: calc(var(--header-height) + var(--topic-height) + 26px); max-height: calc(100vh - var(--header-height) - var(--topic-height) - 44px); overflow: auto; scrollbar-width: thin; }
.sidebar { padding-right: 12px; font-family: var(--font-sans); }
.side-group { margin-bottom: 25px; }
.side-label { margin: 0 0 8px; color: #fff; font-family: var(--font-sans); font-size: 12px; font-weight: 700; }
.side-link { display: block; margin: 1px 0; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-family: var(--font-sans); font-size: 13px; line-height: 1.4; transition: all 0.15s ease; overflow-wrap: anywhere; }
.side-link:hover { color: #fff; background: var(--surface); }
.side-link.active { color: #fff; background: var(--surface-raised); }
.side-link .method { margin-right: 5px; color: var(--accent); font-family: var(--font-mono); font-size: 10px; }
.sidebar-note { margin-top: 30px; padding-top: 15px; border-top: 1px solid var(--border); color: var(--subtle); font-family: var(--font-sans); font-size: 12px; }

.main-content { min-width: 0; max-width: 100%; font-family: var(--font-sans); }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; overflow-wrap: anywhere; }
/* Headings use Neue Montreal */
h1, h2, h3, h4 { margin: 0; color: #fff; line-height: 1.2; letter-spacing: 0; font-family: var(--font-display); font-weight: 700; text-wrap: balance; overflow-wrap: break-word; }
h1 { max-width: 760px; font-size: clamp(32px, 4.6vw, 58px); font-weight: 700; }
h2 { margin-top: 66px; padding-top: 12px; font-size: clamp(24px, 3vw, 30px); scroll-margin-top: calc(var(--header-height) + var(--topic-height) + 24px); }
h3 { margin-top: 30px; font-size: clamp(17px, 2.2vw, 19px); }
h4 { margin-top: 20px; font-size: 15px; }
p { margin: 15px 0; color: #c4c4c4; font-family: var(--font-sans); overflow-wrap: break-word; }
strong { color: #fff; }
ul, ol { margin: 15px 0; padding-left: 22px; color: #c4c4c4; font-family: var(--font-sans); }
li { margin: 7px 0; }
li::marker { color: var(--subtle); }
/* Code / CLI / technical metadata use JetBrains Mono */
code { padding: 2px 5px; border-radius: 4px; background: var(--surface-raised); color: #e8e8e8; font-family: var(--font-mono); font-size: .88em; overflow-wrap: anywhere; }
pre code { overflow-wrap: normal; }
.lead { max-width: 700px; margin-top: 20px; color: #b8b8b8; font-family: var(--font-sans); font-size: clamp(16px, 2vw, 18px); line-height: 1.65; }
.page-meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; color: var(--subtle); font-family: var(--font-mono); font-size: 11px; }
.meta-chip { padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-soft); font-family: var(--font-mono); overflow-wrap: anywhere; }
.meta-chip.accent { border-color: rgba(191, 255, 98, .4); color: var(--accent); }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-raised); color: #fff; font-family: var(--font-sans); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; min-height: 40px; }
.button:hover { border-color: #999; background: #282828; transform: translateY(-1.5px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.button.primary { border-color: var(--accent); background: var(--accent); color: #000; font-weight: 700; }
.button.ghost { background: transparent; }

.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; margin-top: 42px; }
.surface { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.surface-raised { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-raised); }
.surface-pad { padding: 22px; }
.quickstart { min-height: 275px; padding: 26px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.quickstart h2 { margin: 0; padding: 0; font-size: 22px; }
.quickstart p { max-width: 420px; }
.terminal-label { color: var(--subtle); font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; }
.terminal-line { display: block; margin-top: 14px; color: var(--accent); font-family: var(--font-mono); font-size: 13px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-line::before { content: "$ "; color: var(--subtle); }
.diagram { position: relative; min-height: 275px; overflow: hidden; background: radial-gradient(circle at 68% 28%, rgba(191,255,98,.16), transparent 28%), var(--surface); }
.diagram::after { content: ""; position: absolute; inset: 24px; border: 1px solid #303030; border-radius: 50%; transform: rotate(-18deg) scaleX(1.25); }
.diagram-content { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 1; padding: 16px; }
.diagram-node { padding: 17px 19px; border: 1px solid var(--accent); border-radius: 9px; background: rgba(5,5,5,.83); box-shadow: 0 0 40px rgba(191,255,98,.12); max-width: 100%; }
.diagram-node strong { display: block; color: var(--accent); font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.diagram-node span { display: block; margin-top: 5px; color: #ddd; font-family: var(--font-sans); font-size: 12px; }
.section-intro { max-width: 690px; margin-bottom: 24px; }
.section-intro p { margin-top: 12px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.feature { padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); transition: all 0.2s ease; min-width: 0; }
.feature:hover { border-color: var(--border-strong); transform: translateY(-2.5px); box-shadow: 0 6px 16px rgba(0,0,0,0.4); }
.feature .number { color: var(--accent); font-family: var(--font-mono); font-size: 11px; }
.feature h3 { margin-top: 10px; font-size: 16px; }
.feature p { margin-bottom: 0; font-size: 13px; }
.workflow { display: grid; gap: 1px; margin-top: 24px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--border); }
.workflow-step { display: grid; grid-template-columns: 44px 150px 1fr; gap: 15px; align-items: center; padding: 15px 17px; background: var(--surface); transition: all 0.2s ease; min-width: 0; }
.workflow-step:hover { background: var(--surface-raised); transform: translateX(4px); border-radius: 6px; }
.workflow-step .step-number { color: var(--accent); font-family: var(--font-mono); font-size: 12px; }
.workflow-step strong { font-family: var(--font-sans); font-size: 14px; }
.workflow-step span { color: var(--muted); font-family: var(--font-sans); font-size: 13px; overflow-wrap: break-word; }

.code-block { position: relative; margin: 18px 0; overflow: auto; border: 1px solid var(--border-strong); border-radius: 10px; background: #0d0d0d; max-width: 100%; -webkit-overflow-scrolling: touch; }
.code-block code { display: block; min-width: max-content; max-width: none; padding: 22px; background: transparent; color: #e7e7e7; font-family: var(--font-mono); font-size: 13px; line-height: 1.75; }
.code-block code .comment, .code-block code .tok-comment { color: #77808f; }
.code-block code .accent, .code-block code .tok-command { color: var(--accent); }
.code-block code .tok-keyword { color: #ff8f9b; }
.code-block code .tok-string { color: #b7e6a1; }
.code-block code .tok-number { color: #c7a7ff; }
.code-block code .tok-constant { color: #ffd580; }
.code-block code .tok-function { color: #82c9ff; }
.code-block code .tok-property { color: #79d4d2; }
.code-block code .tok-type { color: #d5b0ff; }
.code-block code .tok-flag { color: #9dc8ff; }
.code-block code .tok-operator { color: #f0b7d4; }
.code-block code .tok-punctuation { color: #a7a7b0; }
.copy-button { position: absolute; top: 6px; right: 8px; z-index: 2; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: #1d1d1d; color: #cfcfcf; font-family: var(--font-mono); font-size: 10px; cursor: pointer; min-height: 32px; }
.copy-button:hover { border-color: #999; color: #fff; }
.copy-button.copied { border-color: var(--accent); color: var(--accent); }
.code-caption { display: flex; justify-content: space-between; gap: 12px; min-height: 34px; padding: 9px 90px 9px 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-family: var(--font-mono); font-size: 11px; overflow-x: auto; white-space: nowrap; }
.code-caption .lang { color: #fff; }
.tabs { margin: 20px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-soft); max-width: 100%; }
.tab-list { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); padding: 5px; -webkit-overflow-scrolling: touch; }
.tab-button { border: 0; border-radius: 6px; padding: 8px 11px; background: transparent; color: var(--muted); cursor: pointer; font-family: var(--font-sans); font-size: 12px; font-weight: 500; white-space: nowrap; min-height: 36px; }
.tab-button:hover, .tab-button.active { background: var(--surface-raised); color: #fff; }
.tab-panel { display: none; padding: 16px; min-width: 0; }
.tab-panel.active { display: block; }
.tab-panel p:first-child { margin-top: 0; }
.callout { margin: 22px 0; padding: 16px 18px; border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 9px; background: var(--accent-soft); min-width: 0; }
.callout.warning { border-left-color: var(--warning); background: rgba(243,201,105,.08); }
.callout.danger { border-left-color: var(--danger); background: rgba(255,142,142,.08); }
.callout.info { border-left-color: var(--info); background: rgba(156,202,255,.08); }
.callout strong { display: block; margin-bottom: 5px; font-family: var(--font-sans); font-size: 13px; }
.callout p { margin: 0; font-size: 13px; }
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: 10px; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 560px; border-collapse: collapse; font-family: var(--font-sans); }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: 13px; overflow-wrap: break-word; }
th { color: #fff; background: var(--surface-raised); font-family: var(--font-sans); font-weight: 700; }
td { color: #c5c5c5; }
td code, th code { font-family: var(--font-mono); }
tr:last-child td { border-bottom: 0; }
.endpoint { margin-top: 20px; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); min-width: 0; }
.endpoint-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.method-badge { padding: 4px 7px; border-radius: 4px; background: rgba(191,255,98,.15); color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.path { color: #fff; font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right-rail { padding-left: 6px; font-family: var(--font-sans); }
.right-label { margin-bottom: 10px; color: #fff; font-family: var(--font-sans); font-size: 12px; font-weight: 700; }
.right-link { display: block; padding: 6px 0 6px 13px; border-left: 1px solid var(--border); color: var(--subtle); font-family: var(--font-sans); font-size: 12px; line-height: 1.4; transition: all 0.15s ease; }
.right-link:hover, .right-link.active { border-left-color: var(--accent); color: #fff; }
.right-card { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.right-card p { margin: 8px 0 0; font-size: 12px; }
.footer { max-width: var(--content-width); margin: 0 auto; padding: 24px 28px 40px; border-top: 1px solid var(--border); color: var(--subtle); font-family: var(--font-sans); font-size: 12px; }
.footer a { color: #ddd; }
.footer a:hover { color: var(--accent); }

/* Search */
.search-results { position: fixed; top: 70px; right: 28px; z-index: 80; display: none; width: min(460px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow: auto; padding: 8px; border: 1px solid var(--border-strong); border-radius: 10px; background: #111; box-shadow: 0 20px 70px rgba(0,0,0,.6); font-family: var(--font-sans); -webkit-overflow-scrolling: touch; }
.search-results.open { display: block; }
.search-meta { padding: 8px 10px 4px; color: var(--subtle); font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.search-result { display: block; padding: 10px; border-radius: 7px; }
.search-result:hover, .search-result.selected { background: var(--surface-raised); }
.search-result strong { display: block; font-family: var(--font-sans); font-size: 13px; line-height: 1.4; }
.search-result .result-page { display: block; margin-top: 2px; color: var(--accent); font-family: var(--font-mono); font-size: 10px; }
.search-result .result-snippet { display: block; margin-top: 4px; color: var(--muted); font-family: var(--font-sans); font-size: 12px; line-height: 1.5; }
.search-result mark, .result-snippet mark { background: rgba(191,255,98,.28); color: #fff; border-radius: 3px; padding: 0 2px; }
.no-results { padding: 12px; color: var(--muted); font-family: var(--font-sans); font-size: 12px; }
mark.search-hit { background: rgba(191,255,98,.4); color: #fff; border-radius: 3px; padding: 0 2px; }
.mobile-overlay { display: none; }

/* Mermaid / math blocks scale on small screens */
.mermaid { max-width: 100%; overflow-x: auto; }
.math-formula { max-width: 100%; overflow-x: auto; font-family: var(--font-mono); }

/* ---------- Responsive: large desktop ---------- */
@media (max-width: 1400px) {
  .docs-frame { gap: 40px; padding-left: 24px; padding-right: 24px; }
  .header-nav a, .header-action { padding: 7px 9px; font-size: 13px; }
}

/* ---------- Responsive: small laptop ---------- */
@media (max-width: 1180px) {
  .docs-frame { grid-template-columns: 220px minmax(0, 1fr); gap: 35px; }
  .right-rail { display: none; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .site-header { gap: 14px; padding: 0 20px; }
  .header-nav { gap: 2px; }
  .search-box { width: 180px; }
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .workflow-step { grid-template-columns: 40px 130px 1fr; gap: 12px; }
}

/* ---------- Responsive: tablet / mobile nav ---------- */
@media (max-width: 860px) {
  :root { --header-height: 60px; --topic-height: 46px; }
  .site-header { grid-template-columns: 1fr auto; padding: 0 16px; gap: 10px; }
  .header-nav { display: none; }
  .header-tools { gap: 8px; }
  .search-box { width: min(220px, 44vw); }
  .version-badge { display: none; }
  .menu-button { display: inline-flex; align-items: center; justify-content: center; }
  .topic-bar { padding: 0 16px; gap: 18px; }
  .docs-frame { display: block; padding: 28px 16px 65px; }
  .sidebar { position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 70; width: min(300px, 84vw); max-height: none; padding: 22px 18px 40px; background: #0c0c0c; border-right: 1px solid var(--border); transform: translateX(-105%); transition: transform .22s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .mobile-overlay { position: fixed; inset: var(--header-height) 0 0; z-index: 60; background: rgba(0,0,0,.68); }
  body.menu-open .mobile-overlay { display: block; }
  .hero-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  h2 { margin-top: 52px; }
  .footer { padding: 22px 16px 34px; }
  .search-results { top: calc(var(--header-height) + 8px); right: 12px; left: 12px; width: auto; max-height: 62vh; }
}

/* ---------- Responsive: large phones ---------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .site-header { position: static; grid-template-columns: 1fr auto; grid-template-rows: auto auto; padding: 10px 12px; height: auto; min-height: var(--header-height); row-gap: 8px; }
  .header-tools { grid-column: 1 / -1; order: 3; width: 100%; }
  .search-box { flex: 1 1 auto; width: 100%; }
  .search-box input { display: block; }
  .topic-bar { top: 0; gap: 14px; padding: 0 12px; }
  .docs-frame { padding: 22px 12px 56px; }
  .feature-grid { grid-template-columns: 1fr; }
  .quickstart { min-height: 0; padding: 20px; }
  .diagram { min-height: 210px; }
  .workflow-step { grid-template-columns: 34px 1fr; gap: 8px; padding: 13px 14px; }
  .workflow-step span { grid-column: 2; }
  .page-actions .button { flex: 1 1 auto; justify-content: center; }
  .code-block code { padding: 16px; font-size: 12px; }
  .code-caption { padding-right: 76px; }
  .endpoint { padding: 14px; }
  .endpoint-head { align-items: flex-start; }
  table { min-width: 520px; }
  th, td { padding: 10px 12px; font-size: 12px; }
  .callout { padding: 14px; }
  .tab-panel { padding: 12px; }
}

/* ---------- Responsive: small phones ---------- */
@media (max-width: 400px) {
  .brand { font-size: 15px; gap: 8px; }
  h1 { font-size: 30px; }
  .lead { font-size: 15px; }
  .quickstart, .surface-pad { padding: 16px; }
  .feature { padding: 14px; }
  .button { width: 100%; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .search-results { left: 8px; right: 8px; }
  .diagram-content { padding: 10px; }
  .diagram-node { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .button:hover, .feature:hover, .workflow-step:hover { transform: none; }
}
