/* GP Code developer docs. Tokens follow gpcode-frontend/src/styles/tokens.css. */
:root {
    --bg: #f6f9fd; --surface: #ffffff; --line: #d9e3f0; --fg: #111827; --muted: #5b6779;
    --accent: #1f78c8; --accent-ink: #ffffff; --soft: #eef6ff; --ok: #1d8a52; --warn: #b4630f; --bad: #c0392b;
    --code-bg: #0f1724; --code-fg: #e6edf6; --code-line: #24324a; --code-muted: #8c9bb3;
    --display: "Red Hat Display", ui-sans-serif, system-ui, sans-serif;
    --mono: "Red Hat Mono", ui-monospace, Menlo, monospace;
    --header-h: 60px; --side-w: 272px; --toc-w: 220px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #111827; --surface: #1a2333; --line: #2b3648; --fg: #f3f7fc; --muted: #9aa8bd;
        --accent: #7cc5ff; --accent-ink: #0b1424; --soft: #16233a; --ok: #6fdc9e; --warn: #ffb86b; --bad: #ff8a80;
        --code-bg: #0b1220; --code-line: #22304a;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #111827; --surface: #1a2333; --line: #2b3648; --fg: #f3f7fc; --muted: #9aa8bd;
    --accent: #7cc5ff; --accent-ink: #0b1424; --soft: #16233a; --ok: #6fdc9e; --warn: #ffb86b; --bad: #ff8a80;
    --code-bg: #0b1220; --code-line: #22304a;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.65 var(--display); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 16px;
    padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 900; letter-spacing: -.01em; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: var(--muted); font-size: .9rem; }
.top nav.main { display: flex; gap: 4px; margin-left: 12px; }
.top nav.main a { color: var(--muted); text-decoration: none; font-weight: 700; font-size: .93rem; padding: 6px 10px; border-radius: 8px; }
.top nav.main a:hover, .top nav.main a.on { color: var(--fg); background: var(--soft); }
.top .spacer { flex: 1; }
.search { position: relative; width: min(320px, 34vw); }
.search input { width: 100%; font: 500 .93rem var(--display); color: var(--fg); background: var(--surface); border: 1px solid var(--line);
    border-radius: 10px; padding: 8px 12px 8px 34px; }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 8px; top: 50%; translate: 0 -50%; font: 700 .72rem var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.18); padding: 6px; max-height: 60vh; overflow: auto; min-width: 280px; }
.search-results a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.search-results a small { display: block; color: var(--muted); font-size: .8rem; }
.search-results a.sel, .search-results a:hover { background: var(--soft); }
.search-results .empty { padding: 10px; color: var(--muted); font-size: .9rem; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
    background: var(--surface); color: var(--fg); cursor: pointer; }
.iconbtn svg { width: 18px; height: 18px; }
.menubtn { display: none; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); max-width: 1480px; margin: 0 auto; }
.side { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow: auto; padding: 22px 14px 40px 20px; border-right: 1px solid var(--line); }
.side h4 { margin: 18px 0 6px 10px; font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.side h4:first-child { margin-top: 0; }
.side a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; font-size: .94rem; }
.side a:hover { background: var(--soft); }
.side a.on { background: var(--soft); color: var(--accent); font-weight: 700; }
.side .sub a { padding-left: 22px; font-size: .88rem; color: var(--muted); }
.side .sub a:hover { color: var(--fg); }
.side .sub a.on { color: var(--accent); background: none; }
.side .ver { margin: 0 0 16px 10px; display: inline-flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); }

.page { display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); gap: 40px; padding: 36px 40px 80px; }
.page.wide { grid-template-columns: minmax(0, 1fr); }
.doc { min-width: 0; max-width: 820px; }
.page.wide .doc { max-width: 1120px; }
.toc { position: sticky; top: calc(var(--header-h) + 28px); align-self: start; max-height: calc(100vh - var(--header-h) - 56px); overflow: auto; font-size: .86rem; }
.toc h5 { margin: 0 0 8px; font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0 3px 12px; border-left: 2px solid var(--line); }
.toc a.h3 { padding-left: 24px; }
.toc a:hover { color: var(--fg); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }

/* ---------- Content ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.doc h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; font-weight: 900; }
.doc .lead { font-size: 1.13rem; color: var(--muted); margin: 0 0 28px; max-width: 70ch; }
.doc h2 { font-size: 1.5rem; letter-spacing: -.01em; margin: 48px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); padding-top: 28px; }
.doc h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 32px; }
.doc h3 { font-size: 1.15rem; margin: 30px 0 8px; }
.doc h2, .doc h3 { position: relative; }
.doc .anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 500; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus { opacity: 1; }
.doc p, .doc li { max-width: 74ch; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li + li { margin-top: 4px; }
.doc code { font: 500 .88em var(--mono); background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: .08em .35em; word-break: break-word; }
.doc strong { font-weight: 700; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--soft); border-radius: 10px; padding: 12px 16px; margin: 18px 0; }
.callout p { margin: 0; }
.callout p + p { margin-top: 6px; }
.callout.warn { border-left-color: var(--warn); }
.callout.ok { border-left-color: var(--ok); }
.callout .t { font-weight: 700; display: block; margin-bottom: 2px; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 14px 0 22px; }
.tablewrap { overflow-x: auto; margin: 14px 0 22px; border: 1px solid var(--line); border-radius: 12px; }
.tablewrap table { margin: 0; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--soft); white-space: nowrap; }
td code { white-space: nowrap; }
td.desc code { white-space: normal; }

/* Parameter lists */
.params { margin: 10px 0 24px; border-top: 1px solid var(--line); }
.param { padding: 12px 0; border-bottom: 1px solid var(--line); }
.param .name { font: 700 .92rem var(--mono); }
.param .type { font-size: .8rem; color: var(--muted); margin-left: 8px; }
.param .req { font-size: .72rem; font-weight: 700; color: var(--warn); margin-left: 8px; text-transform: uppercase; letter-spacing: .05em; }
.param p { margin: 4px 0 0; font-size: .93rem; color: var(--fg); }
.param .children { margin: 8px 0 0 14px; padding-left: 14px; border-left: 2px solid var(--line); }
.param .children .param:last-child { border-bottom: 0; }

/* Method badges */
.m { display: inline-block; font: 700 .72rem var(--mono); letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; color: #fff; vertical-align: 2px; min-width: 52px; text-align: center; }
.m.get { background: #1d8a52; } .m.post { background: #1f78c8; } .m.patch { background: #b4630f; } .m.delete { background: #c0392b; }
.side .m { min-width: 44px; font-size: .64rem; padding: 1px 5px; }
.route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font: 700 .95rem var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0 18px; }
.route .path { word-break: break-all; }
.scope { font: 700 .74rem var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; margin-left: auto; white-space: nowrap; }

/* Endpoint sections: text left, code right (like the WooCommerce REST API docs). */
.endpoint { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.endpoint .ep-code { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.endpoint .ep-text > :first-child { margin-top: 0; }

/* ---------- Code ---------- */
pre { margin: 0; overflow: auto; font: 500 .84rem/1.6 var(--mono); color: var(--code-fg); background: var(--code-bg); padding: 14px 16px; tab-size: 2; }
.doc pre code, pre code { font: inherit; background: none; border: 0; border-radius: 0; padding: 0; color: inherit; word-break: normal; white-space: pre; }
.code { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--code-line); background: var(--code-bg); margin: 14px 0 20px; }
.ep-code .code { margin: 0; }
.code .bar { display: flex; align-items: center; gap: 2px; padding: 0 6px 0 10px; border-bottom: 1px solid var(--code-line); min-height: 40px; background: color-mix(in srgb, var(--code-bg) 80%, #24324a); }
.code .bar .label { font: 700 .76rem var(--mono); color: var(--code-muted); margin-right: auto; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code .tab { font: 700 .76rem var(--display); color: var(--code-muted); background: none; border: 0; padding: 10px 9px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.code .tab:hover { color: var(--code-fg); }
.code .tab[aria-selected="true"] { color: #7cc5ff; border-bottom-color: #7cc5ff; }
.code .tabs { display: flex; margin-right: auto; overflow-x: auto; }
.code .copy { font: 700 .74rem var(--display); color: var(--code-muted); background: none; border: 1px solid var(--code-line); border-radius: 7px; padding: 4px 9px; cursor: pointer; margin-left: 8px; }
.code .copy:hover { color: var(--code-fg); }
.code pre { max-height: 560px; }

/* Token colours (Prism classes), tuned for the dark code surface. */
.token.comment, .token.prolog { color: #7d8ba3; font-style: italic; }
.token.string, .token.attr-value, .token.char { color: #a5e3a0; }
.token.number, .token.boolean, .token.constant { color: #ffb86b; }
.token.keyword, .token.important { color: #c7a2ff; }
.token.function, .token.class-name { color: #7cc5ff; }
.token.property, .token.attr-name, .token.key { color: #8fd3ff; }
.token.operator, .token.punctuation { color: #b9c4d6; }
.token.variable, .token.parameter { color: #ffd479; }
.token.null, .token.nil { color: #ff9e9e; }

/* ---------- Home ---------- */
.hero { padding: 6px 0 8px; }
.hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; font: 700 .78rem var(--mono); color: var(--accent); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 22px 0 8px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; color: var(--fg); text-decoration: none; transition: border-color .15s, translate .15s; }
.card:hover { border-color: var(--accent); translate: 0 -2px; }
.card .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--soft); color: var(--accent); margin-bottom: 10px; }
.card .ic svg { width: 18px; height: 18px; }
.card b { display: block; margin-bottom: 4px; }
.card span { color: var(--muted); font-size: .92rem; line-height: 1.5; display: block; }
.endpoints-list { margin: 10px 0 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.endpoints-list a { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; background: var(--surface); }
.endpoints-list a:last-child { border-bottom: 0; }
.endpoints-list a:hover { background: var(--soft); }
.endpoints-list .p { font: 700 .88rem var(--mono); word-break: break-all; }
.endpoints-list .d { color: var(--muted); font-size: .88rem; text-align: right; }

.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps > li { counter-increment: s; position: relative; padding-left: 44px; margin: 0 0 22px; max-width: none; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .9rem; background: var(--accent); color: var(--accent-ink); }
.steps > li > h3:first-child { margin: 0 0 4px; font-size: 1.12rem; line-height: 30px; }

.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; text-decoration: none; color: var(--fg); background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager a small { display: block; color: var(--muted); font-size: .8rem; }
.pager a.next { text-align: right; }

.foot { border-top: 1px solid var(--line); padding: 22px 40px 40px; color: var(--muted); font-size: .86rem; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.foot a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
    .page { grid-template-columns: minmax(0, 1fr); padding: 32px 32px 72px; }
    .toc { display: none; }
}
@media (max-width: 1100px) {
    .endpoint { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .endpoint .ep-code { position: static; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { position: fixed; z-index: 40; top: var(--header-h); left: 0; width: min(320px, 86vw); background: var(--bg); translate: -100% 0; transition: translate .2s; visibility: hidden; }
    body.nav-open .side { translate: 0 0; visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.25); }
    .scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(5, 9, 18, .5); z-index: 35; }
    .menubtn { display: inline-grid; }
    .top nav.main { display: none; }
    .page { padding: 24px 16px 64px; }
    .foot { padding: 20px 16px 36px; }
    .top { padding: 0 12px; gap: 10px; }
    .search { width: auto; flex: 1; }
    .search kbd { display: none; }
    .brand small { display: none; }
    .endpoints-list a { grid-template-columns: 62px minmax(0, 1fr); }
    .endpoints-list .d { display: none; }
}
@media (max-width: 480px) {
    .brand span { display: none; }
    .pager { flex-direction: column; }
}
