:root,
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #090c10;
    --surface: #0f1419;
    --surface-2: #161b22;
    --border: #21262d;
    --border-light: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-faint: #6e7681;
    --accent: #4493f8;
    --accent-soft: rgba(68, 147, 248, 0.12);
    --purple: #bc8cff;
    --purple-soft: rgba(188, 140, 255, 0.12);
    --green: #3fb950;
    --warn: #d29922;
    --header-bg: rgba(9, 12, 16, 0.92);
    --overlay: rgba(0, 0, 0, 0.6);
    --row-hover: rgba(255, 255, 255, 0.02);
    --code-hover: rgba(255, 255, 255, 0.03);
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --header-h: 56px;
    --tabs-h: 40px;
    --sidebar-w: 272px;
    --toc-w: 200px;
    --radius: 8px;
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-2: #eef1f4;
    --border: #d0d7de;
    --border-light: #d8dee4;
    --text: #1f2328;
    --text-muted: #656d76;
    --text-faint: #8c959f;
    --accent: #0969da;
    --accent-soft: rgba(9, 105, 218, 0.1);
    --purple: #8250df;
    --purple-soft: rgba(130, 80, 223, 0.1);
    --green: #1a7f37;
    --warn: #9a6700;
    --header-bg: rgba(246, 248, 250, 0.92);
    --overlay: rgba(31, 35, 40, 0.4);
    --row-hover: rgba(31, 35, 40, 0.04);
    --code-hover: rgba(31, 35, 40, 0.04);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: var(--header-h);
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }

.brand-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.version-picker {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.version-select {
    appearance: none;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    max-width: 220px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    transition: border-color 0.15s;
}

.version-select:hover,
.version-select:focus {
    outline: none;
    border-color: var(--accent);
}

.version-select option[disabled] {
    color: var(--text-faint);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.version-banner {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
    background: color-mix(in srgb, var(--warn) 10%, transparent);
    color: var(--text-muted);
    font-size: 0.88rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.version-banner strong { color: var(--warn); }

.version-banner a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.version-banner a:hover { text-decoration: underline; }

.version-banner .banner-action {
    margin-left: auto;
    padding: 0.3rem 0.65rem;
    border-radius: 5px;
    border: 1px solid var(--border-light);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 180px;
    transition: border-color 0.15s;
}

.search-trigger:hover { border-color: var(--accent); color: var(--text); }

.search-icon { opacity: 0.7; }

.search-placeholder { flex: 1; text-align: left; }

.search-trigger kbd {
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    background: var(--surface-2);
    color: var(--text-faint);
}

.btn {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.btn:hover { background: var(--border); }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-accent:hover { filter: brightness(1.08); background: var(--accent); }

.btn-icon { display: none; padding: 0.4rem 0.6rem; }

.theme-toggle {
    min-width: 4.5rem;
}

/* ── Tab bar ── */
.tab-bar {
    display: flex;
    gap: 0;
    padding: 0 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--border);
    background: var(--surface);
    height: var(--tabs-h);
    align-items: stretch;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 0 1rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Search overlay ── */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: var(--overlay);
    display: flex;
    justify-content: center;
    padding-top: 12vh;
}

.search-overlay[hidden] { display: none; }

.search-panel {
    width: min(560px, 92vw);
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.search-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.search-results {
    list-style: none;
    max-height: 360px;
    overflow-y: auto;
}

.search-results li button {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.search-results li button:hover,
.search-results li button.focused { background: var(--accent-soft); }

.search-results .result-title { font-weight: 600; font-size: 0.9rem; display: block; }
.search-results .result-path { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); }

/* ── Layout ── */
.layout {
    display: flex;
    flex: 1;
    align-items: flex-start;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-h) + var(--tabs-h));
    height: calc(100vh - var(--header-h) - var(--tabs-h));
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--surface);
    padding: 0.75rem 0;
}

.sidebar-section { margin-bottom: 0.25rem; }

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--text-faint);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    cursor: pointer;
    text-align: left;
}

.sidebar-section-header:hover { color: var(--text-muted); }

.sidebar-section-header .chevron {
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.sidebar-section.collapsed .sidebar-section-header .chevron { transform: rotate(-90deg); }
.sidebar-section.collapsed .sidebar-items { display: none; }

.sidebar-items { list-style: none; padding: 0 0.5rem 0.5rem; }

.sidebar-items a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.84rem;
    line-height: 1.35;
    transition: background 0.12s, color 0.12s;
}

.sidebar-items a:hover { background: var(--surface-2); color: var(--text); }

.sidebar-items a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.item-badge {
    font-size: 0.65rem;
    padding: 0.05rem 0.35rem;
    border-radius: 10px;
    background: var(--purple-soft);
    color: var(--purple);
    font-weight: 600;
    flex-shrink: 0;
}

.main-column {
    flex: 1;
    min-width: 0;
    max-width: 780px;
    padding: 1.5rem 2.5rem 3rem;
}

.breadcrumb {
    font-size: 0.78rem;
    color: var(--text-faint);
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.4; }

.doc-header { margin-bottom: 1.5rem; }

.doc-title {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text);
}

.doc-lead {
    margin-top: 0.5rem;
    font-size: 1.05rem;
    color: var(--text-muted);
}

.proof-badge,
.grammar-badge,
.spec-badge {
    display: inline-block;
    margin-left: 0.6rem;
    vertical-align: middle;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.proof-badge {
    background: var(--purple-soft);
    color: var(--purple);
    border: 1px solid rgba(188, 140, 255, 0.25);
}

.grammar-badge {
    background: rgba(63, 185, 80, 0.12);
    color: var(--green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.spec-badge {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(68, 147, 248, 0.3);
}

/* ── Grammar / EBNF viewer ── */
.grammar-page { margin: 0 -0.5rem; }

.grammar-legend {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.grammar-legend h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legend-grid code { font-size: 0.8rem; }

.grammar-meta {
    margin-top: 0.85rem;
    font-size: 0.82rem;
    color: var(--text-faint);
}

.grammar-meta a { color: var(--accent); }

.grammar-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.grammar-index {
    position: sticky;
    top: 1rem;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.grammar-index-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    padding: 0.65rem 0.75rem 0.35rem;
}

.grammar-rule-search {
    margin: 0 0.5rem 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.78rem;
}

.grammar-rule-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 0 0.35rem 0.5rem;
}

.grammar-rule-list a {
    display: block;
    padding: 0.2rem 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 3px;
}

.grammar-rule-list a:hover { background: var(--accent-soft); color: var(--accent); }

.ebnf-section { margin-bottom: 2rem; }

.ebnf-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.ebnf-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0;
    overflow-x: auto;
    margin: 0;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.55;
}

.ebnf-line {
    display: flex;
    padding: 0.05rem 1rem 0.05rem 0;
}

.ebnf-line:hover { background: var(--code-hover); }

.ebnf-ln {
    width: 2.5rem;
    flex-shrink: 0;
    text-align: right;
    padding-right: 1rem;
    color: var(--text-faint);
    user-select: none;
    opacity: 0.5;
}

.ebnf-content { flex: 1; white-space: pre; }

.ebnf-rule-name { color: #79c0ff; font-weight: 500; }
.ebnf-def { color: var(--text-faint); }
.ebnf-terminal { color: #a5d6ff; }
.ebnf-nt { color: #d2a8ff; }
.ebnf-alt { color: var(--warn); }
.ebnf-comment { color: var(--text-faint); font-style: italic; }
.ebnf-rhs { color: var(--text); }

.markdown-body pre.language-block {
    position: relative;
    border-left: 3px solid var(--green);
}

.code-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
}

@media (max-width: 900px) {
    .grammar-layout { grid-template-columns: 1fr; }
    .grammar-index { position: static; max-height: 200px; }
}

/* ── Markdown ── */
.markdown-body { font-size: 0.95rem; line-height: 1.7; color: var(--text); }

.markdown-body > :first-child { margin-top: 0; }

.markdown-body h1 { display: none; }

.markdown-body h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 2.25rem 0 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.02em;
}

.markdown-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.75rem 0 0.6rem;
    color: var(--text);
}

.markdown-body p { margin-bottom: 1rem; }

.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }

.markdown-body code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
}

.markdown-body pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.85rem;
}

.markdown-body pre code {
    background: none;
    border: none;
    padding: 0;
}

.markdown-body blockquote {
    border-left: 3px solid var(--purple);
    padding: 0.6rem 1rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    background: var(--purple-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.markdown-body ul, .markdown-body ol { margin: 0.75rem 0 1rem; padding-left: 1.5rem; }
.markdown-body li { margin: 0.3rem 0; }
.markdown-body li > p { margin-bottom: 0.35rem; }

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.88rem;
}

.markdown-body th, .markdown-body td {
    border: 1px solid var(--border);
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.markdown-body th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.markdown-body tr:hover td { background: var(--row-hover); }

.markdown-body img { max-width: 100%; border-radius: var(--radius); }

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* KaTeX in tables */
.markdown-body .katex { font-size: 0.95em; }

/* ── TOC column ── */
.toc-column {
    width: var(--toc-w);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-h) + var(--tabs-h) + 1.5rem);
    padding: 1.5rem 1rem 2rem 0;
    max-height: calc(100vh - var(--header-h) - var(--tabs-h) - 2rem);
    overflow-y: auto;
}

.toc-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 0.6rem;
}

#pageToc { list-style: none; }

#pageToc a {
    display: block;
    padding: 0.25rem 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    padding-left: 0.6rem;
    line-height: 1.4;
    transition: color 0.12s, border-color 0.12s;
}

#pageToc a:hover { color: var(--text); }
#pageToc a.active { color: var(--accent); border-left-color: var(--accent); }
#pageToc .toc-h3 a { padding-left: 1.2rem; font-size: 0.74rem; }

/* ── Pager ── */
.doc-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.pager-link {
    flex: 1;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
    max-width: 48%;
}

.pager-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.pager-link.next { text-align: right; margin-left: auto; }
.pager-label { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 0.2rem; }
.pager-title { font-size: 0.88rem; font-weight: 500; }

.loading { color: var(--text-muted); }
.error-msg { color: #f85149; padding: 1rem; background: rgba(248, 81, 73, 0.08); border-radius: var(--radius); }

/* ── Footer ── */
.site-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-faint);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-sep { opacity: 0.35; }

/* ── Responsive ── */
@media (max-width: 1100px) {
    .toc-column { display: none; }
}

@media (max-width: 860px) {
    .version-picker { display: none; }
    .search-trigger .search-placeholder,
    .search-trigger kbd { display: none; }
    .search-trigger { min-width: auto; }
    .btn:not(.btn-icon):not(.btn-accent) { display: none; }
    .btn-icon { display: inline-flex; }

    .sidebar {
        position: fixed;
        left: 0;
        top: calc(var(--header-h) + var(--tabs-h));
        z-index: 150;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    .sidebar.open { transform: translateX(0); }

    .main-column { padding: 1.25rem 1.25rem 2.5rem; }

    .wiki-hero-title { font-size: 2rem; }
    .wiki-card-grid { grid-template-columns: 1fr; }
}

/* ── Home hero ── */
.wiki-hero {
    margin: -0.5rem 0 2rem;
    padding: 2rem 2rem 1.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(68, 147, 248, 0.14), transparent),
        radial-gradient(ellipse 60% 50% at 0% 100%, rgba(188, 140, 255, 0.1), transparent),
        var(--surface-2);
}

.wiki-hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.wiki-hero-title {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.wiki-hero-lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 52ch;
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

.wiki-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.wiki-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.wiki-cta:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.wiki-cta-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #0d1117;
}

.wiki-cta-primary:hover {
    filter: brightness(1.06);
    color: #0d1117;
    background: var(--accent);
}

.wiki-hero-code {
    margin: 0;
    padding: 1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    overflow-x: auto;
    font-size: 0.82rem;
}

/* ── Card grid ── */
.wiki-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin: 1rem 0;
}

.wiki-card {
    padding: 1rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

.wiki-card strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.wiki-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Admonitions ── */
.admonition {
    margin: 1.25rem 0;
    padding: 0.85rem 1rem 0.85rem 1rem;
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
}

.admonition-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
    color: var(--accent);
}

.admonition-body { font-size: 0.92rem; color: var(--text-muted); }
.admonition-body p:last-child { margin-bottom: 0; }

.admonition-note { border-left-color: var(--accent); background: var(--accent-soft); }
.admonition-note .admonition-title { color: var(--accent); }

.admonition-tip { border-left-color: var(--green); background: rgba(63, 185, 80, 0.1); }
.admonition-tip .admonition-title { color: var(--green); }

.admonition-warning { border-left-color: #d29922; background: rgba(210, 153, 34, 0.1); }
.admonition-warning .admonition-title { color: #d29922; }

.admonition-important { border-left-color: var(--purple); background: var(--purple-soft); }
.admonition-important .admonition-title { color: var(--purple); }

.admonition-caution { border-left-color: #f85149; background: rgba(248, 81, 73, 0.1); }
.admonition-caution .admonition-title { color: #f85149; }

.doc-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.doc-edit-link {
    font-size: 0.78rem;
    color: var(--text-faint);
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.25rem 0.55rem;
}

.doc-edit-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 860px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: calc(var(--header-h) + var(--tabs-h)) 0 0 0;
        z-index: 140;
        background: var(--overlay);
    }

    .sidebar-backdrop[hidden] {
        display: none;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

/* ── 404 ── */
.not-found-panel {
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    text-align: center;
}

.not-found-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.not-found-panel p { color: var(--text-muted); margin-bottom: 1.25rem; }

.not-found-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* ── Search filters ── */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
}

.search-filter {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

.search-filter.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.search-results .result-cat {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    margin-right: 0.5rem;
}

body.page-home .doc-title { display: none; }
body.page-home .doc-lead { display: none; }