/* =============================================================================
   PatientNow Essentials (PNE) API Docs — branded stylesheet
   -----------------------------------------------------------------------------
   Palette + type are authoritative, sourced from branding.md (PatientNow deck).
   Only the 10 named brand colors are used. Do NOT invent custom colors.
   ========================================================================== */

/* ---- Brand palette (the 10 sanctioned colors) ---------------------------- */
:root {
  --c-charcoal: #2A2929; /* primary dark / default text          */
  --c-cream:    #FAF8E9; /* primary light / default background    */
  --c-canary:   #F7F374; /* signature bright yellow accent        */
  --c-camp:     #6D7356; /* muted olive green                     */
  --c-cosmic:   #3C5DAA; /* deep blue — links / primary action    */
  --c-clove:    #633976; /* deep purple                           */
  --c-crimson:  #EF4879; /* pink-red / magenta                    */
  --c-cloud:    #90DBF0; /* light sky blue                        */
  --c-calm:     #C7BFDF; /* light lavender                        */
  --c-cotton:   #F8BDCE; /* light pink                            */

  /* Fonts (both are free Google Fonts; see branding.md) */
  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Helvetica Neue", "Open Sans", Arial, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  /* Semantic tokens (light theme) — composed only from brand colors above */
  --bg:            var(--c-cream);
  --bg-elevated:   #FFFFFF;
  --bg-sunken:     #F1EEDB;
  --text:          var(--c-charcoal);
  --text-muted:    #6B6A66;
  --border:        #E4E0CC;
  --border-strong: #D6D1B8;
  --link:          var(--c-cosmic);
  --link-hover:    #2C478A;
  --accent:        var(--c-canary);
  --code-bg:       #2F2E2C;
  --code-text:     #F3F1E5;

  /* HTTP method colors (branding.md proposed mapping) */
  --m-get:    var(--c-cosmic);
  --m-post:   var(--c-camp);
  --m-put:    var(--c-canary);
  --m-delete: var(--c-crimson);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(42, 41, 41, .06), 0 4px 16px rgba(42, 41, 41, .06);

  /* ---- Layout widths — TUNE THE SITE'S WIDTH HERE (single source of truth) -
     Every page's outer width, columns, gutters and readable text measure come
     from these tokens. Change them here and the whole site follows. */
  --maxw: 1400px;          /* max width of the centered page shell            */
  --sidebar-w: 260px;      /* left nav column on doc pages                    */
  --toc-w: 220px;          /* right "On this page" rail (only if a .toc exists) */
  --layout-gap: 2.4rem;    /* gutter between layout columns                   */
  --measure-prose: 78ch;   /* readable cap for body prose (not code/tables)   */
}

/* ---- Dark theme ---------------------------------------------------------- */
:root[data-theme="dark"] {
  --bg:            #1E1D1C;
  --bg-elevated:   #2A2929;
  --bg-sunken:     #181716;
  --text:          var(--c-cream);
  --text-muted:    #A8A69A;
  --border:        #3A3937;
  --border-strong: #4A4845;
  --link:          var(--c-cloud);
  --link-hover:    #B7E7F5;
  --code-bg:       #121110;
  --code-text:     #F3F1E5;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 18px rgba(0,0,0,.4);
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; line-height: 1.2; color: var(--text); }
h1 { font-size: 2.4rem; letter-spacing: -.5px; margin: 0 0 .5em; }
h2 { font-size: 1.6rem; margin: 2.2em 0 .6em; padding-top: .2em; }
h3 { font-size: 1.2rem; margin: 1.8em 0 .5em; }
h4 { font-size: 1rem; margin: 1.4em 0 .4em; }
p  { margin: 0 0 1em; }
a  { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
ul, ol { padding-left: 1.3em; }
li { margin: .3em 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
small { color: var(--text-muted); }
img { max-width: 100%; }

code {
  font-family: var(--font-mono);
  font-size: .86em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .12em .4em;
}
pre {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  font-family: var(--font-mono);
  font-size: .86rem;
  line-height: 1.55;
  /* Wrap long lines instead of scrolling horizontally. Authored line breaks
     (and the `\` continuations in curl samples) are preserved; only over-long
     lines (e.g. a full URL) soft-wrap. Copying still yields the original text. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 1em; }

/* ---- Skip link (a11y) ---------------------------------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--c-cosmic); color: var(--c-cream);
  padding: .6em 1em; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---- Top nav ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 1.2rem;
  padding: .7rem 1.4rem;
}
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
/* Real PatientNow logo (6:1 lockup). Primary on light, white variant on dark —
   swapped by CSS so we never recolor the SVG itself (branding.md rule). The
   logo carries the "PatientNow" wordmark; the eyebrow adds product context. */
.brand .brand-logo { display: block; height: 26px; width: auto; flex: none; }
.brand .brand-logo.is-dark { display: none; }
:root[data-theme="dark"] .brand .brand-logo.is-light { display: none; }
:root[data-theme="dark"] .brand .brand-logo.is-dark { display: block; }
.brand-eyebrow {
  font-size: .64rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--text-muted); padding-left: .7rem; margin-left: .1rem;
  border-left: 1px solid var(--border-strong);
}

.nav-links { display: flex; gap: .3rem; margin-left: auto; align-items: center; }
.nav-links a {
  color: var(--text-muted); font-weight: 600; font-size: .9rem;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
}
.nav-links a:hover { color: var(--text); background: var(--bg-sunken); text-decoration: none; }
.nav-links a.active { color: var(--c-cosmic); background: color-mix(in srgb, var(--c-cosmic) 12%, transparent); }
:root[data-theme="dark"] .nav-links a.active { color: var(--c-cloud); }

/* ---- Top-nav dropdown (per-API menus: Quickstart, Reference) -------------
   One nav item that expands to the two APIs. Opens on hover/focus and on
   click via JS (.open) so keyboard + touch work too. Desktop only — on the
   mobile drawer (<=820px) .nav-links is hidden and the sidebar handles nav. */
.nav-dropdown { position: relative; display: flex; align-items: center; }
.nav-dropdown-toggle {
  display: inline-flex; align-items: center; gap: .28rem;
  color: var(--text-muted); font-weight: 600; font-size: .9rem;
  font-family: inherit; background: transparent; border: 0; cursor: pointer;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
}
.nav-dropdown-toggle:hover { color: var(--text); background: var(--bg-sunken); }
.nav-dropdown-toggle .caret { font-size: .62rem; line-height: 1; transition: transform .15s ease; }
.nav-dropdown:hover .caret,
.nav-dropdown:focus-within .caret,
.nav-dropdown.open .caret { transform: rotate(180deg); }
/* Mark the toggle active when its page (or a child page) is the current one. */
.nav-dropdown-toggle.active { color: var(--c-cosmic); background: color-mix(in srgb, var(--c-cosmic) 12%, transparent); }
:root[data-theme="dark"] .nav-dropdown-toggle.active { color: var(--c-cloud); }

.nav-dropdown-menu {
  position: absolute; top: calc(100% + .3rem); right: 0;
  min-width: 230px; display: none; flex-direction: column; gap: .1rem;
  padding: .4rem; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); z-index: 110;
}
/* Invisible bridge spanning the gap between toggle and menu, so moving the
   cursor down to the menu doesn't drop :hover and close it prematurely. */
.nav-dropdown-menu::before {
  content: ""; position: absolute; left: 0; right: 0;
  top: -.5rem; height: .5rem;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a {
  display: block; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; font-size: .9rem;
}
.nav-dropdown-menu a:hover { background: var(--bg-sunken); text-decoration: none; }
.nav-dropdown-menu a .menu-sub {
  display: block; font-weight: 400; font-size: .76rem; color: var(--text-muted); margin-top: .1rem;
}

.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  cursor: pointer; font-size: 1.05rem;
}
.icon-btn:hover { background: var(--bg-sunken); }
.nav-toggle { display: none; }

/* ---- Layout shell -------------------------------------------------------- */
.layout {
  max-width: var(--maxw); margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--layout-gap);
  padding: 0 1.4rem;
}
/* Reserve the right-rail column ONLY when a .toc is actually rendered.
   (Pages declared with-toc but render no .toc, so a static third column
   would otherwise steal ~var(--toc-w) of content width on every doc page.) */
.layout.with-toc:has(.toc) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }
.layout.full { display: block; }

/* ---- Sidebar ------------------------------------------------------------- */
.sidebar {
  position: sticky; top: 64px; align-self: start;
  height: calc(100vh - 64px); overflow-y: auto;
  padding: 1.8rem .4rem 3rem 0;
}
.sidebar h5 {
  font-family: var(--font-body); text-transform: uppercase;
  font-size: .72rem; letter-spacing: .8px; color: var(--text-muted);
  margin: 1.6rem 0 .5rem; font-weight: 700;
}
.sidebar h5:first-child { margin-top: 0; }
.sidebar a {
  display: block; color: var(--text-muted); font-size: .9rem;
  padding: .32rem .7rem; border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
}
.sidebar a:hover { color: var(--text); background: var(--bg-sunken); text-decoration: none; }
.sidebar a.active {
  color: var(--c-cosmic); font-weight: 600;
  background: color-mix(in srgb, var(--c-cosmic) 10%, transparent);
  border-left-color: var(--c-cosmic);
}
:root[data-theme="dark"] .sidebar a.active { color: var(--c-cloud); border-left-color: var(--c-cloud); }

/* ---- Main content -------------------------------------------------------- */
.content { padding: 2.4rem 0 5rem; min-width: 0; }
.content > *:first-child { margin-top: 0; }
.page-eyebrow {
  text-transform: uppercase; letter-spacing: 1.2px; font-size: .74rem;
  font-weight: 700; color: var(--c-clove); margin: 0 0 .6rem;
}
:root[data-theme="dark"] .page-eyebrow { color: var(--c-calm); }
.lead { font-size: 1.18rem; color: var(--text-muted); max-width: 52ch; }

/* Readability: cap running text at --measure-prose, but let wide components
   (code blocks, code groups, tables, callouts, endpoints, card/resource grids)
   use the FULL content column. This is what keeps code/tables from being
   cramped into a narrow strip while keeping paragraphs comfortable to read. */
.content > p,
.content > ul,
.content > ol,
.content > h1,
.content > h2,
.content > h3,
.content > h4,
.content > .lead { max-width: var(--measure-prose); }
.content.prose > p,
.content.prose > ul,
.content.prose > ol { max-width: var(--measure-prose); }

/* ---- Table of contents (right rail) -------------------------------------- */
.toc { position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px); overflow-y: auto; padding: 2.6rem 0; font-size: .85rem; }
.toc h6 { text-transform: uppercase; font-size: .7rem; letter-spacing: .8px; color: var(--text-muted); margin: 0 0 .6rem; font-family: var(--font-body); }
.toc a { display: block; color: var(--text-muted); padding: .22rem 0 .22rem .8rem; border-left: 2px solid var(--border); }
.toc a:hover, .toc a.active { color: var(--c-cosmic); border-left-color: var(--c-cosmic); text-decoration: none; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .95rem;
  padding: .7rem 1.3rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: transform .04s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-cosmic); color: var(--c-cream); }
.btn-primary:hover { background: var(--link-hover); color: var(--c-cream); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text); }
.btn-canary { background: var(--c-canary); color: var(--c-charcoal); }
.btn-canary:hover { filter: brightness(.96); color: var(--c-charcoal); }

/* ---- Hero (landing) ------------------------------------------------------ */
.hero { padding: 4.5rem 0 3rem; text-align: center; }
.hero .tagline {
  font-family: var(--font-heading); font-style: italic;
  color: var(--c-clove); font-size: 1.05rem; margin-bottom: 1rem;
}
:root[data-theme="dark"] .hero .tagline { color: var(--c-calm); }
.hero h1 { font-size: 3.1rem; max-width: 16ch; margin: 0 auto .5rem; }
.hero h1 .hl { background: linear-gradient(transparent 62%, var(--c-canary) 62%); padding: 0 .1em; }
.hero .lead { margin: 1.2rem auto 2rem; font-size: 1.25rem; max-width: 56ch; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ---- Cards / grids ------------------------------------------------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; margin: 1.6rem 0; }
.card {
  display: block; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow);
  color: var(--text); transition: border-color .12s ease, transform .12s ease;
}
.card:hover { text-decoration: none; border-color: var(--c-cosmic); transform: translateY(-2px); }
.card .card-ico { font-size: 1.5rem; margin-bottom: .5rem; display: block; }
.card h3 { margin: 0 0 .3rem; font-size: 1.1rem; }
.card p { margin: 0; color: var(--text-muted); font-size: .92rem; }
.card .arrow { color: var(--c-cosmic); font-weight: 700; margin-top: .7rem; display: inline-block; font-size: .9rem; }

.step-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap:1rem; margin:1.6rem 0; counter-reset: step; }
.step { background: var(--bg-elevated); border:1px solid var(--border); border-radius: var(--radius); padding:1.3rem; position:relative; }
.step::before {
  counter-increment: step; content: counter(step);
  display:grid; place-items:center; width:30px; height:30px;
  background: var(--c-cosmic); color: var(--c-cream); border-radius:50%;
  font-weight:700; font-family: var(--font-heading); margin-bottom:.7rem;
}
.step h3 { margin:.1rem 0 .3rem; font-size:1.02rem; }
.step p { margin:0; font-size:.9rem; color:var(--text-muted); }

/* ---- Admonitions / callouts (branding.md mapping) ------------------------ */
.callout { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin: 1.4rem 0; background: var(--bg-elevated); }
.callout p:last-child { margin-bottom: 0; }
.callout .callout-title { font-weight: 700; display: block; margin-bottom: .25rem; }
.callout-info    { border-left-color: var(--c-cloud);   background: color-mix(in srgb, var(--c-cloud) 14%, var(--bg-elevated)); }
.callout-note    { border-left-color: var(--c-calm);    background: color-mix(in srgb, var(--c-calm) 16%, var(--bg-elevated)); }
.callout-warning { border-left-color: var(--c-canary);  background: color-mix(in srgb, var(--c-canary) 20%, var(--bg-elevated)); }
.callout-danger  { border-left-color: var(--c-crimson); background: color-mix(in srgb, var(--c-crimson) 12%, var(--bg-elevated)); }

/* ---- HTTP method badges -------------------------------------------------- */
.method {
  display: inline-block; font-family: var(--font-mono); font-weight: 700;
  font-size: .7rem; letter-spacing: .5px; text-transform: uppercase;
  padding: .2em .55em; border-radius: 4px; color: var(--c-cream); vertical-align: middle;
}
.method.get    { background: var(--m-get); }
.method.post   { background: var(--m-post); }
.method.put    { background: var(--m-put); color: var(--c-charcoal); }
.method.patch  { background: var(--m-put); color: var(--c-charcoal); }
.method.delete { background: var(--m-delete); }

/* ---- Code blocks with copy + language tabs ------------------------------- */
.code-group { margin: 1.4rem 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--code-bg); }
.code-tabs { display: flex; gap: 0; background: #232220; border-bottom: 1px solid #000; overflow-x: auto; }
.code-tab {
  font-family: var(--font-body); font-size: .82rem; font-weight: 600;
  color: #B7B5AC; background: transparent; border: 0; cursor: pointer;
  padding: .6rem 1rem; border-bottom: 2px solid transparent; white-space: nowrap;
}
.code-tab:hover { color: #fff; }
.code-tab.active { color: var(--c-canary); border-bottom-color: var(--c-canary); }
.code-panels { position: relative; }
.code-panel { display: none; }
.code-panel.active { display: block; }
.code-block { position: relative; }
.copy-btn {
  position: absolute; top: .55rem; right: .55rem; z-index: 2;
  font-family: var(--font-body); font-size: .72rem; font-weight: 600;
  color: #D9D7CC; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  border-radius: 5px; padding: .25rem .55rem; cursor: pointer;
}
.copy-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.copy-btn.copied { background: var(--c-camp); color: var(--c-cream); border-color: transparent; }

/* ---- Parameter tables ---------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1.2rem 0; }
table.params, table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.params th, table.params td, table.data th, table.data td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.params thead th, table.data thead th { background: var(--bg-sunken); font-size: .76rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
table.params td code { white-space: nowrap; }
.param-req { color: var(--c-crimson); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; }
.param-opt { color: var(--text-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; }
.type-pill { font-family: var(--font-mono); font-size: .78rem; color: var(--c-clove); }
:root[data-theme="dark"] .type-pill { color: var(--c-calm); }

/* ---- Endpoint blocks (reference two-pane) -------------------------------- */
.endpoint { border: 1px solid var(--border); border-radius: var(--radius); margin: 2rem 0; overflow: hidden; background: var(--bg-elevated); }
.endpoint-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.endpoint-head h3 { margin: 0 0 .5rem; }
.endpoint-route { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.endpoint-route .path { font-family: var(--font-mono); font-size: .9rem; color: var(--text); word-break: break-all; }
/* The description pane holds the param table (wide), the example pane holds
   code that now wraps compactly — so the description gets the larger share.
   Tunable via --endpoint-split. */
.endpoint-body { display: grid; grid-template-columns: var(--endpoint-split, 7fr 5fr); gap: 0; }
.endpoint-desc { padding: 1.2rem; min-width: 0; }
.endpoint-desc > *:first-child { margin-top: 0; }
.endpoint-example { padding: 1.2rem; background: var(--bg-sunken); border-left: 1px solid var(--border); min-width: 0; }
.endpoint-example h4 { margin-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-family: var(--font-body); }
@media (max-width: 900px) {
  .endpoint-body { grid-template-columns: 1fr; }
  .endpoint-example { border-left: 0; border-top: 1px solid var(--border); }
}

/* ---- Resource catalog (reference index) ---------------------------------- */
.filter-box { position: relative; margin: 1.4rem 0; }
.filter-box input {
  width: 100%; font-family: var(--font-body); font-size: 1rem;
  padding: .75rem 1rem .75rem 2.4rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text);
}
.filter-box input:focus { outline: 2px solid var(--c-cosmic); border-color: transparent; }
.filter-box::before { content: "🔎"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); opacity: .5; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.resource {
  display: block; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .9rem 1rem; background: var(--bg-elevated); color: var(--text);
}
.resource:hover { text-decoration: none; border-color: var(--c-cosmic); }
.resource .r-name { font-weight: 700; font-size: .98rem; }
.resource .r-path { font-family: var(--font-mono); font-size: .76rem; color: var(--c-cosmic); display: block; margin: .15rem 0; word-break: break-all; }
:root[data-theme="dark"] .resource .r-path { color: var(--c-cloud); }
.resource .r-desc { font-size: .84rem; color: var(--text-muted); margin: 0; }
.resource .r-verbs { margin-top: .5rem; display: flex; gap: .25rem; flex-wrap: wrap; }
.resource-empty { color: var(--text-muted); padding: 2rem 0; display: none; }

/* ---- Misc helpers -------------------------------------------------------- */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15em .55em; border-radius: 99px; letter-spacing: .3px; }
.badge-version { background: var(--c-clove); color: var(--c-cream); }
.badge-draft { background: var(--c-canary); color: var(--c-charcoal); }
.kbd { font-family: var(--font-mono); font-size: .8em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: .1em .4em; background: var(--bg-elevated); }
.next-prev { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.next-prev a { font-weight: 600; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-sunken); margin-top: 4rem; }
.site-footer .footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.4rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-muted); }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
  /* Drop the right rail first on mid widths; content reclaims its space. */
  .layout.with-toc:has(.toc) { grid-template-columns: var(--sidebar-w) minmax(0,1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav-toggle { display: grid; }
  .layout, .layout.with-toc { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; width: 86%; max-width: 320px;
    background: var(--bg-elevated); border-right: 1px solid var(--border);
    height: auto; padding: 1.4rem 1.2rem 3rem; transform: translateX(-105%);
    transition: transform .2s ease; z-index: 90; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { display: none; position: fixed; inset: 56px 0 0; background: rgba(0,0,0,.35); z-index: 80; }
  body.nav-open .nav-scrim { display: block; }
  .hero h1 { font-size: 2.2rem; }
  .endpoint-body { grid-template-columns: 1fr; }
  h1 { font-size: 1.9rem; }
}
@media (min-width: 821px) { .nav-scrim { display: none !important; } }

/* ---- Print --------------------------------------------------------------- */
@media print {
  .topbar, .sidebar, .toc, .copy-btn, .nav-scrim { display: none !important; }
  .layout { display: block; }
}
