/* =========================================================================
   developers.css — standalone stylesheet for the /developers portal.
   Deliberately independent of app.css / components.css: this is a
   documentation site, not a marketing page. Dark theme by default via
   html[data-theme="dark"] (set before first paint by the inline script in
   developers.php, toggled by assets/js/developers.js); :root holds the
   light theme.
   ========================================================================= */

:root {
    --d-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --d-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --d-bg: #ffffff;
    --d-bg-subtle: #f6f8fa;
    --d-bg-raised: #ffffff;
    --d-border: #e4e7ec;
    --d-border-strong: #d0d5dd;
    --d-text: #101828;
    --d-text-2: #475467;
    --d-text-3: #667085;
    --d-accent: #16a34a;
    --d-accent-text: #15803d;
    --d-accent-soft: rgba(22, 163, 74, 0.10);
    --d-link: #0b63ce;
    --d-code-bg: #0f172a;
    --d-code-text: #e2e8f0;
    --d-code-bar: #1e293b;
    --d-code-border: #1e293b;
    --d-inline-code-bg: #f1f3f5;
    --d-inline-code-text: #b42318;
    --d-get: #0b63ce;
    --d-post: #15803d;
    --d-info-bg: #eff6ff;
    --d-info-border: #bfdbfe;
    --d-info-text: #1e3a8a;
    --d-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
    --d-radius: 8px;
    --d-topbar-h: 60px;
    --d-sidebar-w: 268px;
    --d-toc-w: 220px;
    --d-content-w: 780px;

    /* token colors inside code blocks (always on the dark code background) */
    --tok-str: #86efac;
    --tok-num: #fbbf24;
    --tok-kw: #93c5fd;
    --tok-cmt: #94a3b8;
    --tok-flag: #67e8f9;
    --tok-var: #f9a8d4;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --d-bg: #0b0f17;
    --d-bg-subtle: #111722;
    --d-bg-raised: #131a26;
    --d-border: #1f2937;
    --d-border-strong: #2b3646;
    --d-text: #f3f4f6;
    --d-text-2: #c3cad6;
    --d-text-3: #8b95a7;
    --d-accent: #22c55e;
    --d-accent-text: #4ade80;
    --d-accent-soft: rgba(34, 197, 94, 0.14);
    --d-link: #7ab8ff;
    --d-code-bg: #0a0e15;
    --d-code-text: #e2e8f0;
    --d-code-bar: #111722;
    --d-code-border: #1f2937;
    --d-inline-code-bg: #1a2230;
    --d-inline-code-text: #fda4af;
    --d-get: #7ab8ff;
    --d-post: #4ade80;
    --d-info-bg: #0f1d33;
    --d-info-border: #1e3a5f;
    --d-info-text: #bfdbfe;
    --d-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--d-topbar-h) + 16px); }
body {
    margin: 0;
    font-family: var(--d-font);
    font-size: 15px;
    line-height: 1.65;
    color: var(--d-text);
    background: var(--d-bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}
a { color: var(--d-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--d-accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; font-size: 20px; vertical-align: middle; line-height: 1; }

/* ---- Staging strip (shared partial markup, restyled here) ---- */
.site-notice--staging {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 6px 16px; font-size: 13px;
    background: #fef3c7; color: #78350f; border-bottom: 1px solid #fcd34d;
}
html[data-theme="dark"] .site-notice--staging { background: #3a2a06; color: #fde68a; border-color: #92400e; }

/* ---- Top bar ---- */
.docs-topbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--d-topbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--d-bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--d-border);
}
.docs-topbar__brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--d-text); font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
    white-space: nowrap;
}
.docs-topbar__brand:hover { text-decoration: none; }
.docs-topbar__brand img { height: 26px; width: auto; max-width: 140px; }
.docs-topbar__mark {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--d-accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.docs-topbar__mark .material-symbols-rounded { font-size: 18px; }
.docs-topbar__sep { color: var(--d-text-3); font-weight: 400; margin: 0 2px; }
.docs-topbar__suffix { color: var(--d-text-2); font-weight: 500; }
.docs-topbar__nav { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
.docs-topbar__nav a {
    padding: 6px 10px; border-radius: 6px;
    color: var(--d-text-2); font-size: 14px; font-weight: 500;
}
.docs-topbar__nav a:hover { background: var(--d-bg-subtle); color: var(--d-text); text-decoration: none; }
.docs-topbar__nav a.is-active { color: var(--d-text); background: var(--d-bg-subtle); }
.docs-topbar__spacer { flex: 1; }
.docs-topbar__actions { display: flex; align-items: center; gap: 8px; }
.docs-iconbtn {
    width: 36px; height: 36px; border-radius: 8px;
    border: 1px solid var(--d-border); background: var(--d-bg-raised); color: var(--d-text-2);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.docs-iconbtn:hover { color: var(--d-text); border-color: var(--d-border-strong); }
.docs-iconbtn .icon-sun, .docs-iconbtn .icon-moon { display: none; }
html[data-theme="dark"] .docs-iconbtn .icon-sun { display: inline; }
html:not([data-theme="dark"]) .docs-iconbtn .icon-moon { display: inline; }
.docs-menubtn { display: none; }

/* ---- Buttons ---- */
.docs-btn {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px; padding: 0 14px; border-radius: 8px;
    font-size: 14px; font-weight: 500; line-height: 1;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.docs-btn:hover { text-decoration: none; }
.docs-btn--primary { background: var(--d-accent); color: #fff; }
.docs-btn--primary:hover { background: color-mix(in srgb, var(--d-accent) 85%, black); color: #fff; }
.docs-btn--secondary { background: var(--d-bg-raised); color: var(--d-text); border-color: var(--d-border-strong); }
.docs-btn--secondary:hover { background: var(--d-bg-subtle); }
.docs-btn--ghost { background: transparent; color: var(--d-text-2); }
.docs-btn--ghost:hover { background: var(--d-bg-subtle); color: var(--d-text); }

/* ---- Layout ---- */
.docs-shell {
    display: grid;
    grid-template-columns: var(--d-sidebar-w) minmax(0, 1fr) var(--d-toc-w);
    gap: 0;
    max-width: 1440px;
    margin: 0 auto;
}

.docs-sidebar {
    position: sticky; top: var(--d-topbar-h);
    height: calc(100vh - var(--d-topbar-h));
    overflow-y: auto; scrollbar-width: thin;
    padding: 24px 16px 40px 24px;
    border-right: 1px solid var(--d-border);
    background: var(--d-bg);
}
.docs-sidebar__group { margin-bottom: 22px; }
.docs-sidebar__heading {
    font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--d-text-3); margin: 0 0 6px; padding: 0 10px;
}
.docs-sidebar a {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 6px;
    color: var(--d-text-2); font-size: 14px; line-height: 1.4;
}
.docs-sidebar a:hover { background: var(--d-bg-subtle); color: var(--d-text); text-decoration: none; }
.docs-sidebar a.is-active { background: var(--d-accent-soft); color: var(--d-accent-text); font-weight: 600; }
.docs-sidebar a .material-symbols-rounded { font-size: 18px; color: var(--d-text-3); }
.docs-sidebar a.is-active .material-symbols-rounded { color: var(--d-accent-text); }
.docs-sidebar__sub { margin: 2px 0 6px; border-left: 1px solid var(--d-border); margin-left: 19px; padding-left: 6px; }
.docs-sidebar__sub a { padding: 4px 10px; font-size: 13px; color: var(--d-text-3); }
.docs-sidebar__sub a:hover { color: var(--d-text); }

.docs-main {
    min-width: 0;
    padding: 40px 48px 96px;
}
.docs-content { max-width: var(--d-content-w); }

.docs-toc {
    position: sticky; top: var(--d-topbar-h);
    height: calc(100vh - var(--d-topbar-h));
    overflow-y: auto; scrollbar-width: thin;
    padding: 40px 24px 40px 0;
    font-size: 13px;
}
.docs-toc__heading { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--d-text-3); margin: 0 0 8px; }
.docs-toc a {
    display: block; padding: 4px 0 4px 12px;
    border-left: 2px solid var(--d-border);
    color: var(--d-text-3); line-height: 1.4;
}
.docs-toc a:hover { color: var(--d-text); text-decoration: none; }
.docs-toc a.is-active { color: var(--d-accent-text); border-left-color: var(--d-accent); font-weight: 500; }

/* ---- Page header & typography ---- */
.docs-page-header { margin: 0 0 32px; padding-bottom: 24px; border-bottom: 1px solid var(--d-border); }
.docs-eyebrow {
    display: inline-block; margin-bottom: 10px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--d-accent-text);
}
.docs-page-header h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.docs-content h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 12px; }
.docs-content h2 {
    font-size: 24px; line-height: 1.3; letter-spacing: -0.015em; font-weight: 650;
    margin: 56px 0 14px; padding-top: 20px; border-top: 1px solid var(--d-border);
    scroll-margin-top: calc(var(--d-topbar-h) + 16px);
}
.docs-content h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.docs-content h3 { font-size: 18px; line-height: 1.35; font-weight: 600; margin: 36px 0 10px; scroll-margin-top: calc(var(--d-topbar-h) + 16px); }
.docs-content h4 { font-size: 15px; font-weight: 600; margin: 24px 0 8px; color: var(--d-text); }
.docs-content p { margin: 0 0 14px; color: var(--d-text-2); }
.docs-content li { color: var(--d-text-2); margin-bottom: 6px; }
.docs-content ul, .docs-content ol { padding-left: 24px; margin: 0 0 16px; }
.docs-content strong { color: var(--d-text); font-weight: 600; }
.docs-lead { font-size: 17px; line-height: 1.6; color: var(--d-text-2); margin: 0; }
.docs-content code:not(pre code) {
    font-family: var(--d-mono); font-size: 0.86em;
    background: var(--d-inline-code-bg); color: var(--d-inline-code-text);
    border-radius: 5px; padding: 2px 6px; word-break: break-word;
}
.docs-content h1 code, .docs-content h2 code, .docs-content h3 code { color: inherit; background: var(--d-bg-subtle); }

/* ---- Badges ---- */
.docs-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
    border-radius: 999px; padding: 3px 10px; border: 1px solid transparent; vertical-align: middle;
}
.docs-badge .material-symbols-rounded { font-size: 14px; }
.docs-badge--recommended { color: var(--d-accent-text); background: var(--d-accent-soft); border-color: color-mix(in srgb, var(--d-accent) 35%, transparent); }
.docs-badge--supported { color: var(--d-info-text); background: var(--d-info-bg); border-color: var(--d-info-border); }

/* ---- Version cards ---- */
.docs-version-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 24px 0; }
.docs-version-card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 24px; border: 1px solid var(--d-border); border-radius: 12px;
    background: var(--d-bg-raised); box-shadow: var(--d-shadow);
}
.docs-version-card h2 { margin: 0; border: 0; padding: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.docs-version-card p { margin: 0; }
.docs-version-card ul { margin: 0; padding-left: 20px; }
.docs-version-card li { font-size: 14px; }
.docs-version-card__actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 8px; }

/* ---- Callouts & notes ---- */
.docs-callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; margin: 20px 0; border-radius: 10px;
    border: 1px solid var(--d-info-border); background: var(--d-info-bg); color: var(--d-info-text);
    font-size: 14px; line-height: 1.55;
}
.docs-callout .material-symbols-rounded { flex: none; margin-top: 1px; }
.docs-callout a { color: inherit; text-decoration: underline; }
.docs-note {
    border-left: 3px solid var(--d-accent); background: var(--d-bg-subtle);
    padding: 12px 16px; margin: 20px 0; border-radius: 0 8px 8px 0; font-size: 14px;
}
.docs-note p:last-child { margin-bottom: 0; }

/* ---- Endpoint headings ---- */
.docs-endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.docs-endpoint code { font-family: var(--d-mono); font-size: 16px; font-weight: 500; background: transparent !important; padding: 0 !important; color: var(--d-text) !important; }
.docs-method {
    font-family: var(--d-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    border-radius: 5px; padding: 3px 8px; color: #fff;
}
.docs-method--get { background: var(--d-get); }
.docs-method--post { background: var(--d-post); }
.docs-anchor { color: var(--d-text-3); font-weight: 400; opacity: 0; font-size: 16px; }
.docs-endpoint:hover .docs-anchor, .docs-anchor:focus-visible { opacity: 1; text-decoration: none; }

/* ---- Code blocks (always dark) ---- */
.docs-code {
    margin: 16px 0; border-radius: 10px; overflow: hidden;
    background: var(--d-code-bg); border: 1px solid var(--d-code-border);
    color-scheme: dark;
}
.docs-code__bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px 6px 14px; background: var(--d-code-bar);
    font-size: 12px; font-weight: 500; color: #94a3b8; letter-spacing: 0.02em;
}
.docs-code__copy {
    border: 1px solid transparent; background: transparent; color: #cbd5e1;
    font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.docs-code__copy:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.docs-code__copy.is-copied { color: #86efac; }
.docs-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; tab-size: 4; }
.docs-code code { font-family: var(--d-mono); color: var(--d-code-text); background: transparent; padding: 0; }
.tok-str, .tok-str2 { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-kw { color: var(--tok-kw); }
.tok-cmt { color: var(--tok-cmt); font-style: italic; }
.tok-flag { color: var(--tok-flag); }
.tok-var { color: var(--tok-var); }

/* ---- Tabs (CSS only) ---- */
.docs-tabs { display: flex; flex-wrap: wrap; margin: 16px 0; }
.docs-tabs__radio { position: absolute; opacity: 0; pointer-events: none; }
.docs-tabs__label {
    cursor: pointer; padding: 7px 14px; margin-right: 2px;
    font-size: 13px; font-weight: 500; color: var(--d-text-3);
    border: 1px solid var(--d-border); border-bottom: 0; border-radius: 8px 8px 0 0;
    background: var(--d-bg-subtle);
}
.docs-tabs__label:hover { color: var(--d-text); }
.docs-tabs__radio:focus-visible + .docs-tabs__label { outline: 2px solid var(--d-accent); outline-offset: 1px; }
.docs-tabs__radio:checked + .docs-tabs__label { color: #e2e8f0; background: var(--d-code-bar); border-color: var(--d-code-border); }
.docs-tabs__panel { display: none; width: 100%; order: 10; }
.docs-tabs__panel .docs-code { margin-top: 0; border-top-left-radius: 0; }
.docs-tabs__radio:nth-of-type(1):checked ~ .docs-tabs__panel--1,
.docs-tabs__radio:nth-of-type(2):checked ~ .docs-tabs__panel--2,
.docs-tabs__radio:nth-of-type(3):checked ~ .docs-tabs__panel--3,
.docs-tabs__radio:nth-of-type(4):checked ~ .docs-tabs__panel--4,
.docs-tabs__radio:nth-of-type(5):checked ~ .docs-tabs__panel--5 { display: block; }

/* ---- Tables ---- */
.docs-table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--d-border); border-radius: 10px; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.docs-table th {
    text-align: left; padding: 10px 14px; background: var(--d-bg-subtle);
    font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--d-text-3);
    border-bottom: 1px solid var(--d-border);
}
.docs-table td { padding: 10px 14px; vertical-align: top; color: var(--d-text-2); border-bottom: 1px solid var(--d-border); line-height: 1.5; }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td:first-child { color: var(--d-text); font-weight: 500; }
.docs-table td:first-child code { white-space: nowrap; }

/* ---- Side-by-side comparisons ---- */
.docs-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.docs-compare__title { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--d-text-3); }
.docs-compare > div > .docs-code { margin-top: 8px; }

/* ---- Footer ---- */
.docs-footer {
    margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--d-border);
    display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between;
    font-size: 13px; color: var(--d-text-3);
}
.docs-footer a { color: var(--d-text-3); }
.docs-footer a:hover { color: var(--d-text); }

/* ---- Responsive ---- */
@media (max-width: 1279px) {
    .docs-shell { grid-template-columns: var(--d-sidebar-w) minmax(0, 1fr); }
    .docs-toc { display: none; }
}

@media (max-width: 959px) {
    .docs-topbar { padding: 0 16px; }
    .docs-topbar__nav { display: none; }
    .docs-menubtn { display: inline-flex; }
    .docs-shell { grid-template-columns: minmax(0, 1fr); }
    .docs-sidebar {
        position: fixed; top: var(--d-topbar-h); left: 0; bottom: 0; z-index: 30;
        width: min(var(--d-sidebar-w), 86vw); height: auto;
        transform: translateX(-104%); transition: transform 180ms ease;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    }
    .docs-sidebar.is-open { transform: none; }
    body.docs-sidebar-open::after {
        content: ""; position: fixed; inset: var(--d-topbar-h) 0 0 0; z-index: 20;
        background: rgba(0, 0, 0, 0.35);
    }
    .docs-main { padding: 28px 20px 72px; }
    .docs-content h1 { font-size: 28px; }
    .docs-content h2 { font-size: 21px; margin-top: 44px; }
    .docs-version-grid, .docs-compare { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
    .docs-main { padding: 24px 16px 64px; }
    .docs-topbar__suffix { display: none; }
    .docs-code pre { font-size: 12.5px; }
}

/* Two uploaded logos (Admin > Settings): the dark-background one on the
   dark theme, the light-mode one on the light theme when it exists. */
.docs-logo--light { display: none; }
html:not([data-theme="dark"]) .docs-topbar__brand:has(.docs-logo--light) .docs-logo--dark { display: none; }
html:not([data-theme="dark"]) .docs-logo--light { display: block; }
