/* Getting Started — API documentation.
 *
 * Tokens are the platform's own (DESIGN.md / the widget's default theme): dark
 * surfaces #0B0B0C → #131316 → #17171B, one accent red #E5352B, hairlines
 * instead of shadows, 14px cards and 10px controls. No web fonts on purpose —
 * the page makes no third-party request, matching the zero-dependency claim the
 * product makes about its SDK. Hierarchy comes from weight, size, tracking and
 * rule lines.
 */
:root {
  --bg: #0b0b0c;
  --panel: #131316;
  --panel-2: #17171b;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f3f1;
  --muted: rgba(244, 243, 241, 0.56);
  --muted-2: rgba(244, 243, 241, 0.38);
  --accent: #e5352b;
  --accent-soft: rgba(229, 53, 43, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --head-h: 65px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { text-wrap: balance; margin: 0; line-height: 1.18; letter-spacing: -0.022em; }
p { margin: 0; }
a { color: inherit; }
code, pre { font-family: var(--mono); }
/* Anything a developer would copy is monospace, so inline code sits on the
 * surface lift rather than changing colour. */
p code, li code, dd code, td code, .hint code {
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
}
pre code { font-size: inherit; color: inherit; background: none; border: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 20px;
  top: -80px;
  z-index: 40;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ header */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--head-h);
  /* Match the content edge of the shell below: the shell is max-width --maxw
   * with a 20px gutter, so the header's padding adds the same gutter on top of
   * the centred column. */
  padding: 12px calc(max(0px, (100% - var(--maxw)) / 2) + 20px);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { display: block; height: 28px; width: auto; }
.head-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.head-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.26); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #cf2c23; border-color: #cf2c23; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }

/* ------------------------------------------------------------------ shell */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 48px;
}
[id] { scroll-margin-top: calc(var(--head-h) + 24px); }

/* --------------------------------------------------------------------- toc */
.toc {
  position: sticky;
  top: calc(var(--head-h) + 20px);
  max-height: calc(100vh - var(--head-h) - 44px);
  overflow-y: auto;
  padding: 34px 0 12px;
}
.toc-title {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 12px;
}
.toc-list, .toc-list ol { list-style: none; margin: 0; padding: 0; }
.toc-list { font-size: 13.5px; }
.toc-list ol { margin: 2px 0 16px; font-size: 12.5px; }
.toc-list a {
  display: block;
  padding: 4px 0 4px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.toc-list a:hover { color: var(--text); }
.toc-list > li > a { color: var(--text); font-weight: 600; }
.toc-list li:last-child > ol { margin-bottom: 0; }
.toc-list a[aria-current] { color: var(--text); border-left-color: var(--accent); }

/* ----------------------------------------------------------------- content */
main { min-width: 0; padding-bottom: 24px; }

.doc-intro { padding: 56px 0 8px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 14px;
}
.doc-intro h1 { font-size: clamp(1.85rem, 3.4vw, 2.5rem); font-weight: 640; }
.lede { margin-top: 16px; max-width: 68ch; color: var(--muted); font-size: 16.5px; }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-2);
}
.facts code { font-size: 12px; color: var(--muted); }
/* The separator trails its item, so a wrapped line never starts with a dot. */
.facts span:not(:last-child)::after { content: "·"; margin-left: 14px; color: var(--accent); }

.doc-section { margin-top: 44px; padding-top: 34px; border-top: 1px solid var(--border); }
.doc-section > h2 { font-size: clamp(1.35rem, 2vw, 1.7rem); font-weight: 640; }
.doc-section > h3 { font-size: 1rem; font-weight: 600; margin-top: 34px; }
.doc-section > h2 + p, .doc-section > h3 + p { margin-top: 14px; max-width: 72ch; color: var(--muted); }
.doc-section p + p { margin-top: 12px; }

.plain { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.plain li { position: relative; padding-left: 22px; color: var(--muted); max-width: 76ch; }
.plain li::before { content: "—"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); }
.plain li strong { color: var(--text); font-weight: 600; }

.hint { margin-top: 14px; max-width: 76ch; color: var(--muted-2); font-size: 13.5px; }
.hint a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.hint a:hover { border-bottom-color: var(--accent); }
.doc-section p a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.doc-section p a:hover { border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- snippets */
.snippet {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.snippet pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.7;
  color: #e9e7e4;
}
/* Inside an endpoint card the code well recesses to the page colour instead of
 * lifting again, so the card keeps its own one-step elevation. */
.endpoint .snippet { background: var(--bg); }
.endpoint .snippet .snippet-head { background: var(--panel-2); }

/* ------------------------------------------------------------------ tables */
.table-wrap {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { text-align: left; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  font-weight: 400;
  background: var(--panel-2);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td { color: var(--muted); }
td:first-child { color: var(--text); }
td code { white-space: nowrap; }
td:nth-child(2) { white-space: nowrap; }
.req {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.endpoint .table-wrap { border-color: var(--border); }
.endpoint th { background: var(--panel-2); }

/* -------------------------------------------------------------- definition */
.fields { margin: 22px 0 0; display: grid; gap: 12px; }
.fields > div { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 12px; }
.fields dt { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.fields dd { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------------------------------------------------------------- filter */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 30px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.filter-label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.filter-row input {
  flex: 1 1 260px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.filter-row input::placeholder { color: var(--muted-2); }
.filter-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
}

/* -------------------------------------------------------------- endpoints */
.ep-group { margin-top: 34px; }
.ep-group-head { font-size: 1rem; font-weight: 600; }
.ep-group-note { margin-top: 12px; max-width: 72ch; color: var(--muted); font-size: 14.5px; }

.endpoint {
  margin-top: 18px;
  padding: 16px 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.ep-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ep-title { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; margin: 0; }
.ep-title code { font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.method {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.auth {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-2);
  white-space: nowrap;
}
.auth.secret, .auth.account { border-color: var(--border-strong); color: var(--muted); }
.ep-desc { margin-top: 14px; max-width: 76ch; color: var(--muted); font-size: 14.5px; }
.endpoint .table-wrap { margin-top: 16px; }
.endpoint .hint { margin-top: 12px; }
.ep-empty { margin-top: 26px; color: var(--muted-2); font-size: 14px; }

/* ------------------------------------------------------------------- foot */
.site-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 22px max(20px, calc((100% - var(--maxw)) / 2));
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--muted-2);
}
.site-foot > div { display: flex; align-items: center; gap: 10px; }
.foot-mark { display: block; height: 20px; width: auto; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-foot a { text-decoration: none; color: var(--muted); }
.site-foot a:hover { color: var(--text); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc {
    position: static;
    max-height: none;
    padding: 28px 0 0;
    border-bottom: 1px solid var(--border);
  }
  /* On a phone the full tree would push the first paragraph off the screen, so
   * the rail shows the eight sections and nothing else. */
  .toc-list ol { display: none; }
  .doc-intro { padding-top: 32px; }
}
@media (max-width: 720px) {
  .head-label { display: none; }
  .fields > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  /* A scrollbar hides code on a phone; wrapping is only safe this narrow. */
  .snippet pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .ep-head { gap: 8px 10px; }
  .auth { margin-left: 0; }
  th, td { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

/* ------------------------------------------------------ AI prompt cards
 * The cards themselves live in web/partials/ai-prompts.html, which the landing
 * page also injects: these rules are deliberately duplicated in
 * web/landing/styles.css, because the two pages carry separate stylesheets and
 * neither inherits the other's. */
.prompt-grid { display: grid; gap: 18px; margin-top: 24px; }
@media (min-width: 1000px) { .prompt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.prompt {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.prompt .snippet-head { background: var(--panel-2); }
.prompt pre { flex: 1; margin: 0; padding: 14px; overflow: auto; max-height: 400px; font-size: 11.5px; line-height: 1.7; }
/* A prompt is read in a third of the page, so it wraps rather than scrolls
 * sideways: an unreadable line is one the reader will not trust to paste. */
.prompt pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-note { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
