/* ==========================================================================
   IPNET: engineering-docs theme
   ========================================================================== */

:root {
    --accent: #4c9aff;
    --accent-2: #2ee6c5;
    --ctrl: #b58cff;

    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --topbar-h: 64px;
    --sidebar-w: 276px;
    --radius: 12px;
    --radius-sm: 8px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Dark (default) */
:root,
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #080b10;
    --bg-2: #0c1016;
    --surface: #10151d;
    --surface-2: #151c26;
    --border: #1c2430;
    --border-2: #273142;
    --text: #e8edf3;
    --text-2: #b3bdca;
    --muted: #7d8898;
    --code-bg: #0b0f15;
    --code-text: #d6deea;
    --glass: rgba(8, 11, 16, .72);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 50px -20px rgba(0, 0, 0, .6);
    --grid-line: rgba(140, 170, 210, .06);
}

/* Light */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #ffffff;
    --bg-2: #f7f9fb;
    --surface: #f4f6f9;
    --surface-2: #eceff4;
    --border: #e3e7ed;
    --border-2: #d3d9e2;
    --text: #0d141d;
    --text-2: #3a4553;
    --muted: #677384;
    --code-bg: #0d131b;
    --code-text: #d6deea;
    --glass: rgba(255, 255, 255, .78);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px -24px rgba(15, 23, 42, .25);
    --grid-line: rgba(30, 60, 110, .06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 24px); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Reading progress --------------------------------------------------------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 100; pointer-events: none; }
.progress span {
    display: block; height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transform: scaleX(var(--p, 0)); transform-origin: 0 50%;
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* Top bar ------------------------------------------------------------------ */
.topbar {
    position: sticky; top: 0; z-index: 60;
    height: var(--topbar-h);
    background: var(--glass);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 28px; padding: 0 24px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .06em; font-size: 16px; }
.brand-mark { color: var(--accent); fill: var(--accent); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 55%, transparent)); }
.brand-mark path { stroke: color-mix(in srgb, var(--accent) 70%, var(--text)); }
.brand-name { text-transform: uppercase; }

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav .nav { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.topnav a {
    display: block; padding: 7px 12px; border-radius: 8px;
    color: var(--text-2); font-weight: 500; font-size: 14px;
    transition: color .15s, background .15s;
}
.topnav a:hover { color: var(--text); background: var(--surface); }
.topnav .nav-current a { color: var(--text); }
.topnav .nav-library, .topnav .nav-home { display: none; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-btn {
    display: inline-flex; align-items: center; gap: 10px;
    height: 36px; min-width: 220px; padding: 0 8px 0 12px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--muted); font-size: 13.5px;
    cursor: pointer; transition: border-color .15s, color .15s;
}
.search-btn:hover { border-color: var(--border-2); color: var(--text-2); }
.search-btn kbd {
    margin-left: auto; font-family: var(--font-mono); font-size: 11.5px;
    padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--muted);
}

.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
    cursor: pointer; color: var(--text-2); transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.menu-toggle { display: none; }
:root[data-theme="dark"] .i-moon, :root:not([data-theme]) .i-moon { display: none; }
:root[data-theme="light"] .i-sun { display: none; }

/* Shell -------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar {
    position: sticky; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 28px 16px 48px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg-2);
    scrollbar-width: thin;
}
.scrim { display: none; }

.main { min-width: 0; padding: 0 56px; }

/* Sidebar library tree */
.lib-title {
    display: flex; align-items: center; gap: 8px; margin: 0 0 14px 8px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.lib-title:hover { color: var(--text); }
.lib-group { margin: 0 0 2px; }
.lib-group summary {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 8px;
    font-weight: 600; font-size: 14px; color: var(--text-2);
    cursor: pointer; list-style: none; user-select: none;
    transition: background .15s, color .15s;
}
.lib-group summary::-webkit-details-marker { display: none; }
.lib-group summary::before {
    content: ""; width: 6px; height: 6px; flex: none;
    border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
    transform: rotate(-45deg); opacity: .55; transition: transform .2s var(--ease);
}
.lib-group[open] > summary::before { transform: rotate(45deg); }
.lib-group summary:hover { background: var(--surface); color: var(--text); }
.lib-group.is-active > summary { color: var(--text); }
.lib-group ul { list-style: none; margin: 4px 0 10px 17px; padding: 0 0 0 10px; border-left: 1px solid var(--border); }
.lib-group li a {
    position: relative; display: block; padding: 6px 10px; border-radius: 6px;
    font-size: 13.5px; line-height: 1.4; color: var(--muted);
    transition: color .15s, background .15s;
}
.lib-group li a:hover { color: var(--text); background: var(--surface); }
.lib-group li a.is-current { color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }
.lib-group li a.is-current::before {
    content: ""; position: absolute; left: -11px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px;
    background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.lib-group li a.lib-all { font-size: 12.5px; color: var(--muted); opacity: .8; }
.lib-group li a.lib-all::after { content: " \2192"; }

/* Buttons & bits ------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 44px; padding: 0 18px; border-radius: 11px;
    font-weight: 600; font-size: 14.5px;
    transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn-primary {
    background: var(--accent); color: #fff;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, white) inset, 0 10px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, white) inset, 0 16px 40px -12px var(--accent); }
.btn-ghost { border: 1px solid var(--border-2); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--muted); transform: translateY(-1px); }

.pill {
    display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

.eyebrow {
    display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
    padding: 6px 12px 6px 10px; border-radius: 999px;
    border: 1px solid var(--border-2); background: var(--surface);
    font-size: 12.5px; color: var(--text-2);
}
.eyebrow-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 20%, transparent), 0 0 12px var(--accent-2);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-2) 0%, transparent), 0 0 18px var(--accent-2); } }

/* Hero --------------------------------------------------------------------- */
.hero {
    position: relative;
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: center;
    max-width: 1240px; margin: 0 auto; padding: 88px 0 72px;
}
.hero-bg {
    position: absolute; inset: 0 -56px; z-index: -1; pointer-events: none;
    background:
        radial-gradient(600px 320px at 78% 42%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
        radial-gradient(420px 260px at 12% 10%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 44px 44px;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
            mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.hero-title {
    margin: 0 0 20px;
    font-size: clamp(36px, 3.7vw, 56px); line-height: 1.05; letter-spacing: -.035em; font-weight: 800;
    background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--text) 55%, var(--accent)));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    text-wrap: balance;
}
.hero-sub { margin: 0 0 32px; max-width: 520px; font-size: 18px; line-height: 1.6; color: var(--text-2); text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 34px; }
.hero-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hero-topics a {
    display: inline-block; padding: 5px 11px; border-radius: 8px;
    font-family: var(--font-mono); font-size: 12px; color: var(--muted);
    border: 1px dashed var(--border-2); transition: color .15s, border-color .15s;
}
.hero-topics a:hover { color: var(--accent); border-color: var(--accent); }

.topo-card {
    position: relative; border-radius: 18px; overflow: hidden;
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--border-2); box-shadow: var(--shadow);
}
.topo-card::before {
    content: ""; position: absolute; inset: -1px; border-radius: 18px; padding: 1px; pointer-events: none;
    background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 70%, transparent), transparent 35%, transparent 65%, color-mix(in srgb, var(--accent-2) 50%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
}
.topo-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.topo-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); }
.topo-bar em { margin-left: 10px; font-style: normal; font-size: 12px; color: var(--muted); }
.topo { display: block; width: 100%; height: auto; padding: 12px 8px 4px; }
.topo .links path { fill: none; stroke: var(--border-2); stroke-width: 1.6; }
.topo .links .links-ctrl { stroke: color-mix(in srgb, var(--ctrl) 45%, transparent); stroke-dasharray: 4 5; animation: dash 1.6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -18; } }
.topo .node rect { fill: var(--bg-2); stroke: var(--border-2); stroke-width: 1.2; }
.topo .node text { fill: var(--text-2); font: 600 11.5px var(--font-mono); text-anchor: middle; }
.topo .node-core rect { stroke: color-mix(in srgb, var(--accent) 55%, var(--border-2)); }
.topo .node-rr rect { stroke: color-mix(in srgb, var(--ctrl) 65%, var(--border-2)); fill: color-mix(in srgb, var(--ctrl) 10%, var(--bg-2)); }
.topo .node-edge rect { stroke-dasharray: 3 3; }
.topo .pk { fill: var(--accent); }
.topo .pk-2 { fill: var(--accent-2); }
.topo .pk-ctrl { fill: var(--ctrl); }
.topo-legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 16px 14px; font-size: 11.5px; color: var(--muted); }
.topo-legend span { display: inline-flex; align-items: center; gap: 7px; }
.topo-status { margin-left: auto; color: var(--accent-2); }
.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg-data { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.lg-ctrl { background: var(--ctrl); box-shadow: 0 0 8px var(--ctrl); }
.lg-up { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }

/* Sections ------------------------------------------------------------------ */
.section { max-width: 1240px; margin: 0 auto; padding: 36px 0 24px; }
.section-tight { padding-top: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.section-title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.section-link { font-size: 14px; font-weight: 600; color: var(--accent); }
.section-link::after { content: " \2192"; }

/* Topic cards */
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.topic {
    --mx: 50%; --my: 0%;
    position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 196px;
    padding: 22px 22px 20px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    overflow: hidden; isolation: isolate;
    transition: transform .25s var(--ease), border-color .25s;
}
.topic::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .3s;
    background: radial-gradient(360px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%);
}
.topic:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.topic:hover::before { opacity: 1; }
.topic-path { font-size: 12px; color: var(--accent); }
.topic-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.topic-desc { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.topic-latest { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--border-2); display: grid; gap: 4px; }
.topic-post { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-post::before { content: "\203A  "; color: var(--accent); }

/* Article rows */
.rows { display: grid; border-top: 1px solid var(--border); }
.row {
    position: relative; display: grid; gap: 8px;
    padding: 24px 56px 24px 4px; border-bottom: 1px solid var(--border);
    transition: background .2s;
}
.row-link { position: absolute; inset: 0; z-index: 1; }
.row:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.row-title { margin: 0; font-size: 21px; line-height: 1.3; font-weight: 700; letter-spacing: -.015em; transition: color .2s; }
.row:hover .row-title { color: var(--accent); }
.row-excerpt { margin: 0; max-width: 820px; color: var(--text-2); font-size: 15px; }
.row-arrow {
    position: absolute; right: 12px; top: 50%; translate: 0 -50%;
    color: var(--muted); opacity: 0; transform: translateX(-6px);
    transition: opacity .2s, transform .2s var(--ease), color .2s;
}
.row:hover .row-arrow { opacity: 1; transform: none; color: var(--accent); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 8px; font-size: 14px; color: var(--muted); }
.pagination a { padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface); }
.pagination a:hover { border-color: var(--accent); }

/* Pages --------------------------------------------------------------------- */
.page-head { max-width: 860px; margin: 0 auto; padding: 64px 0 32px; }
.page-title { margin: 0 0 12px; font-size: clamp(32px, 3.4vw, 46px); line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.page-dek { margin: 0; font-size: 18px; color: var(--text-2); max-width: 680px; }
.page { max-width: 860px; margin: 0 auto; padding-bottom: 64px; }
.page .doc-body { max-width: none; }
.page-head .topic-path { margin: 0 0 10px; }

/* Library shelves */
.shelves { max-width: 860px; margin: 0 auto; padding: 8px 0 64px; display: grid; gap: 18px; }
.shelf { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.shelf-head { padding: 22px 24px 16px; }
.shelf-title { margin: 6px 0 4px; font-size: 22px; letter-spacing: -.015em; }
.shelf-title a:hover { color: var(--accent); }
.shelf-desc { margin: 0; color: var(--text-2); font-size: 14.5px; }
.shelf-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.shelf-list li + li { border-top: 1px solid var(--border); }
.shelf-list a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; transition: background .15s; }
.shelf-list a:hover { background: var(--surface-2); }
.shelf-list a:hover .shelf-post { color: var(--accent); }
.shelf-post { font-weight: 600; font-size: 15px; transition: color .15s; }
.shelf-meta { flex: none; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }

/* Article -------------------------------------------------------------------- */
.doc-layout {
    display: grid; grid-template-columns: minmax(0, 780px) 232px; justify-content: center; gap: 64px;
    max-width: 1240px; margin: 0 auto;
}
.doc { min-width: 0; padding: 48px 0 64px; }
.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 13px; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumb-sep { opacity: .5; }
.doc-title { margin: 0 0 16px; font-size: clamp(32px, 3.6vw, 48px); line-height: 1.08; font-weight: 800; letter-spacing: -.032em; text-wrap: balance; }
.doc-dek { margin: 0 0 22px; font-size: 19px; line-height: 1.55; color: var(--text-2); text-wrap: pretty; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-bottom: 26px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.doc-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.doc-feature { margin: 32px 0 0; }
.doc-feature img { border-radius: var(--radius); border: 1px solid var(--border); }
.doc-feature figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }

/* Content typography */
.gh-content { font-size: 16.5px; line-height: 1.75; color: var(--text-2); padding-top: 12px; }
.gh-content > * { margin: 0 0 1.25em; }
.gh-content h2, .gh-content h3, .gh-content h4 { color: var(--text); letter-spacing: -.02em; line-height: 1.25; scroll-margin-top: calc(var(--topbar-h) + 24px); }
.gh-content h2 { margin: 2.4em 0 .8em; font-size: 27px; font-weight: 750; padding-top: .9em; border-top: 1px solid var(--border); }
.gh-content > h2:first-child { border-top: 0; padding-top: 0; margin-top: 1.4em; }
.gh-content h3 { margin: 1.9em 0 .6em; font-size: 20px; font-weight: 700; }
.gh-content h4 { margin: 1.6em 0 .5em; font-size: 17px; font-weight: 700; }
.gh-content .heading-anchor { margin-left: 8px; color: var(--muted); opacity: 0; font-weight: 400; transition: opacity .15s; }
.gh-content h2:hover .heading-anchor, .gh-content h3:hover .heading-anchor { opacity: 1; }
.gh-content a:not(.kg-btn):not(.heading-anchor) { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.gh-content a:not(.kg-btn):not(.heading-anchor):hover { text-decoration-color: var(--accent); }
.gh-content strong { color: var(--text); font-weight: 650; }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li { margin: .4em 0; padding-left: .2em; }
.gh-content li::marker { color: var(--accent); }
.gh-content hr { border: 0; height: 1px; background: var(--border); margin: 2.5em 0; }
.gh-content blockquote {
    margin-left: 0; padding: 14px 20px; border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 10px 10px 0; color: var(--text);
}
.gh-content blockquote p { margin: 0; }

.gh-content code {
    font-family: var(--font-mono); font-size: .86em;
    padding: .15em .42em; border-radius: 6px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.gh-content pre {
    position: relative; margin: 1.6em 0; padding: 44px 20px 18px;
    background: var(--code-bg); border: 1px solid var(--border-2); border-radius: var(--radius);
    overflow-x: auto; box-shadow: var(--shadow);
    font-family: var(--font-mono); font-size: 13.5px; line-height: 1.65; color: var(--code-text);
    tab-size: 4;
}
.gh-content pre::before {
    content: ""; position: absolute; top: 15px; left: 18px; width: 9px; height: 9px; border-radius: 50%;
    background: #3a4452; box-shadow: 15px 0 0 #3a4452, 30px 0 0 #3a4452;
}
.gh-content pre::after {
    content: attr(data-label); position: absolute; top: 11px; left: 70px;
    font-size: 11.5px; letter-spacing: .04em; color: #6f7c8d;
}
.gh-content pre code { padding: 0; border: 0; background: none; font-size: inherit; color: inherit; }
.code-copy {
    position: absolute; top: 8px; right: 10px; z-index: 2;
    height: 26px; padding: 0 10px; border-radius: 7px; cursor: pointer;
    border: 1px solid #2a3442; background: #121822; color: #9aa6b6;
    font: 500 11.5px var(--font-mono); opacity: 0; transition: opacity .15s, color .15s, border-color .15s;
}
.code-wrap { position: relative; }
.code-wrap:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: #e6edf3; border-color: #3a4656; }
.code-copy.is-done { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); opacity: 1; }

/* Tables */
.gh-content table {
    display: block; width: 100%; overflow-x: auto; border-collapse: separate; border-spacing: 0;
    border: 1px solid var(--border); border-radius: var(--radius); font-size: 14.5px; line-height: 1.55;
}
.gh-content thead th { background: var(--surface-2); color: var(--text); font-weight: 650; text-align: left; font-size: 13px; letter-spacing: .02em; }
.gh-content th, .gh-content td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.gh-content tr:last-child td { border-bottom: 0; }
.gh-content td + td, .gh-content th + th { border-left: 1px solid var(--border); }
.gh-content tbody tr:hover td { background: var(--surface); }
.gh-content td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }

/* Key takeaways callout (built by JS from a "Key Takeaways" heading) */
.gh-content .callout {
    position: relative; margin: 8px 0 2.2em; padding: 22px 24px 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius);
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent);
}
.gh-content .callout > h2 {
    margin: 0 0 12px; padding: 0; border: 0; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.gh-content .callout ul { margin: 0 0 12px; }

/* Koenig cards */
.gh-content .kg-width-wide { position: relative; width: min(1040px, 100vw - 120px); max-width: none; left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full { position: relative; width: 100vw; max-width: none; left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full img { border-radius: 0; }
.gh-content figure { margin: 1.8em 0; }
.gh-content figure img { border-radius: var(--radius); }
.gh-content figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.gh-content .kg-card { margin: 1.8em 0; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager-link {
    display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); transition: border-color .2s, transform .2s var(--ease);
}
.pager-link:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateY(-2px); }
.pager-next { grid-column: 2; text-align: right; }
.pager-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.pager-title { font-weight: 650; color: var(--text); }

/* Table of contents */
.toc { position: relative; }
.toc-inner { position: sticky; top: calc(var(--topbar-h) + 48px); padding-top: 48px; }
.toc-title { margin: 0 0 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc-list li a {
    position: relative; display: block; padding: 5px 0 5px 14px; font-size: 13px; line-height: 1.4; color: var(--muted);
    transition: color .15s;
}
.toc-list li.toc-h3 a { padding-left: 26px; font-size: 12.5px; }
.toc-list li a:hover { color: var(--text); }
.toc-list li a.is-active { color: var(--text); }
.toc-list li a.is-active::before { content: ""; position: absolute; left: -1px; top: 4px; bottom: 4px; width: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.toc.is-empty { visibility: hidden; }

/* Error */
.error { max-width: 640px; margin: 0 auto; padding: 120px 0; text-align: center; }
.error-code { color: var(--accent); margin: 0 0 12px; }
.error .page-dek { margin: 0 auto 28px; }

/* Footer */
.site-footer { max-width: 1240px; margin: 48px auto 0; padding: 28px 0 40px; border-top: 1px solid var(--border); }
.site-footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.site-footer-brand { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.site-footer-copy { margin-left: auto; }

/* Responsive ------------------------------------------------------------------ */
@media (max-width: 1280px) {
    .doc-layout { grid-template-columns: minmax(0, 780px); }
    .toc { display: none; }
}
@media (max-width: 1100px) {
    .hero { grid-template-columns: 1fr; padding-top: 56px; gap: 40px; }
    .hero-visual { max-width: 620px; }
}
@media (max-width: 1024px) {
    :root { --sidebar-w: 300px; }
    .shell { grid-template-columns: minmax(0, 1fr); }
    .menu-toggle { display: inline-grid; }
    .sidebar {
        position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 55; width: var(--sidebar-w);
        height: auto; transform: translateX(-100%); transition: transform .3s var(--ease);
        box-shadow: 20px 0 60px rgba(0, 0, 0, .35);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 54; background: rgba(0, 0, 0, .45); }
    .main { padding: 0 28px; }
    .topnav { display: none; }
}
@media (max-width: 640px) {
    .topbar-inner { gap: 12px; padding: 0 14px; }
    .search-btn { min-width: 0; width: 36px; padding: 0; justify-content: center; }
    .search-btn span, .search-btn kbd { display: none; }
    .main { padding: 0 18px; }
    .hero { padding: 40px 0 32px; }
    .hero-sub { font-size: 16.5px; }
    .row { padding-right: 8px; }
    .row-arrow { display: none; }
    .row-title { font-size: 19px; }
    .gh-content { font-size: 16px; }
    .gh-content pre { margin-left: -18px; margin-right: -18px; border-radius: 0; border-left: 0; border-right: 0; }
    .pager { grid-template-columns: 1fr; }
    .pager-next { grid-column: auto; }
    .topo-status { margin-left: 0; }
}

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