/* Quadruper docs. Layout idea: a road atlas index, with a fixed sidebar of stops, one reading column and
   code as dark panels. Tokens match gateway/web/assets/site.css (Night Route). Geist is vendored in
   gateway/web/assets/fonts and matches the staff pages. */
@font-face { font-family: "Geist"; src: url("/assets/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --q-page: #f2f1ec; --q-surface: #fbfaf7; --q-surface-2: #e9e7e0;
  --q-line: #dcdad2; --q-line-strong: #c9c6bc;
  --q-ink: #0f1115; --q-ink-2: #3c414b; --q-ink-3: #545a64;
  --q-accent: #ffb020; --q-on-accent: #0f1115; --q-accent-text: #875600; --q-focus: #2a78d6;
  --q-code: #0a0c10; --q-code-line: #262a32; --q-code-ink: #ecebe6; --q-code-dim: #9aa1ad;
  --logo-l: block; --logo-d: none;
  --font-ui: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --head-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --q-page: #0f1115; --q-surface: #171a20; --q-surface-2: #1f232b;
    --q-line: #262a32; --q-line-strong: #353a44;
    --q-ink: #f2f1ec; --q-ink-2: #c9ccd2; --q-ink-3: #a3a8b1;
    --q-accent-text: #ffc04d; --q-focus: #3987e5;
    --logo-l: none; --logo-d: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --q-page: #0f1115; --q-surface: #171a20; --q-surface-2: #1f232b;
  --q-line: #262a32; --q-line-strong: #353a44;
  --q-ink: #f2f1ec; --q-ink-2: #c9ccd2; --q-ink-3: #a3a8b1;
  --q-accent-text: #ffc04d; --q-focus: #3987e5;
  --logo-l: none; --logo-d: block;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--head-h) + 16px); }
html, body { margin: 0; }
body { background: var(--q-page); color: var(--q-ink); font: 15.5px/1.6 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: var(--q-accent-text); text-underline-offset: 2px; }
code { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 5px; border-radius: 5px; background: var(--q-surface-2); overflow-wrap: anywhere; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--q-focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 40; padding: 8px 12px; border-radius: 8px; background: var(--q-ink); color: var(--q-page); }
.skip:focus { top: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--q-line-strong); background: var(--q-surface); color: var(--q-ink); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--q-surface-2); }
.btn-p { background: var(--q-accent); border-color: transparent; color: var(--q-on-accent); }
.btn-p:hover { background: #f0a30f; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; min-height: var(--head-h); padding: 10px 24px; background: var(--q-page); border-bottom: 1px solid var(--q-line); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--q-ink-3); font-size: 14px; }
.brand img { height: 24px; width: auto; }
.brand .l { display: var(--logo-l); } .brand .d { display: var(--logo-d); }
.search { position: relative; flex: 1 1 200px; max-width: 360px; margin-left: auto; }
.search input { width: 100%; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--q-line-strong); background: var(--q-surface); color: var(--q-ink); font: 14px var(--font-ui); }
.search input::placeholder { color: var(--q-ink-3); }
.results { position: absolute; top: 42px; left: 0; right: 0; min-width: 280px; max-height: 60vh; overflow: auto; list-style: none; margin: 0; padding: 6px; border-radius: 12px; border: 1px solid var(--q-line-strong); background: var(--q-surface); box-shadow: 0 12px 32px rgba(10, 12, 16, 0.2); }
.results a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--q-ink); text-decoration: none; }
.results a:hover, .results a:focus-visible { background: var(--q-surface-2); }
.results b { display: block; font-size: 14px; font-weight: 600; }
.results span { display: block; font-size: 12.5px; line-height: 1.4; color: var(--q-ink-3); }
.results .none { padding: 10px; font-size: 13.5px; color: var(--q-ink-2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr) 216px; max-width: 1420px; margin: 0 auto; align-items: start; }
.side { position: sticky; top: var(--head-h); max-height: calc(100vh - var(--head-h)); overflow-y: auto; padding: 24px 12px 40px 24px; }
.side h2 { margin: 20px 0 6px; font-size: 13px; font-weight: 600; color: var(--q-ink); }
.side h2:first-child { margin-top: 0; }
/* The route line: each group is a stretch of road, and the current page is the amber destination dot from the logo. */
.side ul { list-style: none; margin: 0 0 0 4px; padding: 0; border-left: 1px solid var(--q-line-strong); }
.side li { position: relative; }
.side a { display: block; padding: 5px 10px 5px 14px; font-size: 14px; line-height: 1.35; border-radius: 0 7px 7px 0; color: var(--q-ink-2); text-decoration: none; }
.side a:hover { color: var(--q-ink); background: var(--q-surface-2); }
.side a[aria-current="page"] { color: var(--q-ink); font-weight: 600; }
.side a[aria-current="page"]::before { content: ""; position: absolute; left: -5px; top: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--q-accent); box-shadow: 0 0 0 2px var(--q-page); }

main { min-width: 0; padding: 36px 40px 64px; border-inline: 1px solid var(--q-line); min-height: calc(100vh - var(--head-h)); }
.page { max-width: 780px; margin: 0 auto; }
.ph { display: grid; gap: 10px; padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--q-line); }
.ph h1 { margin: 0; font-size: 34px; line-height: 1.12; letter-spacing: -0.028em; font-weight: 650; text-wrap: balance; }
.ph .desc { margin: 0; font-size: 17px; line-height: 1.5; color: var(--q-ink-2); max-width: 62ch; }
.sig { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font: 500 15px var(--font-mono); }
.sig .m { padding: 3px 8px; border-radius: 6px; background: var(--q-ink); color: var(--q-page); font-size: 12.5px; font-weight: 600; }
.sig .auth { font: 13.5px var(--font-ui); color: var(--q-ink-3); }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--q-surface-2); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--q-ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--q-surface); color: var(--q-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(10, 12, 16, 0.14); }
.mdpath { font: 12.5px var(--font-mono); color: var(--q-ink-3); overflow-wrap: anywhere; }
.linkbtn { height: 34px; padding: 0 10px; border: 1px solid var(--q-line-strong); border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--q-ink-2); }
.linkbtn:hover { background: var(--q-surface-2); color: var(--q-ink); }

.prose > * { margin-top: 0; }
.prose p, .prose li { max-width: 68ch; }
.prose p { margin: 0 0 14px; }
.prose h2 { margin: 36px 0 12px; font-size: 22px; line-height: 1.25; letter-spacing: -0.016em; font-weight: 630; text-wrap: balance; }
.prose h3 { margin: 24px 0 8px; font-size: 16.5px; font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 6px; }
.prose ol[start] { margin-top: 0; }
.prose blockquote { margin: 16px 0; padding: 12px 16px; border-radius: 10px; background: var(--q-surface); border: 1px solid var(--q-line); }
.prose blockquote p { margin: 0; font-size: 14.5px; color: var(--q-ink-2); }
.prose blockquote strong { color: var(--q-ink); }
.tw { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--q-line); border-radius: 10px; background: var(--q-surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
th { text-align: left; font-weight: 600; font-size: 13px; color: var(--q-ink-2); background: var(--q-surface-2); white-space: nowrap; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--q-line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; background: var(--q-surface-2); }
td a code { white-space: normal; }

/* Quickstart and guide steps: the same route line, ending in the destination dot. */
.stops { counter-reset: stop; margin-top: 28px; }
.stop { position: relative; counter-increment: stop; padding: 0 0 28px 40px; }
.stop::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; border-left: 1px dashed var(--q-line-strong); }
.stop h2 { margin: 0 0 10px; }
.stop h2::before { content: counter(stop); position: absolute; left: 0; top: 0; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--q-line-strong); background: var(--q-surface); font: 600 13px var(--font-ui); letter-spacing: 0; color: var(--q-ink); }
.stop.end { padding-bottom: 8px; }
.stop.end::before { display: none; }
.stop.end h2::before { background: var(--q-accent); border-color: var(--q-accent); color: var(--q-on-accent); }

/* Code is a dark panel in both themes, as on the landing page. */
.cb { margin: 0 0 18px; min-width: 0; border-radius: 12px; overflow: hidden; background: var(--q-code); border: 1px solid var(--q-code-line); color: var(--q-code-ink); }
.cb figcaption, .cb-tabs { display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 4px 6px 0 12px; border-bottom: 1px solid var(--q-code-line); font-size: 12.5px; color: var(--q-code-dim); }
.cb .cp, .cb-tabs .cp { margin: 0 0 4px auto; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--q-code-line); background: #171a20; color: #c9ccd2; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.cb .cp:hover, .cb-tabs .cp:hover { background: #1f232b; color: #fff; }
.cb :focus-visible, .cb-tabs :focus-visible { outline-color: #3987e5; }
.cb pre { margin: 0; padding: 14px 16px; overflow: auto; font: 13px/1.65 var(--font-mono); background: transparent !important; }
.cb pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
/* Pasted instructions wrap, so the whole line can be read without scrolling. */
.cb[data-lang="text"] pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cb-group { margin: 0 0 18px; border-radius: 12px; overflow: hidden; background: var(--q-code); border: 1px solid var(--q-code-line); }
.cb-group > .cb { margin: 0; border: 0; border-radius: 0; }
.cb-group > .cb figcaption { display: none; }
.cb-tabs { padding-left: 6px; }
.cb-tabs [role="tab"] { height: 36px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--q-code-dim); font-size: 13px; font-weight: 500; cursor: pointer; }
.cb-tabs [role="tab"][aria-selected="true"] { color: var(--q-code-ink); border-bottom-color: var(--q-accent); }

.raw { margin-top: 18px; }
.raw pre { margin: 0; padding: 18px 20px; overflow: auto; border-radius: 12px; background: var(--q-code); border: 1px solid var(--q-code-line); color: var(--q-code-ink); font: 13px/1.65 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.entr { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; margin: 24px 0 8px; }
.prose .entr h2 { margin: 0 0 6px; font-size: 19px; }
.entr p { margin: 0 0 12px; font-size: 14.5px; }
.entr > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 20px; border-radius: 14px; min-width: 0; }
.e-users { background: var(--q-surface); border: 1px solid var(--q-line); }
.e-users .p { color: var(--q-ink-2); }
.prose .e-users ol { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 0; }
.e-users li { position: relative; padding: 0 0 10px 22px; font-size: 14.5px; }
.e-users li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--q-ink-3); background: var(--q-surface); z-index: 1; }
.e-users li::after { content: ""; position: absolute; left: 7px; top: 12px; bottom: -6px; border-left: 1px dashed var(--q-line-strong); }
.e-users li:last-child { padding-bottom: 0; }
.e-users li:last-child::before { background: var(--q-accent); border-color: var(--q-accent); }
.e-users li:last-child::after { display: none; }
.e-agents { background: var(--q-code); border: 1px solid var(--q-code-line); color: var(--q-code-ink); }
.e-agents p { color: #c9ccd2; }
.e-agents a { color: #ffc04d; }
.e-agents code { display: block; width: 100%; padding: 10px 12px; margin-bottom: 10px; border-radius: 8px; background: #171a20; color: var(--q-code-ink); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.e-agents .cp { height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--q-code-line); background: #171a20; color: #ecebe6; font-size: 13px; font-weight: 500; cursor: pointer; margin-bottom: 10px; }
.e-agents .cp:hover { background: #1f232b; }
.e-agents :focus-visible { outline-color: #3987e5; }

.toc { position: sticky; top: var(--head-h); padding: 36px 24px 24px 20px; font-size: 13px; }
.toc h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a { display: block; padding: 4px 0; color: var(--q-ink-2); line-height: 1.35; text-decoration: none; }
.toc a:hover { color: var(--q-ink); text-decoration: underline; text-underline-offset: 2px; }

.pn { max-width: 780px; margin: 40px auto 0; display: flex; justify-content: space-between; gap: 12px; padding-top: 20px; border-top: 1px solid var(--q-line); flex-wrap: wrap; }
.pn a { display: grid; gap: 1px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--q-line); background: var(--q-surface); color: var(--q-ink); text-decoration: none; font-weight: 600; font-size: 14.5px; min-width: 180px; }
.pn a:hover { border-color: var(--q-line-strong); background: var(--q-surface-2); }
.pn a small { font-weight: 400; font-size: 12.5px; color: var(--q-ink-3); }
.pn a.next { margin-left: auto; text-align: right; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; padding: 18px 24px; border-top: 1px solid var(--q-line); color: var(--q-ink-3); font-size: 12.5px; }
.foot a { color: var(--q-ink-2); }
.status { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; padding: 8px 14px; border-radius: 8px; background: var(--q-ink); color: var(--q-page); font-size: 13.5px; font-weight: 500; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .toc { display: none; }
  main { border-right: 0; }
}
@media (max-width: 860px) {
  :root { --head-h: 0px; }
  .top { position: static; gap: 8px 10px; padding: 10px 16px; }
  .brand { margin-right: auto; min-height: 44px; }
  .brand span { display: none; }
  .top-actions { order: 2; }
  .search { order: 4; flex: 1 1 100%; max-width: none; margin: 0; }
  .search input { height: 44px; font-size: 16px; }
  .btn, .linkbtn { height: 44px; }
  .seg button { height: 40px; }
  .menu-btn { display: inline-flex; }
  .cta { display: none; }
  .shell { display: block; }
  .side { position: static; max-height: none; display: none; padding: 16px; border-bottom: 1px solid var(--q-line); background: var(--q-surface); }
  .side.open { display: block; }
  .side a { padding-top: 11px; padding-bottom: 11px; }
  .side a[aria-current="page"]::before { top: 16px; box-shadow: 0 0 0 2px var(--q-surface); }
  main { padding: 24px 16px 40px; border: 0; }
  .ph h1 { font-size: 28px; }
  .ph .desc { font-size: 16px; }
  .entr { grid-template-columns: 1fr; }
  table { min-width: 560px; }
  .foot { padding: 16px; }
  .pn a { flex: 1 1 100%; }
  .pn a.next { text-align: left; }
  .cb .cp, .cb-tabs .cp { height: 36px; }
  .cb-tabs [role="tab"] { height: 44px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
