/* davgtz docs: layout, type and components. Tool mockups live in mock.css. */

@font-face { font-family: "Inter"; src: url("fonts/inter-var-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-var-latin.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Consolas, "Liberation Mono", monospace;
    --rail-w: 272px;
    --toc-w: 224px;
    --top-h: 56px;
    --measure: 800px;
    --r: 4px;

    /* Dark: the FontOps window's own surfaces */
    --bg-rail: #0E0E0E;
    --bg: #131313;
    --bg-raised: #1B1C1C;
    --bg-raised-2: #1F2020;
    --bg-high: #2A2A2A;
    --bg-highest: #353535;
    --text: #E4E2E1;
    --text-2: #C2C7D1;
    --text-3: #8C919B;
    --accent: #A2C9FF;
    --accent-strong: #3A72B0;
    --accent-strong-hover: #4A85C4;
    --on-accent: #F0F4FF;
    --accent-wash: rgba(58, 114, 176, 0.18);
    --amber: #F9BB59;
    --amber-wash: rgba(249, 187, 89, 0.10);
    --success: #64C864;
    --success-wash: rgba(100, 200, 100, 0.08);
    --error: #FFB4AB;
    --error-wash: rgba(255, 180, 171, 0.08);
    --note-wash: rgba(162, 201, 255, 0.07);
    --hairline: rgba(255, 255, 255, 0.07);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.35);
    --scrim: rgba(0, 0, 0, 0.72);
    --icon-grad: linear-gradient(135deg, #4A8AD4 0%, #3A72B0 50%, #2D5A8E 100%);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg-rail: #F0F0EE;
    --bg: #FBFBFA;
    --bg-raised: #F2F2F0;
    --bg-raised-2: #E9E9E6;
    --bg-high: #E2E2DF;
    --bg-highest: #D6D6D2;
    --text: #1B1C1C;
    --text-2: #3B4048;
    --text-3: #5F646D;
    --accent: #2A5A92;
    --accent-strong: #3A72B0;
    --accent-strong-hover: #2D5A8E;
    --on-accent: #FFFFFF;
    --accent-wash: rgba(58, 114, 176, 0.12);
    --amber: #8A5800;
    --amber-wash: rgba(249, 187, 89, 0.20);
    --success: #2E7D32;
    --success-wash: rgba(46, 125, 50, 0.08);
    --error: #B3261E;
    --error-wash: rgba(179, 38, 30, 0.07);
    --note-wash: rgba(58, 114, 176, 0.07);
    --hairline: rgba(0, 0, 0, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
    --scrim: rgba(20, 20, 20, 0.6);
    color-scheme: light;
}

/* ── Base ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
    margin: 0;
    font: 400 16px/1.7 var(--font);
    font-feature-settings: "cv11", "ss01";
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-wash); }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 14px; background: var(--accent-strong); color: var(--on-accent); border-radius: var(--r); }
.skip-link:focus { left: 8px; }

/* ── Top bar ──────────────────────────────────────────── */

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--top-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 16px 0 20px;
    background: var(--bg-rail);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand-icon {
    width: 28px; height: 28px; flex: none;
    display: grid; place-items: center;
    background: var(--icon-grad); color: #fff;
    border-radius: var(--r);
    font: 700 15px/1 var(--font);
    box-shadow: 0 2px 8px rgba(58, 114, 176, 0.35);
}
.brand-name { font-size: 15px; letter-spacing: 0.01em; }
.brand-hub { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px;
    font: 700 10.5px/1.6 var(--font); letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-2); background: var(--bg-high);
    border-radius: 3px; white-space: nowrap;
}
.chip-accent { color: var(--accent); background: var(--accent-wash); }
.chip-amber { color: var(--amber); background: var(--amber-wash); }
.chip-success { color: var(--success); background: var(--success-wash); }

.search-trigger {
    margin-left: 24px;
    flex: 0 1 420px; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    height: 36px; padding: 0 10px 0 12px;
    background: var(--bg-raised); color: var(--text-3);
    border: 0; border-radius: var(--r);
    font: 400 14px var(--font); text-align: left; cursor: pointer;
}
.search-trigger:hover { background: var(--bg-raised-2); color: var(--text-2); }
.search-trigger span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd, .kbd {
    font: 600 11px/1 var(--mono);
    padding: 3px 5px;
    color: var(--text-2); background: var(--bg-high);
    border-radius: 3px; box-shadow: inset 0 -1px 0 var(--hairline);
}
.topbar-spacer { flex: 1; }
.top-link { color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; padding: 6px 8px; border-radius: var(--r); white-space: nowrap; }
.top-link:hover { color: var(--text); background: var(--bg-raised); }
.icon-btn {
    width: 36px; height: 36px; flex: none;
    display: grid; place-items: center;
    background: transparent; color: var(--text-2);
    border: 0; border-radius: var(--r);
    font: 400 17px/1 var(--font); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-raised); color: var(--text); }
.menu-btn { display: none; margin-left: -8px; }

/* ── Layout ───────────────────────────────────────────── */

.layout {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--toc-w);
    min-height: calc(100vh - var(--top-h));
}
.layout.no-toc { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.layout { background: linear-gradient(to right, var(--bg-rail) var(--rail-w), var(--bg) var(--rail-w)); }

.sidebar {
    position: sticky; top: var(--top-h);
    height: calc(100vh - var(--top-h));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 12px 12px 40px 16px;
    background: var(--bg-rail);
    scrollbar-width: thin;
}
.side-back { display: block; margin: 4px 8px 14px; font-size: 12px; font-weight: 600; color: var(--text-3); text-decoration: none; }
.side-back:hover { color: var(--text); }
.side-group { margin: 0 0 18px; }
.side-label {
    margin: 0 0 4px; padding: 0 10px;
    font: 700 10.5px/2 var(--font); letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-3);
}
.side-group ul { list-style: none; margin: 0; padding: 0; }
.side-group a {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    font-size: 14px; line-height: 1.4; font-weight: 500;
    color: var(--text-2); text-decoration: none;
    border-radius: var(--r);
}
.side-group a:hover { color: var(--text); background: var(--bg-raised); }
.side-group a[aria-current="page"] {
    color: var(--accent); background: var(--accent-wash);
    box-shadow: inset 2px 0 0 var(--accent);
    font-weight: 600;
}
.side-group a .chip { margin-left: auto; font-size: 9px; padding: 1px 5px; }
.side-sub { margin: 2px 0 6px 12px !important; }
.side-sub a { font-size: 13px; padding: 4px 10px; color: var(--text-3); }

.content { min-width: 0; padding: 32px 48px 64px; }
.article { max-width: var(--measure); margin: 0 auto; }

.toc {
    position: sticky; top: var(--top-h);
    height: calc(100vh - var(--top-h));
    overflow-y: auto;
    padding: 36px 20px 40px 8px;
    font-size: 13px;
    scrollbar-width: thin;
}
.toc-label { margin: 0 0 8px; font: 700 10.5px/2 var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 0 4px 12px; color: var(--text-3); text-decoration: none; line-height: 1.4; box-shadow: inset 1px 0 0 var(--hairline); }
.toc a:hover { color: var(--text); }
.toc a.lvl-3 { padding-left: 24px; font-size: 12.5px; }
.toc a.active { color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.toc-actions { margin-top: 16px; padding-left: 12px; }
.toc-actions a { color: var(--text-3); font-size: 12px; text-decoration: none; }
.toc-actions a:hover { color: var(--text); }

/* ── Page header ──────────────────────────────────────── */

.article .crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 13px; color: var(--text-3); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--text-3); }
.crumbs a { color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.page-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }

/* ── Prose ────────────────────────────────────────────── */

.article h1 { margin: 0; font-size: 38px; line-height: 1.15; font-weight: 750; letter-spacing: -0.022em; text-wrap: balance; }
.article h2 {
    margin: 56px 0 16px; padding-top: 4px;
    font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -0.014em;
    text-wrap: balance;
}
.article h3 { margin: 40px 0 12px; font-size: 19px; line-height: 1.35; font-weight: 650; letter-spacing: -0.006em; }
.article h4 { margin: 28px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.article h2 + h3 { margin-top: 20px; }
.article p, .article ul, .article ol, .article dl { margin: 0 0 18px; }
.article ul, .article ol { padding-left: 24px; }
.article li { margin: 0 0 8px; }
.article li > ul, .article li > ol { margin: 8px 0 0; }
.article strong { font-weight: 650; color: var(--text); }
.article p, .article li, .article dd, .article td, figcaption, .details-body { overflow-wrap: break-word; }
.article hr { border: 0; height: 1px; background: var(--hairline); margin: 40px 0; }
.lead, .doc-subtitle { margin: 12px 0 0; font-size: 19px; line-height: 1.6; color: var(--text-2); text-wrap: pretty; }
.doc-version { display: none; }

.anchor {
    margin-left: 8px; padding: 0 4px;
    font-weight: 500; color: var(--text-3); text-decoration: none;
    opacity: 0; transition: opacity 0.12s;
    border: 0; background: none; cursor: pointer; font-size: 0.8em;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor.copied::after { content: " copied"; font-size: 12px; font-weight: 600; color: var(--success); }

code {
    font: 500 0.86em/1 var(--mono);
    padding: 0.18em 0.38em;
    background: var(--bg-high); color: var(--text);
    border-radius: 3px;
    overflow-wrap: break-word;
}
pre {
    position: relative;
    margin: 0 0 22px; padding: 16px 18px;
    background: var(--bg-rail);
    border-radius: var(--r);
    overflow-x: auto;
    font: 450 13.5px/1.65 var(--mono);
    scrollbar-width: thin;
}
:root[data-theme="light"] pre { background: #1B1C1C; color: #E4E2E1; }
code, pre { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
h1 code, h2 code, h3 code { font-size: 0.8em; font-weight: 600; padding: 0.1em 0.3em; }
.lead code { font-size: 0.8em; }
pre code { padding: 0; background: none; font: inherit; color: inherit; overflow-wrap: normal; }
.copy-btn {
    position: absolute; top: 8px; right: 8px;
    padding: 4px 8px;
    font: 700 10.5px/1.4 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
    color: #C2C7D1; background: #2A2A2A;
    border: 0; border-radius: 3px; cursor: pointer;
    opacity: 0; transition: opacity 0.12s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: #353535; color: #fff; }
.copy-btn.copied { color: #64C864; opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

.ui {
    font: 700 0.74em/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase;
    padding: 0.32em 0.6em;
    color: var(--text); background: var(--bg-highest);
    border-radius: 3px; white-space: nowrap;
    vertical-align: 0.08em;
}
.ui.primary { background: var(--accent-strong); color: var(--on-accent); }

/* Tables */
.table-wrap { margin: 0 0 24px; overflow-x: auto; border-radius: var(--r); background: var(--bg-raised); scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
th {
    padding: 10px 14px; text-align: left; vertical-align: bottom;
    font: 700 10.5px/1.4 var(--font); letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-3); background: var(--bg-raised-2);
}
td { padding: 11px 14px; vertical-align: top; border-top: 1px solid var(--hairline); color: var(--text-2); }
td:first-child { color: var(--text); }
td code { font-size: 0.84em; }
.table-wrap > table:has(th:nth-child(3)) { min-width: 560px; }

/* Callouts */
.doc-note, .doc-tip, .doc-warning, .callout {
    position: relative;
    margin: 0 0 22px; padding: 14px 18px 14px 20px;
    font-size: 15px; line-height: 1.65; color: var(--text-2);
    background: var(--note-wash);
    border-radius: var(--r);
    box-shadow: inset 3px 0 0 var(--accent);
}
.doc-note::before, .doc-tip::before, .doc-warning::before {
    display: block; margin-bottom: 2px;
    font: 700 10.5px/1.8 var(--font); letter-spacing: 0.14em; text-transform: uppercase;
}
.doc-note::before { content: "Note"; color: var(--accent); }
.doc-tip { background: var(--success-wash); box-shadow: inset 3px 0 0 var(--success); }
.doc-tip::before { content: "Tip"; color: var(--success); }
.doc-warning { background: var(--amber-wash); box-shadow: inset 3px 0 0 var(--amber); }
.doc-warning::before { content: "Watch out"; color: var(--amber); }
.doc-note > :last-child, .doc-tip > :last-child, .doc-warning > :last-child { margin-bottom: 0; }
.doc-note ul, .doc-tip ul, .doc-warning ul { margin-top: 6px; }

.doc-card { margin: 0 0 22px; padding: 18px 20px; background: var(--bg-raised); border-radius: var(--r); }
.doc-card > :last-child { margin-bottom: 0; }

/* Steps */
.doc-steps { counter-reset: step; list-style: none; padding-left: 0 !important; margin: 0 0 24px; }
.doc-steps > li { counter-increment: step; position: relative; padding: 2px 0 0 44px; margin: 0 0 14px; }
.doc-steps > li::before {
    content: counter(step);
    position: absolute; left: 0; top: 1px;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    font: 700 13px/1 var(--font);
    color: var(--accent); background: var(--accent-wash);
    border-radius: var(--r);
}

/* Apply confidence dots */
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: var(--bg-highest); vertical-align: 0.05em; }
.dot.good { background: var(--success); }
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--error); }

/* Definition lists */
.article dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
.article dt { font-weight: 650; }
.article dd { margin: 0; color: var(--text-2); }

/* Details (FAQ, troubleshooting) */
details { margin: 0 0 8px; background: var(--bg-raised); border-radius: var(--r); }
details > summary {
    list-style: none; cursor: pointer;
    padding: 13px 16px 13px 40px; position: relative;
    font-weight: 600; color: var(--text);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; position: absolute; left: 16px; top: 13px; color: var(--text-3); transition: transform 0.15s; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { color: var(--accent); }
details > .details-body { padding: 0 18px 4px 40px; color: var(--text-2); font-size: 15px; }

/* Feature and task cards */
.doc-features, .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0 0 28px; }
.doc-feature-card, .card {
    display: flex; flex-direction: column;
    padding: 16px 18px;
    background: var(--bg-raised); color: var(--text-2);
    border-radius: var(--r); text-decoration: none;
    transition: background 0.12s;
}
a.doc-feature-card:hover, a.card:hover { background: var(--bg-raised-2); }
.doc-feature-card h3, .card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; letter-spacing: 0; color: var(--text); }
.doc-feature-card p, .card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-3); }
.card .card-cta { margin-top: auto; padding-top: 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.card-thumb { margin: -16px -18px 14px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r) var(--r) 0 0; background: #0E0E0E; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }

/* ── Media ────────────────────────────────────────────── */

figure { margin: 0 0 28px; }
.shot, .clip, .compare-fig { margin: 8px 0 28px; }
.frame {
    position: relative;
    display: block;
    background: #0E0E0E;
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.frame img, .frame video { width: 100%; }
.frame.pad { padding: 14px; background: #1B1C1C; }
.frame.pad img { margin: 0 auto; width: auto; }
.shot .frame { cursor: zoom-in; }
.shot .frame:focus-visible { outline-offset: 3px; }
figcaption { margin: 10px 2px 0; font-size: 13.5px; line-height: 1.55; color: var(--text-3); }
figcaption strong { color: var(--text-2); font-weight: 600; }
.shot.narrow { max-width: 480px; }
.clip.narrow { max-width: 460px; }
.shot.small { max-width: 380px; }
.shot.center, .shot.narrow.center, .shot.small.center { margin-left: auto; margin-right: auto; }
.shots { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 14px; margin: 8px 0 28px; align-items: start; }
.shots .shot { margin: 0; }
.shots.three { --cols: 3; }
.zoom-hint {
    position: absolute; right: 8px; bottom: 8px;
    padding: 3px 7px;
    font: 700 10px/1.4 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
    color: #E4E2E1; background: rgba(14, 14, 14, 0.8);
    border-radius: 3px; opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
.frame:hover .zoom-hint, .frame:focus-visible .zoom-hint { opacity: 1; }

.clip .frame { cursor: default; }
.clip-badge {
    position: absolute; left: 8px; top: 8px;
    padding: 3px 7px;
    font: 700 10.5px/1.4 var(--font); letter-spacing: 0.03em;
    color: #E4E2E1; background: rgba(14, 14, 14, 0.8); border-radius: 3px;
}
.clip-toggle {
    position: absolute; right: 8px; bottom: 8px;
    width: 32px; height: 32px; display: grid; place-items: center;
    color: #E4E2E1; background: rgba(14, 14, 14, 0.8);
    border: 0; border-radius: var(--r); cursor: pointer; font-size: 13px;
}
.clip-toggle:hover { background: #2A2A2A; }

/* Before/after slider */
.compare { position: relative; overflow: hidden; border-radius: var(--r); background: #0E0E0E; box-shadow: var(--shadow); --pos: 50%; touch-action: pan-y; user-select: none; }
.compare img { width: 100%; pointer-events: none; }
.compare .after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.compare .divider { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #A2C9FF; pointer-events: none; }
.compare .divider::after {
    content: "◀ ▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    padding: 6px 8px; font: 700 10px/1 var(--font); letter-spacing: 2px; white-space: nowrap;
    color: #0E0E0E; background: #A2C9FF; border-radius: var(--r);
}
.compare .tag { position: absolute; top: 10px; padding: 3px 8px; font: 700 10.5px/1.4 var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: #E4E2E1; background: rgba(14, 14, 14, 0.8); border-radius: 3px; pointer-events: none; }
.compare .tag.l { left: 10px; }
.compare .tag.r { right: 10px; }
.compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.compare input[type="range"]:focus-visible + .divider { outline: 2px solid #fff; }

/* Lightbox */
.lightbox { padding: 0; border: 0; max-width: none; max-height: none; width: 100vw; height: 100vh; background: transparent; }
.lightbox::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.lightbox-inner { width: 100%; height: 100%; overflow: auto; display: grid; place-items: center; padding: 56px 24px 24px; cursor: zoom-out; }
.lightbox img { max-width: none; width: auto; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6); border-radius: var(--r); cursor: zoom-out; }
.lightbox.fit img { max-width: calc(100vw - 48px); max-height: calc(100vh - 96px); }
.lightbox-bar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: #E4E2E1; font-size: 13px; background: rgba(14, 14, 14, 0.86); }
.lightbox-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar button { padding: 6px 10px; color: #E4E2E1; background: #2A2A2A; border: 0; border-radius: var(--r); font: 700 11px var(--font); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.lightbox-bar button:hover { background: #353535; }

/* ── Search ───────────────────────────────────────────── */

.search-dialog { width: min(680px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 80px)); margin: 72px auto auto; padding: 0; border: 0; border-radius: 6px; background: var(--bg-raised); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5); overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: var(--scrim); }
.search-field { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg-rail); }
.search-field input { flex: 1; min-width: 0; height: 36px; padding: 0 4px; border: 0; outline: none; background: transparent; color: var(--text); font: 400 17px var(--font); }
.search-field input::placeholder { color: var(--text-3); }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results li { margin: 0; }
.search-results a { display: block; padding: 10px 12px; border-radius: var(--r); color: var(--text-2); text-decoration: none; }
.search-results a .r-path { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-3); }
.search-results a .r-title { display: block; font-weight: 600; color: var(--text); }
.search-results a .r-snip { display: block; font-size: 13.5px; line-height: 1.5; color: var(--text-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-results a mark { background: none; color: var(--accent); font-weight: 650; }
.search-results a.sel, .search-results a:hover { background: var(--accent-wash); }
.search-empty, .search-foot { padding: 16px 18px; font-size: 13px; color: var(--text-3); }
.search-foot { padding: 8px 14px; background: var(--bg-rail); display: flex; gap: 14px; }

/* ── Page footer ──────────────────────────────────────── */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 72px 0 0; }
.pager a { display: block; padding: 14px 18px; background: var(--bg-raised); border-radius: var(--r); text-decoration: none; color: var(--text); }
.pager a:hover { background: var(--bg-raised-2); }
.pager small { display: block; font: 700 10.5px/1.8 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.pager span { font-weight: 600; color: var(--accent); }
.pager .next { grid-column: 2; text-align: right; }
.page-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin: 32px 0 0; padding: 20px 0 0; font-size: 13px; color: var(--text-3); box-shadow: 0 -1px 0 var(--hairline); }
.page-foot a { color: var(--text-3); }
.page-foot a:hover { color: var(--text); }

/* ── Changelog ────────────────────────────────────────── */

.changelog-version { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.changelog-date { font-size: 14px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.changelog-tag { display: inline-block; margin: 8px 0 8px; padding: 3px 8px; font: 700 10.5px/1.4 var(--font); letter-spacing: 0.12em; border-radius: 3px; }
.changelog-added { background: var(--success-wash); color: var(--success); }
.changelog-changed { background: var(--accent-wash); color: var(--accent); }
.changelog-fixed { background: var(--amber-wash); color: var(--amber); }
.changelog-removed { background: var(--error-wash); color: var(--error); }

/* ── Product overview (hero) ──────────────────────────── */

.hero { margin: 0 0 40px; }
.hero-head { display: flex; align-items: center; gap: 16px; }
.hero-head .brand-icon { width: 52px; height: 52px; font-size: 26px; border-radius: 6px; }
.hero h1 { font-size: 44px; }
.hero .lead { max-width: 640px; font-size: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    font: 700 12px/1.2 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text); background: var(--bg-highest);
    border: 0; border-radius: var(--r); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--bg-high); filter: brightness(1.15); }
.btn-primary { background: var(--accent-strong); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong-hover); filter: none; }
.hero-media { margin: 32px 0 0; }

/* ── Hub ──────────────────────────────────────────────── */

.hub { max-width: 1040px; margin: 0 auto; padding: 72px 24px 56px; }
.hub-head h1 { margin: 6px 0 10px; font-size: 44px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 750; }
.hub-head p { margin: 0; font-size: 19px; color: var(--text-2); max-width: 600px; }
.hub-kicker { font: 700 12px/1 var(--font); letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-3); }
.hub-label { margin: 56px 0 14px; font: 700 11px/1 var(--font); letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); }
.product {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0;
    background: var(--bg-raised); border-radius: 6px; overflow: hidden;
}
.product-body { padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.product-title { display: flex; align-items: center; gap: 14px; }
.product-title .brand-icon { width: 44px; height: 44px; font-size: 22px; border-radius: 6px; }
.product-title h2 { margin: 0; font-size: 26px; letter-spacing: -0.015em; }
.product-title a { color: inherit; text-decoration: none; }
.product-body p { margin: 0; color: var(--text-2); font-size: 15.5px; }
.product-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.product-links { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.product-links a { display: block; padding: 5px 0; font-size: 14px; font-weight: 500; text-decoration: none; }
.product-links a:hover { text-decoration: underline; }
.product-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.product-media { position: relative; background: #0E0E0E; min-height: 260px; }
.product-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.hub-foot { max-width: 1040px; margin: 0 auto; padding: 24px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 13px; color: var(--text-3); box-shadow: 0 -1px 0 var(--hairline); }
.hub-foot a { color: var(--text-3); }
.hub-foot a:hover { color: var(--text); }
.hub-top { position: static; }

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 1240px) {
    .layout { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
    .toc { display: none; }
}
@media (max-width: 960px) {
    .menu-btn { display: grid; }
    .layout, .layout.no-toc { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
    .sidebar {
        position: fixed; z-index: 40; top: var(--top-h); left: 0; bottom: 0;
        width: min(320px, 86vw); height: auto;
        transform: translateX(-100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
    }
    body.nav-open .sidebar { transform: none; visibility: visible; }
    body.nav-open::after { content: ""; position: fixed; inset: var(--top-h) 0 0 0; z-index: 35; background: var(--scrim); }
    .content { padding: 24px 24px 56px; }
    .top-link.hide-sm { display: none; }
    .product { grid-template-columns: 1fr; }
    .product-media { min-height: 0; aspect-ratio: 16 / 10; }
}
@media (max-width: 640px) {
    :root { --top-h: 52px; }
    body { font-size: 16px; }
    .topbar { gap: 4px; padding: 0 8px 0 16px; }
    .search-trigger { margin-left: auto; flex: none; width: 36px; padding: 0; justify-content: center; background: transparent; }
    .search-trigger span, .search-trigger kbd { display: none; }
    .search-trigger::before { content: "⌕"; font-size: 22px; line-height: 1; color: var(--text-2); }
    .topbar-spacer { display: none; }
    .brand .chip { display: none; }
    .content { padding: 20px 16px 48px; }
    .article h1 { font-size: 30px; }
    .hero h1 { font-size: 34px; }
    .article h2 { font-size: 22px; margin-top: 48px; }
    .article h3 { font-size: 18px; }
    .lead, .doc-subtitle { font-size: 17px; }
    .shots, .shots.three { grid-template-columns: 1fr; }
    .pager { grid-template-columns: 1fr; }
    .pager .next { grid-column: 1; }
    .article dl { grid-template-columns: 1fr; gap: 2px; }
    .article dd { margin-bottom: 10px; }
    .hub { padding: 40px 16px 40px; }
    .hub-head h1 { font-size: 34px; }
    .product-body { padding: 22px 18px 18px; }
    .product-links { grid-template-columns: 1fr; }
    .hub-foot { padding: 20px 16px; }
    .doc-note, .doc-tip, .doc-warning { padding: 12px 14px 12px 16px; }
    .table-wrap > table:has(th:nth-child(3)) { min-width: 520px; }
    .clip-badge { left: 5px; top: 5px; padding: 1px 5px; font-size: 9.5px; }
    .clip-toggle { right: 5px; bottom: 5px; width: 24px; height: 24px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
    .topbar, .sidebar, .toc, .pager, .copy-btn, .anchor { display: none !important; }
    .layout { display: block; }
}
