/*
 * Pages of the public site other than the front page: the developer documentation (/docs) and
 * the legal texts (/terms, /privacy, /aml). Loaded after site.css (sitePage `styles`), so every
 * token and component of site.css (--surface, .code, .chip, .h2 ...) is available here.
 * CSP: no inline styles anywhere; everything the pages need is in this file.
 */

/* ------------------------------------------------------------------ page head */
.dhead { position: relative; padding: 64px 0 28px; border-bottom: 1px solid var(--border); overflow: clip; }
.dhead-bg {
  position: absolute; inset: -40% -10% auto; height: 520px; pointer-events: none;
  background: radial-gradient(520px 320px at 80% 30%, var(--glow), transparent 70%);
}
.dhead .wrap { position: relative; }
.dtitle { font-size: clamp(32px, 3.4vw, 46px); line-height: 1.1; font-weight: 650; letter-spacing: -0.035em; text-wrap: balance; }
.dhead .lead { max-width: 720px; }
.dmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; font-size: 13.5px; color: var(--muted); }
.base-url {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; height: 34px; padding: 0 6px 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-xs);
}
.base-url span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.base-url code {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 8px; border-radius: 7px;
  background: var(--surface-3); font-size: 12.5px; font-weight: 500; color: var(--text);
}

/* --------------------------------------------------------------------- layout */
.docs { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 56px; padding-top: 40px; padding-bottom: 112px; }
.docs-body { min-width: 0; max-width: 880px; }

/* table of contents: sticky beside the text on wide screens */
.toc { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 112px); overflow-y: auto; padding-bottom: 12px; }
.toc-h { margin-bottom: 10px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.toc ol { display: grid; gap: 1px; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; line-height: 20px; font-weight: 500; color: var(--text-2); transition: color .15s, background-color .15s; }
.toc a:hover { color: var(--text); background: var(--surface-3); }
.toc ol ol { margin: 1px 0 4px; }
.toc ol ol a { padding-left: 22px; font-size: 13px; font-weight: 400; color: var(--muted); }
.toc ol ol a:hover { color: var(--text); }

/* -------------------------------------------------------------------- sections */
.dsec { scroll-margin-top: 84px; padding-bottom: 56px; margin-bottom: 56px; border-bottom: 1px solid var(--border); }
.dsec:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.dh2 { font-size: clamp(24px, 2.2vw, 30px); line-height: 1.2; font-weight: 650; letter-spacing: -0.025em; }
.dh3 { scroll-margin-top: 84px; margin: 36px 0 10px; font-size: 18px; line-height: 1.4; font-weight: 600; letter-spacing: -0.01em; }
.dh2 + .prose, .dh2 + p { margin-top: 12px; }

/* prose: comfortable reading width; lists get their markers back (site.css removes them) */
.prose { max-width: 74ch; }
.prose p, .dsec > p { margin: 12px 0; font-size: 15px; line-height: 1.7; color: var(--text-2); text-wrap: pretty; }
.prose ul, .prose ol { margin: 12px 0; padding-left: 22px; color: var(--text-2); }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 6px 0; padding-left: 2px; font-size: 15px; line-height: 1.65; }
.prose li::marker { color: var(--faint); }
.prose b, .dt b { font-weight: 600; color: var(--text); }
.prose a, .dt a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover, .dt a:hover { color: var(--accent-hover); }
.prose code, .dt code, .note code {
  padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text);
  font-size: 0.86em; font-weight: 500; overflow-wrap: anywhere;
}

/* --------------------------------------------------------------- endpoints */
.ep {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 12px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-xs);
}
.ep-m {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
}
.ep-get { background: var(--ok-soft); color: var(--ok); }
.ep-post { background: var(--accent-soft); color: var(--accent); }
.ep-p { margin-left: 4px; font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.ep-d { flex-basis: 100%; font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------- parameter / field tables */
.dt-wrap { margin: 14px 0 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; line-height: 20px; }
.dt th { padding: 10px 14px; background: var(--surface-2); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.dt td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: top; color: var(--text-2); }
.dt td:first-child { white-space: nowrap; }
.dt td:first-child code { background: none; padding: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.dt .dt-type { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.dt .dt-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); white-space: nowrap; }
.dt .chip { height: 20px; padding: 0 8px; font-size: 11.5px; }
.dt .dt-def { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.chip-off { background: var(--surface-3); color: var(--muted); }
.chip-bad { background: rgba(220, 58, 64, 0.12); color: var(--bad); }

/* ---------------------------------------------------------------- code cards */
.docs-body .code, .legal .code { margin: 16px 0 24px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.docs-body .code-pre { white-space: pre; tab-size: 2; }
.docs-body .code-hd { height: 44px; }
.code-tabs { display: grid; gap: 0; }

/* ------------------------------------------------------------------- notes */
.note {
  max-width: 74ch; margin: 16px 0; padding: 12px 16px; border: 1px solid var(--accent-ring); border-radius: 12px;
  background: var(--accent-soft); font-size: 14px; line-height: 1.65; color: var(--text-2);
}
.note b { color: var(--text); font-weight: 600; }
.note-warn { border-color: rgba(194, 120, 12, 0.28); background: var(--warn-soft); }

/* ------------------------------------------------------------------- legal */
.legal { padding-top: 40px; padding-bottom: 112px; }
.legal-in { max-width: 800px; }
.legal .lg-toc { max-width: 74ch; }
.legal .dsec { padding-bottom: 8px; margin-bottom: 28px; border-bottom: 0; }
.legal .dh2 { font-size: 21px; letter-spacing: -0.015em; }
.lg-draft {
  display: flex; gap: 10px; align-items: flex-start; max-width: 74ch; margin-top: 20px; padding: 10px 14px;
  border: 1px solid rgba(194, 120, 12, 0.28); border-radius: 12px; background: var(--warn-soft);
  font-size: 13.5px; line-height: 1.6; color: var(--text-2);
}
.lg-draft b { color: var(--warn); font-weight: 600; }
.lg-ph { padding: 0 5px; border-radius: 5px; background: var(--warn-soft); color: var(--text); font-weight: 500; }
.lg-confirm { padding: 1px 3px; border-radius: 4px; background: var(--warn-soft); box-shadow: inset 0 -2px 0 rgba(194, 120, 12, 0.45); color: var(--text); }
.lg-confirm-tag { margin-right: 6px; font-size: 12px; font-weight: 600; color: var(--warn); white-space: nowrap; }
.lg-toc { margin-top: 24px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.lg-toc ol { list-style: decimal; padding-left: 22px; display: grid; gap: 4px; }
.lg-toc a { font-size: 14px; color: var(--text-2); }
.lg-toc a:hover { color: var(--accent); }
.lg-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.lg-links a { height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 500; line-height: 28px; color: var(--text-2); }
.lg-links a:hover { color: var(--text); border-color: var(--border-strong); }
.lg-links a[aria-current='page'] { border-color: var(--accent-ring); background: var(--accent-soft); color: var(--accent); }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1023px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 28px; padding-bottom: 84px; }
  .toc { position: static; max-height: none; overflow: visible; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .toc > ol { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
  .toc ol ol { display: none; }
  .legal { padding-bottom: 84px; }
}
@media (max-width: 560px) {
  .dhead { padding: 40px 0 22px; }
  .toc > ol { grid-template-columns: minmax(0, 1fr); }
  .dt th, .dt td { padding: 9px 10px; }
  .dsec { padding-bottom: 40px; margin-bottom: 40px; }
}
@media print {
  .hdr, .ft, .toc, .skip { display: none; }
  .docs { display: block; padding: 0; }
  .code { box-shadow: none; }
}
