/* ============================================================
   Load Factor Developer Docs (/developers)
   Pages are pre-rendered by scripts/developers/build_docs.py; behaviour lives
   in /static/js/developers.js. The reading experience follows the patterns of
   Apple's developer documentation (navigator, eyebrow + title + abstract,
   Topics, See Also, declarations) in Load Factor's own look: a calm neutral page,
   the system font stack, two weights (400 / 600), and navy, gold and teal only
   where they mean something (links, selection, callouts). The theme follows
   prefers-color-scheme unless the reader picked one (data-theme on <html> is
   set before first paint).
   ============================================================ */

:root,
:root[data-theme="light"] {
    --bg: #ffffff;
    --bg-elev: #f7f8fa;
    --bg-soft: #f1f3f6;
    --bg-hover: #e9ecf0;
    --border: #e1e4e9;
    --border-strong: #c9ced6;
    --text: #15181e;
    --text-2: #474e5a;
    --text-3: #626a77;
    /* Brand: navy for structure (eyebrows, symbol names), gold for selection, teal for links. */
    --navy: #13305e;
    --accent: #f0a500;
    --accent-soft: rgba(240, 165, 0, 0.14);
    --accent-line: rgba(176, 116, 0, 0.5);
    --link: #00706a;
    --link-soft: rgba(0, 112, 106, 0.08);
    --on-accent: #14100a;
    --code-bg: #f6f7f9;
    --code-head: #f1f3f6;
    --code-border: #e1e4e9;
    --code-text: #1f2430;
    --code-muted: #5d6573;
    --tok-comment: #5f6774;
    --tok-keyword: #9b2393;
    --tok-string: #b3261e;
    --tok-number: #1c00cf;
    --tok-name: #0f4c81;
    --tok-func: #00706a;
    --tok-attr: #845400;
    --tok-punct: #4a505c;
    --shadow: 0 18px 50px rgba(15, 23, 32, 0.14);
    --shadow-sm: 0 4px 14px rgba(15, 23, 32, 0.08);
    --note: #13305e;
    --note-bg: rgba(19, 48, 94, 0.05);
    --note-line: rgba(19, 48, 94, 0.28);
    --tip: #00706a;
    --tip-bg: rgba(0, 112, 106, 0.06);
    --tip-line: rgba(0, 112, 106, 0.3);
    --warn: #8f5b00;
    --warn-bg: rgba(240, 165, 0, 0.1);
    --warn-line: rgba(176, 116, 0, 0.45);
    --ok: #00706a;
    --ok-bg: rgba(0, 112, 106, 0.08);
    --topbar-bg: rgba(255, 255, 255, 0.86);
    /* gi_loaders.css colours (the loader art shared with the app) */
    --accent-primary: #00a396;
    --text-dim: #9aa1ad;
    --bg-primary: #ffffff;
    --bg-secondary: #f1f3f6;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #101217;
    --bg-elev: #15181e;
    --bg-soft: #1b1e25;
    --bg-hover: #22262e;
    --border: #272b34;
    --border-strong: #3a404b;
    --text: #eceef2;
    --text-2: #b4bac4;
    --text-3: #8f97a3;
    --navy: #a9c3ee;
    --accent: #f0a500;
    --accent-soft: rgba(240, 165, 0, 0.14);
    --accent-line: rgba(240, 165, 0, 0.5);
    --link: #4fd6c6;
    --link-soft: rgba(79, 214, 198, 0.1);
    --on-accent: #14100a;
    --code-bg: #15181e;
    --code-head: #1b1e25;
    --code-border: #272b34;
    --code-text: #dfe3ea;
    --code-muted: #9aa2ae;
    --tok-comment: #8a93a1;
    --tok-keyword: #fc7fd5;
    --tok-string: #ff8f80;
    --tok-number: #d9c97c;
    --tok-name: #9ccbff;
    --tok-func: #67e8d6;
    --tok-attr: #f5c46b;
    --tok-punct: #b4bac4;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.32);
    --note: #a9c3ee;
    --note-bg: rgba(169, 195, 238, 0.07);
    --note-line: rgba(169, 195, 238, 0.32);
    --tip: #4fd6c6;
    --tip-bg: rgba(79, 214, 198, 0.07);
    --tip-line: rgba(79, 214, 198, 0.32);
    --warn: #f5c46b;
    --warn-bg: rgba(240, 165, 0, 0.09);
    --warn-line: rgba(240, 165, 0, 0.4);
    --ok: #4fd6c6;
    --ok-bg: rgba(79, 214, 198, 0.1);
    --topbar-bg: rgba(16, 18, 23, 0.86);
    --accent-primary: #4fd6c6;
    --text-dim: #6b7380;
    --bg-primary: #101217;
    --bg-secondary: #1b1e25;
    color-scheme: dark;
}

:root {
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --topbar-h: 56px;
    --radius: 10px;
    --gutter: 48px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 17px/1.53 var(--sans);
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
kbd {
    font: 400 11px/1 var(--mono);
    padding: 3px 5px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--bg-soft);
    color: var(--text-2);
}
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute;
    left: 12px; top: -48px;
    z-index: 100;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}
.skip-link:focus { top: 10px; text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-elev);
    color: var(--text);
    font: 600 14px/1 var(--sans);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
/* Brand gold with dark text in both themes: white on the darker light-theme
   gold would fall under 4.5:1. */
.btn-primary {
    background: #f0a500;
    border-color: #f0a500;
    color: #14100a;
}
.btn-primary:hover { background: #f5b41f; border-color: #f5b41f; }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; gap: 6px; }
.btn i { font-size: 0.92em; }
.btn.is-copied { color: var(--ok); border-color: var(--ok); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px; height: 36px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn-sm { width: 28px; height: 28px; border-radius: 6px; font-size: 13px; }
.icon-btn.is-copied { color: var(--ok); }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--topbar-bg);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: var(--topbar-h);
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}
.menu-btn { display: none; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.brand-name { font-size: 16px; }
.brand-docs {
    padding: 2px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.top-tabs {
    display: flex;
    align-self: stretch;
    gap: 4px;
    margin-left: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.top-tabs::-webkit-scrollbar { display: none; }
.top-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.top-tab .gi-i { width: 16px; height: 16px; color: var(--text-3); transition: color .15s; }
.top-tab:hover { color: var(--text); text-decoration: none; }
.top-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.top-tab.active .gi-i { color: var(--navy); }
.top-tab:focus-visible { outline-offset: -4px; }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 230px;
    height: 36px;
    padding: 0 8px 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-elev);
    color: var(--text-3);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}
.search-btn:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-btn-text { flex: 1; text-align: left; }
.search-kbd { min-width: 44px; text-align: center; }
.os-mac .k-other, .os-other .k-mac { display: none; }
[data-theme="dark"] .when-light, [data-theme="light"] .when-dark { display: none; }

/* ---------- Layout ---------- */
/* Columns: sidebar 280 | content 780 | rail 240, with 40px gutters. The
   gutters are padding on the content and rail (not column-gap) so the divider
   can sit on the content column and run the full height of the page. */
.layout {
    display: grid;
    grid-template-columns: 290px minmax(0, calc(760px + var(--gutter))) calc(220px + var(--gutter));
    justify-content: center;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}
.sidebar {
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
    height: calc(100vh - var(--topbar-h));
}
.sidebar-inner {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px 18px 40px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
/* The navigator: the whole doc set as a tree (a branch per tab), a filter on top. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.gi-i {
    width: 18px; height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav-filter {
    position: sticky;
    top: -28px;
    z-index: 1;
    margin: -28px 0 14px;
    padding: 28px 0 8px;
    background: var(--bg);
}
.nav-filter i { position: absolute; left: 11px; top: calc(50% + 10px); transform: translateY(-50%); color: var(--text-3); font-size: 12px; pointer-events: none; }
.nav-filter-input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 31px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev);
    color: var(--text);
    font: 400 14px/1 var(--sans);
}
.nav-filter-input::placeholder { color: var(--text-3); }
.nav-filter-input:focus { border-color: var(--link); outline: none; box-shadow: 0 0 0 3px var(--link-soft); }
.nav-filter-empty { margin: 8px 10px; color: var(--text-3); font-size: 14px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-tab + .nav-tab { margin-top: 2px; }
.nav-tab summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.nav-tab summary::-webkit-details-marker { display: none; }
.nav-tab summary:hover { background: var(--bg-soft); }
.nav-tab summary .gi-i { color: var(--navy); }
.nav-twisty { width: 12px; color: var(--text-3); font-size: 10px; transition: transform .15s ease; }
.nav-tab details[open] > summary .nav-twisty { transform: rotate(90deg); }
.nav-groups { padding: 2px 0 10px 18px !important; }
.nav-group-label {
    margin: 12px 0 4px;
    padding: 0 10px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.nav-group:first-child .nav-group-label { margin-top: 6px; }
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 7px;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.4;
    transition: background-color .12s, color .12s;
}
.nav-link .gi-i { width: 16px; height: 16px; color: var(--text-3); }
.nav-link:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-link.active::before {
    content: "";
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}
.nav-link.active .gi-i { color: var(--navy); }
.nav-link code {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-family: var(--mono);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.nav-filtering .nav-groups { padding-bottom: 4px !important; }
.sidebar-foot { display: none; }

.content {
    min-width: 0;
    min-height: calc(100vh - var(--topbar-h));
    padding: 36px 0 88px var(--gutter);
    border-left: 1px solid var(--border);
    outline: none;
}
/* No overflow on the rail itself: the Copy page menu must be able to spill
   out of it. A long outline scrolls inside .toc instead. */
.rail {
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
}
.rail-inner { padding: 40px 0 40px var(--gutter); }

/* ---------- Article ---------- */
.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
    font-size: 14px;
    color: var(--text-3);
}
.breadcrumbs li + li::before {
    content: "\203A";
    margin: 0 8px;
    color: var(--text-3);
}
.breadcrumbs a { color: var(--text-2); }
.breadcrumbs a:hover { color: var(--link); }
.breadcrumbs [aria-current] { color: var(--text-3); }
.doc-header { padding-bottom: 28px; margin-bottom: 8px; }
.doc-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--navy);
    font-size: 17px;
    font-weight: 600;
}
.doc-eyebrow .gi-i { width: 22px; height: 22px; }
.doc-header h1 {
    margin: 0;
    font-size: 40px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.022em;
    text-wrap: balance;
}
.doc-lede { margin: 16px 0 0; color: var(--text-2); font-size: 21px; line-height: 1.38; letter-spacing: -0.012em; text-wrap: pretty; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.chip {
    display: inline-block;
    padding: 4px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-2);
    font-size: 13px;
    line-height: 16px;
    white-space: nowrap;
}
.chip-date { border-color: transparent; background: var(--bg-soft); }
.doc-header-actions { display: none; margin-top: 18px; }

/* Topics and See Also: Apple-style link lists, an icon, a title and one line of abstract. */
.doc-related:empty { display: none; }
.topics, .see-also { margin-top: 8px; }
.doc-related h2 {
    position: relative;
    margin: 48px 0 8px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
    scroll-margin-top: calc(var(--topbar-h) + 24px);
}
.topic-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 28px 0 6px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    scroll-margin-top: calc(var(--topbar-h) + 24px);
}
.topic-group-icon { width: 22px; height: 22px; color: var(--navy); }
.topic-list { list-style: none !important; margin: 0 0 8px !important; padding: 0 !important; }
.topic-list li + li { margin-top: 0 !important; }
.topic {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 10px;
    margin: 0 -10px;
    border-radius: 10px;
    color: var(--text);
    transition: background-color .12s;
}
.topic:hover { background: var(--bg-soft); text-decoration: none; }
.topic-icon { width: 20px; height: 20px; margin-top: 2px; color: var(--text-3); }
.topic:hover .topic-icon { color: var(--link); }
.topic-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topic-title { color: var(--link); font-size: 17px; font-weight: 400; }
.topic:hover .topic-title { text-decoration: underline; text-underline-offset: 3px; }
.topic-title code {
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: inherit !important;
    font: 400 15.5px/1.5 var(--mono) !important;
}
.topic-abstract { color: var(--text-2); font-size: 15px; line-height: 1.47; }
.topic-abstract code { font-size: 0.86em; }

.doc-body > :first-child { margin-top: 0; }
.doc-body p, .doc-body ul, .doc-body ol { margin: 0 0 16px; }
.doc-body ul, .doc-body ol { padding-left: 24px; }
/* Plain Markdown lists only; styled lists (steps, prompts) carry a class. */
.doc-body ul:not([class]) { list-style: disc; }
.doc-body ol:not([class]) { list-style: decimal; }
.doc-body li::marker { color: var(--text-3); }
.doc-body li + li { margin-top: 6px; }
.doc-body li > p { margin-bottom: 8px; }
.doc-body strong { font-weight: 600; color: var(--text); }
.doc-body h2, .doc-body h3, .doc-body h4 { position: relative; scroll-margin-top: calc(var(--topbar-h) + 24px); }
.doc-body h2 {
    margin: 48px 0 16px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
.doc-body h3 { margin: 32px 0 12px; font-size: 21px; font-weight: 600; line-height: 1.4; }
.doc-body h4 { margin: 24px 0 10px; font-size: 17px; font-weight: 600; }
.anchor {
    display: inline-grid;
    place-items: center;
    width: 26px; height: 26px;
    margin-left: 8px;
    border-radius: 6px;
    color: var(--text-3);
    font-size: 13px;
    vertical-align: 2px;
    opacity: 0;
    transition: opacity .15s, color .15s, background-color .15s;
}
h2:hover > .anchor, h3:hover > .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--link); background: var(--bg-soft); text-decoration: none; }
.doc-body hr { margin: 32px 0; border: 0; border-top: 1px solid var(--border); }
.doc-body blockquote {
    margin: 0 0 16px;
    padding: 2px 0 2px 16px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-2);
}

/* Inline code */
.doc-body code, .param-extra code, .copybox code {
    padding: 0.12em 0.4em;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-soft);
    color: var(--text);
    font: 400 0.86em/1.5 var(--mono);
    overflow-wrap: anywhere;
}
.doc-body a code { color: var(--link); }
.doc-body a:hover code { text-decoration: underline; }

/* ---------- Tables ---------- */
.table-wrap {
    margin: 20px 0 24px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.table-wrap th {
    padding: 10px 14px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}
.table-wrap td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-2); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td code { font-size: 12.5px; white-space: nowrap; overflow-wrap: normal; }
.table-wrap td strong { color: var(--text); }
.table-wrap th:empty { display: none; }

/* ---------- Code ---------- */
.code-block, .code-group {
    margin: 20px 0 24px;
    overflow: hidden;
    border: 1px solid var(--code-border);
    border-radius: var(--radius);
    background: var(--code-bg);
}
.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 0 6px 0 14px;
    border-bottom: 1px solid var(--code-border);
    background: var(--code-head);
    color: var(--code-muted);
    font-size: 12.5px;
    font-weight: 400;
}
.code-label { letter-spacing: 0.01em; }
.code-block .copy, .code-group .copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--code-muted);
    font: 400 12.5px/1 var(--sans);
    cursor: pointer;
    transition: color .15s, background-color .15s;
}
.code-block .copy:hover, .code-group .copy:hover { background: var(--bg-hover); color: var(--text); }
.copy.is-copied { color: var(--ok) !important; }
.code-tabs { display: flex; align-self: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: -8px; }
.code-tabs::-webkit-scrollbar { display: none; }
.code-tab {
    padding: 0 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--code-muted);
    font: 400 12.5px/1 var(--sans);
    white-space: nowrap;
    cursor: pointer;
}
.code-tab:hover { color: var(--text); }
.code-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.code-tab:focus-visible { outline-offset: -3px; }
.code-block pre, .code-group pre {
    margin: 0;
    padding: 14px 16px 16px;
    overflow-x: auto;
    color: var(--code-text);
    font: 400 13px/1.65 var(--mono);
    tab-size: 4;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.code-block pre code, .code-group pre code {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    white-space: pre;
    overflow-wrap: normal;
}

/* Pygments tokens (class-based spans from HtmlFormatter(nowrap=True)), coloured per theme */
.hl .c, .hl .c1, .hl .cm, .hl .ch, .hl .cs, .hl .cp, .hl .cpf, .hl .gp { color: var(--tok-comment); }
.hl .gp { user-select: none; }
.hl .k, .hl .kc, .hl .kd, .hl .kn, .hl .kp, .hl .kr, .hl .kt, .hl .ow { color: var(--tok-keyword); }
.hl .s, .hl .s1, .hl .s2, .hl .sb, .hl .sc, .hl .sd, .hl .se, .hl .sh, .hl .si, .hl .sx, .hl .sr, .hl .ss { color: var(--tok-string); }
.hl .m, .hl .mi, .hl .mf, .hl .mh, .hl .mo, .hl .il { color: var(--tok-number); }
.hl .nt, .hl .na, .hl .nv, .hl .vg, .hl .vi, .hl .vc { color: var(--tok-attr); }
.hl .nb, .hl .bp, .hl .nf, .hl .fm, .tok-name { color: var(--tok-func); }
.hl .o, .hl .p { color: var(--tok-punct); }
.hl .err { color: var(--tok-string); }
.tok-name { font-weight: 600; }
.tok-param { color: var(--tok-name); }
.tok-type { color: var(--tok-keyword); }

/* ---------- Callouts ---------- */
.callout {
    display: flex;
    gap: 12px;
    margin: 22px 0;
    padding: 14px 16px;
    border: 1px solid var(--note-line);
    border-left-width: 3px;
    border-radius: 8px;
    background: var(--note-bg);
}
.callout-icon { margin-top: 4px; color: var(--note); font-size: 15px; }
.callout-body { min-width: 0; color: var(--text); }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p { margin-bottom: 8px; }
.callout-tip { border-color: var(--tip-line); background: var(--tip-bg); }
.callout-tip .callout-icon { color: var(--tip); }
.callout-warning { border-color: var(--warn-line); background: var(--warn-bg); }
.callout-warning .callout-icon { color: var(--warn); }

/* ---------- Cards ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0 28px;
}
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elev);
    color: var(--text);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background-color .18s;
}
.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-line);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}
.card-icon {
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    margin-bottom: 6px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--link);
    font-size: 15px;
}
.card-title { font-size: 15.5px; font-weight: 600; }
.card-title::after {
    content: "\2192";
    margin-left: 6px;
    color: var(--text-3);
    transition: color .18s, margin-left .18s;
}
.card:hover .card-title::after { color: var(--link); margin-left: 9px; }
.card-text { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.card-text code { font-size: 12.5px; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; list-style: none; margin: 28px 0 32px !important; padding: 0 !important; }
.steps > .step {
    position: relative;
    padding: 0 0 12px 50px;
    margin: 0 !important;
}
.steps > .step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0; top: 0;
    display: grid;
    place-items: center;
    width: 32px; height: 32px;
    border: 1px solid var(--accent-line);
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--link);
    font-size: 14px;
    font-weight: 600;
}
.steps > .step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 16px; top: 40px; bottom: 6px;
    width: 1px;
    background: var(--border);
}
.steps > .step > h2:first-child,
.steps > .step > h3:first-child {
    margin: 3px 0 10px;
    padding-top: 0;
    border-top: 0;
    font-size: 18px;
    line-height: 1.45;
}
.steps > .step + .step { padding-top: 10px; }
.steps > .step + .step::before { top: 10px; }
.steps > .step + .step::after { top: 50px; }

/* ---------- Tabs (content) ---------- */
.tabs {
    margin: 20px 0 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
}
.tab-list {
    display: flex;
    gap: 2px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }
.tab {
    padding: 11px 10px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:focus-visible { outline-offset: -4px; }
.tab-panel { padding: 18px 20px 4px; outline: none; }
.tab-panel:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.tab-panel .code-block { margin: 12px 0 18px; }

/* ---------- Copy box, prompts, buttons, checklist ---------- */
.copybox {
    margin: 16px 0 22px;
    padding: 12px 12px 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
}
.copybox-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.copybox-row { display: flex; align-items: center; gap: 12px; }
.copybox code {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 14.5px;
    font-weight: 400;
    overflow-wrap: anywhere;
}
.prompt-list { list-style: none; margin: 18px 0 24px !important; padding: 0 !important; display: grid; gap: 10px; }
.prompt-list > .prompt { margin: 0 !important; }
.prompt {
    padding: 14px 16px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    transition: border-color .15s;
}
.prompt:hover { border-color: var(--border-strong); }
.prompt-text { margin: 0 0 10px !important; color: var(--text); font-size: 14.5px; line-height: 1.55; }
.prompt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-actions .btn { font-weight: 400; }
.prompt-actions .btn i { color: var(--text-3); font-size: 11px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.btn-row .btn { height: 40px; padding: 0 18px; }
.doc-body .checklist ul { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding-left: 30px; }
.checklist li::before {
    content: "\f00c";
    position: absolute;
    left: 0; top: 2px;
    display: grid;
    place-items: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--ok-bg);
    color: var(--ok);
    font: 900 10px/1 "Font Awesome 6 Free";
}

/* ---------- Client tabs (:::clients) ---------- */
/* One tab per AI client: short numbered steps, the copy box as the primary
   action, a "Full guide" link and the client's clip. */
.client-tabs .tab-panel { padding: 20px 22px 20px; }
.doc-body .client-panel > ol { list-style: none; counter-reset: client-step; margin: 2px 0 18px; padding-left: 0; }
.doc-body .client-panel > ol > li {
    position: relative;
    counter-increment: client-step;
    min-height: 26px;
    padding-left: 40px;
}
.doc-body .client-panel > ol > li + li { margin-top: 12px; }
.doc-body .client-panel > ol > li::before {
    content: counter(client-step);
    position: absolute;
    left: 0; top: 0;
    display: grid;
    place-items: center;
    width: 26px; height: 26px;
    border: 1px solid var(--accent-line);
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--link);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}
.client-panel .copybox { margin: 18px 0 14px; }
.client-panel .copybox .btn {
    height: 34px;
    padding: 0 14px;
    border-color: #f0a500;
    background: #f0a500;
    color: #14100a;
    font-weight: 600;
}
.client-panel .copybox .btn:hover { border-color: #f5b41f; background: #f5b41f; }
.client-panel .copybox .btn.is-copied { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.client-panel > p { color: var(--text-2); font-size: 14px; }
.doc-body .client-panel > p.client-guide { margin: 0 0 4px; font-size: 14.5px; }
.client-guide a { font-weight: 600; }
.client-panel > :last-child { margin-bottom: 0; }

/* ---------- Setup clips (:::video) ---------- */
/* Fixed 16:9 box before anything loads (no layout shift); the clip itself is
   navy in both themes. */
.walkthrough { margin: 22px 0 26px; }
.client-panel .walkthrough { margin: 20px 0 2px; }
.walkthrough-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #0b1324;
    box-shadow: var(--shadow-sm);
}
.walkthrough-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}
.walkthrough-toggle {
    position: absolute;
    right: 12px; bottom: 12px;
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(11, 19, 36, 0.78);
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, background-color .15s;
}
.walkthrough-toggle:hover { background: rgba(11, 19, 36, 0.92); }
.walkthrough-media:hover .walkthrough-toggle,
.walkthrough-toggle:focus-visible,
.walkthrough:not(.is-playing) .walkthrough-toggle { opacity: 1; }
/* No hover on touch screens: keep the pause button in sight. */
@media (hover: none) { .walkthrough-toggle { opacity: 1; } }
.walkthrough .when-playing,
.walkthrough.is-playing .when-paused { display: none; }
.walkthrough.is-playing .when-playing { display: inline; }
/* Reduced motion: the poster, with a play button in the middle. */
.walkthrough.is-reduced:not(.is-playing) .walkthrough-toggle {
    right: auto; bottom: auto;
    left: 50%; top: 50%;
    width: 64px; height: 64px;
    margin: -32px 0 0 -32px;
    border-color: transparent;
    background: #f0a500;
    color: #14100a;
    font-size: 22px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.walkthrough.is-reduced:not(.is-playing) .when-paused { margin-left: 4px; }
/* User-guide clips (:::guide-video): a "Sign in to watch" card until developers.js finds a session and
   swaps in the player. The card is navy in both themes, like the clips. */
.guide-video { margin: 22px 0 26px; }
.guide-video-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #0b1324;
    box-shadow: var(--shadow-sm);
}
.guide-video-media .walkthrough-video { cursor: auto; object-fit: contain; }
.guide-video-locked {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    color: #e8e6e3;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(45, 212, 168, 0.12), transparent 60%),
        linear-gradient(180deg, #0f1a30, #0b1324);
}
.guide-video-play {
    display: grid;
    place-items: center;
    width: 56px; height: 56px;
    margin-bottom: 6px;
    padding-left: 4px;
    border-radius: 50%;
    background: rgba(240, 165, 0, 0.16);
    border: 1px solid rgba(240, 165, 0, 0.45);
    color: #f0a500;
    font-size: 20px;
}
.guide-video-title { font-size: 18px; font-weight: 600; }
.guide-video-note { font-size: 13px; color: rgba(232, 230, 227, 0.72); }
.guide-video-signin {
    margin-top: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    background: #f0a500;
    color: #14100a;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
}
.guide-video-signin:hover { background: #ffb81c; }
.walkthrough-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
    margin-top: 10px;
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.5;
}
.walkthrough-title { color: var(--text-2); font-weight: 600; }
.walkthrough-transcript { flex-basis: 100%; }
.walkthrough-transcript summary {
    display: inline-block;
    color: var(--link);
    font-weight: 600;
    cursor: pointer;
}
.walkthrough-transcript summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.doc-body .walkthrough-transcript ol { list-style: none; margin: 8px 0 0; padding: 0; }
.doc-body .walkthrough-transcript li { display: flex; gap: 10px; margin-top: 6px; color: var(--text-2); }
.walkthrough-step {
    flex: none;
    display: grid;
    place-items: center;
    width: 20px; height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    background: #f0a500;
    color: #14100a;
    font-size: 11px;
    font-weight: 600;
}

/* ---------- Tool pages (Declaration, Parameters) ---------- */
.declaration pre { font-size: 14px; line-height: 1.7; white-space: pre; }
.param-list { margin: 8px 0 24px; padding: 0; }
.param { padding: 14px 0; border-bottom: 1px solid var(--border); }
.param:first-child { padding-top: 4px; }
.param dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.param dd { margin: 6px 0 0; color: var(--text-2); font-size: 16px; line-height: 1.5; }
.doc-body .param-name { padding: 0; border: 0; background: none; color: var(--text); font: 600 15px/1.5 var(--mono); }
.param-type { color: var(--text-3); font: 400 14px/1.5 var(--mono); }
.pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}
.pill-required { background: var(--accent-soft); color: var(--text); }
.param-extra { display: block; margin-top: 6px; color: var(--text-3); font-size: 14px; }
.param-extra code { font-size: 12.5px; }

/* ---------- Pager + footer of the article ---------- */
.pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 56px;
}
.pager-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, background-color .15s;
}
.pager-card:hover { border-color: var(--accent-line); background: var(--bg-elev); text-decoration: none; }
.pager-card.next { text-align: right; }
.pager-label { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.pager-label i { font-size: 11px; }
.pager-title { color: var(--text); font-size: 15px; font-weight: 600; }
.pager-card:hover .pager-title { color: var(--link); }

/* ---------- Right rail: copy page + TOC ---------- */
.copy-page { position: relative; display: inline-flex; margin-bottom: 26px; }
.copy-page-main, .copy-page-toggle {
    display: inline-flex;
    align-items: center;
    height: 34px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elev);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.copy-page-main { gap: 8px; padding: 0 12px; border-radius: 8px 0 0 8px; }
.copy-page-main i { color: var(--text-3); }
.copy-page-toggle { justify-content: center; width: 34px; border-left: 0; border-radius: 0 8px 8px 0; color: var(--text-3); font-size: 11px; }
.copy-page-main:hover, .copy-page-toggle:hover { background: var(--bg-hover); }
.copy-page-toggle[aria-expanded="true"] { background: var(--bg-hover); color: var(--text); }
.copy-page-main.is-copied, .copy-page-main.is-copied i { color: var(--ok); }
.copy-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    width: 270px;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--bg-elev);
    box-shadow: var(--shadow);
}
.copy-menu-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.copy-menu-item:hover, .copy-menu-item:focus-visible { background: var(--bg-soft); text-decoration: none; outline: none; }
.copy-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.copy-menu-item i { width: 16px; margin-top: 3px; color: var(--text-3); text-align: center; }
.copy-menu-item span { display: flex; flex-direction: column; gap: 1px; }
.copy-menu-item strong { font-size: 13.5px; font-weight: 600; }
.copy-menu-item small { color: var(--text-3); font-size: 12px; }

.toc-title {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: calc(100vh - var(--topbar-h) - 190px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.doc-header-actions .copy-menu { left: 0; right: auto; }
/* The guide line is each link's own left border (the list scrolls, so nothing
   may hang outside it); the active entry thickens it in the accent colour. */
.toc a {
    display: block;
    padding: 5px 0 5px 14px;
    border-left: 1px solid var(--border);
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.45;
    transition: color .15s, border-color .15s, box-shadow .15s;
}
.toc .toc-l3 a { padding-left: 26px; font-size: 12.5px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a:focus-visible { outline-offset: -2px; }
.toc a.active { color: var(--text); border-left-color: var(--accent); box-shadow: inset 1px 0 0 var(--accent); font-weight: 400; }

/* ---------- Site footer ---------- */
.site-footer { border-top: 1px solid var(--border); }
.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 22px 24px;
    color: var(--text-3);
    font-size: 13px;
}
.site-footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer-links a { color: var(--text-2); }
.site-footer-links a:hover { color: var(--text); }
.site-footer-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--text-2); cursor: pointer; }
.site-footer-btn:hover { color: var(--text); }

/* ---------- Search ---------- */
.search-modal { position: fixed; inset: 0; z-index: 90; }
.search-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, 0.62); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.search-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(640px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 120px));
    margin: 12vh auto 0;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--bg-elev);
    box-shadow: var(--shadow);
}
.search-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 0 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-3);
}
.search-input {
    flex: 1;
    min-width: 0;
    height: 56px;
    border: 0;
    background: none;
    color: var(--text);
    font: 400 16px/1 var(--sans);
    outline: none;
}
.search-input::placeholder { color: var(--text-3); }
.search-esc {
    padding: 4px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--bg-soft);
    color: var(--text-3);
    font: 400 11.5px/1.2 var(--sans);
    cursor: pointer;
}
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results:empty { display: none; }
.search-result a {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    column-gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--text);
}
.search-result-icon { grid-row: span 2; width: 20px; height: 20px; margin-top: 1px; color: var(--text-3); }
.search-result[aria-selected="true"] .search-result-icon { color: var(--navy); }
.search-result a:hover { text-decoration: none; }
.search-result[aria-selected="true"] a { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.search-result-top { display: flex; align-items: baseline; gap: 10px; }
.search-result-title { font-size: 15px; font-weight: 600; }
.search-result-kind { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.search-result[aria-selected="true"] .search-result-title { color: var(--text); }
.search-result-name { color: var(--text-3); font: 400 12px/1 var(--mono); }
.search-result-section { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.search-result-snippet {
    display: -webkit-box;
    margin-top: 3px;
    overflow: hidden;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.5;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.search-result mark { background: none; color: var(--link); font-weight: 600; }
.search-result-heading { color: var(--text-3); font-size: 13px; }

/* ---------- Loaders (gi_loader_art.js + gi_loaders.css, the app's own loader family) ---------- */
.search-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 16px 28px; color: var(--text-3); font-size: 14px; }
.search-loading .gl-svg, .page-loader .gl-svg { width: 56px; height: auto; }
.page-loader {
    position: fixed;
    right: 24px; bottom: 24px;
    z-index: 80;
    display: grid;
    place-items: center;
    width: 76px; height: 64px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elev);
    box-shadow: var(--shadow-sm);
}
.search-group-label {
    padding: 10px 12px 4px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.search-empty { padding: 28px 16px 30px; color: var(--text-3); font-size: 14px; text-align: center; }
.search-foot {
    display: flex;
    gap: 18px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-3);
    font-size: 12px;
}
.search-foot kbd { margin-right: 3px; }
body.search-open { overflow: hidden; }

/* ---------- Drawer (small screens) ---------- */
.drawer-backdrop { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 55; background: rgba(4, 6, 10, 0.55); }
.menu-btn .when-open, .menu-btn[aria-expanded="true"] .when-closed { display: none; }
.menu-btn[aria-expanded="true"] .when-open { display: inline; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .layout { --gutter: 32px; grid-template-columns: 260px minmax(0, 1fr) calc(220px + var(--gutter)); }
    .search-btn { width: 200px; }
}

@media (max-width: 1100px) {
    .layout { grid-template-columns: 250px minmax(0, 1fr); }
    .content { padding-right: 8px; }
    .rail { display: none; }
    .doc-header-actions { display: block; }
    .doc-header-actions .copy-page { margin-bottom: 0; }
}

@media (max-width: 960px) {
    .search-btn { width: auto; }
    .search-btn-text { display: none; }
}

@media (max-width: 820px) {
    :root { --topbar-h: 104px; }
    .topbar-inner { flex-wrap: wrap; height: auto; gap: 0 10px; padding: 0 12px; }
    .menu-btn { display: inline-grid; margin-left: -6px; }
    .brand { height: 56px; }
    .topbar-actions { gap: 6px; }
    .open-app { display: none; }
    .top-tabs { order: 10; flex-basis: 100%; height: 48px; margin: 0 -12px; padding: 0 8px; border-top: 1px solid var(--border); }
    .top-tab { padding: 0 10px; }
    .layout { display: block; padding: 0 20px; }
    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        bottom: 0;
        z-index: 60;
        width: min(320px, 86vw);
        height: auto;
        /* The desktop rule's align-self: start also aligns fixed boxes; stretch
           keeps the drawer between the top bar and the bottom of the screen. */
        align-self: stretch;
        border-right: 1px solid var(--border);
        background: var(--bg);
        box-shadow: var(--shadow);
        transform: translateX(-102%);
        visibility: hidden;
        transition: transform .22s ease, visibility 0s linear .22s;
    }
    body.drawer-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
    body.drawer-open { overflow: hidden; }
    .sidebar-inner { padding: 20px 16px 28px 14px; display: flex; flex-direction: column; }
    .nav-filter { top: -20px; margin-top: -20px; padding-top: 20px; }
    .sidebar-nav { flex: 1; }
    .sidebar-foot { display: block; padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--border); }
    .sidebar-foot .btn { width: 100%; height: 38px; }
    .content { min-height: 0; padding: 28px 0 56px; border-left: 0; }
    .doc-header h1 { font-size: 32px; }
    .doc-lede { font-size: 19px; }
    .page-loader { right: 16px; bottom: 16px; }
    .card-grid { grid-template-columns: 1fr; }
    .doc-body h2, .doc-related h2 { margin-top: 40px; padding-top: 24px; font-size: 24px; }
}

@media (max-width: 520px) {
    .brand-name { font-size: 15px; }
    .search-btn { width: 38px; justify-content: center; padding: 0; }
    .search-kbd { display: none; }
    .layout { padding: 0 16px; }
    .pager { grid-template-columns: 1fr; }
    .pager-card.next { text-align: left; }
    .steps > .step { padding-left: 42px; }
    .steps > .step::before { width: 28px; height: 28px; font-size: 13px; }
    .steps > .step:not(:last-child)::after { left: 14px; }
    .tab-panel { padding: 16px 14px 2px; }
    .client-tabs .tab-panel { padding: 16px 14px 16px; }
    .doc-body .client-panel > ol > li { padding-left: 36px; }
    .client-panel .copybox-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .site-footer-inner { flex-direction: column; align-items: flex-start; }
    .search-dialog { margin-top: 10px; max-height: calc(100vh - 20px); }
    .search-foot { display: none; }
    .search-result-section, .search-result-kind { display: none; }
    body { font-size: 16px; }
    .copybox-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
    /* Page to page: a short cross-fade of the article, where the browser supports it. */
    @view-transition { navigation: auto; }
    .doc { view-transition-name: doc; }
    ::view-transition-old(doc) { animation: doc-out .14s ease both; }
    ::view-transition-new(doc) { animation: doc-in .2s ease both; }
    @keyframes doc-out { to { opacity: 0; } }
    @keyframes doc-in { from { opacity: 0; transform: translateY(4px); } }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
    .page-loader { display: none !important; }
}

@media print {
    .topbar, .sidebar, .rail, .pager, .site-footer, .doc-header-actions, .prompt-actions, .copy,
    .walkthrough-media { display: none !important; }
    .layout { display: block; }
    body { background: #fff; color: #000; }
}

/* ---------- User-guide steps you can click (:::guide-video, the library player) ---------- */
.doc-body .gv-steps, .vl-player .gv-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.gv-step {
    width: 100%;
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--text-2);
    font: inherit;
    font-size: 13.5px;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
}
.gv-step:hover { background: var(--bg-hover); color: var(--text); }
.gv-step.is-active { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.gv-step-time { color: var(--text-3); font-family: 'JetBrains Mono', monospace; font-size: 12px; padding-top: 1px; }

/* ---------- Video library (:::video-library) ---------- */
.vl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin: 14px 0 30px;
}
.doc-body a.vl-card, .vl-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 0 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, transform .15s;
}
.vl-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.vl-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(45, 212, 168, 0.12), transparent 60%),
        linear-gradient(180deg, #0f1a30, #0b1324);
}
.vl-poster, .vl-poster img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.vl-play {
    position: absolute;
    left: 50%; top: 50%;
    display: grid;
    place-items: center;
    width: 48px; height: 48px;
    margin: -24px 0 0 -24px;
    padding-left: 3px;
    border-radius: 50%;
    background: rgba(11, 19, 36, 0.78);
    border: 1px solid rgba(240, 165, 0, 0.5);
    color: #f0a500;
    font-size: 16px;
    transition: background-color .15s, color .15s;
}
.vl-card:hover .vl-play { background: #f0a500; color: #14100a; }
.vl-time {
    position: absolute;
    right: 8px; bottom: 8px;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 600;
}
.vl-title { padding: 6px 14px 0; font-size: 15px; font-weight: 600; }
.vl-blurb { padding: 0 14px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.vl-card:not(.is-unlocked) .vl-blurb::after {
    content: "Sign in to watch";
    display: block;
    margin-top: 8px;
    color: var(--link);
    font-weight: 600;
}

/* The player, opened from a card */
body.vl-open { overflow: hidden; }
.vl-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 8, 12, 0.72);
    backdrop-filter: blur(3px);
}
.vl-player {
    width: min(1220px, 100%);
    max-height: 100%;
    overflow: auto;
    padding: 18px 20px 20px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--bg-elev);
    box-shadow: var(--shadow);
}
.vl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.vl-kicker { color: var(--link); font-size: 12px; font-weight: 600; }
.doc-body .vl-heading, .vl-heading { margin: 2px 0 0; padding: 0; border: 0; font-size: 21px; color: var(--text); }
.vl-close {
    border: 0;
    background: none;
    color: var(--text-3);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.vl-close:hover { color: var(--text); }
.vl-body { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.vl-media { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #0b1324; }
.vl-media .walkthrough-video { cursor: auto; object-fit: contain; }
.vl-summary { margin: 0 0 6px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.vl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.vl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}
.vl-btn:hover { border-color: var(--accent-line); }
.vl-btn-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.vl-btn-primary:hover { background: #ffb81c; }
@media (max-width: 860px) {
    .vl-body { grid-template-columns: 1fr; }
    .vl-overlay { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .vl-card, .vl-card:hover { transition: none; transform: none; }
}

/* Ask Coco on the developer docs (Bala 2026-11-14: "ask coco should be across all the pages"). The panel and pill come
   from site.js; these rules are copied from site.css, scoped to the elements site.js adds, with the light tokens they read. */
.gi-ask-bg,.gi-ask,.gi-askpill{--card:#FFFFFF;--font:"Inter",-apple-system,BlinkMacSystemFont,system-ui,"Segoe UI",sans-serif;--green:#0E8A6B;--ink:#1D1D1F;--ink-hover:#000;--ink2:#424245;--line:#D2D2D7;--muted:#6E6E73;--on-band-3:#8C9792;--paper:#FFFFFF;--radius:12px}
/* ---------- Ask Coco (site.js: GI.ask, the pill) ---------- */
.gi-ask-bg{position:fixed;inset:0;z-index:9992;background:rgba(11,19,36,.45);opacity:0;transition:opacity .22s ease}
.gi-ask{position:fixed;inset:0;z-index:9993;display:grid;place-items:center;padding:16px;pointer-events:none}
.gi-ask[hidden],.gi-ask-bg[hidden]{display:none}
.gi-ask-card{pointer-events:auto;width:min(560px,96vw);height:min(72vh,620px);display:flex;flex-direction:column;background:var(--card);border:1px solid var(--line);border-radius:8px;box-shadow:0 30px 80px -20px rgba(11,19,36,.5);opacity:0;transform:translateY(10px) scale(.97);transition:opacity .22s ease,transform .22s cubic-bezier(.2,.7,.2,1)}
.gi-ask-bg.open{opacity:1}
.gi-ask.open .gi-ask-card{opacity:1;transform:none}
.gi-ask-head{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--line)}
.gi-ask-head h2{margin:0;font-size:19px}
.gi-ask-head p{margin:2px 0 0;font-size:12.5px;color:var(--muted)}
.gi-ask-mark,.gi-askpill-mark{flex:none;display:inline-block;width:30px;height:30px;background:url(/static/coco/coco-face.png) center/contain no-repeat;color:transparent;font-size:0;overflow:hidden}
/* the floating pill gets the live Coco: site.js adds the idle loop and drops the still face (the clip is transparent) */
.gi-askpill-mark{position:relative;width:38px;height:38px}
.gi-askpill-mark.live{background:none}
.gi-askpill-mark video{position:absolute;left:50%;top:50%;width:60px;height:60px;transform:translate(-50%,-52%);pointer-events:none}
.gi-ask-x{margin-left:auto;background:none;border:1px solid var(--line);border-radius:var(--radius);width:34px;height:34px;cursor:pointer;color:var(--ink);font-size:18px;line-height:1}
.gi-ask-x:hover{border-color:var(--ink)}
.gi-ask-ctx{margin:0;padding:9px 18px;border-bottom:1px solid var(--line);background:var(--paper);font-size:12.5px;color:var(--ink2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gi-ask-ctx[hidden]{display:none}
.gi-ask-body{padding:18px 20px;overflow:auto;display:flex;flex-direction:column;gap:10px;flex:1}
.gi-ask-form{display:flex;gap:8px;padding:12px 18px 16px;border-top:1px solid var(--line);align-items:flex-end}
.gi-ask-form .field{flex:1;margin:0}
/* the work-email step before the first question (backend/ask_gate.py) */
.gi-ask-form[hidden],.gi-ask-gate[hidden],.gi-ask-who[hidden],.gi-ask-err[hidden]{display:none}
.gi-ask-gate{padding:14px 18px 16px;border-top:1px solid var(--line)}
.gi-ask-gate-row{display:flex;gap:8px;align-items:flex-end}
.gi-ask-gate .field{flex:1;margin:0}
.gi-ask-opt{display:inline-flex;gap:9px;align-items:center;margin:12px 0 0;font-size:13.5px;color:var(--ink);cursor:pointer}
.gi-ask-opt input{width:16px;height:16px;margin:0;accent-color:var(--green);cursor:pointer}
.gi-ask-note{margin:8px 0 0;font-size:12.5px;line-height:1.5;color:var(--muted)}
.gi-ask-note a{color:var(--ink2);text-decoration:underline;text-underline-offset:2px}
.gi-ask-note a:hover{color:var(--ink)}
.gi-ask-err{margin:8px 0 0;font-size:13px;color:#a3271f}
.gi-ask-who{display:flex;flex-wrap:wrap;gap:6px;align-items:baseline;margin:-6px 0 0;padding:0 18px 12px;font-size:12px;color:var(--muted)}
.gi-ask-who b{font-weight:600;color:var(--ink2);overflow-wrap:anywhere}
.gi-ask-who button{background:none;border:0;padding:0;margin-left:4px;color:var(--green);font:600 12px var(--font);cursor:pointer}
.gi-ask-who button:hover{text-decoration:underline}
.gi-askpill{position:fixed;left:50%;bottom:calc(18px + var(--gi-cc-h,0px));z-index:9970;display:inline-flex;align-items:center;gap:10px;padding:7px 18px 7px 7px;border-radius:999px;border:1px solid rgba(255,255,255,.12);background:var(--ink);color:#fff;font:14px/1 var(--font);cursor:pointer;box-shadow:0 18px 40px -16px rgba(11,19,36,.6);opacity:0;visibility:hidden;transform:translate(-50%,18px);transition:opacity .28s ease,transform .32s cubic-bezier(.2,.7,.2,1),bottom .25s ease,visibility 0s linear .32s}
.gi-askpill.show{opacity:1;visibility:visible;transform:translate(-50%,0);transition:opacity .28s ease,transform .32s cubic-bezier(.2,.7,.2,1),bottom .25s ease,visibility 0s}
.gi-askpill:hover{background:var(--ink-hover)}
.gi-askpill b{font-weight:700}
.gi-askpill-hint{color:var(--on-band-3);font-size:13px}
.gi-ask-on .gi-askpill{opacity:0;visibility:hidden}
@media(max-width:620px){
.gi-ask{place-items:end center;padding:0}
.gi-ask-card{width:100%;height:min(86vh,640px);border-radius:12px 12px 0 0;transform:translateY(24px)}
.gi-askpill{left:0;right:0;bottom:var(--gi-cc-h,0px);transform:translateY(100%);border-radius:0;justify-content:center;padding:12px 16px;border:0;border-top:1px solid rgba(255,255,255,.14)}
.gi-askpill.show{transform:none}
.gi-askpill-hint{display:none}
}
@media(max-width:734px){
body.has-lf-sticky .gi-askpill{display:none}
}

/* The Ask Coco panel's own text, field and dark theme on the docs (Bala 2026-11-14: "the chatbot in dark mode looks
   a little bit funny"): the docs' body colour and form styles must not leak in, and dark docs get a dark panel. */
.gi-ask{color:var(--ink);font-family:var(--font)}
.gi-ask .field{display:block;margin:0}
.gi-ask .field>span{display:block;font-size:13px;font-weight:600;color:var(--ink);margin:0 0 6px}
.gi-ask .field input,.gi-ask textarea,.gi-ask input[type="text"]{width:100%;font:15px/1.4 var(--font);color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:11px 13px;box-shadow:none}
.gi-ask .field input:focus,.gi-ask textarea:focus,.gi-ask input[type="text"]:focus{outline:2px solid var(--green);outline-offset:1px}
.gi-ask input[type="checkbox"]{accent-color:var(--green);background:none;width:auto}
:root[data-theme="dark"] .gi-ask-bg,:root[data-theme="dark"] .gi-ask{--card:#1D1D1F;--ink:#F5F5F7;--ink2:#D2D2D7;--line:#3A3A3C;--muted:#A1A1A6;--paper:#101112;--green:#1DD39E}
.gi-ask .btn-dark{display:inline-flex;align-items:center;justify-content:center;font:600 14px/1.2 var(--font);padding:11px 22px;border-radius:999px;border:0;cursor:pointer;background:#1D1D1F;color:#fff}
:root[data-theme="dark"] .gi-ask .btn-dark{background:#F5F5F7;color:#1D1D1F}
