/* Merchant Integration Guide — layout after the Resend API reference: fixed sidebar, framed content, sticky examples. */
:root {
  --page: #ffffff; --panel: #ffffff; --line: #ebebef; --line-soft: #f6f6f8;
  --h: #09090b; --text: #3f3f46; --muted: #71717a; --faint: #a1a1aa;
  --hover: #f4f4f5; --active: #f1f1f3; --chip: #f4f4f5; --chip-line: #e4e4e7;
  --link: #2563eb;
  --req: #dc2626; --req-bg: #fef2f2;
  --get: #15803d; --get-bg: #dcfce7; --post: #1d4ed8; --post-bg: #dbeafe;
  --note-bg: #fafafa; --must: #6d28d9; --must-bg: #f5f3ff;
  --code-bg: #fafafa; --code-line: #ececf0; --code-fg: #18181b; --code-dim: #71717a;
  --c-str: #047857; --c-key: #1d4ed8; --c-fn: #c2410c; --c-kw: #7c3aed; --c-num: #be123c; --c-com: #a1a1aa;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --side: 272px; --top: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #000000; --panel: #0a0a0a; --line: #1f1f23; --line-soft: #111113;
    --h: #fafafa; --text: #b4b4bb; --muted: #8b8b93; --faint: #5f5f66;
    --hover: #141416; --active: #1c1c1f; --chip: #18181b; --chip-line: #26262b;
    --link: #e4e4e7;
    --req: #f87171; --req-bg: #2a1215;
    --get: #4ade80; --get-bg: #0f2a19; --post: #60a5fa; --post-bg: #0f1f3a;
    --note-bg: #111113; --must: #c4b5fd; --must-bg: #17122a;
    --code-bg: #0e0e10; --code-line: #232327; --code-fg: #e4e4e7; --code-dim: #8b8b93;
    --c-str: #6ee7b7; --c-key: #93c5fd; --c-fn: #fdba74; --c-kw: #c4b5fd; --c-num: #fda4af; --c-com: #6b6b73;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #000000; --panel: #0a0a0a; --line: #1f1f23; --line-soft: #111113;
  --h: #fafafa; --text: #b4b4bb; --muted: #8b8b93; --faint: #5f5f66;
  --hover: #141416; --active: #1c1c1f; --chip: #18181b; --chip-line: #26262b;
  --link: #e4e4e7;
  --req: #f87171; --req-bg: #2a1215;
  --get: #4ade80; --get-bg: #0f2a19; --post: #60a5fa; --post-bg: #0f1f3a;
  --note-bg: #111113; --must: #c4b5fd; --must-bg: #17122a;
  --code-bg: #0e0e10; --code-line: #232327; --code-fg: #e4e4e7; --code-dim: #8b8b93;
  --c-str: #6ee7b7; --c-key: #93c5fd; --c-fn: #fdba74; --c-kw: #c4b5fd; --c-num: #fda4af; --c-com: #6b6b73;
  color-scheme: dark;
}

/* embedded in the Gosaic admin (assets/embed-kit.js): the admin owns theme and language, and the page takes on the
   admin's surfaces so it reads as part of the console; syntax colours stay the guide's own */
:root[data-embed] #themeBtn, :root[data-embed] .seg { display: none; }
:root[data-gosaic-tokens] {
  --page: var(--gosaic-background); --panel: var(--gosaic-card);
  --line: var(--gosaic-border); --line-soft: var(--gosaic-muted);
  --h: var(--gosaic-foreground); --muted: var(--gosaic-muted-foreground);
  --hover: var(--gosaic-accent); --active: var(--gosaic-accent);
  --chip: var(--gosaic-muted); --chip-line: var(--gosaic-border);
}

/* bilingual: every prose piece is written twice, .en and .zh; <html lang> picks one */
html[lang="en"] .zh, html[lang="zh-CN"] .en { display: none !important; }

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; scroll-padding-top: calc(var(--top) + 24px); background: var(--page); }
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.75 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
b, strong { color: var(--h); font-weight: 600; }
code, pre { font-family: var(--mono); }
:not(pre) > code { font-size: 12.5px; background: var(--chip); border: 1px solid var(--chip-line); padding: 1px 5px; border-radius: 6px; color: var(--h); word-break: break-word; }
ul { padding-left: 20px; } li { margin: 4px 0; }
/* no native scrollbars in the chrome: content that fits is shown whole, the rest scrolls without a bar */
.side, .rail, .card-bar .tabs, pre.code, .tw, .flow { scrollbar-width: none; }
.side::-webkit-scrollbar, .rail::-webkit-scrollbar, .card-bar .tabs::-webkit-scrollbar, pre.code::-webkit-scrollbar,
.tw::-webkit-scrollbar, .flow::-webkit-scrollbar { display: none; }
/* the page scrollbar follows the theme: narrow overlay pill on a transparent track, same as the admin console */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in oklch, var(--h) 18%, transparent); border: 2.5px solid transparent; border-radius: 9999px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in oklch, var(--h) 32%, transparent); background-clip: padding-box; border-width: 2px; }

/* top bar */
.top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: var(--top); display: flex; align-items: center; gap: 28px; padding: 0 24px; background: var(--page); }
.logo { font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--h); text-decoration: none; width: calc(var(--side) - 48px); white-space: nowrap; }
.top-tabs { display: flex; gap: 22px; }
.top-tabs a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.top-tabs a:hover, .top-tabs a.on { color: var(--h); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ver { color: var(--faint); font-size: 12.5px; margin-right: 6px; }
.llms { font: 12px var(--mono); color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.llms:hover { color: var(--h); border-color: var(--muted); }
.seg { display: inline-flex; background: var(--chip); border-radius: 8px; padding: 2px; }
.seg button, .icon, .menu { font: 500 12.5px var(--sans); color: var(--muted); background: none; border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--h); box-shadow: 0 0 0 1px var(--line); }
.icon { display: inline-flex; padding: 6px; }
.icon:hover, .menu:hover { color: var(--h); background: var(--hover); }
.menu { display: none; font-size: 18px; padding: 2px 8px; }

/* sidebar: fixed to the left edge, so switching pages never moves it */
.side { position: fixed; z-index: 20; top: var(--top); left: 0; bottom: 0; width: var(--side); overflow-y: auto; padding: 8px 16px 48px; background: var(--page); }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--faint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--h); font: 14px var(--sans); }
.nav-g { color: var(--h); font-size: 14px; font-weight: 600; margin: 22px 8px 6px; }
.nav-g:first-of-type { margin-top: 6px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { margin: 1px 0; }
.side li a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; line-height: 1.4; text-decoration: none; }
.side li a:hover { color: var(--h); background: var(--hover); }
.side li a.on { color: var(--h); background: var(--active); font-weight: 500; }
.side li.hide, .nav-g.hide { display: none; }

/* method badges */
.m { flex: none; display: inline-block; font: 600 10px/16px var(--mono); padding: 0 5px; border-radius: 4px; letter-spacing: .02em; }
.m-get { color: var(--get); background: var(--get-bg); }
.m-post { color: var(--post); background: var(--post-bg); }
.side .m { font-size: 9px; line-height: 15px; min-width: 34px; text-align: center; }

/* framed content */
.frame { margin: var(--top) 8px 8px var(--side); min-height: calc(100vh - var(--top) - 8px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 720px) 224px; justify-content: start; gap: 64px; padding: 56px 48px 96px 64px; }
.cols.wide { grid-template-columns: minmax(0, 600px) minmax(0, 470px); gap: 48px; }
main.doc { min-width: 0; }
.rail { position: sticky; top: calc(var(--top) + 32px); align-self: start; max-height: calc(100vh - var(--top) - 48px); overflow-y: auto; }

.crumb { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
h1 { color: var(--h); font-size: 34px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; margin: 0 0 10px; }
.subtitle { color: var(--muted); font-size: 18px; line-height: 1.6; margin: 0 0 32px; }
h2 { color: var(--h); font-size: 22px; letter-spacing: -.015em; font-weight: 600; margin: 48px 0 14px; }
h3 { color: var(--h); font-size: 17px; font-weight: 600; margin: 32px 0 10px; }
h4 { color: var(--h); font-size: 15px; font-weight: 600; margin: 24px 0 8px; }
p { margin: 0 0 16px; }
.hint, .kv { color: var(--muted); font-size: 14px; }
.sub { color: var(--muted); }

.ep { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin: 0 0 8px; }
.ep .m { font-size: 12px; line-height: 22px; padding: 0 8px; border-radius: 6px; }
.ep code { font-size: 14px; color: var(--h); overflow-wrap: anywhere; background: none; border: 0; padding: 0; }
.ep-meta { color: var(--muted); font-size: 13px; margin: 0 0 28px; }

/* parameter rows */
.params { margin: 6px 0 24px; }
.param { padding: 16px 0; border-bottom: 1px solid var(--line); }
.param:first-child { padding-top: 6px; }
.p-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.p-name { font: 500 14px var(--mono); color: var(--h); }
.p-type, .p-opt { font: 12px var(--mono); color: var(--muted); background: var(--chip); padding: 1px 7px; border-radius: 6px; }
.p-req { font: 12px var(--mono); color: var(--req); background: var(--req-bg); padding: 1px 7px; border-radius: 6px; }
.p-desc { font-size: 14.5px; }
.p-desc p:last-child { margin-bottom: 0; }

/* tables (non-field) */
.tw { overflow-x: auto; margin: 8px 0 24px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--line-soft); white-space: nowrap; }
td code { white-space: normal; word-break: normal; overflow-wrap: break-word; }
td:first-child code { white-space: nowrap; }
td.case-name { min-width: 7.5em; }
td.req { min-width: 15em; }
.cols.full { grid-template-columns: minmax(0, 1100px) 200px; gap: 48px; }

/* test cases (endpoint pages) */
.cases { margin: 8px 0 24px; border-top: 1px solid var(--line); }
.case { padding: 12px 0; border-bottom: 1px solid var(--line); }
.case-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cid { font: 500 12.5px var(--mono); color: var(--h); }
.cid a { color: inherit; text-decoration: none; }
.case-t { color: var(--h); font-size: 14.5px; font-weight: 500; }
.case-x { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.case-b { margin-top: 6px; font-size: 14px; }
.case-check { color: var(--muted); margin-top: 4px; }

/* callouts */
.note, .must, .warn { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 20px 0; background: var(--note-bg); font-size: 14.5px; }
.must { background: var(--must-bg); border-color: color-mix(in srgb, var(--must) 30%, transparent); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--h); margin-right: 8px; }
.badge { display: inline-block; font: 11.5px var(--mono); padding: 0 7px; border-radius: 6px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.b-req { color: var(--req); background: var(--req-bg); }
.b-get { color: var(--get); background: var(--get-bg); }
.b-post { color: var(--post); background: var(--post-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip { font: 12.5px var(--mono); padding: 2px 8px; border-radius: 6px; background: var(--chip); border: 1px solid var(--chip-line); color: var(--h); text-decoration: none; }
.chip:hover { border-color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.card h3, .card h4 { margin: 0 0 6px; font-size: 15px; }
.card p, .card ul { font-size: 14px; }
a.card { display: block; color: var(--muted); font-size: 14px; text-decoration: none; transition: border-color .15s; }
a.card:hover { border-color: var(--muted); }
.quick { margin: 0 0 28px; }
/* ASCII sequence diagrams keep their layout; app.js shrinks the font until the whole diagram fits */
.flow { font: 12.5px/1.6 var(--mono); white-space: pre; overflow-x: auto; color: var(--code-fg); background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 12px; padding: 14px 16px; margin: 12px 0 20px; }
main pre:not(.code) { font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--code-fg); background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 12px; padding: 14px 16px; }

/* code cards (right rail and inline) */
.card-code { background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 14px; margin: 0 0 16px; overflow: hidden; }
main .card-code { margin: 16px 0 24px; }
.card-bar { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--code-line); }
.card-title { color: var(--h); font-size: 13px; font-weight: 500; padding-right: 8px; white-space: nowrap; }
.card-bar .tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; }
.tab { font: 500 13px var(--sans); color: var(--code-dim); background: none; border: 0; padding: 10px 7px 9px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--code-fg); }
.tab.on { color: var(--code-fg); border-bottom-color: var(--code-fg); }
span.tab { cursor: default; }
.copy { flex: none; display: inline-flex; color: var(--code-dim); background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; }
.copy:hover { color: var(--code-fg); background: var(--hover); }
.copy.done { color: var(--get); }
pre.code { display: none; margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.7; color: var(--code-fg); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 440px; overflow-y: auto; }
pre.code.on { display: block; }
.code .s { color: var(--c-str); }
.code .key { color: var(--c-key); }
.code .f { color: var(--c-fn); }
.code .k { color: var(--c-kw); }
.code .n { color: var(--c-num); }
.code .c { color: var(--c-com); font-style: italic; }

/* on this page */
.toc-h { color: var(--h); font-size: 13px; font-weight: 600; margin: 4px 0 10px; }
.toc { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.toc a:hover { color: var(--h); }
.toc a.on { color: var(--h); border-left-color: var(--h); font-weight: 500; }

@media (max-width: 1560px) {
  .cols.full { grid-template-columns: minmax(0, 1fr); }
  .cols.full .rail { display: none; }
}
@media (max-width: 1280px) {
  .cols, .cols.wide, .cols.full { grid-template-columns: minmax(0, 760px); justify-content: start; gap: 0; padding: 40px 32px 80px 48px; }
  .cols.full { grid-template-columns: minmax(0, 1fr); }
  .cols:not(.wide) .rail { display: none; }
  .cols.wide .rail { position: static; max-height: none; overflow: visible; margin-top: 16px; }
}
@media (max-width: 900px) {
  .menu { display: inline-block; }
  .top { gap: 12px; padding: 0 12px; }
  .top-tabs, .ver, .llms { display: none; }
  .logo { width: auto; }
  .side { transform: translateX(-100%); transition: transform .2s; border-right: 1px solid var(--line); }
  .side.open { transform: none; }
  .frame { margin: var(--top) 0 0; border-radius: 0; border-width: 1px 0 0; }
  .cols, .cols.wide, .cols.full { padding: 28px 16px 64px; }
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
  .subtitle { font-size: 16px; }
}
