@font-face { font-family: 'Satoshi'; src: url('fonts/Satoshi-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('fonts/Satoshi-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('fonts/Satoshi-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* Layout: sticky top bar, section index on the left, reading column in the middle;
   each API call splits into explanation (left) and request/response (right). */
:root {
  --bg: #ffffff; --surface: #f5f6fa; --surface-2: #eceef5;
  --ink: #1c2340; --ink-2: #444b68; --muted: #6c7391; --line: #e2e5ee;
  --accent: #ec7d3a; --accent-ink: #b4541b; --accent-soft: #fdf0e7;
  --code-bg: #171c36; --code-fg: #e4e7f4; --code-muted: #8f96b8; --code-line: #2a3155;
  --tok-key: #f4a66f; --tok-str: #a8d5b0; --tok-num: #d9b074; --tok-lit: #9db4ff;
  --get: #1b7f58; --get-soft: #e3f4ec; --post: #b4541b; --post-soft: #fdf0e7;
  --font-display: "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bar-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1224; --surface: #151a31; --surface-2: #1c2340;
    --ink: #eef0f8; --ink-2: #c3c8de; --muted: #8c93b2; --line: #252b49;
    --accent: #f49352; --accent-ink: #f6a973; --accent-soft: #2b2130;
    --code-bg: #090c1a; --code-fg: #e4e7f4; --code-muted: #7f86a8; --code-line: #1f2542;
    --tok-key: #f4a66f; --tok-str: #a8d5b0; --tok-num: #d9b074; --tok-lit: #9db4ff;
    --get: #5fd0a0; --get-soft: #12302a; --post: #f6a973; --post-soft: #2b2130;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1224; --surface: #151a31; --surface-2: #1c2340;
  --ink: #eef0f8; --ink-2: #c3c8de; --muted: #8c93b2; --line: #252b49;
  --accent: #f49352; --accent-ink: #f6a973; --accent-soft: #2b2130;
  --code-bg: #090c1a; --code-fg: #e4e7f4; --code-muted: #7f86a8; --code-line: #1f2542;
  --tok-key: #f4a66f; --tok-str: #a8d5b0; --tok-num: #d9b074; --tok-lit: #9db4ff;
  --get: #5fd0a0; --get-soft: #12302a; --post: #f6a973; --post-soft: #2b2130;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-2); padding: 0.1em 0.38em; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

/* Top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1360px; margin: 0 auto; min-height: var(--bar-h); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.brand small { font-weight: 500; font-size: 14px; color: var(--muted); }
.later { align-self: flex-start; }
.pill { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#search { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; width: 200px; max-width: 100%; }
#search::placeholder { color: var(--muted); }
.btn { font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.88; background: var(--ink); }
.btn.small { font-size: 12px; padding: 4px 10px; color: var(--ink-2); }
#menu-btn { display: none; }

/* Shell */
.shell { max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#nav { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 1px); align-self: start; max-height: calc(100vh - var(--bar-h) - 2px); overflow-y: auto; padding-block: 28px; font-size: 14px; }
.nav-group { margin-bottom: 22px; display: flex; flex-direction: column; gap: 1px; }
.nav-group > span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
#nav a { display: flex; align-items: center; gap: 8px; color: var(--ink-2); text-decoration: none; padding: 4px 8px; border-radius: 6px; margin-left: -8px; }
#nav a:hover { background: var(--surface); color: var(--ink); }
#nav a[aria-current="true"] { background: var(--surface); color: var(--ink); font-weight: 500; }
#nav .m { font-size: 9px; padding: 1px 4px; min-width: 32px; text-align: center; }
main { min-width: 0; padding-bottom: 96px; }

/* Sections */
.sec { padding-block: 44px; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) + 12px); display: flex; flex-direction: column; gap: 16px; }
.sec:first-child { border-top: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec h2 { font-size: 24px; line-height: 1.2; }
.sec h3 { font-size: 16px; margin-top: 10px; }
.sec h4 { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 14px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 62ch; }
.note { background: var(--surface); border-radius: 10px; padding: 12px 16px; color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.note strong { color: var(--ink); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.hero h1 { font-size: 40px; line-height: 1.08; letter-spacing: -0.02em; }
.hero-text { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; font-family: var(--font-mono); font-size: 12px; }
.flow li { display: flex; align-items: center; gap: 4px; }
.flow li + li::before { content: "\2192"; color: var(--muted); margin-right: 4px; }
.flow code { background: var(--surface); border: 1px solid var(--line); padding: 3px 8px; font-size: 12px; }
.results { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; background: var(--bg); }
.results-head { background: var(--code-bg); color: var(--code-fg); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.results-head b { font-family: var(--font-display); font-size: 17px; }
.results-head span { font-size: 12px; color: var(--code-muted); }
.result { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 18px; border-top: 1px solid var(--line); }
.result b { font-family: var(--font-display); font-size: 15px; }
.result .sub { font-size: 12px; color: var(--muted); grid-column: 1; }
.result .price { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; white-space: nowrap; }
.result .price small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.tag-best { white-space: nowrap; font-size: 10px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--get); background: var(--get-soft); padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; }
.results-foot { padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface); }
.caption { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Tables */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
td:first-child { color: var(--ink); white-space: nowrap; }
td .req { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-ink); margin-left: 6px; }
td .type { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Method badge */
.m { font-family: var(--font-mono); font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 5px; }
.m.get { color: var(--get); background: var(--get-soft); }
.m.post { color: var(--post); background: var(--post-soft); }
.route { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route code { font-size: 14px; background: none; padding: 0; color: var(--ink); }

/* Endpoint split */
.ep-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.ep-text { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ep-code { display: flex; flex-direction: column; gap: 14px; min-width: 0; position: sticky; top: calc(var(--bar-h) + 16px); }

/* Code */
.code { background: var(--code-bg); color: var(--code-fg); border-radius: 12px; overflow: hidden; min-width: 0; }
.code-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--code-line); flex-wrap: wrap; }
.code-bar h4 { color: var(--code-muted); margin-right: auto; }
.tab, .copy { font: inherit; font-size: 12px; color: var(--code-muted); background: none; border: 0; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.tab:hover, .copy:hover { color: var(--code-fg); }
.tab[aria-pressed="true"] { color: var(--code-fg); background: var(--code-line); }
.copy { border: 1px solid var(--code-line); margin-left: 4px; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; max-height: 460px; }
.code .k { color: var(--tok-key); } .code .s { color: var(--tok-str); } .code .n { color: var(--tok-num); } .code .l { color: var(--tok-lit); }

#empty { padding-block: 60px; color: var(--muted); }
#manual { position: fixed; inset: 0; z-index: 20; background: rgba(14, 18, 36, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
#manual .box { background: var(--bg); color: var(--ink); border-radius: 12px; padding: 16px; width: min(640px, 100%); display: flex; flex-direction: column; gap: 10px; }
#manual textarea { width: 100%; height: 260px; font-family: var(--font-mono); font-size: 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }

@media (max-width: 1180px) {
  .ep-grid, .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .ep-code { position: static; }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; max-height: none; overflow-y: auto; background: var(--bg); padding-block: 16px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  #nav.open { display: block; }
  #menu-btn { display: inline-block; }
  .top-tools > :not(#menu-btn) { display: none; }
  .top.open .top-tools { width: 100%; margin-left: 0; }
  .top.open .top-tools > :not(#menu-btn) { display: inline-block; }
  .top.open #search { flex: 1 1 140px; width: auto; }
  .hero h1 { font-size: 32px; }
  .sec { padding-block: 32px; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

#nav .soon { margin-left: auto; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
