/* ============================================================================
   AGRO-AI Platform API — Design System
   A single source of truth for the developer platform surface.
   Brand: forest green + lime/olive + amber, on Tailwind-family neutrals.
   Themeable (light/dark), responsive, accessible.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Brand */
  --brand-forest: #234224;
  --brand-green: #2d5a2e;
  --brand-green-600: #3d6b3e;
  --brand-ink: #0a150f;
  --brand-ink-2: #0f2318;
  --brand-lime: #7ea80f;
  --brand-lime-soft: #bbde75;
  --brand-amber: #eab308;

  /* Neutrals (light) */
  --n-0: #ffffff;
  --n-25: #fbfcfb;
  --n-50: #f4f7f4;
  --n-100: #eaefea;
  --n-150: #dfe6df;
  --n-200: #d1dad1;
  --n-300: #b6c2b6;
  --n-500: #6b776b;
  --n-600: #4b554b;
  --n-700: #364036;
  --n-800: #1f2a1f;
  --n-900: #111a12;

  /* Semantic (light default) */
  --bg: var(--n-25);
  --bg-elevated: var(--n-0);
  --bg-sunken: var(--n-50);
  --bg-code: #0c1a12;
  --surface-border: var(--n-150);
  --surface-border-strong: var(--n-200);
  --text: #16221a;
  --text-muted: #55645a;
  --text-faint: #7c8a80;
  --text-on-brand: #f5faf1;
  --accent: var(--brand-green);
  --accent-hover: var(--brand-forest);
  --accent-contrast: #ffffff;
  --link: #2f6d3a;
  --focus-ring: #7ea80f;
  --success: #2f8f4e;
  --warning: #b7791f;
  --danger: #c0392b;
  --info: #2f6d3a;

  /* Method colors (HTTP verbs) */
  --m-get: #2f6d3a;
  --m-post: #1f6feb;
  --m-put: #b7791f;
  --m-patch: #8250df;
  --m-delete: #c0392b;

  /* Typography */
  --font-sans: "Glacial Indifference", "Segoe UI", system-ui, -apple-system,
    Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code",
    "Cascadia Code", Menlo, Consolas, monospace;

  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.075rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.6rem;
  --fs-2xl: 2.1rem;
  --fs-3xl: 2.9rem;
  --fs-4xl: 3.6rem;
  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-normal: 1.65;

  /* Space / radius / shadow */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;
  --sp-10: 4rem;
  --sp-12: 6rem;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(16, 26, 18, 0.06),
    0 1px 3px rgba(16, 26, 18, 0.08);
  --shadow: 0 4px 12px rgba(16, 26, 18, 0.08), 0 2px 4px rgba(16, 26, 18, 0.06);
  --shadow-lg: 0 18px 40px rgba(16, 26, 18, 0.14),
    0 6px 12px rgba(16, 26, 18, 0.08);
  --ring: 0 0 0 3px rgba(126, 168, 15, 0.45);

  --header-h: 64px;
  --content-max: 1200px;
  --prose-max: 46rem;
  --sidebar-w: 264px;
  --toc-w: 220px;
}

/* Dark theme — via system preference, overridable by [data-theme] */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a130d;
    --bg-elevated: #0f1b12;
    --bg-sunken: #0c160f;
    --bg-code: #071009;
    --surface-border: #1e2c21;
    --surface-border-strong: #29392c;
    --text: #e7efe7;
    --text-muted: #9fb0a2;
    --text-faint: #7a8a7d;
    --accent: #86c34a;
    --accent-hover: #9fd363;
    --accent-contrast: #08130a;
    --link: #9fd363;
    --success: #67c98a;
    --warning: #e0b25a;
    --danger: #e88b7f;
    --info: #9fd363;
    --m-get: #6fbf7f;
    --m-post: #6ea8ff;
    --m-put: #e0b25a;
    --m-patch: #b998f5;
    --m-delete: #e88b7f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #0a130d;
  --bg-elevated: #0f1b12;
  --bg-sunken: #0c160f;
  --bg-code: #071009;
  --surface-border: #1e2c21;
  --surface-border-strong: #29392c;
  --text: #e7efe7;
  --text-muted: #9fb0a2;
  --text-faint: #7a8a7d;
  --accent: #86c34a;
  --accent-hover: #9fd363;
  --accent-contrast: #08130a;
  --link: #9fd363;
  --success: #67c98a;
  --warning: #e0b25a;
  --danger: #e88b7f;
  --info: #9fd363;
  --m-get: #6fbf7f;
  --m-post: #6ea8ff;
  --m-put: #e0b25a;
  --m-patch: #b998f5;
  --m-delete: #e88b7f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.55);
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@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;
  }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,
h2,
h3,
h4 {
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.5em;
}
h1 {
  font-size: var(--fs-3xl);
}
h2 {
  font-size: var(--fs-2xl);
}
h3 {
  font-size: var(--fs-lg);
}
p {
  margin: 0 0 1rem;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
img {
  max-width: 100%;
  height: auto;
}
hr {
  border: 0;
  border-top: 1px solid var(--surface-border);
  margin: var(--sp-6) 0;
}
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important;
  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: 8px;
  top: -60px;
  z-index: 1000;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 8px;
  text-decoration: none;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.section {
  padding-block: var(--sp-10);
}
.grid {
  display: grid;
  gap: var(--sp-5);
}
.stack > * + * {
  margin-top: var(--sp-4);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede {
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 42rem;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--surface-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand:hover {
  text-decoration: none;
}
.brand svg {
  width: 30px;
  height: 30px;
  flex: none;
}
.brand-name {
  font-size: 1.05rem;
}
.brand-name b {
  color: var(--accent);
}
.brand-sub {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--surface-border-strong);
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: auto;
}
.nav a.nav-link {
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}
.nav a.nav-link:hover {
  color: var(--text);
  background: var(--bg-sunken);
  text-decoration: none;
}
.nav a.nav-link[aria-current="page"] {
  color: var(--accent);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--surface-border-strong);
}
.theme-toggle .icon-sun {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme="light"]) .theme-toggle .icon-sun {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}
.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-sm);
  line-height: 1;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--surface-border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-sunken);
}
.btn-lg {
  padding: 0.9rem 1.5rem;
  font-size: var(--fs-base);
}
.btn-block {
  width: 100%;
}

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border-strong);
  color: var(--text-muted);
  background: var(--bg-sunken);
  letter-spacing: 0.02em;
}
.badge-accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.badge-beta {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent);
}

/* HTTP method chips */
.method {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: #fff;
  text-transform: uppercase;
}
.method.get {
  background: var(--m-get);
}
.method.post {
  background: var(--m-post);
}
.method.put {
  background: var(--m-put);
}
.method.patch {
  background: var(--m-patch);
}
.method.delete {
  background: var(--m-delete);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.card-hover {
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--surface-border-strong);
}
.card h3 {
  margin-top: 0.25rem;
}
.card-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  margin-bottom: var(--sp-3);
}
.card-icon svg {
  width: 22px;
  height: 22px;
}

/* ---------- Callouts ---------- */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--surface-border-strong);
  background: var(--bg-sunken);
  margin: var(--sp-4) 0;
}
.callout .callout-icon {
  flex: none;
  margin-top: 2px;
}
.callout p:last-child {
  margin-bottom: 0;
}
.callout-note {
  border-color: color-mix(in srgb, var(--info) 35%, transparent);
  background: color-mix(in srgb, var(--info) 8%, transparent);
}
.callout-warn {
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  background: color-mix(in srgb, var(--warning) 9%, transparent);
}
.callout-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
}
.callout-icon.note {
  color: var(--info);
}
.callout-icon.warn {
  color: var(--warning);
}
.callout-icon.danger {
  color: var(--danger);
}

/* ---------- Code blocks ---------- */
.code {
  position: relative;
  background: var(--bg-code);
  border: 1px solid #16281a;
  border-radius: var(--radius);
  overflow: hidden;
  margin: var(--sp-4) 0;
}
.code-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #16281a;
  background: #0a160e;
}
.code-lang {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: #7f9a86;
  letter-spacing: 0.04em;
}
.code-copy {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #9fb6a5;
  background: transparent;
  border: 1px solid #233a29;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  font-family: var(--font-sans);
}
.code-copy:hover {
  color: #dff3e6;
  border-color: #35563d;
}
.code pre {
  margin: 0;
  padding: var(--sp-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: #d7e6d9;
  tab-size: 2;
}
.code pre code {
  font-size: inherit;
}
/* inline code */
:not(pre) > code {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-sunken));
  border: 1px solid var(--surface-border);
  border-radius: 5px;
  padding: 0.12em 0.4em;
  color: var(--text);
  white-space: nowrap;
}
/* tiny token highlighting (applied by highlight in platform.js) */
.tok-str {
  color: #9fd39a;
}
.tok-key {
  color: #7fc7ff;
}
.tok-num {
  color: #e6c07b;
}
.tok-com {
  color: #5f7a66;
  font-style: italic;
}
.tok-punc {
  color: #90a89a;
}
.tok-prop {
  color: #c7b7ff;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  margin: var(--sp-4) 0;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  min-width: 420px;
}
table.data th,
table.data td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--surface-border);
  vertical-align: top;
}
table.data th {
  background: var(--bg-sunken);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
table.data tr:last-child td {
  border-bottom: 0;
}
table.data td code {
  white-space: nowrap;
}
.req {
  color: var(--danger);
  font-weight: 700;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--surface-border);
  background: var(--bg-sunken);
  padding-block: var(--sp-8) var(--sp-6);
  margin-top: var(--sp-12);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--sp-6);
}
.footer-col h4 {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}
.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: 0.25rem 0;
}
.footer-col a:hover {
  color: var(--accent);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--surface-border);
  color: var(--text-faint);
  font-size: var(--fs-sm);
}

/* ---------- Docs layout (sidebar + content + toc) ---------- */
.docs-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: var(--sp-6);
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
  max-height: calc(100vh - var(--header-h) - var(--sp-6));
  overflow-y: auto;
  padding: var(--sp-4) 0;
}
.docs-nav-group + .docs-nav-group {
  margin-top: var(--sp-5);
}
.docs-nav-group h5 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin: 0 0 var(--sp-2);
  padding-inline: 0.5rem;
}
.docs-nav-group a {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
}
.docs-nav-group a:hover {
  color: var(--text);
  background: var(--bg-sunken);
  text-decoration: none;
}
.docs-nav-group a[aria-current="page"] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left-color: var(--accent);
}
.docs-content {
  min-width: 0;
  padding-block: var(--sp-6);
  max-width: var(--prose-max);
}
.docs-content h2 {
  margin-top: var(--sp-8);
  padding-top: var(--sp-2);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.docs-content h3 {
  margin-top: var(--sp-6);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.docs-content ul,
.docs-content ol {
  padding-inline-start: 1.3rem;
  margin: 0 0 1rem;
}
.docs-content li + li {
  margin-top: 0.35rem;
}
.docs-content .anchor {
  color: var(--text-faint);
  opacity: 0;
  margin-left: 0.4rem;
  font-weight: 400;
  transition: opacity 0.1s ease;
}
.docs-content h2:hover .anchor,
.docs-content h3:hover .anchor {
  opacity: 1;
}
.toc {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
  max-height: calc(100vh - var(--header-h) - var(--sp-6));
  overflow-y: auto;
  padding: var(--sp-6) 0;
  font-size: var(--fs-sm);
}
.toc h6 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin: 0 0 var(--sp-3);
}
.toc a {
  display: block;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-left: 2px solid var(--surface-border);
  padding-left: 0.75rem;
}
.toc a:hover,
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  text-decoration: none;
}
.toc a.lvl-3 {
  padding-left: 1.5rem;
  font-size: var(--fs-xs);
}
.breadcrumbs {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}
.breadcrumbs a {
  color: var(--text-muted);
}
.doc-footer-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-10);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--surface-border);
}
.doc-footer-nav a {
  flex: 1;
  padding: var(--sp-4);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  color: var(--text);
}
.doc-footer-nav a:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.doc-footer-nav .dir {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.doc-footer-nav a.next {
  text-align: right;
}

/* ---------- API Explorer ---------- */
.exp-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--sp-6);
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
  align-items: start;
}
.exp-main {
  min-width: 0;
  padding-block: var(--sp-6);
}
.exp-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin: var(--sp-4) 0;
}
.exp-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.exp-label {
  font-size: var(--fs-sm);
  font-weight: 700;
}
.exp-label em,
.exp-field em {
  font-style: normal;
  font-weight: 500;
  font-size: var(--fs-xs);
}
.exp-field input,
.exp-field select,
#exp-body {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--surface-border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}
#exp-body {
  font-family: var(--font-mono);
  line-height: 1.55;
  resize: vertical;
}
.exp-field input:focus,
.exp-field select:focus,
#exp-body:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.exp-modes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-sunken);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}
.exp-mode,
.exp-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.exp-remember {
  margin-inline-start: auto;
  color: var(--text-muted);
}
.exp-block {
  margin-top: var(--sp-5);
}
.exp-block h4 {
  font-size: 0.95rem;
  margin-bottom: var(--sp-2);
}
.exp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.exp-response {
  min-height: 60px;
}
.exp-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border-strong);
  background: var(--bg-sunken);
  margin-bottom: var(--sp-3);
}
@media (max-width: 860px) {
  .exp-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .exp-controls,
  .exp-grid {
    grid-template-columns: 1fr;
  }
  .exp-remember {
    margin-inline-start: 0;
  }
}

/* ---------- Utility ---------- */
.text-muted {
  color: var(--text-muted);
}
.text-center {
  text-align: center;
}
.mt-0 {
  margin-top: 0;
}
.flex {
  display: flex;
}
.gap-2 {
  gap: var(--sp-2);
}
.gap-3 {
  gap: var(--sp-3);
}
.gap-4 {
  gap: var(--sp-4);
}
.wrap {
  flex-wrap: wrap;
}
.items-center {
  align-items: center;
}
.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ---------- Landing composition (responsive splits) ---------- */
.split-hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: var(--sp-8);
  align-items: center;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--sp-8);
  align-items: center;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
  text-align: center;
}
.stat-row .stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--accent);
}
.stat-row .stat-label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .split-hero,
  .split {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }
}
@media (max-width: 620px) {
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
  }
}
@media (max-width: 1080px) {
  .docs-shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}
@media (max-width: 860px) {
  :root {
    --fs-3xl: 2.3rem;
    --fs-4xl: 2.7rem;
    --fs-2xl: 1.8rem;
  }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--surface-border);
    padding: var(--sp-3);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav.open {
    display: flex;
  }
  .nav a.nav-link {
    padding: 0.75rem;
    font-size: var(--fs-base);
  }
  .nav-toggle {
    display: inline-grid;
    place-items: center;
    margin-inline-start: auto;
  }
  .nav .nav-cta {
    margin-top: var(--sp-2);
  }
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .docs-sidebar {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: var(--sp-4);
  }
  .cols-2,
  .cols-3,
  .cols-4 {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .brand-sub {
    display: none;
  }
}
