/* ============================================================
   Wire Docs — modern documentation theme
   Light + dark, sticky chrome, refined typography.
   ============================================================ */

:root {
    color-scheme: light;

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

    /* Brand */
    --primary: #f59e0b;
    --primary-strong: #d97706;
    --primary-contrast: #1c1206;

    /* Light surfaces */
    --bg: #fbfbfc;
    --bg-grid: rgba(15, 23, 42, 0.025);
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --surface-3: #f1f2f4;

    --text: #18181b;
    --text-muted: #52525b;
    --text-soft: #71717a;
    --text-faint: #a1a1aa;

    --border: #ebebef;
    --border-strong: #dededf;

    --primary-soft: rgba(245, 158, 11, 0.12);
    --primary-ring: rgba(245, 158, 11, 0.32);

    --info: #2563eb;
    --info-soft: rgba(37, 99, 235, 0.1);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.12);
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --success: #16a34a;
    --success-soft: rgba(22, 163, 74, 0.1);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.18);
    --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, 0.28);

    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --sidebar-w: 290px;
    --toc-w: 240px;
    --header-h: 64px;
    --content-max: 820px;

    /* Code surface stays dark in both themes */
    --code-bg: #18181b;
    --code-border: rgba(255, 255, 255, 0.08);
    --code-text: #e4e4e7;
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0b0b0d;
    --bg-grid: rgba(255, 255, 255, 0.02);
    --surface: #131316;
    --surface-2: #18181b;
    --surface-3: #1f1f23;

    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --text-soft: #8b8b93;
    --text-faint: #6b6b73;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --primary-soft: rgba(245, 158, 11, 0.16);
    --primary-ring: rgba(245, 158, 11, 0.36);

    --info-soft: rgba(96, 165, 250, 0.14);
    --warning-soft: rgba(245, 158, 11, 0.16);
    --danger-soft: rgba(248, 113, 113, 0.14);
    --success-soft: rgba(74, 222, 128, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);

    --code-bg: #09090b;
    --code-border: rgba(255, 255, 255, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

code,
pre {
    font-family: var(--font-mono);
}

::selection {
    background: var(--primary-soft);
}

/* Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* ============================================================
   Shell
   ============================================================ */

.site-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.site-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--header-h);
    padding: 16px 16px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 9px;
    background: linear-gradient(140deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: var(--primary-contrast);
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 4px 14px -4px var(--primary-ring);
}

.brand-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-strong);
    background: var(--primary-soft);
    padding: 3px 7px;
    border-radius: 6px;
    line-height: 1;
}

[data-theme="dark"] .brand-badge { color: var(--primary); }

.sidebar-nav {
    flex: 1;
    padding: 20px 14px 32px;
    display: grid;
    gap: 22px;
    align-content: start;
}

.nav-section > h2 {
    margin: 0 0 8px;
    padding: 0 10px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1px;
}

.nav-section a {
    position: relative;
    display: block;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    transition: background 130ms ease, color 130ms ease;
}

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

.nav-section a.is-active {
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-weight: 600;
}

[data-theme="dark"] .nav-section a.is-active {
    color: var(--primary);
}

.nav-section a.is-active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

/* ---------- Main column ---------- */

.site-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--header-h);
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(16px);
}

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    flex: none;
    padding: 0;
    position: relative;
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.nav-toggle span {
    position: absolute;
    left: 11px;
    right: 11px;
    height: 1.5px;
    background: var(--text);
    border-radius: 999px;
}
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 19px; }
.nav-toggle span:nth-child(3) { top: 24px; }

/* Search trigger */
.search-shell {
    position: relative;
    width: min(100%, 420px);
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 88px 0 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background:
        var(--surface)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E")
        no-repeat 12px center;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 130ms ease, box-shadow 130ms ease;
}

.search-input::placeholder { color: var(--text-soft); }

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-kbd {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: inline-flex;
    gap: 3px;
    pointer-events: none;
}

.search-kbd kbd {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-soft);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 6px;
    line-height: 1;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 40;
}

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

.search-result {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.search-result:hover,
.search-result.is-active {
    background: var(--surface-2);
}

.search-result strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.search-result small {
    display: block;
    color: var(--text-soft);
    font-size: 12.5px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: none;
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
}

.icon-button:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-strong);
}

.icon-button svg { width: 18px; height: 18px; }

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Page body ---------- */

.page-body {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 40px 28px 80px;
    max-width: calc(var(--content-max) + var(--toc-w) + 64px);
}

.content-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--toc-w);
    gap: 56px;
    align-items: start;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--text-soft);
}

.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-faint); }
.breadcrumb .current { color: var(--text-muted); }

/* Page hero (within article column) */
.page-hero { margin-bottom: 8px; }

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary-strong);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

[data-theme="dark"] .eyebrow { color: var(--primary); }

.page-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.page-hero .lead {
    margin: 14px 0 0;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1.6;
}

.hero-preview {
    margin: 28px 0 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.hero-preview img {
    display: block;
    width: 100%;
    height: auto;
}

/* Preview gallery */
.preview-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 28px 0 0;
}

.preview-card {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.preview-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.preview-card a { display: block; }

.preview-card-image {
    margin: 0;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.preview-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.preview-card-copy { padding: 16px 18px; }
.preview-card-copy strong { display: block; font-size: 15px; font-weight: 600; }
.preview-card-copy p { margin: 6px 0 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }

/* ============================================================
   Article typography
   ============================================================ */

.docs-article {
    min-width: 0;
    max-width: var(--content-max);
    font-size: 16px;
}

.docs-article > *:first-child { margin-top: 0; }

.docs-article h2,
.docs-article h3,
.docs-article h4 {
    scroll-margin-top: calc(var(--header-h) + 24px);
    position: relative;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text);
}

.docs-article h2 {
    margin: 48px 0 16px;
    padding-bottom: 8px;
    font-size: 1.6rem;
    border-bottom: 1px solid var(--border);
}

.docs-article h3 { margin: 32px 0 12px; font-size: 1.25rem; }
.docs-article h4 { margin: 26px 0 10px; font-size: 1.05rem; }

.heading-anchor {
    position: absolute;
    left: -1.2em;
    top: 0;
    width: 1.2em;
    opacity: 0;
    color: var(--text-faint);
    font-weight: 400;
    transition: opacity 120ms ease;
}

.docs-article h2:hover .heading-anchor,
.docs-article h3:hover .heading-anchor,
.docs-article h4:hover .heading-anchor { opacity: 1; }

.heading-anchor:hover { color: var(--primary-strong); }

.docs-article p {
    margin: 0 0 18px;
    color: var(--text-muted);
    line-height: 1.75;
}

.docs-article ul,
.docs-article ol {
    margin: 0 0 18px;
    padding-left: 24px;
    color: var(--text-muted);
}

.docs-article li { margin: 6px 0; line-height: 1.7; }
.docs-article li::marker { color: var(--text-faint); }

.docs-article strong { color: var(--text); font-weight: 650; }

.docs-article a {
    color: var(--primary-strong);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--primary-ring);
    text-underline-offset: 2px;
    transition: text-decoration-color 130ms ease;
}

[data-theme="dark"] .docs-article a { color: var(--primary); }
.docs-article a:hover { text-decoration-color: var(--primary); }

.docs-article hr {
    margin: 40px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* Blockquote / callout */
.docs-article blockquote {
    margin: 24px 0;
    padding: 14px 18px;
    border-left: 3px solid var(--primary);
    background: var(--primary-soft);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
}

.docs-article blockquote p:last-child { margin-bottom: 0; }

/* Tables */
.docs-article table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    font-size: 14.5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.docs-article thead { background: var(--surface-2); }

.docs-article th,
.docs-article td {
    padding: 11px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.docs-article th { color: var(--text); font-weight: 600; }
.docs-article td { color: var(--text-muted); }
.docs-article tbody tr:last-child td { border-bottom: 0; }
.docs-article tbody tr:hover { background: var(--surface-2); }

/* Inline code */
.docs-article :not(pre) > code {
    font-size: 0.86em;
    padding: 0.15em 0.42em;
    border-radius: 6px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

/* Code blocks */
.code-block {
    position: relative;
    margin: 24px 0;
}

.docs-article pre {
    margin: 0;
    overflow-x: auto;
    padding: 18px 20px;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.docs-article pre code {
    display: block;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--code-text);
    font-size: 13.5px;
    line-height: 1.7;
    white-space: pre;
}

/* Torchlight highlighted blocks (background-color set inline by Torchlight) */
.docs-article pre.torchlight code {
    color: inherit;
}

.torchlight .line {
    display: block;
    min-height: 1.5em;
    white-space: pre;
}

.torchlight .line-number,
.torchlight .summary-caret {
    margin-right: 1.2em;
    color: rgba(255, 255, 255, 0.3);
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: #d4d4d8;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 130ms ease, background 130ms ease, color 130ms ease;
}

.code-block:hover .copy-button,
.copy-button:focus-visible { opacity: 1; }

.copy-button:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.copy-button.is-copied { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.copy-button svg { width: 13px; height: 13px; }

/* Images in article */
.docs-article img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* Prev / Next */
.page-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.page-nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

.page-nav-link:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.page-nav-link.is-next { text-align: right; align-items: flex-end; }
.page-nav-link span { font-size: 12px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.page-nav-link strong { font-size: 15px; font-weight: 600; color: var(--text); }

/* ---------- Table of contents ---------- */

.page-toc {
    position: sticky;
    top: calc(var(--header-h) + 32px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 64px);
    overflow-y: auto;
}

.toc-title {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.page-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--border);
    display: grid;
    gap: 1px;
}

.page-toc li.level-3 a { padding-left: 26px; }

.page-toc a {
    display: block;
    padding: 5px 14px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
    transition: color 120ms ease, border-color 120ms ease;
}

.page-toc a:hover { color: var(--text); }

.page-toc a.is-active {
    color: var(--primary-strong);
    border-left-color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] .page-toc a.is-active { color: var(--primary); }

/* ============================================================
   Home page
   ============================================================ */

.home-main { padding: 0; }

.home-hero {
    position: relative;
    overflow: hidden;
    padding: 88px 28px 72px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 70% at 50% -10%, var(--primary-soft), transparent 70%);
    pointer-events: none;
}

.home-hero-inner { position: relative; max-width: 760px; margin: 0 auto; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 8px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

.hero-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.home-hero h1 {
    margin: 0;
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.home-hero h1 .grad {
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-strong) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.home-hero .lead {
    margin: 22px auto 0;
    max-width: 600px;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 22px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 130ms ease, border-color 130ms ease, transform 130ms ease, box-shadow 130ms ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--primary);
    color: var(--primary-contrast);
    box-shadow: 0 8px 22px -8px var(--primary-ring);
}
.btn-primary:hover { background: var(--primary-strong); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }

/* Home content sections */
.home-section {
    max-width: 1120px;
    margin: 0 auto;
    padding: 72px 28px 0;
}

.home-section:last-of-type { padding-bottom: 96px; }

.section-intro { max-width: 640px; margin: 0 0 36px; }
.section-intro .eyebrow { text-align: left; }
.section-intro h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.section-intro p { margin: 12px 0 0; color: var(--text-muted); font-size: 16px; line-height: 1.65; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.feature-card {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.feature-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.feature-card a { display: block; height: 100%; }

.feature-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.feature-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 400ms ease;
}

.feature-card:hover .feature-image img { transform: scale(1.03); }

.feature-copy { padding: 22px 24px 24px; }
.feature-copy h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.feature-copy h3 .arrow { color: var(--primary-strong); transition: transform 150ms ease; }
.feature-card:hover .feature-copy h3 .arrow { transform: translateX(3px); }
.feature-copy p { margin: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.6; }

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.stat-card {
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    text-align: center;
}

.stat-card strong {
    display: block;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-strong) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-card span { display: block; margin-top: 6px; color: var(--text-muted); font-size: 14px; }

/* Preview showcase */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* Overview panels */
.overview-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.overview-panel {
    padding: 26px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
}

.overview-panel h3 { margin: 0 0 12px; font-size: 1.15rem; font-weight: 700; }
.overview-panel p { margin: 0; color: var(--text-muted); line-height: 1.7; }
.overview-panel code {
    font-size: 0.86em;
    padding: 0.12em 0.4em;
    border-radius: 6px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text);
}

.panel-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.panel-list li {
    position: relative;
    padding-left: 26px;
    color: var(--text-muted);
    line-height: 1.6;
}
.panel-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 16px;
    height: 16px;
    background: var(--primary-soft);
    border-radius: 5px;
}
.panel-list li::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 10px;
    width: 5px;
    height: 8px;
    border: solid var(--primary-strong);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.site-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--text-soft);
    font-size: 13.5px;
}

.site-footer-inner a:hover { color: var(--text); }

/* ============================================================
   Responsive
   ============================================================ */

.site-overlay { display: none; }

@media (max-width: 1180px) {
    .content-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .page-toc { display: none; }
    .docs-article { max-width: 100%; }
}

@media (max-width: 980px) {
    :root { --sidebar-w: 0px; }

    .site-shell { grid-template-columns: 1fr; }

    .site-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 320px);
        z-index: 60;
        transform: translateX(-100%);
        transition: transform 200ms ease;
        background: var(--surface);
    }

    body.nav-open .site-sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }

    .site-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 50;
        opacity: 0;
        pointer-events: none;
        transition: opacity 200ms ease;
    }
    body.nav-open .site-overlay { display: block; opacity: 1; pointer-events: auto; }

    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .topbar { padding: 0 16px; }
    .page-body { padding: 28px 18px 64px; }
}

@media (max-width: 720px) {
    .search-kbd { display: none; }
    .feature-grid,
    .preview-grid,
    .preview-gallery,
    .overview-panels,
    .stats-row,
    .page-nav { grid-template-columns: 1fr; }

    .home-hero { padding: 64px 20px 52px; }
    .home-section { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
