/* ekash developer docs — hand-written, no third-party resources.
   Palette from the ekash kit: ink #231F20, gold-500 #FFB71B, gold-800 #7A640F (the only gold for text on
   light), gold-100 #FFF4D6, warm surfaces #FAF8F5 / #F2EFEB, hairline #E6E4E1, muted text #5C5A58. */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #FFFFFF;
  --bg-subtle: #FAF8F5;
  --surface-2: #F2EFEB;
  --hairline: #E6E4E1;
  --hairline-strong: #D6D2CE;
  --text: #231F20;
  --text-muted: #5C5A58;
  --link: #7A640F;
  --link-underline: rgba(122, 100, 15, 0.45);
  --accent: #FFB71B;
  --accent-soft: #FFF4D6;
  --accent-text: #7A640F;
  --focus: #7A640F;
  --code-inline-bg: #F2EFEB;
  --code-inline-text: #231F20;
  --code-bg: #231F20;
  --code-head: #2C2829;
  --code-text: #F2EFEB;
  --code-border: transparent;
  --shadow: 0 8px 28px rgba(35, 31, 32, 0.12), 0 1px 3px rgba(35, 31, 32, 0.08);
  --scrim: rgba(35, 31, 32, 0.40);

  --get-bg: #DBEDDB;   --get-fg: #266626;
  --post-bg: #FFF4D6;  --post-fg: #7A640F;
  --patch-bg: #D1ECF1; --patch-fg: #0C5460;
  --delete-bg: #F5D9D9; --delete-fg: #8C2626;
  --ok-bg: #DBEDDB;    --ok-fg: #266626;
  --err-bg: #F5D9D9;   --err-fg: #8C2626;
  --req: #8C2626;

  --topbar-h: 60px;
  --sidebar-w: 280px;
  --toc-w: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171415;
    --bg-subtle: #1D1A1B;
    --surface-2: #2A2627;
    --hairline: #363132;
    --hairline-strong: #4A4445;
    --text: #F2EFEB;
    --text-muted: #B8B2AC;
    --link: #FFC94D;
    --link-underline: rgba(255, 201, 77, 0.45);
    --accent-soft: rgba(255, 183, 27, 0.13);
    --accent-text: #FFC94D;
    --focus: #FFC94D;
    --code-inline-bg: #2A2627;
    --code-inline-text: #F2EFEB;
    --code-bg: #0F0D0E;
    --code-head: #161314;
    --code-border: #2E2A2B;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --scrim: rgba(0, 0, 0, 0.55);
    --get-bg: rgba(110, 190, 120, 0.16);  --get-fg: #9AD7A3;
    --post-bg: rgba(255, 183, 27, 0.16);  --post-fg: #FFC94D;
    --patch-bg: rgba(90, 180, 200, 0.18); --patch-fg: #95D5E2;
    --delete-bg: rgba(230, 100, 100, 0.18); --delete-fg: #F4A7A7;
    --ok-bg: rgba(110, 190, 120, 0.16);   --ok-fg: #9AD7A3;
    --err-bg: rgba(230, 100, 100, 0.18);  --err-fg: #F4A7A7;
    --req: #F4A7A7;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #171415;
  --bg-subtle: #1D1A1B;
  --surface-2: #2A2627;
  --hairline: #363132;
  --hairline-strong: #4A4445;
  --text: #F2EFEB;
  --text-muted: #B8B2AC;
  --link: #FFC94D;
  --link-underline: rgba(255, 201, 77, 0.45);
  --accent-soft: rgba(255, 183, 27, 0.13);
  --accent-text: #FFC94D;
  --focus: #FFC94D;
  --code-inline-bg: #2A2627;
  --code-inline-text: #F2EFEB;
  --code-bg: #0F0D0E;
  --code-head: #161314;
  --code-border: #2E2A2B;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --scrim: rgba(0, 0, 0, 0.55);
  --get-bg: rgba(110, 190, 120, 0.16);  --get-fg: #9AD7A3;
  --post-bg: rgba(255, 183, 27, 0.16);  --post-fg: #FFC94D;
  --patch-bg: rgba(90, 180, 200, 0.18); --patch-fg: #95D5E2;
  --delete-bg: rgba(230, 100, 100, 0.18); --delete-fg: #F4A7A7;
  --ok-bg: rgba(110, 190, 120, 0.16);   --ok-fg: #9AD7A3;
  --err-bg: rgba(230, 100, 100, 0.18);  --err-fg: #F4A7A7;
  --req: #F4A7A7;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}
img, svg { max-width: 100%; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--link-underline); }
a:hover { color: var(--text); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, kbd, pre { font-family: var(--font-mono); }
code { font-size: 0.875em; background: var(--code-inline-bg); color: var(--code-inline-text); padding: 0.12em 0.38em; border-radius: 4px; overflow-wrap: anywhere; }
strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 40px 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-muted); }
code.nowrap { white-space: nowrap !important; overflow-wrap: normal; }

.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; background: #231F20; color: #FFFFFF; padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 10px; color: #FFFFFF; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; flex: none; }
.brand:hover { color: var(--text); }
.wordmark { display: block; width: 74px; height: 14px; fill: currentColor; }
.brand-divider { width: 1px; height: 18px; background: var(--hairline-strong); }
.brand-label { font-weight: 600; font-size: 15px; letter-spacing: -0.005em; }
.topnav { display: flex; gap: 4px; margin-left: 24px; }
.topnav a { color: var(--text-muted); text-decoration: none; font-size: 14.5px; font-weight: 500; padding: 6px 12px; border-radius: 8px; }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a[aria-current] { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.theme-toggle {
  margin-left: auto; width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 1px solid var(--hairline); border-radius: 999px; cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-icon { width: 16px; height: 16px; border-radius: 999px; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
html:not(.js) .theme-toggle { display: none; }
.menu-toggle { display: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); min-height: calc(100vh - var(--topbar-h)); }
.layout-reference .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  background: var(--bg-subtle);
  border-right: 1px solid var(--hairline);
}
.sidebar-inner { padding: 20px 16px 48px; }
.sidebar-close { display: none; }
.main { min-width: 0; padding: 40px 56px 0; outline: none; }
.content { max-width: 760px; margin: 0 auto; }
.layout-home .content { max-width: 880px; }
.layout-reference .content { max-width: 1240px; }
.layout-schemas .content { max-width: 860px; }

/* ---------- sidebar nav ---------- */
.nav-group { margin-top: 18px; }
.nav-heading { font-size: 12px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 650; color: var(--text-muted); margin: 0 0 6px; padding: 0 12px; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a { display: block; padding: 6px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.45; }
.nav-group a:hover { background: var(--surface-2); }
.nav-group a.active { background: var(--accent-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-sub { margin: 4px 0 8px 14px !important; padding-left: 8px !important; border-left: 1px solid var(--hairline); }
.nav-sub a { font-size: 13.5px; display: flex; gap: 8px; align-items: baseline; padding: 5px 8px; color: var(--text-muted); }
.nav-sub a:hover { color: var(--text); }

/* ---------- search ---------- */
.search { position: relative; }
html:not(.js) .search { display: none; }
.search-input {
  width: 100%; height: 40px; padding: 0 34px 0 36px;
  font: 15px var(--font-sans); color: var(--text);
  background: var(--bg) no-repeat 12px 50% / 16px 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238A8784' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.75'/%3E%3Cpath d='M10.5 10.5L14 14'/%3E%3C/svg%3E");
  border: 1px solid var(--hairline-strong); border-radius: 8px;
  -webkit-appearance: none; appearance: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.search-kbd { position: absolute; right: 9px; top: 9px; font-size: 12px; line-height: 20px; min-width: 20px; text-align: center; border: 1px solid var(--hairline-strong); border-radius: 4px; color: var(--text-muted); background: var(--bg-subtle); pointer-events: none; }
.search-results {
  position: absolute; z-index: 40; top: 46px; left: 0; right: 0;
  max-height: 60vh; overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 12px; box-shadow: var(--shadow);
}
.search-results li a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.search-results li a .sr-title { display: flex; gap: 8px; align-items: baseline; font-weight: 600; font-size: 14.5px; }
.search-results li a .sr-section { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results li[aria-selected="true"] a, .search-results li a:hover { background: var(--accent-soft); }
.search-results .sr-empty { padding: 10px; color: var(--text-muted); font-size: 14px; }

/* ---------- typography ---------- */
.page-header { margin-bottom: 8px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-text); }
h1, h2, h3, h4 { color: var(--text); line-height: 1.25; letter-spacing: -0.015em; scroll-margin-top: calc(var(--topbar-h) + 16px); }
h1 { font-size: 2.25rem; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; font-weight: 680; margin: 48px 0 12px; }
h3 { font-size: 1.15rem; font-weight: 650; margin: 32px 0 8px; }
h4 { font-size: 1rem; font-weight: 650; margin: 24px 0 8px; }
h2 code, h3 code { font-size: 0.85em; }
.anchor { margin-left: 0.4em; color: var(--text-muted); text-decoration: none; font-weight: 400; opacity: 0; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
p, ul, ol { margin: 0 0 16px; }
ul, ol { padding-left: 1.4em; }
li { margin: 6px 0; }
li > p { margin: 0 0 8px; }
.lead { font-size: 1.175rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 24px; }
blockquote.note { margin: 24px 0; padding: 14px 18px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }
blockquote.note p:last-child { margin-bottom: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 20px 0 24px; border: 1px solid var(--hairline); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--hairline); }
thead th { background: var(--bg-subtle); font-weight: 650; font-size: 13.5px; color: var(--text-muted); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 600; }
td code, th code { white-space: nowrap; }
td:last-child code { white-space: normal; }

/* ---------- code blocks ---------- */
.codeblock { margin: 20px 0 24px; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 12px; overflow: hidden; color: var(--code-text); }
.codeblock-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 16px; background: var(--code-head); border-bottom: 1px solid rgba(255, 255, 255, 0.07); min-height: 40px; }
.codeblock-title { font: 600 12.5px/1.4 var(--font-sans); color: #CFCAC5; letter-spacing: 0.01em; }
.copy-btn { font: 600 12px/1 var(--font-sans); color: #F2EFEB; background: transparent; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 8px; padding: 6px 12px; cursor: pointer; min-height: 28px; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.08); }
.copy-btn:focus-visible { outline: 2px solid #FFC94D; outline-offset: 2px; }
.copy-btn[data-copied] { color: #A8D8B0; border-color: rgba(168, 216, 176, 0.5); }
html:not(.js) .copy-btn { display: none; }
.codeblock pre { margin: 0; padding: 16px; overflow: auto; font-size: 13.5px; line-height: 1.6; tab-size: 2; max-height: 640px; }
.codeblock pre:focus-visible { outline: 2px solid #FFC94D; outline-offset: -2px; border-radius: 0 0 12px 12px; }
.codeblock code { background: none; padding: 0; color: inherit; font-size: inherit; border-radius: 0; overflow-wrap: normal; white-space: pre; }
.codeblock-compact pre { font-size: 13px; max-height: 360px; }
.t-key { color: #FFD27A; }
.t-str { color: #A8D8B0; }
.t-num, .t-lit { color: #F4A57A; }
.t-pun { color: #ADA7A2; }
.t-com { color: #A39D98; font-style: italic; }
.t-var { color: #95D5E2; }
.t-flag { color: #F0C987; }
.t-kw { color: #FFB71B; }
.t-dec { color: #95D5E2; }
.t-fn { color: #FFE3A3; }

/* ---------- method + status badges ---------- */
.method { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 60px; padding: 2px 8px; border-radius: 999px; font: 700 12px/1.5 var(--font-mono); letter-spacing: 0.03em; }
.method-get { background: var(--get-bg); color: var(--get-fg); }
.method-post { background: var(--post-bg); color: var(--post-fg); }
.method-patch, .method-put { background: var(--patch-bg); color: var(--patch-fg); }
.method-delete { background: var(--delete-bg); color: var(--delete-fg); }
.method-sm { min-width: 50px; font-size: 10.5px; padding: 0 6px; }
.status { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; padding: 2px 8px; border-radius: 999px; font: 700 12.5px/1.5 var(--font-mono); }
.status-ok { background: var(--ok-bg); color: var(--ok-fg); }
.status-err { background: var(--err-bg); color: var(--err-fg); }
.status-warn { background: var(--post-bg); color: var(--post-fg); }

/* ---------- endpoint lists ---------- */
.endpoint-list { list-style: none; padding: 0; margin: 12px 0 24px; border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; }
.endpoint-list li { margin: 0; border-bottom: 1px solid var(--hairline); }
.endpoint-list li:last-child { border-bottom: 0; }
.endpoint-list a { display: grid; grid-template-columns: 72px minmax(0, max-content) minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px 14px; text-decoration: none; color: var(--text); }
.endpoint-list a:hover { background: var(--bg-subtle); }
.ep-path { background: none; padding: 0; font-size: 14px; overflow-wrap: anywhere; }
.ep-summary { color: var(--text-muted); font-size: 14.5px; }
.code-link { text-decoration: none; }
.code-link code { box-shadow: inset 0 -1px 0 var(--link-underline); }
.code-link:hover code { box-shadow: inset 0 -2px 0 var(--accent); }
.type-link { font-family: var(--font-mono); }
.ref-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.ref-link { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 12px; border: 1px solid var(--hairline-strong); border-radius: 999px; font-size: 13px; text-decoration: none; color: var(--text); }
.ref-link:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.ref-link-label { font-weight: 600; }
.ref-link-label::after { content: " \2192"; color: var(--accent-text); }
.ref-link code { background: none; padding: 0; font-size: 12.5px; }

/* ---------- reference operations ---------- */
.op { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; padding: 48px 0; border-top: 1px solid var(--hairline); }
.op h2 { margin-top: 0; }
.op-endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.op-path { font-size: 15px; background: none; padding: 0; color: var(--text); overflow-wrap: anywhere; }
.op-scope { font-size: 14.5px; color: var(--text-muted); margin: 0 0 16px; }
.op-desc { margin-bottom: 8px; }
.op-desc p { margin-bottom: 12px; }
.op h3 { font-size: 1rem; text-transform: none; margin: 28px 0 6px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
.op-code-inner { position: sticky; top: calc(var(--topbar-h) + 24px); }
.op-code .codeblock { margin: 0 0 16px; }
.op-code .codeblock pre { max-height: calc(50vh - 60px); min-height: 0; }
.content-type, .schema-ref { font-size: 13.5px; color: var(--text-muted); margin: 8px 0; }
.endpoint-summary { margin-bottom: 8px; }

.fields { list-style: none; padding: 0; margin: 0 0 8px; }
.field { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.fields .fields .field:last-child { border-bottom: 0; }
.field-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.field-name { background: none; padding: 0; font-size: 14px; font-weight: 700; color: var(--text); }
.field-type { font: 13px var(--font-mono); color: var(--text-muted); }
.badge-req { font-size: 12px; font-weight: 650; color: var(--req); }
.badge-opt { font-size: 12px; color: var(--text-muted); }
.field-desc { font-size: 15px; margin-top: 4px; }
.field-desc p { margin: 0 0 6px; }
.field-desc p:last-child { margin-bottom: 0; }
.field-meta { font-size: 13.5px; color: var(--text-muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.field-meta-label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-right: 2px; }
.field-children { margin-top: 10px; }
.field-children > summary, .schema-example > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 600; color: var(--text); padding: 4px 12px; border: 1px solid var(--hairline-strong); border-radius: 999px;
}
.field-children > summary::-webkit-details-marker, .schema-example > summary::-webkit-details-marker, .response > summary::-webkit-details-marker { display: none; }
.field-children > summary::before, .schema-example > summary::before, .response > summary::before { content: "+"; font-family: var(--font-mono); font-weight: 700; color: var(--text-muted); }
.field-children[open] > summary::before, .schema-example[open] > summary::before, .response[open] > summary::before { content: "\2212"; }
.field-children > .fields { margin: 8px 0 0 2px; padding-left: 16px; border-left: 2px solid var(--surface-2); }

.response { border: 1px solid var(--hairline); border-radius: 12px; margin: 8px 0; }
.response > summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
.response-desc { font-size: 15px; }
.response-body { padding: 0 14px 6px; border-top: 1px solid var(--hairline); }
.response-body > .fields > .field:last-child { border-bottom: 0; }
.response .codeblock { margin: 12px 0; }

.schema { padding: 24px 0 16px; border-top: 1px solid var(--hairline); }
.schema h2 { margin-top: 8px; font-size: 1.3rem; }
.schema h2 code { font-size: 0.95em; background: none; padding: 0; }
.schema-example { margin: 12px 0; }
.used-by { margin: 12px 0; font-size: 14px; }
.used-by ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.used-by li { margin: 0; }
.used-by a { display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
.used-by code { background: none; padding: 0; }

/* ---------- home ---------- */
.hero { padding: 16px 0 16px; }
.hero h1 { font-size: 2.6rem; }
.hero .lead { font-size: 1.25rem; max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 600; font-size: 15.5px; text-decoration: none; }
.btn-primary { background: #FFB71B; color: #231F20; }
.btn-primary:hover { background: #F5AA05; color: #231F20; }
.btn-secondary { border: 1px solid #8A8784; color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 16px 0 24px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; border: 1px solid var(--hairline); border-radius: 12px; text-decoration: none; color: var(--text); background: var(--bg); }
.card:hover { border-color: var(--accent); color: var(--text); background: var(--bg-subtle); }
.card-title { font-weight: 650; font-size: 16px; }
.card-title::after { content: " \2192"; color: var(--accent-text); }
.card-text { color: var(--text-muted); font-size: 14.5px; line-height: 1.5; }
.steps li { margin: 8px 0; }
.example-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.example-pair .codeblock { margin-top: 8px; }

.download-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.download-list li { margin: 0; }
.download { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--hairline); border-radius: 12px; text-decoration: none; color: var(--text); }
.download:hover { border-color: var(--accent); color: var(--text); background: var(--bg-subtle); }
.download-title { font-weight: 650; }
.download-meta { font-size: 14px; color: var(--text-muted); }

/* ---------- pager + footer ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 56px 0 0; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--hairline); border-radius: 12px; text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--accent); background: var(--bg-subtle); color: var(--text); }
.pager-next { text-align: right; grid-column: 2; }
.pager-label { font-size: 13px; color: var(--text-muted); }
.pager-title { font-weight: 650; }
.footer { max-width: 760px; margin: 64px auto 0; padding: 24px 0 40px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--text-muted); }
.layout-reference .footer { max-width: 1240px; }
.layout-home .footer { max-width: 880px; }
.footer p { margin: 0 0 6px; }

/* ---------- on this page ---------- */
.toc { position: relative; }
.toc-inner { position: sticky; top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 40px 24px 40px 8px; }
.toc-heading { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 650; color: var(--text-muted); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--hairline); }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.45; color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc a.is-current { color: var(--text); font-weight: 600; border-left-color: var(--accent); }
.toc .toc-l3 a { padding-left: 26px; }
.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 40px 40px 0; }
}
@media (max-width: 1100px) {
  .op { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 40px 0; }
  .op-code-inner { position: static; }
  .op-code .codeblock pre { max-height: 480px; }
}
@media (max-width: 960px) {
  .shell, .layout-reference .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-toggle {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 10px; margin-left: -8px;
    border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14.5px;
  }
  .menu-toggle:hover { background: var(--surface-2); color: var(--text); }
  .menu-icon { position: relative; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
  .menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
  .menu-icon::before { top: -6px; }
  .menu-icon::after { top: 6px; }
  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; height: 100%;
    width: min(320px, 86vw);
    transform: translateX(-102%); visibility: hidden;
    transition: transform 250ms cubic-bezier(.2, 0, 0, 1), visibility 0s linear 250ms;
    box-shadow: var(--shadow);
  }
  .sidebar:target, body.nav-open .sidebar { transform: none; visibility: visible; transition: transform 250ms cubic-bezier(.05, .7, .1, 1); }
  .sidebar-close { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: center; height: 40px; margin: -20px -16px 12px; padding: 0 16px; background: var(--bg-subtle); border-bottom: 1px solid var(--hairline); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
  .sidebar-close::before { content: "\00D7"; font-size: 20px; line-height: 1; margin-right: 8px; color: var(--text-muted); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: var(--scrim); }
  body.nav-open { overflow: hidden; }
}
@media (max-width: 760px) {
  .topnav { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .main { padding: 28px 16px 0; }
  h1 { font-size: 1.9rem; }
  .hero h1 { font-size: 2.1rem; }
  h2 { font-size: 1.3rem; margin-top: 40px; }
  .example-pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .endpoint-list a { grid-template-columns: 64px minmax(0, 1fr); gap: 4px 12px; }
  .ep-summary { grid-column: 2; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: 1; }
  th, td { padding: 9px 12px; }
  td code, th code { white-space: normal; }
  table { font-size: 14.5px; }
  .codeblock pre { font-size: 12.5px; padding: 14px; }
}
@media (max-width: 400px) {
  .brand-label { font-size: 14px; }
  .brand { gap: 10px; }
  .menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .menu-toggle { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .copy-btn, .scrim { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .codeblock { border: 1px solid #ccc; }
}
