/* MavenFin Docs — Stripe/Linear/Resend-inspired
 * © 2026 MavenFin
 * Single shared stylesheet. Uses CSS custom properties for theming.
 */

:root {
  /* Brand */
  --accent: #0b6e4f;
  --accent-hover: #0a5e44;
  --accent-soft: rgba(11, 110, 79, 0.10);
  --accent-soft-2: rgba(11, 110, 79, 0.18);

  /* Surfaces — light */
  --bg: #ffffff;
  --bg-elev: #fafafa;
  --bg-sunk: #f5f6f7;
  --bg-code: #f6f8fa;
  --bg-tryit: #fbfdfc;
  --bg-modal: rgba(15, 23, 28, 0.45);

  /* Text */
  --fg: #0f1419;
  --fg-muted: #4d5a66;
  --fg-faint: #7a8693;
  --fg-inverse: #ffffff;

  /* Lines */
  --border: #e6e8eb;
  --border-strong: #d0d5db;
  --border-focus: var(--accent);

  /* Semantic */
  --green: #137a4d;
  --red: #b3261e;
  --amber: #b76e00;
  --blue: #1f6feb;

  /* Verb pills */
  --verb-get: #1f6feb;
  --verb-post: #137a4d;
  --verb-put: #b76e00;
  --verb-delete: #b3261e;
  --verb-patch: #6f42c1;

  /* Type */
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Layout */
  --sidebar-w: 260px;
  --toc-w: 220px;
  --content-max: 760px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  /* Shadow */
  --shadow-1: 0 1px 2px rgba(15, 23, 28, 0.04), 0 1px 1px rgba(15, 23, 28, 0.03);
  --shadow-2: 0 4px 16px rgba(15, 23, 28, 0.08), 0 1px 2px rgba(15, 23, 28, 0.04);
  --shadow-modal: 0 24px 64px rgba(15, 23, 28, 0.24);
}

[data-theme="dark"] {
  --bg: #0b0f12;
  --bg-elev: #11161a;
  --bg-sunk: #0a0d10;
  --bg-code: #11161a;
  --bg-tryit: #0e1417;
  --bg-modal: rgba(0, 0, 0, 0.62);

  --fg: #e8edf2;
  --fg-muted: #9aa6b2;
  --fg-faint: #6a7682;
  --fg-inverse: #0b0f12;

  --border: #1d242a;
  --border-strong: #2a3138;

  --accent: #1aa97a;
  --accent-hover: #28b988;
  --accent-soft: rgba(26, 169, 122, 0.14);
  --accent-soft-2: rgba(26, 169, 122, 0.24);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

p { margin: 0 0 1em; }

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  letter-spacing: -0.012em;
  color: var(--fg);
  line-height: 1.25;
  margin: 0 0 0.5em;
  font-weight: 600;
}
h1 { font-size: 2.1rem; letter-spacing: -0.022em; margin-top: 0.2em; }
h2 { font-size: 1.4rem; margin-top: 2.2em; padding-top: 0.2em; }
h3 { font-size: 1.1rem; margin-top: 1.6em; }
h4 { font-size: 0.95rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-variant-ligatures: none;
}
:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 0.08em 0.36em;
  border-radius: 4px;
  color: var(--fg);
}
kbd {
  display: inline-block;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  vertical-align: 1px;
}

/* ── App chrome ───────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  grid-column: 1 / -1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 14px;
  font-family: var(--font-mono);
}
.brand-tag {
  font-size: 0.78rem;
  color: var(--fg-faint);
  padding-left: 10px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  font-weight: 400;
}

.topbar-spacer { flex: 1; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--fg-faint);
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 200px;
}
.topbar-search:hover { border-color: var(--border-strong); color: var(--fg-muted); }
.topbar-search kbd { margin-left: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 80ms ease, border-color 80ms ease;
}
.btn:hover { background: var(--bg-elev); border-color: var(--border-strong); }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--bg-elev); color: var(--fg); }
.btn-sm { padding: 4px 9px; font-size: 0.78rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-elev); color: var(--fg); }

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  padding: 22px 14px 40px;
  background: var(--bg);
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.sidebar h5 {
  margin: 18px 8px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  font-weight: 600;
}
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.sidebar li a:hover {
  background: var(--bg-elev);
  color: var(--fg);
  text-decoration: none;
}
.sidebar li a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 8px;
}

/* Content area */
.content-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 36px 80px;
  gap: 48px;
}
.content {
  max-width: var(--content-max);
  min-width: 0;
}
.content.wide { max-width: none; }

.toc {
  position: sticky;
  top: 88px;
  align-self: start;
  font-size: 0.84rem;
  border-left: 1px solid var(--border);
  padding-left: 18px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.toc h6 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  margin: 0 0 8px;
  font-weight: 600;
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { line-height: 1.45; }
.toc li a {
  display: block;
  padding: 3px 0;
  color: var(--fg-muted);
}
.toc li a:hover { color: var(--fg); text-decoration: none; }
.toc li.level-3 a { padding-left: 12px; font-size: 0.81rem; }
.toc li a.is-active { color: var(--accent); font-weight: 500; }

/* Eyebrow / breadcrumbs */
.eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  padding: 24px 0 8px;
}
.hero h1 {
  font-size: 2.6rem;
  letter-spacing: -0.028em;
  background: linear-gradient(180deg, var(--fg) 0%, color-mix(in srgb, var(--fg) 70%, var(--accent)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lede {
  font-size: 1.12rem;
  color: var(--fg-muted);
  max-width: 640px;
  line-height: 1.6;
}
.hero-cta {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 28px 0;
}
.card {
  display: block;
  padding: 18px 18px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color 100ms ease, transform 100ms ease, box-shadow 100ms ease;
  position: relative;
}
.card:hover {
  border-color: var(--accent);
  text-decoration: none;
  box-shadow: var(--shadow-1);
}
.card h3 { margin: 8px 0 6px; font-size: 1.02rem; }
.card p { font-size: 0.88rem; color: var(--fg-muted); margin: 0; line-height: 1.55; }
.card-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}

/* ── Code blocks ──────────────────────────────────────────────────────── */
.code {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.2em 0;
  overflow: hidden;
  font-size: 0.84rem;
}
.code-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-code) 50%, var(--bg-sunk));
  font-size: 0.78rem;
  color: var(--fg-faint);
}
.code-tab {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font: 500 0.76rem var(--font-ui);
}
.code-tab.is-active {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
}
.code-tab:hover:not(.is-active) { color: var(--fg); }
.code-spacer { flex: 1; }
.code-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  font: 500 0.74rem var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.code-action:hover { background: var(--bg-elev); color: var(--fg); border-color: var(--border); }
.code-pane {
  display: none;
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.55;
  font-family: var(--font-mono);
  white-space: pre;
  tab-size: 2;
}
.code-pane.is-active { display: block; }
.code-pane code { background: transparent; border: none; padding: 0; font-family: inherit; font-size: 1em; color: var(--fg); }
.code-toast {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--accent);
  color: white;
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 0.74rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
  z-index: 5;
}
.code-toast.is-visible { opacity: 1; transform: translateY(0); }

/* highlight.js token overrides (atom-one-ish, theme-aware) */
.hljs { background: transparent !important; color: var(--fg) !important; padding: 0 !important; }
.hljs-comment, .hljs-quote { color: var(--fg-faint); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #c9376b; }
[data-theme="dark"] .hljs-keyword, [data-theme="dark"] .hljs-selector-tag, [data-theme="dark"] .hljs-built_in { color: #ff8caa; }
.hljs-string, .hljs-attr { color: var(--accent); }
.hljs-number, .hljs-literal { color: var(--amber); }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: var(--blue); }
.hljs-meta, .hljs-symbol { color: var(--fg-faint); }
.hljs-attribute { color: var(--blue); }

/* ── Verb pills ───────────────────────────────────────────────────────── */
.verb {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  color: white;
  vertical-align: 2px;
}
.verb-get    { background: var(--verb-get); }
.verb-post   { background: var(--verb-post); }
.verb-put    { background: var(--verb-put); }
.verb-delete { background: var(--verb-delete); }
.verb-patch  { background: var(--verb-patch); }

/* ── Reference operation cards ────────────────────────────────────────── */
.ref-tag-section { margin-top: 48px; }
.ref-tag-section h2 {
  font-size: 1.18rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 22px;
}
.ref-tag-desc { color: var(--fg-muted); font-size: 0.9rem; margin-top: -8px; }

.operation {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0;
  margin: 22px 0;
  overflow: hidden;
}
.op-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.op-path {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--fg);
  word-break: break-all;
  line-height: 1.55;
}
.op-summary {
  margin: 8px 0 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.op-desc {
  margin: 8px 0 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.op-body { padding: 16px 18px; }
.op-body h4 {
  font-size: 0.74rem;
  color: var(--fg-faint);
  margin: 18px 0 8px;
  letter-spacing: 0.08em;
}
.op-body h4:first-child { margin-top: 0; }

/* Param table */
.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin: 0;
}
.params th, .params td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.params th {
  color: var(--fg-faint);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-elev);
}
.params tr:last-child td { border-bottom: none; }
.params td.name { font-family: var(--font-mono); color: var(--fg); }
.params td.type { font-family: var(--font-mono); color: var(--accent); font-size: 0.78rem; }
.params .req { color: var(--red); font-weight: 700; margin-left: 3px; }
.params td.desc { color: var(--fg-muted); }

.schema-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: pre;
  overflow-x: auto;
  color: var(--fg);
}

.responses .resp {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.88rem;
}
.responses .resp:last-child { border-bottom: none; }
.status-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  min-width: 38px;
  text-align: center;
}
.status-2xx { background: rgba(19, 122, 77, 0.16); color: var(--green); }
.status-4xx { background: rgba(183, 110, 0, 0.18); color: var(--amber); }
.status-5xx { background: rgba(179, 38, 30, 0.18); color: var(--red); }


/* ── Auth modal ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--bg-modal);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 20px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-modal);
  padding: 22px 22px 18px;
}
.modal h3 { margin-top: 0; }
.modal-sub { color: var(--fg-muted); font-size: 0.88rem; margin-top: -4px; }
.field { display: block; margin: 14px 0; }
.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--fg);
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 16px;
}
.modal-msg {
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 1.2em;
}
.modal-msg.is-error { color: var(--red); }
.modal-msg.is-ok { color: var(--green); }

/* Auth state pill */
.auth-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--fg-muted);
  padding: 4px 9px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.auth-state .dot {
  width: 7px; height: 7px;
  background: var(--fg-faint);
  border-radius: 50%;
}
.auth-state.is-authed .dot { background: var(--green); }
.auth-state.is-authed { color: var(--green); border-color: rgba(19,122,77,0.3); }

/* ── Search overlay (Cmd-K) ──────────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0;
  background: var(--bg-modal);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 90;
  padding: 80px 20px;
}
.search-overlay.is-open { display: flex; }
.search-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font: 400 1rem var(--font-ui);
}
.search-results { max-height: 50vh; overflow-y: auto; padding: 6px; }
.search-result {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
}
.search-result.is-active { background: var(--accent-soft); color: var(--accent); }
.search-result .sr-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--fg-faint);
  margin-top: 1px;
}
.search-empty { padding: 22px; text-align: center; color: var(--fg-faint); font-size: 0.86rem; }

/* ── Misc ────────────────────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 18px 0;
  font-size: 0.9rem;
}
.callout strong { color: var(--accent); }
.callout.warn {
  border-color: var(--amber);
  background: rgba(183, 110, 0, 0.08);
}
.callout.warn strong { color: var(--amber); }

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

footer.page-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding-top: 22px;
  color: var(--fg-faint);
  font-size: 0.82rem;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
footer.page-footer a { color: var(--fg-muted); }
footer.page-footer .footer-spacer { flex: 1; }

/* Hamburger */
.menu-toggle { display: none; }

/* SVG diagrams */
.diagram {
  width: 100%; height: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 18px 0;
}

/* Lists in prose */
.content ul, .content ol { padding-left: 1.4em; margin: 0 0 1em; }
.content li { margin-bottom: 0.3em; }

/* Tables in prose */
.content table:not(.params) {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.9rem;
}
.content table:not(.params) th,
.content table:not(.params) td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.content table:not(.params) th { color: var(--fg-muted); font-weight: 600; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Anchored heading offset (sticky topbar) */
:target { scroll-margin-top: 80px; }
h2[id], h3[id], section[id] { scroll-margin-top: 80px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .content-wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 32px 28px 60px; }
  .toc { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 100%; }
  .app { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-grid; }
  .sidebar {
    position: fixed;
    top: 56px; left: 0;
    width: 280px;
    height: calc(100vh - 56px);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow-2);
  }
  .sidebar.is-open { transform: translateX(0); }
  .topbar-search { min-width: 0; }
  .topbar-search-label { display: none; }
  .brand-tag { display: none; }
  .content-wrap { padding: 24px 18px 60px; }
}

@media (max-width: 500px) {
  .hero h1 { font-size: 2rem; }
  h1 { font-size: 1.7rem; }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, a:focus-visible { outline-offset: 3px; }

/* Endpoint index card — grouped overview at top of API Reference */
.ref-index {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 20px 24px 24px;
  margin: 24px 0 40px;
}
.ref-index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.ref-index-head h2 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ref-index-count {
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-family: var(--mono, "JetBrains Mono", monospace);
}
.ref-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px 24px;
}
.ref-index-group h6 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 8px 0;
  color: var(--fg-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-index-group h6 a {
  color: inherit;
  text-decoration: none;
}
.ref-index-group h6 a:hover {
  color: var(--accent);
}
.ref-index-group-count {
  font-size: 0.65rem;
  background: var(--bg-soft, rgba(0,0,0,0.04));
  color: var(--fg-muted);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.ref-index-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ref-index-list li { margin: 0; }
.ref-index-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.ref-index-item:hover {
  background: var(--bg-soft, rgba(0,0,0,0.03));
  border-color: var(--border);
}
.ref-index-method {
  grid-row: 1;
  grid-column: 1;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 2px 0;
  border-radius: 4px;
  color: white;
  background: #888;
}
.ref-index-method.method-get    { background: #0b6e4f; }
.ref-index-method.method-post   { background: #1d4ed8; }
.ref-index-method.method-put    { background: #b45309; }
.ref-index-method.method-patch  { background: #6d28d9; }
.ref-index-method.method-delete { background: #b91c1c; }
.ref-index-path {
  grid-row: 1;
  grid-column: 2;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 0.78rem;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-index-summary {
  grid-row: 2;
  grid-column: 2;
  font-size: 0.72rem;
  color: var(--fg-muted);
  line-height: 1.35;
}
[data-theme="dark"] .ref-index-item:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .ref-index-group-count { background: rgba(255,255,255,0.06); }

/* ── Try-It v2 (native, polished) ───────────────────────────────────────── */
.ti-card {
  margin-top: 18px;
  background: var(--bg-tryit, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* header bar: method pill + path */
.ti-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card), transparent);
}
.ti-headpath {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--fg);
  flex: 1;
}
.ti-headlabel {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  font-weight: 600;
}

/* method pills */
.ti-method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 4px;
  color: white;
  background: #888;
  line-height: 1.2;
}
.ti-method-sm { font-size: 0.62rem; padding: 2px 7px; }
.ti-method-get    { background: #0b6e4f; }
.ti-method-post   { background: #1d4ed8; }
.ti-method-put    { background: #b45309; }
.ti-method-patch  { background: #6d28d9; }
.ti-method-delete { background: #b91c1c; }

/* URL preview as code block */
.ti-urlblock {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 16px 0;
  padding: 9px 12px;
  background: var(--bg-code, #f6f8fa);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}
.ti-urlcode {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg);
  flex: 1;
  white-space: nowrap;
  overflow-x: auto;
  background: transparent;
  padding: 0;
}
.ti-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: 5px;
  width: 26px; height: 26px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ti-copy:hover { background: var(--bg-soft, rgba(0,0,0,0.04)); color: var(--fg); border-color: var(--fg-muted); }

/* sections */
.ti-section {
  padding: 14px 16px 4px;
}
.ti-section + .ti-section {
  border-top: 1px dashed var(--border);
  margin-top: 6px;
}
.ti-sect-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 8px;
}
.ti-sect-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--fg);
}
.ti-sect-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-faint);
  background: var(--bg-soft, rgba(0,0,0,0.04));
  padding: 1px 6px;
  border-radius: 4px;
}

/* field rows */
.ti-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.ti-lab {
  display: flex; flex-direction: column; gap: 2px;
}
.ti-name {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg);
  font-weight: 500;
}
.ti-type {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-faint);
  text-transform: lowercase;
}
.ti-input, .ti-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg);
  line-height: 1.5;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ti-input:focus, .ti-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(11,110,79,0.15));
}
.ti-textarea {
  display: block;
  min-height: 100px;
  resize: vertical;
  white-space: pre;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* headers preview */
.ti-headers {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--fg-muted);
  background: var(--bg-code, #f6f8fa);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  margin: 0;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.55;
}
.ti-headers em { color: var(--fg-faint); font-style: italic; }

/* action bar */
.ti-actionbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft, rgba(0,0,0,0.015));
}
.ti-authpill {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.ti-auth-ok    { color: #0b6e4f; border-color: rgba(11,110,79,0.3); }
.ti-auth-none  { color: var(--fg-faint); }
.ti-status {
  flex: 1;
  font-size: 0.78rem;
  color: var(--fg-muted);
}
.ti-status .ti-err { color: #b91c1c; }
.ti-send {
  background: var(--accent, #0b6e4f);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.12s, transform 0.06s;
}
.ti-send:hover:not(:disabled) { background: #094f3a; }
.ti-send:active:not(:disabled) { transform: translateY(1px); }
.ti-send:disabled { opacity: 0.6; cursor: not-allowed; }

/* response */
.ti-resp {
  margin: 0 16px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-code, #f6f8fa);
  display: none;
  position: relative;
  overflow: hidden;
}
.ti-resp.is-visible { display: block; }
.ti-resp-head {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card, white);
}
.ti-resp-statustext {
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.ti-resp-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-faint);
  background: var(--bg-soft, rgba(0,0,0,0.04));
  padding: 1px 8px;
  border-radius: 999px;
  margin-right: 36px;
}
.ti-resp-copy {
  position: absolute;
  top: 7px; right: 8px;
  z-index: 2;
}
.ti-resp-body {
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--fg);
  background: transparent;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
}

/* JSON syntax tokens (kept from v1) */
.json-key    { color: var(--blue, #1d4ed8); }
.json-string { color: var(--accent, #0b6e4f); }
.json-number { color: var(--amber, #b45309); }
.json-bool   { color: #c9376b; }
.json-null   { color: var(--fg-faint); }

[data-theme="dark"] .ti-urlblock,
[data-theme="dark"] .ti-headers,
[data-theme="dark"] .ti-resp { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .ti-actionbar { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .ti-sect-hint { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .ti-resp-head { background: rgba(255,255,255,0.03); }
