/* =============================================================================
   Web API documentation — stylesheet
   site_api.md §8. Hand-written; nothing here is generated.

   SEPARATE FROM THE WIKI, DELIBERATELY. The 2016 wiki archive
   (public/CSS/Pages/Wiki/wiki.css) is Bootstrap 3 + MediaWiki ResourceLoader
   output assembled by tools/wiki/build-css.js from the mirror, and it exists to
   make 2016 markup look like 2016. This file shares nothing with it: no
   bootstrap, no MediaWiki, no Xblock skin, its own reset, its own fonts. Do not
   link them together and do not "unify" them later — the archive must keep its
   period skin, and these docs must not inherit one.

   Rendered through reply.viewBare(), so this is the ONLY stylesheet on the page.

   Fonts are self-hosted from fonts/ because this server is routinely run on a
   LAN with no route to the internet; a fonts.googleapis.com <link> there blocks
   text for the whole webfont timeout and then falls back anyway. IBM Plex Sans
   is a variable file (one woff2 covers 400-700).
   ========================================================================== */

/* ---- 1. Fonts --------------------------------------------------------- */

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- 2. Tokens -------------------------------------------------------- */
/* DARK IS THE DEFAULT, deliberately and unconditionally.
   :root carries the dark palette, so a reader with no stored preference gets
   dark whatever their OS says. Light is available and one click away, but it is
   the alternate, not the baseline — this surface has a dark identity.
   That is why there is no prefers-color-scheme block here at all: adding one
   back would make the default depend on the visitor's machine again, which is
   exactly what was not wanted.

   Resolution is therefore two states, not three:
     no data-theme attribute  -> dark   (the default below)
     data-theme="light"       -> light  (the override block)
   _head.ejs stamps data-theme="light" before first paint when, and only when,
   the reader has chosen light, so there is never a flash of the wrong theme.

   Neutrals are warm (a touch of yellow in the greys) rather than the blue-grey
   every developer site defaults to. It is the cheapest way for this to not read
   as a GitHub reskin while keeping the same calm, high-legibility feel. */

:root {
  --canvas:        #121211;
  --surface:       #1a1a18;
  --surface-2:     #212120;
  --surface-3:     #2b2b28;
  --surface-sunk:  #161615;

  --border:        #32312d;
  --border-strong: #47453f;

  --ink:           #edebe6;
  --ink-2:         #b6b2a9;
  --ink-3:         #8b877e;
  --ink-4:         #6b6860;

  --link:          #74a9f7;
  --link-hover:    #9cc3fb;

  --accent:        #ff6a52;
  --accent-ink:    #23100c;
  --accent-soft:   rgba(255, 106, 82, 0.14);
  --accent-line:   rgba(255, 106, 82, 0.42);

  --get:     #4ac26b;  --get-soft:    rgba(74, 194, 107, 0.13);
  --post:    #58a6ff;  --post-soft:   rgba(88, 166, 255, 0.13);
  --patch:   #e3b341;  --patch-soft:  rgba(227, 179, 65, 0.13);
  --delete:  #ff7b72;  --delete-soft: rgba(255, 123, 114, 0.13);

  --ok:      #4ac26b;  --ok-soft:     rgba(74, 194, 107, 0.11);
  --warn:    #e3b341;  --warn-soft:   rgba(227, 179, 65, 0.11);
  --danger:  #ff7b72;  --danger-soft: rgba(255, 123, 114, 0.10);
  --note:    #58a6ff;  --note-soft:   rgba(88, 166, 255, 0.09);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 2px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);

  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --r-sm: 4px;
  --r:    6px;
  --r-lg: 10px;

  --topbar-h: 56px;
  --sidebar-w: 268px;
  --toc-w: 208px;
  --measure: 1080px;

  --ease: cubic-bezier(0.2, 0, 0.1, 1);

  color-scheme: dark;
}

:root[data-theme='light'] {
  --canvas:        #fbfaf7;
  --surface:       #ffffff;
  --surface-2:     #f4f2ed;
  --surface-3:     #eae7e0;
  --surface-sunk:  #f7f5f1;

  --border:        #e2ded5;
  --border-strong: #cdc8bc;

  --ink:           #1a1917;
  --ink-2:         #4c4a44;
  --ink-3:         #7b776d;
  --ink-4:         #a19d92;

  --link:          #0b5fd0;
  --link-hover:    #0a4ea9;

  --accent:        #d6301f;
  --accent-ink:    #ffffff;
  --accent-soft:   rgba(214, 48, 31, 0.10);
  --accent-line:   rgba(214, 48, 31, 0.35);

  --get:     #1a7f37;  --get-soft:    rgba(26, 127, 55, 0.10);
  --post:    #0969da;  --post-soft:   rgba(9, 105, 218, 0.10);
  --patch:   #9a6700;  --patch-soft:  rgba(154, 103, 0, 0.12);
  --delete:  #cf222e;  --delete-soft: rgba(207, 34, 46, 0.10);

  --ok:      #1a7f37;  --ok-soft:     rgba(26, 127, 55, 0.09);
  --warn:    #9a6700;  --warn-soft:   rgba(154, 103, 0, 0.10);
  --danger:  #cf222e;  --danger-soft: rgba(207, 34, 46, 0.08);
  --note:    #0969da;  --note-soft:   rgba(9, 105, 218, 0.07);

  --shadow-sm: 0 1px 2px rgba(26, 25, 23, 0.05);
  --shadow:    0 2px 6px rgba(26, 25, 23, 0.07), 0 1px 2px rgba(26, 25, 23, 0.05);
  --shadow-lg: 0 12px 32px rgba(26, 25, 23, 0.13), 0 2px 8px rgba(26, 25, 23, 0.07);

  color-scheme: light;
}

/* ---- 3. Reset and base ------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor jumps must clear the sticky header. */
  scroll-padding-top: calc(var(--topbar-h) + 20px);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.25; color: var(--ink); }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.5em; }
li { margin: 0.25em 0; }
img, svg, video { max-width: 100%; height: auto; }
hr { height: 1px; margin: 2.5rem 0; border: 0; background: var(--border); }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 2px; }

code, kbd, samp, pre { font-family: var(--mono); font-size: 0.875em; }

::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: var(--r);
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  transition: top 0.16s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---- 4. Top bar ------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
/* A hairline of brand under the bar. Two pixels of identity, no cost. */
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-line) 22%, transparent 55%);
  opacity: 0.8; pointer-events: none;
}

.topbar-inner {
  max-width: 1600px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono); font-weight: 500; font-size: 13px; line-height: 1;
  /* The mark is set at a slight angle — the one playful gesture in the whole
     design, and a nod to the tilted studs of the era. */
  transform: rotate(-6deg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(6deg) scale(1.06); }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name .brand-dim { color: var(--ink-3); font-weight: 400; }

.topbar-nav { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.topbar-nav a {
  padding: 6px 10px; border-radius: var(--r);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.topbar-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.topbar-nav a[aria-current='page'] { color: var(--ink); background: var(--surface-2); }

.topbar-spacer { flex: 1 1 auto; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  /* flex: none matters. These live in a flex row that runs out of width on a
     phone, and without it the button is the thing that gives — it collapses to a
     sliver and the navigation becomes unopenable on exactly the layout that
     needs it most. */
  flex: none;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--ink-2);
  cursor: pointer; padding: 0;
  transition: background 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; display: block; }

/* One button, two glyphs: the button advertises what it will DO, not what is on.
   Dark is the default (see Tokens), so with no attribute we offer the sun. */
/* Qualified with .icon-btn ON PURPOSE. The rule above is `.icon-btn svg`
   (0,1,1); a bare `.icon-moon` (0,1,0) loses to it, so both glyphs keep
   display:block — and because the button is a grid they stack into two rows
   and it renders at double height with a moon above a sun. Two classes beat
   one class plus one element. */
.icon-btn .icon-moon { display: none; }
.icon-btn .icon-sun  { display: block; }
:root[data-theme='light'] .icon-btn .icon-moon { display: block; }
:root[data-theme='light'] .icon-btn .icon-sun  { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  flex: none;
  height: 32px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; font-weight: 500; white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.14s var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600;
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--accent-ink); }

/* Search field in the bar. Widens on focus — the only layout animation here. */
.search {
  position: relative; flex: none; width: 216px;
  transition: width 0.22s var(--ease);
}
.search:focus-within { width: 280px; }
.search svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--ink-4); pointer-events: none;
}
.search input {
  width: 100%; height: 32px; padding: 0 34px 0 30px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-sunk); color: var(--ink);
  font-family: var(--sans); font-size: 13.5px;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { outline: none; background: var(--surface); border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  padding: 2px 5px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-4);
  font-size: 10.5px; line-height: 1.4; pointer-events: none;
}
.search:focus-within kbd { display: none; }

/* ---- 5. Shell --------------------------------------------------------- */

.shell {
  max-width: 1600px; margin: 0 auto; padding: 0 20px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.shell.has-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }

/* ---- 6. Sidebar ------------------------------------------------------- */

.sidebar {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 8px 48px 0;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--canvas); }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.side-filter { position: relative; margin: 0 0 18px; }
.side-filter input {
  width: 100%; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-sunk); color: var(--ink);
  font-family: var(--sans); font-size: 13px;
}
.side-filter input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }

.side-group { margin-bottom: 22px; }
.side-group h4 {
  margin: 0 0 6px; padding: 0 10px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-4);
}
.side-group ul { list-style: none; margin: 0; padding: 0; }
.side-group li { margin: 0; }

.side-group a {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--r);
  color: var(--ink-2); font-size: 13.5px; line-height: 1.45;
}
.side-group a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-group a[aria-current] {
  background: var(--accent-soft); color: var(--ink); font-weight: 600;
}
/* The active marker is a bar in the gutter, not a background change alone —
   it survives at a glance when the list is 40 items long. */
.side-group a[aria-current]::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.side-group a .side-count {
  margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-4);
}
.side-endpoint { font-family: var(--mono); font-size: 12.5px !important; }
.side-endpoint .m { flex: none; width: 34px; font-size: 9.5px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.side-endpoint .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-get { color: var(--get); }
.m-post { color: var(--post); }
.m-patch, .m-put { color: var(--patch); }
.m-delete { color: var(--delete); }

.side-empty { padding: 8px 10px; color: var(--ink-4); font-size: 13px; font-style: italic; }

/* ---- 7. Main column --------------------------------------------------- */

.main { min-width: 0; padding: 34px 0 96px; max-width: var(--measure); }

.crumbs {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-bottom: 14px; font-size: 12.5px; color: var(--ink-4);
}
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-4); }

.page-head { margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.page-head h1 {
  font-size: 34px; letter-spacing: -0.022em; font-weight: 600;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.page-head .lede { margin: 10px 0 0; max-width: 62ch; color: var(--ink-2); font-size: 16px; }
.page-head .host {
  margin-top: 14px; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-sunk);
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
}
.page-head .host b { font-weight: 500; color: var(--ink); }

/* ---- 8. Prose --------------------------------------------------------- */

.prose { font-size: 15px; color: var(--ink); }
.prose > :first-child { margin-top: 0; }

.prose h2 {
  margin: 44px 0 14px; padding-bottom: 8px;
  font-size: 21px; letter-spacing: -0.012em;
  border-bottom: 1px solid var(--border);
}
.prose h3 { margin: 32px 0 10px; font-size: 16.5px; letter-spacing: -0.006em; }
.prose h4 { margin: 24px 0 8px; font-size: 14.5px; color: var(--ink-2); }
.prose p, .prose ul, .prose ol { max-width: 74ch; }
.prose li > p { margin-bottom: 0.4em; }
.prose strong { font-weight: 600; }

/* Heading anchors: invisible until the heading is hovered, like a wiki. */
.anchor {
  margin-left: 8px; color: var(--ink-4); font-weight: 400;
  opacity: 0; transition: opacity 0.14s var(--ease);
}
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }

/* .page-head too: a service's one-line summary is the lede ABOVE the prose, and it renders
   `code` spans through deco.inlineCode like every other piece of endpoint text. */
.prose :not(pre) > code,
.page-head :not(pre) > code {
  padding: 0.14em 0.38em;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.855em;
  white-space: nowrap;
}

.prose blockquote {
  margin: 1.2em 0; padding: 2px 0 2px 16px;
  border-left: 3px solid var(--border-strong);
  color: var(--ink-2);
}

/* ---- 9. Tables -------------------------------------------------------- */

.table-wrap { margin: 18px 0 24px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td {
  padding: 9px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
table.data thead th {
  background: var(--surface-2); color: var(--ink-2);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-sunk); }
table.data td.name { font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
table.data td.type { font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
table.data td.desc { color: var(--ink-2); min-width: 240px; }

.req {
  display: inline-block; margin-left: 6px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--danger); vertical-align: 1px;
}

/* ---- 10. Endpoints ---------------------------------------------------- */

.endpoint {
  margin: 22px 0 30px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.endpoint-head {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 13px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.method {
  flex: none; padding: 3px 8px; border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.07em; text-transform: uppercase; line-height: 1.5;
}
.method.get    { color: var(--get);    background: var(--get-soft);    border-color: color-mix(in srgb, var(--get) 26%, transparent); }
.method.post   { color: var(--post);   background: var(--post-soft);   border-color: color-mix(in srgb, var(--post) 26%, transparent); }
.method.patch,
.method.put    { color: var(--patch);  background: var(--patch-soft);  border-color: color-mix(in srgb, var(--patch) 26%, transparent); }
.method.delete { color: var(--delete); background: var(--delete-soft); border-color: color-mix(in srgb, var(--delete) 26%, transparent); }

.path {
  font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--ink);
  word-break: break-all;
}
/* Path segments carry meaning, so they are coloured: the fixed part recedes,
   the parameters advance. A reader scanning 40 endpoints reads the shape. */
.path .seg-dim { color: var(--ink-3); font-weight: 400; }
.path .seg-param { color: var(--accent); }

.endpoint-head .spacer { flex: 1 1 auto; }
.endpoint-body { padding: 16px; }
.endpoint-body > :first-child { margin-top: 0; }
.endpoint-summary { margin: 0 0 10px; color: var(--ink); font-size: 15.5px; max-width: 74ch; }
/* The summary is the sentence a reader needs; the note under it is context.
   Sized and coloured in that order — the reverse reads as a page of shouting. */
.endpoint-note { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; max-width: 74ch; }

.scopes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-family: var(--mono); font-size: 11px; color: var(--ink-2); white-space: nowrap;
}
.chip-scope { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.chip-auth { border-style: dashed; }

.subhead {
  margin: 20px 0 8px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-4);
}

/* ---- 11. Code --------------------------------------------------------- */

.code {
  position: relative; margin: 14px 0 18px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-sunk);
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4);
  font-weight: 600;
}
.code-head .spacer { flex: 1 1 auto; }
.code pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.62; color: var(--ink);
  tab-size: 2;
}
.code pre code { font-size: inherit; }

.copy {
  height: 24px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-3);
  font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.03em;
  text-transform: uppercase; cursor: pointer;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.copy:hover { color: var(--ink); border-color: var(--border-strong); background: var(--surface-2); }
.copy.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }

/* Token colours. Deliberately few: strings, numbers/literals, keys, comments,
   punctuation. More than five colours in a JSON sample is decoration. */
.tok-key { color: var(--post); }
.tok-str { color: var(--get); }
.tok-num { color: var(--patch); }
.tok-lit { color: var(--accent); }
.tok-punc { color: var(--ink-4); }
.tok-cmt { color: var(--ink-4); font-style: italic; }
.tok-flag { color: var(--ink-3); }

/* ---- 11b. Try it ------------------------------------------------------ */
/* A real request against the running server, fired from the docs page.
   The point is that the reader sees THEIR data with THEIR key and their own
   remaining rate budget — a canned example cannot show any of that. */

.tryit-btn {
  flex: none; height: 24px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2);
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.tryit-btn:hover { color: var(--ink); border-color: var(--accent-line); background: var(--accent-soft); }
.tryit-btn[aria-expanded='true'] { color: var(--ink); border-color: var(--accent-line); background: var(--accent-soft); }

.tryit {
  margin: 16px 0 4px;
  border: 1px solid var(--accent-line); border-radius: var(--r);
  background: var(--surface-sunk);
  overflow: hidden;
}
.tryit-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
}
.tryit-bar .spacer { flex: 1 1 auto; }
.tryit-body { padding: 12px; }

/* Key row. The key is a credential, so it is masked once stored and the input
   is only shown when there is nothing saved or the reader asks to change it. */
.tryit-key { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tryit-key label { font-size: 12px; color: var(--ink-3); }
.tryit-key input {
  flex: 1 1 240px; min-width: 0; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--mono); font-size: 12px;
}
.tryit-key input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.tryit-key .key-set { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.tryit-note { margin: 0 0 12px; font-size: 12px; color: var(--ink-4); }

.tryit-fields { display: grid; gap: 8px; margin-bottom: 12px; }
.tryit-field { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: 10px; }
.tryit-field > label {
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis;
}
.tryit-field > label .req { margin-left: 4px; }
.tryit-field input, .tryit-field select, .tryit-field textarea {
  width: 100%; min-width: 0; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
}
.tryit-field textarea { min-height: 84px; resize: vertical; }
.tryit-field input:focus, .tryit-field select:focus, .tryit-field textarea:focus {
  outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft);
}
.tryit-field.is-body { grid-template-columns: minmax(0, 1fr); }
.tryit-field.is-body > label { margin-bottom: 2px; }

/* The URL rebuilds as the fields change. It is the cheapest possible teaching
   aid: the reader watches the request they are about to send take shape. */
.tryit-url {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface);
  font-family: var(--mono); font-size: 12px; word-break: break-all;
}
.tryit-url .m { flex: none; font-weight: 500; }
.tryit-url .u { color: var(--ink-2); }

.tryit-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tryit-send {
  height: 30px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--r);
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.14s var(--ease), transform 0.14s var(--ease);
}
.tryit-send:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.tryit-send:active:not(:disabled) { transform: translateY(1px); }
.tryit-send:disabled { opacity: 0.45; cursor: not-allowed; }
.tryit-status { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--ink-3); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
}
.pill.st-2xx { color: var(--ok);     background: var(--ok-soft);     border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill.st-3xx { color: var(--note);   background: var(--note-soft);   border-color: color-mix(in srgb, var(--note) 30%, transparent); }
.pill.st-4xx { color: var(--warn);   background: var(--warn-soft);   border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pill.st-5xx { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.pill.st-err { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.tryit-result { margin-top: 12px; }
.tryit-result .code { margin: 0; }
.tryit-heads {
  margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); font-size: 12px;
}
.tryit-heads > summary {
  padding: 7px 11px; cursor: pointer; color: var(--ink-3);
  font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600;
  list-style: none;
}
.tryit-heads > summary::-webkit-details-marker { display: none; }
.tryit-heads > summary::before { content: 'B8 '; color: var(--ink-4); }
.tryit-heads[open] > summary::before { content: 'BE '; }
.tryit-heads > summary:hover { color: var(--ink); }
.tryit-heads dl {
  margin: 0; padding: 0 11px 10px;
  display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr); gap: 2px 14px;
  font-family: var(--mono); font-size: 11.5px;
}
.tryit-heads dt { color: var(--ink-4); }
.tryit-heads dd { margin: 0; color: var(--ink-2); word-break: break-all; }

/* Anything that is not a plain read gets a confirmation step before it fires.
   v1 is read-only so this is dormant, but it is here now so that adding the
   first write endpoint cannot quietly ship a one-click destructive button. */
.tryit-confirm {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-radius: var(--r); background: var(--warn-soft);
  font-size: 12.5px; color: var(--ink-2);
}
.tryit-confirm input { accent-color: var(--accent); }

@media (max-width: 599px) {
  .tryit-field { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

/* ---- 12. Callouts ----------------------------------------------------- */

.callout {
  display: flex; gap: 11px;
  margin: 18px 0; padding: 12px 14px;
  border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--r);
  background: var(--surface);
  font-size: 14px; color: var(--ink-2);
}
.callout > svg { flex: none; width: 16px; height: 16px; margin-top: 3px; }
.callout > div > :first-child { margin-top: 0; }
.callout > div > :last-child { margin-bottom: 0; }
.callout b { color: var(--ink); font-weight: 600; }
.callout-note   { border-left-color: var(--note);   background: var(--note-soft); }
.callout-note > svg { color: var(--note); }
.callout-warn   { border-left-color: var(--warn);   background: var(--warn-soft); }
.callout-warn > svg { color: var(--warn); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout-danger > svg { color: var(--danger); }

/* ---- 13. Service cards (index) ---------------------------------------- */

.card-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  margin: 22px 0 8px;
}
.card {
  display: block; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.card:hover {
  text-decoration: none; color: var(--ink);
  border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow);
}
.card h3 { display: flex; align-items: baseline; gap: 8px; font-size: 15px; margin-bottom: 5px; }
.card h3 .card-host { font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--ink-4); }
.card p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.card .card-meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- 14. On this page ------------------------------------------------- */

.toc {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 38px 0 48px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.toc h4 {
  margin: 0 0 8px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-4);
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 4px 0 4px 12px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-3); font-size: 12.5px; line-height: 1.45;
}
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
.toc .lvl-3 a { padding-left: 24px; font-size: 12px; }

/* Endpoint rows in the index: the method is a fixed-width gutter so the paths
   line up in a column and can be read as a list rather than as prose. Paths
   truncate instead of wrapping — a three-line entry destroys the scan. */
.toc a.toc-endpoint { display: flex; align-items: baseline; gap: 7px; font-family: var(--mono); font-size: 11.5px; }
.toc .toc-m { flex: none; width: 30px; font-size: 9px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.toc .toc-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 15. Footer ------------------------------------------------------- */

.docs-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-sunk);
  padding: 28px 0;
  color: var(--ink-3); font-size: 13px;
}
.docs-footer .footer-inner {
  max-width: 1600px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.docs-footer a { color: var(--ink-2); }
.docs-footer a:hover { color: var(--ink); }
.docs-footer .footer-spacer { flex: 1 1 auto; }
.docs-footer .version { font-family: var(--mono); font-size: 11.5px; color: var(--ink-4); }

/* ---- 16. Motion ------------------------------------------------------- */
/* One orchestrated entrance on load, nothing else. Staggering the three shell
   regions reads as the page assembling itself rather than as three unrelated
   animations. */

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sidebar { animation: rise 0.34s var(--ease) both; }
.main    { animation: rise 0.34s var(--ease) 0.05s both; }
.toc     { animation: rise 0.34s var(--ease) 0.10s both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- 17. Responsive --------------------------------------------------- */

.menu-btn { display: none; }

@media (max-width: 1279px) {
  .shell.has-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 959px) {
  .shell, .shell.has-toc { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .menu-btn { display: grid; }

  .sidebar {
    position: fixed; inset: var(--topbar-h) auto 0 0; z-index: 45;
    width: min(320px, 84vw); max-height: none;
    padding: 22px 16px 40px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 0.24s var(--ease);
    animation: none;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: ''; position: fixed; inset: var(--topbar-h) 0 0; z-index: 44;
    background: rgba(0, 0, 0, 0.35);
  }
  .side-group a[aria-current]::before { left: -16px; }

  .topbar-nav { display: none; }
  .search { width: 150px; }
  .search:focus-within { width: 190px; }
  .main { padding-top: 26px; }
  .page-head h1 { font-size: 27px; }
}

@media (max-width: 599px) {
  /* The bar has to fit 375px: menu, mark, search, theme and the key button all
     sit in one row, so the gaps and the field come down rather than any control
     being dropped. Every one of them is load-bearing on a phone. */
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  .search { width: 96px; }
  .search:focus-within { width: 132px; }
  .search kbd { display: none; }
  .btn { padding: 0 11px; }
  .endpoint-head { gap: 8px; }
  .path { font-size: 12.5px; }
}

/* ---- 18. Print -------------------------------------------------------- */

@media print {
  .topbar, .sidebar, .toc, .docs-footer, .copy, .anchor { display: none !important; }
  .shell, .shell.has-toc { display: block; max-width: none; padding: 0; }
  .main { padding: 0; max-width: none; animation: none; }
  .endpoint { break-inside: avoid; box-shadow: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; text-decoration: underline; }
  .code { background: #fafafa; }
}
