/* ==========================================================================
   SurePay — API reference
   Three panes: nav, prose, code. The markup is generated by site/build.mjs
   from source/index.html.md, so this file only describes presentation.
   ========================================================================== */

/* ── tokens ────────────────────────────────────────────────────────────── */
:root {
  --top: 72px; --side: 300px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --header: #0A1226; --header-ink: #FFFFFF; --header-muted: #B7C0DA;
  --bg: #FFFFFF; --bg-side: #FBFCFE; --bar: rgba(255,255,255,.86);
  --surface: #F2F4FA; --surface-2: #F6F7FC; --hover: #EFF1F9;
  --ink: #101B36; --body: #56617A; --muted: #68708A;
  --line: #E4E7F2; --line-2: #E9EBF5; --row: #F2F4F9;
  --accent: #4040D1; --accent-deep: #3A3ACB; --accent-soft: rgba(64,64,209,.1); --accent-ink: #FFFFFF;
  --sky: #50B3F6; --note: rgba(80,179,246,.09);
  --warn: #B7791F; --warn-bg: rgba(245,179,107,.14);
  --ok: #177A46; --ok-bg: #E4F6EC; --err: #B0362A; --err-bg: #FDE9E8;

  --get-bg: #E4F6EC; --get: #16794A;
  --post-bg: #E7E7FA; --post: #3A3ACB;
  --put-bg: #FFF3DC; --put: #8A5D0B;
  --del-bg: #FDE9E8; --del: #B0362A;
  --doc-bg: #EEF0F7; --doc: #5C657D;

  --cb-bg: #0C1424; --cb-head: #111C33; --cb-line: rgba(255,255,255,.07);
  --cb-ink: #C7D0E6; --cb-muted: #8B97B8; --cb-shadow: 0 18px 44px -26px rgba(5,10,26,.7);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --header: #060B17; --header-muted: #9AA5C4;
    --bg: #0B1120; --bg-side: #0D1426; --bar: rgba(11,17,32,.86);
    --surface: #17213A; --surface-2: #121B31; --hover: #172139;
    --ink: #E8ECF7; --body: #A9B3CC; --muted: #8791AC;
    --line: #1F2A44; --line-2: #1B263E; --row: #172038;
    --accent: #8F8FFF; --accent-deep: #A9A9FF; --accent-soft: rgba(143,143,255,.14); --accent-ink: #0B1120;
    --note: rgba(80,179,246,.1); --warn: #F5B36B; --warn-bg: rgba(245,179,107,.1);
    --ok: #6FDF9B; --ok-bg: rgba(111,223,155,.12); --err: #FF8F84; --err-bg: rgba(255,143,132,.12);
    --get-bg: rgba(111,223,155,.13); --get: #6FDF9B;
    --post-bg: rgba(143,143,255,.16); --post: #B3B3FF;
    --put-bg: rgba(245,179,107,.15); --put: #F5C07F;
    --del-bg: rgba(255,143,132,.14); --del: #FF9C92;
    --doc-bg: rgba(160,172,204,.12); --doc: #A0ACCC;
    --cb-bg: #070D1A; --cb-head: #0C1426; --cb-line: rgba(255,255,255,.06);
    --cb-shadow: 0 0 0 1px rgba(255,255,255,.06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --header: #060B17; --header-muted: #9AA5C4;
  --bg: #0B1120; --bg-side: #0D1426; --bar: rgba(11,17,32,.86);
  --surface: #17213A; --surface-2: #121B31; --hover: #172139;
  --ink: #E8ECF7; --body: #A9B3CC; --muted: #8791AC;
  --line: #1F2A44; --line-2: #1B263E; --row: #172038;
  --accent: #8F8FFF; --accent-deep: #A9A9FF; --accent-soft: rgba(143,143,255,.14); --accent-ink: #0B1120;
  --note: rgba(80,179,246,.1); --warn: #F5B36B; --warn-bg: rgba(245,179,107,.1);
  --ok: #6FDF9B; --ok-bg: rgba(111,223,155,.12); --err: #FF8F84; --err-bg: rgba(255,143,132,.12);
  --get-bg: rgba(111,223,155,.13); --get: #6FDF9B;
  --post-bg: rgba(143,143,255,.16); --post: #B3B3FF;
  --put-bg: rgba(245,179,107,.15); --put: #F5C07F;
  --del-bg: rgba(255,143,132,.14); --del: #FF9C92;
  --doc-bg: rgba(160,172,204,.12); --doc: #A0ACCC;
  --cb-bg: #070D1A; --cb-head: #0C1426; --cb-line: rgba(255,255,255,.06);
  --cb-shadow: 0 0 0 1px rgba(255,255,255,.06);
  color-scheme: dark;
}

/* ── base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 72px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6;
  color: var(--body); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 700; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { display: block; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.skip:focus { left: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 10px;
  font-size: .9rem; font-weight: 700; white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--light { background: #FFFFFF; color: #26268F; }
.btn--light:hover { background: #ECEDFB; color: #1C1C77; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-deep); }

/* ── header ────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--top);
  display: flex; align-items: center; gap: 28px;
  padding: 0 clamp(16px, 3vw, 46px) 0 20px;
  background: var(--header); color: var(--header-ink);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--header-ink); }
.brand:hover { text-decoration: none; }
.brand__logo { width: 124px; height: auto; }
.brand__tag {
  padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2);
  font-size: .68rem; font-weight: 700; letter-spacing: .12em; color: var(--header-muted);
}
.theme {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: var(--header-muted);
  transition: background-color .16s ease, color .16s ease;
}
.theme:hover { background: rgba(255,255,255,.08); color: var(--header-ink); }
.theme svg { width: 19px; height: 19px; }
.theme__sun { display: none; }
:root[data-theme="dark"] .theme__sun { display: block; }
:root[data-theme="dark"] .theme__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme__sun { display: block; }
  :root:not([data-theme="light"]) .theme__moon { display: none; }
}

/* ── layout ────────────────────────────────────────────────────────────── */
.doc { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); align-items: start; padding-top: var(--top); }
.doc__main { min-width: 0; }
.doc__scrim { display: none; }

/* ── sidebar ───────────────────────────────────────────────────────────── */
.doc__side {
  position: sticky; top: var(--top); height: calc(100vh - var(--top));
  display: flex; flex-direction: column; overflow: hidden;
  border-right: 1px solid var(--line); background: var(--bg-side);
}
.doc__search { position: relative; display: flex; align-items: center; padding: 18px 18px 14px; }
.doc__search svg { position: absolute; left: 32px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.doc__search input {
  width: 100%; height: 42px; padding: 0 40px 0 40px; font: inherit; font-size: .9rem;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.doc__search input::placeholder { color: var(--muted); }
.doc__search input:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: transparent; }
.doc__search input::-webkit-search-cancel-button { display: none; }
.doc__search kbd, .fam__body kbd {
  font-family: var(--mono); font-size: .74rem; color: var(--muted);
  padding: 1px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--bg);
}
.doc__search kbd { position: absolute; right: 30px; pointer-events: none; }

.dnav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 40px; }
.dnav__g + .dnav__g { margin-top: 20px; }
.dnav__g h2 { margin: 0 0 6px; padding: 0 10px; }
.dnav__g h2 a {
  display: block; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); line-height: 1.5;
}
.dnav__g h2 a:hover, .dnav__g h2 a.is-active { color: var(--ink); text-decoration: none; }
.dnav ul { list-style: none; margin: 0; padding: 0; }
.dnav ul a {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 8px;
  font-size: .875rem; color: var(--body);
  transition: background-color .14s ease, color .14s ease;
}
.dnav ul a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnav ul a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.dnav ul a.is-active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.dnav__empty { padding: 8px 12px 24px; font-size: .86rem; color: var(--muted); }

/* method badges */
.m {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  font-family: var(--mono); font-style: normal; font-weight: 700; letter-spacing: .04em; border-radius: 5px;
}
.dnav .m { width: 44px; height: 19px; font-size: .58rem; }
.ep__path .m { height: 24px; padding: 0 9px; font-size: .68rem; margin-right: 2px; }
.m--get { background: var(--get-bg); color: var(--get); }
.m--post { background: var(--post-bg); color: var(--post); }
.m--put, .m--patch { background: var(--put-bg); color: var(--put); }
.m--delete { background: var(--del-bg); color: var(--del); }
.m--doc { background: var(--doc-bg); color: var(--doc); }

/* ── sticky action bar ─────────────────────────────────────────────────── */
.doc__bar {
  position: sticky; top: var(--top); z-index: 20;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px clamp(16px, 3vw, 46px);
  background: var(--bar); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.doc__base { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: .84rem; color: var(--muted); }
.doc__base > span { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .68rem; white-space: nowrap; }
.doc__base code {
  min-width: 0; font-family: var(--mono); font-size: .82rem; color: var(--ink);
  padding: .2em .5em; border-radius: 6px; background: var(--surface);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc__pm { margin-left: auto; }
.doc__menu { display: none; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: var(--ink); }
.doc__menu svg { width: 20px; height: 20px; }

/* ── content ───────────────────────────────────────────────────────────── */
.doc__scroll { padding: 0 clamp(16px, 3vw, 46px) 80px; }
.doc__h1 { padding: 46px 0 0; font-size: clamp(2rem, 3.4vw, 2.9rem); letter-spacing: -.04em; }
.fam__head { padding: 54px 0 4px; }
.fam__head h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -.035em; }
.fam__body { margin-top: .9rem; max-width: 80ch; }
.fam--doc .fam__body { max-width: none; }
.fam__head + .ep { border-top: 0; }

.ep {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 44%);
  gap: clamp(24px, 3vw, 44px); align-items: start;
  padding: 34px 0 38px; border-top: 1px solid var(--line-2);
}
.ep--ref { grid-template-columns: minmax(0, 1fr); }
.ep__copy { min-width: 0; }
.ep__copy h3 { font-size: 1.3rem; letter-spacing: -.03em; margin-bottom: .8rem; }
.ep__copy h4, .fam__body h4 {
  margin: 1.9rem 0 .7rem; font-size: .7rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.ep__copy p, .fam__body p, .ep__copy li, .fam__body li { font-size: .94rem; line-height: 1.72; }
.ep__copy p, .fam__body p { margin-bottom: .9rem; max-width: 72ch; }
.ep__copy ul, .ep__copy ol, .fam__body ul, .fam__body ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.ep__copy strong, .fam__body strong, .dt strong { color: var(--ink); font-weight: 600; }
.ep__copy code, .fam__body code, .dt code {
  font-family: var(--mono); font-size: .84em; padding: .14em .42em; border-radius: 5px;
  background: var(--surface); color: var(--ink); word-break: break-word;
}
.ep__path { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem !important; }
.ep__path code { font-size: .86rem !important; font-weight: 600; word-break: break-all; }
.ep__variants { margin: -.3rem 0 1.2rem; padding-left: 12px; border-left: 2px solid var(--line); }
.ep__variants > span { display: block; margin-bottom: .35rem; font-size: .74rem; font-weight: 600; color: var(--muted); }
.ep__path--alt { margin-bottom: .3rem !important; }
.ep__path--alt .m { height: 20px; font-size: .6rem; opacity: .8; }
.ep__path--alt code { font-size: .8rem !important; font-weight: 500; }
.ep__copypath { display: inline-flex; flex: none; padding: 5px; border-radius: 6px; color: var(--muted); }
.ep__copypath svg { width: 15px; height: 15px; }
.ep__copypath:hover { color: var(--accent); background: var(--surface); }
.ep__copypath.is-done { color: var(--ok); }

/* callouts: <aside class="success|notice|warning"> in the markdown */
.ep__copy aside, .fam__body aside {
  margin: 1.2rem 0; padding: 13px 16px; border-radius: 11px; max-width: 72ch;
  background: var(--note); border-left: 3px solid var(--sky);
  font-size: .89rem; line-height: 1.6; color: var(--body);
}
.ep__copy aside.warning, .fam__body aside.warning { background: var(--warn-bg); border-left-color: var(--warn); }

/* response codes */
.statuses { display: flex; flex-wrap: wrap; gap: 8px; }
.status {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 11px 4px 5px; border-radius: 999px;
  font-size: .84rem; text-transform: capitalize; background: var(--surface); color: var(--body);
}
.status b { padding: 1px 8px; border-radius: 999px; font-family: var(--mono); font-size: .78rem; background: var(--bg); color: var(--ink); }
.status--2xx { background: var(--ok-bg); color: var(--ok); }
.status--4xx, .status--5xx { background: var(--err-bg); color: var(--err); }

/* ── parameter tables ──────────────────────────────────────────────────── */
.dt__wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 12px; margin-bottom: 1rem; }
.dt { width: 100%; border-collapse: collapse; font-size: .86rem; }
.dt th {
  padding: 10px 14px; text-align: left; white-space: nowrap;
  font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line-2);
}
.dt td { padding: 11px 14px; vertical-align: top; line-height: 1.6; color: var(--body); border-bottom: 1px solid var(--row); }
.dt tr:last-child td { border-bottom: 0; }
.dt td.k { font-family: var(--mono); font-size: .82rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.fam--doc .dt td.k { white-space: normal; min-width: 90px; }

/* ── code rail ─────────────────────────────────────────────────────────── */
.ep__code { position: sticky; top: calc(var(--top) + 78px); display: grid; gap: 14px; min-width: 0; }
.cb { margin: 0 0 1rem; border-radius: 14px; overflow: hidden; background: var(--cb-bg); box-shadow: var(--cb-shadow); min-width: 0; }
.ep__code .cb { margin: 0; }
.cb figcaption {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 10px 7px 16px;
  background: var(--cb-head); border-bottom: 1px solid var(--cb-line);
}
.cb__t { flex: none; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--cb-muted); }
.cb__sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: .7rem; color: var(--cb-muted); opacity: .8; }
.cb__lang { margin-left: auto; font-size: .74rem; font-weight: 600; color: var(--cb-muted); }
.cb__tabs { display: flex; gap: 2px; margin-left: auto; }
.cb__tabs button {
  padding: 4px 10px; border-radius: 6px; font-size: .74rem; font-weight: 600; color: var(--cb-muted);
  transition: background-color .14s ease, color .14s ease;
}
.cb__tabs button:hover { color: #D5DCF0; }
.cb__tabs button[aria-selected="true"] { background: rgba(255,255,255,.11); color: #FFFFFF; }
.cb__copy {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 7px;
  font-size: .74rem; font-weight: 600; color: var(--cb-muted);
  transition: background-color .14s ease, color .14s ease;
}
.cb__copy svg { width: 14px; height: 14px; }
.cb__copy:hover { background: rgba(255,255,255,.09); color: #FFFFFF; }
.cb__copy.is-done { color: #6FDF9B; }
.cb__desc { margin: 0; padding: 12px 18px 0; font-size: .8rem; line-height: 1.55; color: var(--cb-muted); }
.cb pre { margin: 0; padding: 16px 18px 18px; overflow: auto; max-height: 480px; }
.cb code { font-family: var(--mono); font-size: .76rem; line-height: 1.65; color: var(--cb-ink); white-space: pre; }
.cb pre::-webkit-scrollbar { width: 10px; height: 10px; }
.cb pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 10px; border: 2px solid var(--cb-bg); }
.cb pre::-webkit-scrollbar-corner { background: transparent; }

/* syntax colours (applied lazily by docs.js) */
.t-key { color: #C4A9F5; } .t-str { color: #9FE6B4; } .t-num { color: #7FC4F8; }
.t-bool { color: #F5B36B; } .t-kw { color: #F48FB1; } .t-type { color: #7FDBCA; }
.t-com { color: #6B7794; font-style: italic; } .t-cmd { color: #7FC4F8; } .t-flag { color: #8B97B8; }
.t-var { color: #F5B36B; } .t-tag { color: #F48FB1; } .t-attr { color: #C4A9F5; }

.doc__foot { padding-top: 42px; font-size: .86rem; color: var(--muted); }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .ep { grid-template-columns: minmax(0, 1fr); }
  .ep__code { position: static; }
}
@media (max-width: 900px) {
  :root { --top: 64px; }
  html { scroll-padding-top: calc(var(--top) + 118px); }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .doc__menu { display: inline-flex; }
  .doc__pm { min-height: 38px; padding: 0 12px; }
  .doc__pm span { display: none; }
  .doc__side {
    position: fixed; inset: var(--top) auto 0 0; z-index: 60; width: min(320px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform .28s cubic-bezier(.22,.61,.36,1);
  }
  .doc__side.is-open { transform: none; box-shadow: 0 24px 60px -20px rgba(10,18,38,.4); }
  .doc__scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10,18,38,.42); }
  .doc__scrim.is-open { display: block; }
  .doc__base { order: 3; width: 100%; }
  .site-header .btn { display: none; }
  .brand__logo { width: 108px; }
}
@media (prefers-reduced-motion: reduce) { .doc__side { transition: none; } }

@media print {
  .site-header, .doc__side, .doc__bar { display: none; }
  .doc { display: block; padding: 0; }
  .ep { display: block; break-inside: avoid-page; }
  .ep__code { position: static; }
  .cb pre { max-height: none; }
  .cb pre[hidden] { display: none !important; }
}
