/* API reference page (/docs/api).
 *
 * Loaded ON TOP of legal.css, which already supplies the document shell (hero,
 * TOC sidebar, .legal-section rhythm). Only the things a reference page needs
 * and a legal page does not live here: method chips, endpoint headings, wide
 * code blocks, parameter tables, and the two callout styles.
 *
 * Colours are theme.css channel tokens, never literals — see CLAUDE.md. */

/* ── Endpoint heading ── */
.da-ep {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 30px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 15px !important;
}
.da-ep code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  color: var(--heading);
  background: none;
  border: 0;
  padding: 0;
  word-break: break-all;
}

.da-method {
  flex: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 8px;
  border-radius: 5px;
  text-transform: uppercase;
}
/* Verb colours carry meaning: blue reads, green creates, amber changes, red
   destroys. Each is a theme channel so both themes keep the same separation. */
.da-get    { background: rgba(var(--accent-rgb), .16);  color: var(--accent2); }
.da-post   { background: rgba(var(--success-rgb), .16); color: var(--success); }
.da-patch  { background: rgba(var(--warning-rgb), .16); color: var(--warning); }
.da-delete { background: rgba(var(--danger-rgb), .16);  color: var(--danger); }

/* ── Code ── */
.da-code {
  /* Wide snippets scroll inside their own box; the page body never does. */
  overflow-x: auto;
  background: var(--well);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre;
  tab-size: 2;
}
.da-code code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ── Parameter tables ── */
.da-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px;
  font-size: 13.5px;
  /* A three-column table on a phone is wider than the viewport — let it scroll
     in place rather than widening the article. */
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
.da-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(var(--ink-rgb), .45);
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--glass-border);
}
.da-table td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid rgba(var(--hi-rgb), .05);
  color: rgba(var(--ink-rgb), .68);
  vertical-align: top;
  white-space: normal;
}
.da-table td:first-child { white-space: nowrap; }
.da-table td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--well);
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--accent2);
}
.da-table b { color: var(--text-bright); font-weight: 600; }

/* ── Callouts ──
   Two only, and the split is meaningful: .da-note is information worth not
   missing, .da-warn is a way to hurt yourself. A third tier would dilute both. */
.da-note, .da-warn {
  border-radius: 11px;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.7;
}
.da-note {
  background: rgba(var(--accent-rgb), .08);
  border: 1px solid rgba(var(--accent-rgb), .22);
  color: rgba(var(--ink-rgb), .72);
}
.da-note b { color: var(--accent2); }
.da-warn {
  background: rgba(var(--warning-rgb), .09);
  border: 1px solid rgba(var(--warning-rgb), .26);
  color: rgba(var(--ink-rgb), .72);
}
.da-warn b { color: var(--warning); }
.da-note code, .da-warn code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--well);
  border-radius: 4px;
  padding: 1px 5px;
}

.legal-badge code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

/* ── Smooth scroll ──
   Anchor jumps from the "On this page" sidebar (legal-toc-list, legal.js)
   otherwise snap instantly. Scoped to this stylesheet's file rather than a
   selector, since docs_api.css only ever loads on this page — no :has()
   needed. Two rules because the scroll container differs by viewport: the
   dashboard shell scrolls .main-content on desktop, but legal.css hands
   scrolling back to the document below 768px (see its comment on
   .legal-doc-page.dashboard-page:has(...)). */
.legal-doc-page .main-content { scroll-behavior: smooth; }
@media (max-width: 768px) {
  html { scroll-behavior: smooth; }
}

/* ── Tabbed code examples ──
   One request, three clients: Qunivex SDK / OpenAI SDK / cURL. The active
   tab is a single GLOBAL selection (docs_api.js, localStorage-persisted) —
   every group on the page switches together, since a reader picking cURL is
   choosing it for the whole integration, not one snippet. Markup default
   (qunivex active) matches the JS default so there's no flash before it runs. */
.da-codetabs {
  background: var(--well);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  margin: 14px 0 18px;
  overflow: hidden;
}
.da-tabbar {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 2px;
  padding: 7px 7px 0;
}
.da-tab {
  appearance: none;
  background: none;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .01em;
  color: rgba(var(--ink-rgb), .5);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.da-tab:hover { color: var(--text); }
.da-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.da-tab.is-active {
  color: var(--accent2);
  background: var(--surface);
  border-color: var(--glass-border);
  border-bottom-color: var(--surface);
}
.da-tabpanel { display: none; }
.da-tabpanel.is-active { display: block; }
.da-tabpanel .da-code {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
}
.da-tabpanel .da-code + .da-code {
  border-top: 1px solid var(--glass-border);
}

@media (max-width: 640px) {
  .da-code { font-size: 11.5px; padding: 12px; }
  .da-ep { font-size: 14px !important; }
  .da-tabbar { justify-content: flex-start; }
  .da-tab { font-size: 11px; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .legal-doc-page .main-content,
  html { scroll-behavior: auto; }
}
