/* Shared styles for /docs/* pages. Mirrors the REALLY DS palette
   from public/index.html — the docs surface is a sibling, not a
   different brand. */

:root {
  color-scheme: dark;

  --font-sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-serif:
    ui-serif, "New York", "Iowan Old Style", "Palatino Linotype",
    "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-mono:
    "SFMono-Regular", ui-monospace, "Cascadia Code", "Source Code Pro", Menlo,
    Consolas, monospace;

  --ink: #FFFFFF;
  --ink-muted: rgba(255, 255, 255, 0.70);
  --ink-subtle: rgba(255, 255, 255, 0.50);
  --accent: #7C5DFC;
  --accent-bright: #9880FF;
  --accent-soft: rgba(124, 93, 252, 0.14);

  --surface: rgba(30, 26, 43, 0.72);
  --surface-border: rgba(255, 255, 255, 0.10);
  --rule: rgba(255, 255, 255, 0.10);

  --surface-2: rgba(30, 26, 43, 0.58);
  --surface-2-border: rgba(255, 255, 255, 0.08);
  --panel: rgba(12, 10, 20, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);

  --ease-soft: cubic-bezier(0.2, 0.7, 0.2, 1);

  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-weight: 400;
  background-color: #141318;
  background-image:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(124,93,252,0.35), transparent 65%),
    radial-gradient(ellipse 40% 30% at 82% 14%, rgba(124,93,252,0.12), transparent 70%),
    linear-gradient(180deg, #0C0A14 0%, #141318 55%, #0C0A14 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.45  0 0 0 0 0.99  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ─── Layout: top bar + sidebar + main ───────────────────────── */

.docs-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(15rem, 17rem) minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
}

/* Landing variant — no sidebar column. Main content takes the full
   width; the topbar's `grid-column: 1 / -1` still works because
   `1 / -1` spans whatever columns the parent has. */
.docs-shell--landing {
  grid-template-columns: 1fr;
}

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  min-height: var(--topbar-h);
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  border-bottom: 1px solid var(--rule);
}

/* Soft accent line bleeding from beneath the topbar — gives the
   sticky bar a subtle horizon glow that matches the page-top
   radial in the main page hero. */
.docs-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(124, 93, 252, 0.35) 22%,
    rgba(124, 93, 252, 0.55) 50%,
    rgba(124, 93, 252, 0.35) 78%,
    transparent 100%
  );
  opacity: 0.55;
}

/* Composite brand link — REALLY logo + "Agent Number" wordmark
   together as one clickable anchor pointing at `/`. The REALLY
   consumer surface is reached via the "Human number" sidebar
   section, so the logo no longer needs its own outbound link. */
.docs-topbar .brand-link,
.docs-topbar .brand-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
  cursor: pointer;
  /* Raise above `.landing-topbar-pills` (absolutely-positioned,
     center of topbar) which can overlay the right edge of the
     brand link on narrower desktops. Without this, hovering the
     overlap zone hits a transparent gap between pills, showing
     the default cursor instead of the link's pointer. */
  position: relative;
  z-index: 2;
  transition: opacity 0.15s var(--ease-soft);
}
/* Force children to also show the pointer — Safari can drop the
   anchor's cursor when hovering an inner `<img>` (default drag
   pointer) or non-text inline element. Direct rule guarantees the
   composite logo + wordmark always reads as clickable. */
.docs-topbar .brand-link > *,
.docs-topbar .brand-logo-link > * {
  cursor: pointer;
}
.docs-topbar .brand-link:hover,
.docs-topbar .brand-logo-link:hover { opacity: 0.85; }

.docs-topbar .brand-logo {
  display: block;
  width: auto;
  height: 18px;
  flex: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 0 12px rgba(124, 93, 252, 0.35));
}

.docs-topbar .brand-product,
.docs-topbar a.brand-product {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: color 0.15s var(--ease-soft);
}
.docs-topbar a.brand-product:hover,
.docs-topbar .brand-link:hover .brand-product {
  color: var(--accent-bright);
}

.docs-topbar .topbar-spacer { flex: 1; }

/* ─── Primary-nav pills — every page ───────────────────────────────
   Two render targets that share content:
     - `.landing-topbar-pills` — absolutely positioned IN the topbar
       (desktop). One header row, no extra band beneath.
     - `.landing-pills` — sticky strip BELOW the topbar (mobile).
       Hidden on desktop; flipped on by the `@media (max-width:760px)`
       block below.
   Class names are historical (originated on the landing inline
   `<style>` block); kept identical here so docs + landing render
   the same nav with one stylesheet. */

.landing-topbar-pills {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 0.4rem;
  max-width: calc(100% - 18rem);
  overflow-x: auto;
  scrollbar-width: none;
}
.landing-topbar-pills::-webkit-scrollbar { display: none; }

.landing-topbar-pill {
  flex: none;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--surface-2-border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s var(--ease-soft),
    color 0.15s var(--ease-soft),
    border-color 0.15s var(--ease-soft);
}
.landing-topbar-pill:hover {
  color: var(--accent-bright);
  border-color: rgba(124, 93, 252, 0.45);
  background: var(--accent-soft);
}

/* Mobile-strip variant — hidden by default (desktop has the
   in-topbar variant above). The mobile `@media` further below
   flips it on. `display: none` keeps it out of the grid layout
   entirely so it doesn't claim a cell in `.docs-shell`. */
.landing-pills {
  display: none;
}

/* Hamburger nav toggle — visible at every viewport now.
   `.nav-open` flips the sidebar's behavior per context (mobile +
   landing-desktop open a drawer; docs-desktop collapses the
   permanent column). Raised above `.landing-topbar-pills` for
   the same reason as `.brand-link` — the absolutely-positioned
   pills can otherwise overlay the toggle on narrower desktops. */
.docs-nav-toggle {
  display: inline-flex;
  position: relative;
  z-index: 2;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--surface-border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  transition: border-color 0.15s var(--ease-soft), background 0.15s var(--ease-soft);
}

.docs-nav-toggle:hover {
  border-color: rgba(124, 93, 252, 0.45);
  background: var(--accent-soft);
}

.docs-nav-toggle .icon-bars {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 14px;
  height: 10px;
}

.docs-nav-toggle .icon-bars::before,
.docs-nav-toggle .icon-bars::after,
.docs-nav-toggle .icon-bars span {
  content: "";
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.18s var(--ease-soft), opacity 0.15s var(--ease-soft);
}

.docs-shell.nav-open .docs-nav-toggle .icon-bars::before {
  transform: translateY(4.25px) rotate(45deg);
}
.docs-shell.nav-open .docs-nav-toggle .icon-bars span { opacity: 0; }
.docs-shell.nav-open .docs-nav-toggle .icon-bars::after {
  transform: translateY(-4.25px) rotate(-45deg);
}

/* ─── Sidebar ───────────────────────────────────────────────── */
/*
 * Sidebar default (this rule below) = permanent column in
 * `.docs-shell` (docs pages, desktop). One override flips it to
 * drawer mode:
 *   - `@media (max-width: 760px)` below — drawer everywhere on mobile
 *
 * Visibility is flipped by `.nav-open` per surface (handled in the
 * desktop block below): docs-desktop hides on toggle, landing-desktop
 * reveals on toggle. Both use the SAME column-style sidebar — only
 * the default state differs.
 */
.docs-sidebar {
  border-right: 1px solid var(--rule);
  padding: clamp(1.5rem, 3vw, 2.2rem) clamp(1rem, 2vw, 1.4rem);
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

/* ── Desktop layout — sidebar as a fixed-position left rail
   (NOT a grid column), main always centered in the viewport.
   Toggling the sidebar slides it in/out via transform without
   ever shifting main's centering.
     - Docs desktop:    DEFAULT visible · `.nav-open` HIDES
     - Landing desktop: DEFAULT hidden  · `.nav-open` SHOWS
   Trade-off: on narrow desktops where the viewport isn't wide
   enough for sidebar (17rem) + centered main (56rem) + side
   gutters, the sidebar visually overlaps the left edge of main
   when shown. Acceptable because the user explicitly toggled it
   and main stays readable in the remaining width.
   Mobile (`@media (max-width: 760px)` further down) keeps the
   top-drop drawer pattern unchanged. */
@media (min-width: 761px) {
  /* Both shells collapse to a single column on desktop — the
     sidebar is no longer in flow, so no grid track for it. */
  .docs-shell,
  .docs-shell--landing {
    grid-template-columns: 1fr;
  }

  /* Main: explicitly centered in the viewport regardless of
     sidebar state. `.docs-main` had no `margin-auto` rule before
     (it relied on the grid column to position it); now it
     centers itself. */
  .docs-main {
    margin-left: auto;
    margin-right: auto;
  }

  /* Sidebar: fixed-positioned on the left edge of the viewport,
     sliding in/out via transform. Always the same `.docs-sidebar`
     visual treatment when visible. */
  .docs-shell .docs-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 17rem;
    max-width: 90vw;
    height: calc(100vh - var(--topbar-h));
    z-index: 25;
    border-right: 1px solid var(--rule);
    background: rgba(12, 10, 20, 0.92);
    backdrop-filter: blur(14px) saturate(1.05);
    -webkit-backdrop-filter: blur(14px) saturate(1.05);
    transition: transform 0.22s var(--ease-soft);
    box-shadow: 0 0 32px -16px rgba(0, 0, 0, 0.6);
  }

  /* Docs default: visible.   `.nav-open`: slide off-screen left. */
  .docs-shell:not(.docs-shell--landing) .docs-sidebar {
    transform: translateX(0);
  }
  .docs-shell:not(.docs-shell--landing).nav-open .docs-sidebar {
    transform: translateX(-100%);
  }

  /* Landing default: off-screen.   `.nav-open`: slide in. */
  .docs-shell--landing .docs-sidebar {
    transform: translateX(-100%);
  }
  .docs-shell--landing.nav-open .docs-sidebar {
    transform: translateX(0);
  }

  /* Hamburger icon — inverted animation on docs-desktop only.
     Default state of docs-desktop already shows an open sidebar,
     so the icon should read as an X (close). When toggled
     (`.nav-open`, sidebar hidden), the icon reverts to bars (open).
     Landing-desktop + mobile keep the original mapping:
     no class = bars (open menu), `.nav-open` = X (close). */
  .docs-shell:not(.docs-shell--landing) .docs-nav-toggle .icon-bars::before {
    transform: translateY(4.25px) rotate(45deg);
  }
  .docs-shell:not(.docs-shell--landing) .docs-nav-toggle .icon-bars span {
    opacity: 0;
  }
  .docs-shell:not(.docs-shell--landing) .docs-nav-toggle .icon-bars::after {
    transform: translateY(-4.25px) rotate(-45deg);
  }
  .docs-shell:not(.docs-shell--landing).nav-open .docs-nav-toggle .icon-bars::before {
    transform: none;
  }
  .docs-shell:not(.docs-shell--landing).nav-open .docs-nav-toggle .icon-bars span {
    opacity: 1;
  }
  .docs-shell:not(.docs-shell--landing).nav-open .docs-nav-toggle .icon-bars::after {
    transform: none;
  }
}

.docs-sidebar nav {
  display: grid;
}

.docs-sidebar .nav-section h3 {
  margin: 0 0 0.35rem 0;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.docs-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
}

.docs-sidebar li a {
  display: block;
  padding: 0.42rem 0.7rem;
  border-radius: 7px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.4;
  transition: background 0.15s var(--ease-soft), color 0.15s var(--ease-soft);
}

.docs-sidebar li a:hover {
  background: var(--accent-soft);
  /* Use the DS-canonical hover tone (`--really-violet-hi` / #9880FF)
     so a hovered link reads as "highlight" not "selected" — the
     active state still uses pure white. */
  color: var(--accent-bright);
}

.docs-sidebar li a.active {
  background: linear-gradient(
    90deg,
    rgba(124, 93, 252, 0.22),
    rgba(124, 93, 252, 0.08) 80%
  );
  color: var(--ink);
  border: 1px solid rgba(124, 93, 252, 0.45);
  padding: calc(0.42rem - 1px) calc(0.7rem - 1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 24px -8px rgba(124, 93, 252, 0.45);
  position: relative;
}

.docs-sidebar li a.active::before {
  content: "";
  position: absolute;
  left: -0.7rem;
  top: 50%;
  width: 3px;
  height: 1.1rem;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 10px rgba(124, 93, 252, 0.65);
}

/* Mobile sidebar backdrop — fades in when nav is open */
.docs-nav-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  z-index: 19;
  background: rgba(8, 6, 14, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-soft);
}

.docs-shell.nav-open .docs-nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Main content ─────────────────────────────────────────── */

.docs-main {
  padding: clamp(1.6rem, 4vw, 3.5rem) clamp(1.1rem, 5vw, 4rem)
           clamp(2.4rem, 5vw, 4rem);
  max-width: 56rem;
  width: 100%;
  min-width: 0;
  /* Center within whatever container holds it: viewport on
     landing (1-col shell), the sidebar's right column on docs
     (col-2 of the 2-col shell). Matches the landing's
     `.landing-main` centering so prose feels balanced on both
     surfaces — the column it's centering in differs, but the
     visual treatment doesn't. */
  margin-left: auto;
  margin-right: auto;
  animation: docs-rise 0.7s var(--ease-soft) both;
}

/* Defensive overflow protection — prevents any single child from
   pushing .docs-main wider than its grid track on mobile, which
   was causing prose to flow off the right edge and get clipped
   by the body's overflow-x: hidden. */
.docs-main > * {
  max-width: 100%;
  min-width: 0;
}

@keyframes docs-rise {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

.docs-main h1 {
  margin: 0 0 0.8rem 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.85rem, 5.6vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--ink);
  text-wrap: balance;
}

.docs-main .lede {
  margin: 0 0 2rem 0;
  color: var(--ink-muted);
  font-size: clamp(0.98rem, 1.6vw, 1.05rem);
  line-height: 1.6;
  max-width: 38rem;
  text-wrap: pretty;
}

.docs-main h2 {
  margin: clamp(2rem, 4vw, 2.6rem) 0 0.8rem 0;
  padding-top: clamp(0.9rem, 2vw, 1.1rem);
  border-top: 1px solid transparent;
  border-image: linear-gradient(
    90deg,
    rgba(124, 93, 252, 0.45) 0%,
    rgba(255, 255, 255, 0.18) 22%,
    rgba(255, 255, 255, 0.10) 60%,
    transparent 100%
  ) 1;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 3.4vw, 1.55rem);
  letter-spacing: -0.012em;
  line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}

/* First-h2 on a page: drop the rule entirely so the lede flows
   naturally into the first section without an awkward divider. */
.docs-main h2:first-of-type {
  border-image: none;
  border-top: none;
  padding-top: 0;
  margin-top: 0.5rem;
}

.docs-main h3 {
  margin: 1.6rem 0 0.5rem 0;
  font-size: clamp(0.98rem, 2vw, 1.05rem);
  font-weight: 600;
  color: var(--ink);
}

.docs-main p {
  margin: 0 0 1rem 0;
  color: var(--ink-muted);
  max-width: 42rem;
  text-wrap: pretty;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.docs-main h1,
.docs-main h2,
.docs-main h3,
.docs-main li {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.docs-main ul, .docs-main ol {
  margin: 0 0 1.2rem 0;
  padding-left: 1.25rem;
  color: var(--ink-muted);
}

.docs-main li {
  margin: 0.25rem 0;
  line-height: 1.55;
}

.docs-main strong { color: var(--ink); font-weight: 600; }
.docs-main em { color: var(--ink); font-style: italic; }

.docs-main a {
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.docs-main a:hover { color: var(--ink); }

/* Inline code — wrap aggressively on small viewports so long
   identifiers don't blow out the line. */
.docs-main code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--accent-bright);
  background: var(--accent-soft);
  padding: 0.08rem 0.36rem;
  border-radius: 5px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* B3 — wrapper around every `<pre>` injected by `_docs.js`. Holds
   the copy button as a sibling of `<pre>` so the button is OUTSIDE
   the pre's `overflow-x: auto` scroll container; otherwise an
   absolute-positioned button inside an overflow-auto parent can
   drift with the scroll. Wrapper carries the bottom margin pre
   used to own.

   `min-width: 0` is critical: this wrapper can land inside a
   grid/flex parent (landing's `.section` is `display: grid`, for
   example). Grid items default to `min-width: auto` which expands
   to the wrapper's content min-width — i.e. the longest line of
   the pre's code. On mobile, a long curl command then pushes the
   wrapper past viewport width, breaks `overflow-x: hidden` on
   body, and causes the whole page to scroll horizontally. */
.docs-main .code-block-wrapper {
  position: relative;
  margin: 0 0 1.5rem 0;
  min-width: 0;
  max-width: 100%;
}
.docs-main .code-block-wrapper > pre {
  min-width: 0;
  max-width: 100%;
}

/* Code blocks — horizontal scroll instead of wrap; full bleed
   on narrow viewports so long curl commands aren't cramped.
   `margin-bottom: 0` because the wrapper above owns the spacing. */
.docs-main pre {
  margin: 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 1.6vw, 0.84rem);
  line-height: 1.55;
}
/* Fallback when `<pre>` hasn't been wrapped yet (JS hasn't run,
   or for plain pre blocks outside `.code-block-wrapper`). */
.docs-main > pre,
.docs-main p + pre,
.docs-main h1 + pre,
.docs-main h2 + pre,
.docs-main h3 + pre,
.docs-main li > pre {
  margin-bottom: 1.5rem;
}

.docs-main pre code {
  background: none;
  color: var(--ink);
  padding: 0;
  font-size: inherit;
  word-break: normal;
  overflow-wrap: normal;
  white-space: pre;
}

/* B3 — copy button on every code block. Injected by `_docs.js`
   after `window.load` (Shiki has finished re-tokenizing by then).
   Always visible — square icon button anchored top-right of each
   `<pre>`. Hover-reveal felt hidden on mobile + confusing across
   surfaces, so it's a persistent affordance now. */
.code-copy-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--surface-2-border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-subtle);
  cursor: pointer;
  transition:
    background 0.15s var(--ease-soft),
    color 0.15s var(--ease-soft),
    border-color 0.15s var(--ease-soft);
}

.code-copy-btn:hover {
  color: var(--accent-bright);
  border-color: rgba(124, 93, 252, 0.45);
  background: var(--accent-soft);
}

.code-copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.code-copy-btn.copied {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.code-copy-btn.copy-failed {
  color: #F4B740;
  border-color: rgba(244, 183, 64, 0.45);
  background: rgba(244, 183, 64, 0.10);
}

.code-copy-btn svg {
  display: block;
  pointer-events: none;
}


/* HTTP method tags inside prose */
.docs-main .method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 93, 252, 0.35);
  margin-right: 0.45rem;
  vertical-align: middle;
}

/* Tables — wrap in .table-scroll for horizontal overflow on
   narrow viewports without breaking the page layout. The wrapper
   establishes a hard width boundary; the table inside can grow
   to its natural width and scroll within. */
.docs-main .table-scroll {
  margin: 0 0 1.6rem 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--surface-2-border);
  border-radius: 12px;
  background: var(--surface-2);
}

.docs-main .table-scroll table {
  margin: 0;
  border-radius: 0;
  border: none;
  /* Inside the scroll wrapper, allow the table to size to content
     so wide rows scroll horizontally rather than squashing cells. */
  width: auto;
  min-width: 100%;
}

.docs-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.6rem 0;
  font-size: 0.92rem;
}

.docs-main th, .docs-main td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.docs-main tr:last-child td { border-bottom: none; }

.docs-main th {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.03);
}

.docs-main td { color: var(--ink-muted); }
.docs-main td code { font-size: 0.84em; }

/* Callouts */
.docs-main .callout {
  margin: 1.2rem 0 1.6rem 0;
  padding: 0.95rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 9px 9px 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.docs-main .callout strong { color: var(--ink); }

.docs-main .callout--warn {
  border-left-color: #FFB454;
  background: rgba(255, 180, 84, 0.10);
}

/* Pagination (prev/next at bottom of each page) */
.docs-pagination {
  margin-top: 2.8rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.docs-pagination a {
  display: block;
  padding: 1rem 1.15rem;
  border: 1px solid var(--surface-2-border);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%),
    var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 0.18s var(--ease-soft),
    transform 0.18s var(--ease-soft),
    box-shadow 0.18s var(--ease-soft),
    background 0.18s var(--ease-soft);
}

.docs-pagination a:hover {
  border-color: rgba(124, 93, 252, 0.55);
  color: var(--ink);
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(124, 93, 252, 0.08), transparent 60%),
    var(--surface-2);
  box-shadow: 0 18px 32px -22px rgba(124, 93, 252, 0.55);
}

.docs-pagination a:hover .pagination-title {
  color: var(--accent-bright);
}

.docs-pagination .pagination-title {
  transition: color 0.15s var(--ease-soft);
}

.docs-pagination .pagination-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin-bottom: 0.25rem;
}

.docs-pagination .pagination-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink);
}

.docs-pagination a.next { text-align: right; }

/* Scalar API ref customization */
.scalar-host {
  margin: 0;
  padding: 0;
  background: transparent;
}

/* ─── Mobile: <= 760px ───────────────────────────────────────
   Sidebar collapses behind the hamburger toggle. Tightens
   spacing, stacks pagination, surfaces mobile-only chrome. */

@media (max-width: 760px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }

  /* Mobile-strip pills: flip on, hide the in-topbar variant. */
  .landing-topbar-pills { display: none; }

  .landing-pills {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    gap: 0.55rem;
    padding: 0.7rem clamp(0.75rem, 3vw, 1.5rem);
    background: rgba(12, 10, 20, 0.85);
    backdrop-filter: blur(14px) saturate(1.05);
    -webkit-backdrop-filter: blur(14px) saturate(1.05);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: var(--topbar-h, 52px);
    z-index: 18;
    grid-column: 1 / -1;
  }
  .landing-pills::-webkit-scrollbar { display: none; }

  .landing-pill {
    flex: none;
    scroll-snap-align: start;
    padding: 0.45rem 1rem;
    border: 1px solid var(--surface-2-border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-muted);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    transition:
      background 0.15s var(--ease-soft),
      color 0.15s var(--ease-soft),
      border-color 0.15s var(--ease-soft);
  }
  .landing-pill:hover {
    color: var(--accent-bright);
    border-color: rgba(124, 93, 252, 0.45);
    background: var(--accent-soft);
  }

  /* T0.3 — mobile-overflow fix. Grid + flex children inherit
     `min-width: auto` which lets intrinsic content (long URLs,
     the "AGENT NUMBER" topbar link, long inline code spans)
     push their container wider than the viewport. Body's
     `overflow-x: hidden` then clips the right edge, hiding
     line-ends of normal prose. min-width: 0 lets each child
     shrink to its track width; ellipsis + scroll handle the
     overflow inside the child instead of leaking outside. */
  .docs-shell > *,
  .docs-topbar > * {
    min-width: 0;
  }

  .docs-topbar {
    padding: 0.7rem 1rem;
    gap: 0.6rem;
  }

  .docs-topbar .brand-product {
    font-size: 0.66rem;
    letter-spacing: 0.18em;
  }

  /* On mobile the topbar is tight — drop the "· Docs" suffix so
     the menu button stays comfortably on-screen. */
  .docs-topbar .brand-suffix {
    display: none;
  }

  /* Hide secondary topbar links — the same destinations live
     in the drawer + page footer. */
  .docs-topbar .topbar-links { display: none; }

  /* Show the hamburger */
  .docs-nav-toggle {
    display: inline-flex;
  }

  /* Sidebar becomes a drop-down panel from below the topbar.
     Hidden by default; transforms in when .nav-open is set.
     `visibility: hidden` pairs with the transform so the panel
     genuinely doesn't paint when closed — iOS Safari's rubber-band
     scroll can momentarily lose a fixed element's `transform`
     offset, briefly flashing the sidebar above the topbar
     ("SMS overview" appearing on pull-to-refresh). Visibility
     transitions with a delay so the slide-out animation still
     completes before the element becomes non-paintable. */
  .docs-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: auto;
    max-height: calc(100dvh - var(--topbar-h));
    height: auto;
    z-index: 20;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    background: rgba(12, 10, 20, 0.94);
    backdrop-filter: blur(18px) saturate(1.05);
    -webkit-backdrop-filter: blur(18px) saturate(1.05);
    padding: 1.1rem 1rem 1.3rem;
    transform: translateY(-105%);
    visibility: hidden;
    transition:
      transform 0.22s var(--ease-soft),
      visibility 0s linear 0.22s;
    box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.6);
  }

  .docs-shell.nav-open .docs-sidebar {
    transform: translateY(0);
    visibility: visible;
    transition:
      transform 0.22s var(--ease-soft),
      visibility 0s linear 0s;
  }

  .docs-nav-backdrop { display: block; }

  .docs-sidebar nav { gap: 1.1rem; }

  .docs-main {
    padding: 1.5rem 1.1rem 2.2rem;
  }

  .docs-main h1 {
    margin-bottom: 0.6rem;
  }

  .docs-main .lede {
    margin-bottom: 1.5rem;
  }

  .docs-main h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-top: 1.05rem;
  }

  .docs-main h2 + p,
  .docs-main h2 + ul,
  .docs-main h2 + ol,
  .docs-main h2 + .table-scroll,
  .docs-main h2 + pre,
  .docs-main h2 + .callout {
    margin-top: 0.4rem;
  }

  .docs-main h3 {
    margin-top: 1.4rem;
  }

  /* On the Overview page, the API reference Scalar embed lives
     inside .ref-host. Give the lede above it some real breathing
     room on small screens so it doesn't crash into the widget. */
  .docs-main .ref-host {
    margin-top: 1.6rem;
    margin-left: -0.3rem;
    margin-right: -0.3rem;
  }

  .docs-pagination {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-top: 2.2rem;
  }

  .docs-pagination a.next { text-align: left; }
}

@media (max-width: 380px) {
  .docs-topbar {
    padding: 0.6rem 0.75rem;
  }
  .docs-topbar .brand-product {
    font-size: 0.62rem;
  }
  .docs-main {
    padding: 1.3rem 0.9rem 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .docs-sidebar { transition: none !important; }
}

/* ─── Reference-page additions (Scalar replacement) ─────────────── */

/* Method pill — used in the sidebar AND on reference page H1.
   GET / POST / etc. each get their own hue. Shared structure
   (fixed width, monospace) keeps paths aligning across rows. */
.method {
  display: inline-block;
  flex: 0 0 auto;
  /* Pill is intrinsic-sized — each method occupies only the space
     it needs. Cross-row path alignment in endpoint lists is handled
     by a subgrid on the parent <ul> (see .endpoint-list below). */
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.5rem;
  vertical-align: middle;
  text-transform: uppercase;
  white-space: nowrap;        /* keep POST / GET on one line */
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.method-get    { color: #7CE7B0; background: rgba(124, 231, 176, 0.10); border-color: rgba(124, 231, 176, 0.28); }
.method-post   { color: #9880FF; background: rgba(152, 128, 255, 0.12); border-color: rgba(152, 128, 255, 0.32); }
.method-put    { color: #F4B740; background: rgba(244, 183, 64, 0.10); border-color: rgba(244, 183, 64, 0.28); }
.method-delete { color: #F25757; background: rgba(242, 87, 87, 0.10); border-color: rgba(242, 87, 87, 0.28); }
.method-patch  { color: #B69CFE; background: rgba(182, 156, 254, 0.10); border-color: rgba(182, 156, 254, 0.28); }

/* Sidebar: endpoint sub-headings + endpoint-list rows.
   The two heading levels here have to clearly NOT look like
   clickable rows — they share the section with endpoint links
   that ARE clickable, and visual confusion was a real complaint.
   Tactics: smaller, more tracking, less weight, faded color,
   visible vertical separator above each group. */
.docs-sidebar h4.nav-subheading {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin: 1rem 0 0.35rem;
  padding-left: 0.7rem;
}
/* Endpoint group sub-heading (Subscriptions / Auth / Discovery /
   SMS / Voice inside the API reference section). Smaller, dimmer
   eyebrow than the top-level `.nav-section-heading` so the visual
   hierarchy reads as: SECTION (--accent, larger) > group
   (--ink-subtle, smaller). Always rendered — no toggle. */
.nav-group-heading {
  margin: 0.85rem 0 0.3rem;
  padding: 0 0.7rem;
  color: var(--ink-subtle);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}
.docs-sidebar ul.endpoint-list {
  margin-bottom: 0.4rem;
  /* Subgrid pattern: <ul> defines a 2-column grid (pill | path).
     <li> and <a> inherit those columns via subgrid so every
     pill across rows lives in a column that's max-content-wide
     (sized to the LONGEST method in this list). The pill itself
     stays intrinsic-sized — GET pill is small, POST pill is
     bigger — but paths after them all start at the same x. */
  display: grid;
  grid-template-columns: max-content 1fr;
  row-gap: 0.1rem;
  column-gap: 0.5rem;
}
.docs-sidebar ul.endpoint-list li {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}
.docs-sidebar ul.endpoint-list li a {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  align-items: center;
  font-size: 0.85rem;
  padding: 0.32rem 0.5rem;
}
.docs-sidebar ul.endpoint-list .method {
  margin-right: 0;          /* grid column-gap handles spacing */
}
.docs-sidebar ul.endpoint-list li a .path {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-sidebar ul.endpoint-list li a:hover .path {
  color: var(--accent-bright);
}
.docs-sidebar ul.endpoint-list li a.active .path {
  color: var(--ink);
}
.docs-sidebar ul.endpoint-list li a .endpoint-suffix {
  margin-left: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-subtle);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.05rem 0.32rem;
  border-radius: 4px;
}

/* Reference page H1 — method chip + path code. */
.docs-main h1.ref-h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.docs-main h1.ref-h1 .method {
  font-size: 0.78rem;
  width: auto;
  min-width: 3.4rem;
  padding: 0.32rem 0.7rem;
}
.docs-main h1.ref-h1 .ref-path {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-2-border);
  padding: 0.18rem 0.55rem;
  border-radius: 8px;
  letter-spacing: -0.01em;
}

/* Required-field pill in parameter / body tables. */
.required-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #F25757;
  background: rgba(242, 87, 87, 0.10);
  border: 1px solid rgba(242, 87, 87, 0.28);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* Status pill — colored by HTTP class (2xx green, 4xx orange,
   5xx red). Used in the response-block H3s. */
.status-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.12rem 0.5rem;
  border-radius: 5px;
  margin-right: 0.55rem;
  vertical-align: middle;
}
.status-pill.status-2xx { color: #7CE7B0; background: rgba(124, 231, 176, 0.10); border: 1px solid rgba(124, 231, 176, 0.28); }
.status-pill.status-3xx { color: #9DC8FF; background: rgba(157, 200, 255, 0.10); border: 1px solid rgba(157, 200, 255, 0.28); }
.status-pill.status-4xx { color: #F4B740; background: rgba(244, 183, 64, 0.10); border: 1px solid rgba(244, 183, 64, 0.28); }
.status-pill.status-5xx { color: #F25757; background: rgba(242, 87, 87, 0.10); border: 1px solid rgba(242, 87, 87, 0.28); }

/* Code-sample tabs — every pane is in the DOM (agents see all
   languages); JS toggles `.active` to show one at a time. */
.code-samples {
  margin: 0.7rem 0 1.4rem;
  border: 1px solid var(--surface-2-border);
  border-radius: 12px;
  background: var(--panel);
  /* No `overflow: hidden` here — it would clip the absolutely-
     positioned `.code-overflow-menu` popover at the bottom of the
     visible-tabs row. The inner `.code-pane pre` carries its own
     bottom radius so we don't need a clip on the outer box. */
}
/* Tabs bar: visible row on the left, `+ N more` overflow on the
   right. Bar itself never wraps onto a second line — overflow
   takes the rest. */
.code-samples .code-tabs-bar {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0.4rem 0.4rem 0;
  border-bottom: 1px solid var(--surface-2-border);
  background: rgba(255, 255, 255, 0.02);
}
.code-samples .code-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;        /* Visible row never spills */
}
.code-samples .code-tabs-overflow {
  position: relative;
  flex: 0 0 auto;
}
.code-samples .code-tab-more {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-subtle);
  background: transparent;
  border: 1px dashed var(--surface-2-border);
  border-bottom: none;
}
.code-samples .code-tab-more:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}
.code-samples .code-tab-more.has-selection {
  color: var(--ink);
  border-style: solid;
  border-color: var(--surface-2-border);
}
/* Overflow popover — positioned beneath the toggle, reveals the
   non-primary language buttons. */
.code-samples .code-overflow-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 11rem;
  padding: 0.35rem;
  background: var(--bg-3, #1E1A2B);
  border: 1px solid var(--surface-2-border);
  border-radius: 10px;
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.45));
}
.code-samples .code-overflow-menu[hidden] { display: none; }
.code-samples .code-tab-overflow {
  text-align: left;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  color: var(--ink-muted);
}
.code-samples .code-tab-overflow:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}
.code-samples .code-tab-overflow.active {
  background: var(--accent-soft);
  border-color: rgba(124, 93, 252, 0.32);
  color: var(--ink);
}
/* Mobile-only overflow items mirror primary tabs that don't fit in
   the visible row at ≤760px. Hidden on desktop where those tabs ARE
   visible in the bar (rendering them in both places would create a
   duplicate-buttons-with-same-data-tab footgun for the active-state
   logic). */
.code-samples .code-tab-overflow--mobile { display: none; }
.code-samples .code-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s var(--ease-soft), color 0.15s var(--ease-soft);
}
.code-samples .code-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}
.code-samples .code-tab.active {
  color: var(--ink);
  background: var(--bg-2, #1A1622);
  border-color: var(--surface-2-border);
  border-bottom-color: var(--bg-2, #1A1622);
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.code-samples .code-pane {
  padding: 0.2rem 0.25rem;
}
.code-samples .code-pane[hidden] { display: none; }
.code-samples .code-pane pre {
  margin: 0;
  border-radius: 0 0 10px 10px;
}

/* Parameter / request-body tables.
   Two shapes:
     3-col: Field | Type | Description           (request-body)
     4-col: Name  | In   | Type | Description    (parameters)
   Goal: Field/Name and Type chips never wrap; Description gets the
   leftover width. Browser auto-layout does this naturally as long
   as the leading columns are nowrap and the trailing column is
   given `width: 100%` to absorb the slack. No fixed widths — they
   bit us before by giving Description a fixed share equal to Type. */
.docs-main table.param-table {
  width: 100%;
}
.docs-main table.param-table th,
.docs-main table.param-table td {
  vertical-align: top;
}
/* Leading columns — short identifier chips. Never break. */
.docs-main table.param-table tbody td:not(:last-child) {
  white-space: nowrap;
}
.docs-main table.param-table tbody td:not(:last-child) > code:first-child {
  word-break: keep-all;
}
/* Trailing (description) column — prose + Example. Absorb the
   leftover row width so Field/Type can't bloat past their content. */
.docs-main table.param-table tbody td:last-child {
  white-space: normal;
  width: 100%;
}
.docs-main .param-example {
  margin-top: 0.45rem;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.docs-main .param-example-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.docs-main .param-example code {
  word-break: break-all;        /* still wrap long hex/wallet/etc. */
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  /* On phones the visible tab row only fits ~4 tabs (curl, TS,
     Python, Go per Jake spec). Demote the rest by hiding tabs
     flagged `data-mobile-hidden` from the bar; their twins live
     in the overflow popover under `.code-tab-overflow--mobile`. */
  .code-samples .code-tab[data-mobile-hidden] {
    display: none;
  }
  .code-samples .code-tab-overflow--mobile {
    display: block;
  }
  /* Tighter tab padding so the 4 mobile-primaries fit comfortably. */
  .code-samples .code-tab {
    padding: 0.4rem 0.55rem;
    font-size: 0.74rem;
  }
  .code-samples .code-tab-more {
    padding: 0.4rem 0.55rem;
  }

  /* Reference H1 — stack method chip above the path so a long path
     doesn't push the chip off-screen. */
  .docs-main h1.ref-h1 {
    align-items: flex-start;
    font-size: 1.55rem;
  }
  .docs-main h1.ref-h1 .ref-path {
    font-size: 1.15rem;
    word-break: break-all;
  }

  /* Sidebar endpoint rows: shrink the path font slightly so most
     full paths fit on one line in a phone-width drawer. */
  .docs-sidebar ul.endpoint-list li a .path { font-size: 0.74rem; }

  /* Tap targets — Apple HIG ≥ 44px, Google ≥ 48px. Bump sidebar
     link + section-summary padding so each row clears 44px tall on
     a phone. Desktop keeps the tighter spacing (rules above). */
  .docs-sidebar li a {
    padding: 0.7rem 0.85rem;
  }
  /* Slight visual separation between adjacent rows so the bumped
     tap area doesn't read as one continuous tappable zone. */
  .docs-sidebar ul {
    gap: 0.15rem;
  }
}

/* ── Flat-expanded sidebar sections (saperly-style, no `<details>`)
   Each section is `<section class="nav-section">` with an `<h3
   class="nav-section-heading">` eyebrow followed by a flat `<ul
   class="nav-list">` (and optionally `<h5 class="nav-group-heading">
   + <ul>` groups inside the API reference section). Always visible,
   no toggle. */
.nav-section {
  margin-bottom: 1.35rem;
}
.nav-section-heading {
  /* Section eyebrow: uppercase + tracked, the same visual language
     used on landing section-tags before they were removed. Sized
     just a touch smaller than the desktop section H3 so the nav
     reads as a chrome strip, not a heading-heavy column. */
  margin: 0 0 0.35rem;
  padding: 0 0.7rem;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

/* Top-level links sit above any section header (Quickstart,
   Overview). Slightly bolder + brighter than items inside a
   section, with comfortable padding so they read as the
   navigational anchor of the column. */
.nav-top-link {
  display: block;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.15rem;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.15s var(--ease-soft), color 0.15s var(--ease-soft);
}
.nav-top-link:hover {
  background: var(--accent-soft);
  color: var(--accent-bright);
}
.nav-top-link.active {
  background: linear-gradient(
    90deg,
    rgba(124, 93, 252, 0.22),
    rgba(124, 93, 252, 0.08) 80%
  );
  color: var(--ink);
  border: 1px solid rgba(124, 93, 252, 0.45);
  padding: calc(0.5rem - 1px) calc(0.7rem - 1px);
  position: relative;
}
.nav-top-link.active::before {
  content: "";
  position: absolute;
  left: -0.7rem;
  top: 50%;
  width: 3px;
  height: 1.1rem;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 10px rgba(124, 93, 252, 0.65);
}

/* ── Footer discovery strip (every page, landing + docs).
   Subdued, semi-hidden link row at page end. Same look-and-feel as
   the inline copy on landing — moved here so docs pages pick it up
   automatically. */
.footer-discovery {
  width: min(42rem, 100%);
  margin: clamp(2rem, 5vw, 3rem) auto 0;
  color: var(--ink-subtle);
  font-size: 0.78rem;
  line-height: 1.7;
  opacity: 0.7;
}
.footer-discovery a {
  color: var(--ink-subtle);
  text-decoration: none;
  transition: color 0.15s var(--ease-soft);
}
.footer-discovery a + a::before {
  content: " · ";
  color: var(--ink-subtle);
  opacity: 0.55;
  margin: 0 0.05rem;
}
.footer-discovery a:hover {
  color: var(--ink-muted);
}

/* Landing-page CTAs — three buttons on the hero quickstart card. */
.docs-main .landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.docs-main .landing-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid var(--surface-2-border);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s var(--ease-soft), background 0.15s var(--ease-soft);
}
.docs-main .landing-cta:hover {
  border-color: rgba(124, 93, 252, 0.45);
  background: var(--accent-soft);
}
.docs-main .landing-cta--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.docs-main .landing-cta--primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

/* Landing-main: the existing inline CSS of public/index.html
   targets `main` directly — and `_docs.css` defines layout for
   `.docs-main`. With both classes on the same element, the
   inline rules can fight `_docs.css`. The override below scopes
   the docs grid to landing-main without touching the main padding. */
.docs-main.landing-main {
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 3rem);
  /* Landing has no sidebar column to anchor it; center the main
     block in the viewport so it doesn't sit hard against the
     viewport's left edge (`.docs-main` defaults to no horizontal
     margin, which made the column read as left-aligned with a
     wide empty gutter on the right on wide desktops). */
  margin: 0 auto;
}

/* ── Docs actions dropdown ──────────────────────────────────────────
   "Copy page ▼" split button rendered at the top of any docs page
   with a parallel `.md` mirror. Mirrors the Claude Code Docs pattern.
   Behavior in `_docs.js` (event delegation on `[data-docs-action]`). */
.docs-main .docs-actions {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  /* Float right so the H1 below wraps to the left of the button —
     puts the dropdown on the same baseline as the page title.
     Tiny top offset to optically align with the H1's cap height. */
  float: right;
  margin: 0.4rem 0 0.5rem 1rem;
  border: 1px solid var(--surface-2-border, rgba(255, 255, 255, 0.12));
  border-radius: 0.5rem;
  background: var(--surface-2, rgba(30, 26, 43, 0.58));
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1;
}
.docs-main .docs-action-main,
.docs-main .docs-action-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 0;
  color: var(--ink, #fff);
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s ease;
}
.docs-main .docs-action-main:hover,
.docs-main .docs-action-toggle:hover {
  background: var(--accent-soft, rgba(124, 93, 252, 0.14));
}
.docs-main .docs-action-toggle {
  padding: 0.55rem 0.55rem;
  border-left: 1px solid var(--surface-2-border, rgba(255, 255, 255, 0.12));
}
.docs-main .docs-action-icon,
.docs-main .docs-action-chevron {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}
.docs-main .docs-action-chevron {
  transition: transform 0.15s ease;
}
.docs-main .docs-actions[data-open="true"] .docs-action-chevron {
  transform: rotate(180deg);
}
.docs-main .docs-action-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 20rem;
  padding: 0.4rem;
  border: 1px solid var(--surface-2-border, rgba(255, 255, 255, 0.12));
  border-radius: 0.5rem;
  background: var(--panel, rgba(12, 10, 20, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.docs-main .docs-action-menu[hidden] {
  display: none;
}
.docs-main .docs-action-menu > * {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 0;
  background: transparent;
  color: var(--ink, #fff);
  text-decoration: none;
  text-align: left;
  border-radius: 0.4rem;
  font: inherit;
  cursor: pointer;
  transition: background 0.1s ease;
}
.docs-main .docs-action-menu > *:hover,
.docs-main .docs-action-menu > *:focus-visible {
  background: var(--accent-soft, rgba(124, 93, 252, 0.14));
  outline: none;
}
.docs-main .docs-action-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.docs-main .docs-action-text strong {
  font-weight: 600;
  font-size: 0.875rem;
}
.docs-main .docs-action-text span {
  font-size: 0.78rem;
  color: var(--ink-subtle, rgba(255, 255, 255, 0.55));
}
.docs-main .docs-action-main.copied,
.docs-main .docs-action-menu > .copied {
  background: var(--accent, #7c5dfc);
  color: #fff;
}
.docs-main .docs-action-main.copy-failed,
.docs-main .docs-action-menu > .copy-failed {
  background: rgba(245, 158, 11, 0.22); /* amber */
  color: #fbbf24;
}
@media (max-width: 760px) {
  .docs-main .docs-action-menu {
    min-width: min(20rem, calc(100vw - 2rem));
  }
}

/* Sidebar close button — desktop-only X at the top-right of the
   `.docs-sidebar` panel. Triggers the same `.nav-open` toggle the
   hamburger fires (wired in `_docs.js`). On mobile the topbar
   hamburger is the close affordance, so this button is hidden
   ≤760px. */
.docs-sidebar-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--ink-muted, rgba(255, 255, 255, 0.7));
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  z-index: 2;
}
.docs-sidebar-close:hover,
.docs-sidebar-close:focus-visible {
  background: var(--accent-soft, rgba(124, 93, 252, 0.14));
  color: var(--ink, #fff);
  border-color: var(--surface-2-border, rgba(255, 255, 255, 0.12));
  outline: none;
}
.docs-sidebar-close svg {
  width: 1rem;
  height: 1rem;
}
@media (min-width: 761px) {
  .docs-sidebar-close {
    display: inline-flex;
  }
}
