/* MokaDocs Default Theme — "Moka" */
/* ================================ */

:root {
    --color-primary: #0ea5e9;
    --color-primary-light: #38bdf8;
    --color-primary-dark: #0284c7;
    --gradient-secondary: #06b6d4;
    --gradient-tertiary: #3b82f6;
    --color-accent: #f59e0b;
    --color-bg: #ffffff;
    --color-bg-secondary: #f8fafc;
    --color-bg-code: #f1f5f9;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --sidebar-width: 280px;
    --toc-width: 220px;
    --header-height: 60px;
    --content-max-width: 780px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.15);
    --transition: 150ms ease;
}

[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-code: #1e293b;
    --color-text: #e2e8f0;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-border: #334155;
    --color-border-light: #1e293b;
}

/* Color theme presets — override primary accent colors
   Uses html[] for higher specificity than inline :root overrides */
html[data-color-theme="ocean"] {
    --color-primary: #0ea5e9 !important;
    --color-primary-light: #38bdf8 !important;
    --color-primary-dark: #0284c7 !important;
    --gradient-secondary: #06b6d4;
    --gradient-tertiary: #3b82f6;
}
html[data-color-theme="emerald"] {
    --color-primary: #10b981 !important;
    --color-primary-light: #34d399 !important;
    --color-primary-dark: #059669 !important;
    --gradient-secondary: #06d6a0;
    --gradient-tertiary: #2dd4bf;
}
html[data-color-theme="violet"] {
    --color-primary: #8b5cf6 !important;
    --color-primary-light: #a78bfa !important;
    --color-primary-dark: #7c3aed !important;
    --gradient-secondary: #a855f7;
    --gradient-tertiary: #6366f1;
}
html[data-color-theme="amber"] {
    --color-primary: #f59e0b !important;
    --color-primary-light: #fbbf24 !important;
    --color-primary-dark: #d97706 !important;
    --gradient-secondary: #f97316;
    --gradient-tertiary: #ef4444;
}
html[data-color-theme="rose"] {
    --color-primary: #f43f5e !important;
    --color-primary-light: #fb7185 !important;
    --color-primary-dark: #e11d48 !important;
    --gradient-secondary: #ec4899;
    --gradient-tertiary: #f97316;
}
html[data-color-theme="moka-red"] {
    --color-primary: #d32f2f !important;
    --color-primary-light: #ff6659 !important;
    --color-primary-dark: #9a0007 !important;
    --gradient-secondary: #c62828;
    --gradient-tertiary: #e53935;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 1rem); }

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-dark); }

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

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-text);
    text-decoration: none;
}
.site-logo:hover { color: var(--color-primary); }
.site-logo-icon {
    color: var(--color-primary);
    flex-shrink: 0;
}
.site-logo-img {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}
.site-name {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

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

.search-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: border-color var(--transition);
}
.search-trigger:hover { border-color: var(--color-primary); }
.search-trigger kbd {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.theme-toggle, .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.theme-toggle:hover, .mobile-nav-toggle:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

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

/* Color theme selector */
.color-theme-selector { position: relative; }
.color-theme-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.color-theme-trigger:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}
.color-theme-trigger[aria-expanded="true"] {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.color-theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}
.color-theme-dropdown[hidden] { display: none; }
.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    outline-offset: 2px;
}
.color-swatch:hover {
    transform: scale(1.15);
}
.color-swatch.active {
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px currentColor;
    box-shadow: 0 0 0 3px var(--color-bg), 0 0 0 5px var(--color-text-secondary);
}

/* Code Theme Selector */
.code-theme-selector { position: relative; }
.code-theme-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.code-theme-trigger:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}
.code-theme-trigger[aria-expanded="true"] {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.code-theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 200px;
}
.code-theme-dropdown[hidden] { display: none; }
.code-theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.82rem;
    width: 100%;
    text-align: left;
}
.code-theme-option:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}
.code-theme-option.active {
    color: var(--color-primary);
    font-weight: 600;
}
.code-theme-preview {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}
.code-theme-name { flex: 1; }
.code-theme-check {
    opacity: 0;
    font-size: 0.75rem;
    color: var(--color-primary);
    transition: opacity var(--transition);
}
.code-theme-option.active .code-theme-check { opacity: 1; }

/* Code Style Selector */
.code-style-selector { position: relative; }
.code-style-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.code-style-trigger:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}
.code-style-trigger[aria-expanded="true"] {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.code-style-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 160px;
}
.code-style-dropdown[hidden] { display: none; }
.code-style-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.82rem;
    width: 100%;
    text-align: left;
}
.code-style-option:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}
.code-style-option.active {
    color: var(--color-primary);
    font-weight: 600;
}
.code-style-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
    transition: all var(--transition);
}
.code-style-option.active .code-style-indicator {
    border-color: var(--color-primary);
    background: var(--color-primary);
    box-shadow: inset 0 0 0 3px var(--color-bg);
}
.code-style-name { flex: 1; }
.code-style-check {
    opacity: 0;
    font-size: 0.75rem;
    color: var(--color-primary);
    transition: opacity var(--transition);
}
.code-style-option.active .code-style-check { opacity: 1; }

/* Appearance group — wraps color/code/style selectors */
.appearance-group { display: flex; align-items: center; gap: 0.5rem; }

.mobile-nav-toggle { display: none; }

/* Layout */
.site-container {
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height) - 60px);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--color-border);
    flex-shrink: 0;
}

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

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.nav-link:hover { color: var(--color-text); background: var(--color-bg-secondary); }
.nav-link.current {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg));
    font-weight: 600;
    border-left: 2px solid var(--color-primary);
    padding-left: calc(0.75rem - 2px);
}

.nav-header {
    display: flex;
    align-items: center;
}
.nav-header .nav-link {
    flex: 1;
    font-weight: 600;
    color: var(--color-text);
}
.nav-header .nav-link:hover { color: var(--color-primary); }
.nav-header .nav-link.parent-active {
    color: var(--color-text);
    font-weight: 700;
}
.nav-chevron-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    color: var(--color-text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.nav-chevron-btn:hover { color: var(--color-text); background: var(--color-bg-secondary); }

.nav-group-label {
    cursor: default;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}
.nav-group-label.parent-active { color: var(--color-primary); }

.nav-sub-section { margin-bottom: 0.125rem; }
.nav-sub-section .nav-header { padding-left: 0; }
.nav-sub-section .nav-children { padding-left: 0.5rem; }

.nav-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 0.375rem;
    flex-shrink: 0;
}

.nav-chevron {
    flex-shrink: 0;
    transition: transform var(--transition);
}
.nav-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.nav-children {
    list-style: none;
    padding-left: 1rem;
}

/* Content */
.content {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.5rem;
    max-width: calc(var(--content-max-width) + 5rem);
}

.page-content h1 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; letter-spacing: -0.025em; }
.page-content h2 { font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border); }
.page-content h3 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.page-content h4 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }

.page-content p { margin-bottom: 1rem; }
.page-content ul, .page-content ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.page-content li { margin-bottom: 0.25rem; }
.page-content img { max-width: 100%; height: auto; border-radius: var(--radius); }

.page-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.125rem 0.375rem;
    background: var(--color-bg-code);
    border-radius: var(--radius-sm);
    color: var(--color-primary);
}

.page-content pre {
    position: relative;
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: var(--color-bg-code);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow-x: auto;
}
.page-content pre code {
    padding: 0;
    background: none;
    color: var(--color-text);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Copy button on code blocks — uses inherit to match code block theme */
.page-content pre .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition);
}
.page-content pre .copy-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}
.page-content pre:hover .copy-btn { opacity: 1; }
.page-content pre:hover .code-lang { opacity: 0; }

/* Light code themes need dark button colors */
[data-code-theme="catppuccin-latte"] .page-content pre .copy-btn,
[data-code-theme="github-light"] .page-content pre .copy-btn {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.12);
    color: rgba(0,0,0,0.45);
}
[data-code-theme="catppuccin-latte"] .page-content pre .copy-btn:hover,
[data-code-theme="github-light"] .page-content pre .copy-btn:hover {
    background: rgba(0,0,0,0.12);
    color: rgba(0,0,0,0.7);
}

/* Line numbers on code blocks */
.page-content pre.has-line-numbers { padding-left: 3.5rem; }
.page-content pre .line-numbers {
    position: absolute; left: 0; top: 1rem; bottom: 0; width: 2.5rem;
    padding-right: 0.5rem; text-align: right; font-family: var(--font-mono);
    font-size: 0.875rem; line-height: 1.6; user-select: none;
    color: var(--color-text-muted); opacity: 0.4; border-right: 1px solid var(--color-border);
}
.page-content pre .line-numbers span { display: block; }

/* Language label on code blocks */
.page-content pre .code-lang {
    position: absolute;
    top: 0.375rem;
    left: 0.75rem;
    font-size: 0.625rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.35);
    user-select: none;
    transition: opacity var(--transition);
}
[data-code-theme="catppuccin-latte"] .page-content pre .code-lang,
[data-code-theme="github-light"] .page-content pre .code-lang {
    color: rgba(0,0,0,0.3);
}

/* Syntax highlighting tokens */
.token.comment, .token.prolog { color: var(--sh-comment); font-style: italic; }
.token.string, .token.char { color: var(--sh-string); }
.token.keyword { color: var(--sh-keyword); font-weight: 600; }
.token.number, .token.boolean { color: var(--sh-number); }
.token.type-name, .token.class-name { color: var(--sh-type); }
.token.function { color: var(--sh-function); }
.token.operator { color: var(--sh-operator); }
.token.punctuation { color: var(--sh-punctuation); }
.token.attr-name { color: var(--sh-attr); }
.token.attr-value, .token.tag-name { color: var(--sh-tag); }
.token.property { color: var(--sh-property); }
.token.namespace { color: var(--sh-type); opacity: 0.8; }
.token.directive { color: var(--sh-keyword); }

/* Code Theme: Catppuccin Mocha (default) */
:root, [data-code-theme="catppuccin-mocha"] {
    --sh-comment: #6c7086; --sh-string: #a6e3a1; --sh-keyword: #cba6f7;
    --sh-number: #fab387; --sh-type: #89dceb; --sh-function: #89b4fa;
    --sh-operator: #94e2d5; --sh-punctuation: #bac2de; --sh-attr: #f9e2af;
    --sh-tag: #f38ba8; --sh-property: #b4befe;
}
[data-code-theme="catppuccin-mocha"] .page-content pre { background: #1e1e2e; border-color: #313244; }
[data-code-theme="catppuccin-mocha"] .page-content pre code { color: #cdd6f4; }

/* Code Theme: Catppuccin Latte */
[data-code-theme="catppuccin-latte"] {
    --sh-comment: #9ca0b0; --sh-string: #40a02b; --sh-keyword: #8839ef;
    --sh-number: #fe640b; --sh-type: #04a5e5; --sh-function: #1e66f5;
    --sh-operator: #179299; --sh-punctuation: #5c5f77; --sh-attr: #df8e1d;
    --sh-tag: #d20f39; --sh-property: #7287fd;
}
[data-code-theme="catppuccin-latte"] .page-content pre { background: #eff1f5; border-color: #ccd0da; }
[data-code-theme="catppuccin-latte"] .page-content pre code { color: #4c4f69; }

/* Code Theme: GitHub Dark */
[data-code-theme="github-dark"] {
    --sh-comment: #8b949e; --sh-string: #a5d6ff; --sh-keyword: #ff7b72;
    --sh-number: #79c0ff; --sh-type: #ffa657; --sh-function: #d2a8ff;
    --sh-operator: #ff7b72; --sh-punctuation: #c9d1d9; --sh-attr: #79c0ff;
    --sh-tag: #7ee787; --sh-property: #79c0ff;
}
[data-code-theme="github-dark"] .page-content pre { background: #0d1117; border-color: #30363d; }
[data-code-theme="github-dark"] .page-content pre code { color: #c9d1d9; }

/* Code Theme: Dracula */
[data-code-theme="dracula"] {
    --sh-comment: #6272a4; --sh-string: #f1fa8c; --sh-keyword: #ff79c6;
    --sh-number: #bd93f9; --sh-type: #8be9fd; --sh-function: #50fa7b;
    --sh-operator: #ff79c6; --sh-punctuation: #f8f8f2; --sh-attr: #50fa7b;
    --sh-tag: #ff79c6; --sh-property: #66d9ef;
}
[data-code-theme="dracula"] .page-content pre { background: #282a36; border-color: #44475a; }
[data-code-theme="dracula"] .page-content pre code { color: #f8f8f2; }

/* Code Theme: One Dark */
[data-code-theme="one-dark"] {
    --sh-comment: #5c6370; --sh-string: #98c379; --sh-keyword: #c678dd;
    --sh-number: #d19a66; --sh-type: #e5c07b; --sh-function: #61afef;
    --sh-operator: #56b6c2; --sh-punctuation: #abb2bf; --sh-attr: #d19a66;
    --sh-tag: #e06c75; --sh-property: #e06c75;
}
[data-code-theme="one-dark"] .page-content pre { background: #282c34; border-color: #3e4451; }
[data-code-theme="one-dark"] .page-content pre code { color: #abb2bf; }

/* Code Theme: Nord */
[data-code-theme="nord"] {
    --sh-comment: #616e88; --sh-string: #a3be8c; --sh-keyword: #81a1c1;
    --sh-number: #b48ead; --sh-type: #8fbcbb; --sh-function: #88c0d0;
    --sh-operator: #81a1c1; --sh-punctuation: #d8dee9; --sh-attr: #8fbcbb;
    --sh-tag: #bf616a; --sh-property: #88c0d0;
}
[data-code-theme="nord"] .page-content pre { background: #2e3440; border-color: #3b4252; }
[data-code-theme="nord"] .page-content pre code { color: #d8dee9; }

/* Code Theme: GitHub Light */
[data-code-theme="github-light"] {
    --sh-comment: #6e7781; --sh-string: #0a3069; --sh-keyword: #cf222e;
    --sh-number: #0550ae; --sh-type: #953800; --sh-function: #8250df;
    --sh-operator: #cf222e; --sh-punctuation: #24292f; --sh-attr: #0550ae;
    --sh-tag: #116329; --sh-property: #0550ae;
}
[data-code-theme="github-light"] .page-content pre { background: #ffffff; border-color: #d0d7de; }
[data-code-theme="github-light"] .page-content pre code { color: #24292f; }

/* ── Code Block Window Styles ─────────────────────────── */

/* macOS style — three traffic-light dots in a title bar */
html[data-code-style="macos"] .page-content pre {
    padding-top: 2.75rem !important;
    border-radius: 10px !important;
}
html[data-code-style="macos"] .page-content pre::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(128,128,128,0.08);
    border-bottom: 1px solid rgba(128,128,128,0.1);
    border-radius: 10px 10px 0 0;
}
html[data-code-style="macos"] .page-content pre::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 20px 0 0 #febc2e, 40px 0 0 #28c840;
}
html[data-code-style="macos"] .page-content pre .code-lang {
    top: 0 !important;
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
    border-top: none !important;
    line-height: 32px !important;
    padding: 0 0.75rem !important;
    background: transparent !important;
    border: none !important;
}
html[data-code-style="macos"] .page-content pre .copy-btn {
    top: 4px !important;
    right: 8px !important;
}
html[data-code-style="macos"] .page-content pre.has-line-numbers .line-numbers {
    top: 32px !important;
}
/* Light mode adjustments for macOS dots */
[data-theme="light"] html[data-code-style="macos"] .page-content pre::before,
html[data-code-style="macos"][data-theme="light"] .page-content pre::before {
    background: rgba(128,128,128,0.06);
}

/* Terminal style — dark header with prompt icon */
html[data-code-style="terminal"] .page-content pre {
    padding-top: 2.75rem !important;
    border-radius: 2px !important;
}
html[data-code-style="terminal"] .page-content pre::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 34px;
    background: #1a1a2e;
    border-bottom: 1px solid rgba(0,255,100,0.15);
    border-radius: 2px 2px 0 0;
}
html[data-code-style="terminal"] .page-content pre::after {
    content: '$';
    position: absolute;
    top: 7px;
    left: 14px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: #4ade80;
}
html[data-code-style="terminal"] .page-content pre .code-lang {
    top: 0 !important;
    right: auto !important;
    left: 32px !important;
    border-radius: 0 !important;
    line-height: 34px !important;
    padding: 0 0.5rem !important;
    background: transparent !important;
    border: none !important;
    color: #4ade80 !important;
    font-weight: 600 !important;
    opacity: 0.9 !important;
}
html[data-code-style="terminal"] .page-content pre .copy-btn {
    top: 5px !important;
    right: 8px !important;
}
html[data-code-style="terminal"] .page-content pre.has-line-numbers .line-numbers {
    top: 34px !important;
}
/* Light mode terminal */
html[data-code-style="terminal"][data-theme="light"] .page-content pre::before {
    background: #e8e8f0;
    border-bottom-color: rgba(0,128,60,0.2);
}
html[data-code-style="terminal"][data-theme="light"] .page-content pre::after {
    color: #16a34a;
}
html[data-code-style="terminal"][data-theme="light"] .page-content pre .code-lang {
    color: #16a34a !important;
}

/* VS Code style — tab header with accent bar and activity border */
html[data-code-style="vscode"] .page-content pre {
    padding-top: 2.75rem !important;
    border-radius: 4px !important;
    border-left: 3px solid color-mix(in srgb, var(--color-primary) 40%, transparent) !important;
}
html[data-code-style="vscode"] .page-content pre::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: -3px;
    right: 0;
    height: 3px;
    background: var(--color-primary);
    border-radius: 4px 4px 0 0;
}
html[data-code-style="vscode"] .page-content pre::after {
    content: '';
    position: absolute;
    top: 3px;
    left: -3px;
    right: 0;
    height: 32px;
    background: rgba(128,128,128,0.06);
    border-bottom: 1px solid rgba(128,128,128,0.1);
}
html[data-code-style="vscode"] .page-content pre .code-lang {
    top: 3px !important;
    right: auto !important;
    left: 0 !important;
    border-radius: 0 !important;
    line-height: 32px !important;
    padding: 0 1rem !important;
    background: rgba(128,128,128,0.04) !important;
    border: none !important;
    border-right: 1px solid rgba(128,128,128,0.1) !important;
    border-bottom: 2px solid var(--color-primary) !important;
    font-weight: 500 !important;
    opacity: 1 !important;
}
html[data-code-style="vscode"] .page-content pre .copy-btn {
    top: 7px !important;
    right: 8px !important;
}
html[data-code-style="vscode"] .page-content pre.has-line-numbers {
    padding-left: 4rem !important;
}
html[data-code-style="vscode"] .page-content pre.has-line-numbers .line-numbers {
    top: 35px !important;
    left: 0 !important;
    background: rgba(128,128,128,0.04) !important;
    border-right: 1px solid rgba(128,128,128,0.1) !important;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
}
.table-responsive table { margin: 0; }
.page-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    font-size: 0.875rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.page-content thead, .page-content tbody, .page-content tr { width: 100%; }
.page-content th, .page-content td {
    padding: 0.625rem 1rem;
    text-align: left;
    border: 1px solid var(--color-border);
    white-space: nowrap;
}
.page-content td:last-child { white-space: normal; }
.page-content th { background: var(--color-bg-secondary); font-weight: 600; }
.page-content tr:hover td { background: var(--color-bg-secondary); }

/* Package install widget */
.package-install-widget {
    border: 1px solid var(--color-border);
    border-radius: var(--radius, 8px);
    margin-bottom: 2rem;
    overflow: hidden;
}
.install-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}
.install-package-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
}
.install-nuget-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm, 4px);
    transition: all var(--transition);
}
.install-nuget-link:hover {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}
.install-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    padding: 0 0.5rem;
}
.install-tab {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: -1px;
}
.install-tab:hover { color: var(--color-text); }
.install-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}
.install-panel {
    display: none;
    position: relative;
    padding: 0.875rem 1.25rem;
    background: var(--color-bg-code, var(--color-bg-secondary));
}
.install-panel.active { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.install-panel pre {
    margin: 0;
    padding: 0;
    background: none !important;
    border: none !important;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
}
.install-panel pre code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-text);
    background: none !important;
    padding: 0 !important;
}
/* Hide the global copy button injected by code block JS */
.install-panel pre .copy-btn { display: none !important; }
.install-copy-btn {
    flex-shrink: 0;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--color-bg, #fff);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 4px);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.install-copy-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* API Reference styles */
.api-type-header { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.api-badge {
    display: inline-block; padding: 0.25rem 0.625rem; border-radius: var(--radius-sm);
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
    min-width: 4.5rem; text-align: center;
}
.api-badge-class { background: color-mix(in srgb, #3b82f6 15%, var(--color-bg)); color: #3b82f6; }
.api-badge-struct { background: color-mix(in srgb, #22c55e 15%, var(--color-bg)); color: #22c55e; }
.api-badge-record { background: color-mix(in srgb, #8b5cf6 15%, var(--color-bg)); color: #8b5cf6; }
.api-badge-interface { background: color-mix(in srgb, #06b6d4 15%, var(--color-bg)); color: #06b6d4; }
.api-badge-enum { background: color-mix(in srgb, #f59e0b 15%, var(--color-bg)); color: #f59e0b; }
.api-badge-delegate { background: color-mix(in srgb, #ec4899 15%, var(--color-bg)); color: #ec4899; }
.api-badge-static { background: color-mix(in srgb, #64748b 15%, var(--color-bg)); color: #64748b; }
.api-badge-abstract { background: color-mix(in srgb, #a78bfa 15%, var(--color-bg)); color: #a78bfa; }
.api-badge-sealed { background: color-mix(in srgb, #f97316 15%, var(--color-bg)); color: #f97316; }
.api-badge-obsolete { background: color-mix(in srgb, #ef4444 15%, var(--color-bg)); color: #ef4444; }
.api-badge-sm { font-size: 0.625rem; padding: 0.125rem 0.375rem; border-radius: 3px; vertical-align: middle; }
.api-badge-sm.api-badge-static { background: color-mix(in srgb, #64748b 12%, var(--color-bg)); color: #64748b; }
.api-badge-sm.api-badge-virtual { background: color-mix(in srgb, #06b6d4 12%, var(--color-bg)); color: #06b6d4; }
.api-badge-sm.api-badge-abstract { background: color-mix(in srgb, #a78bfa 12%, var(--color-bg)); color: #a78bfa; }
.api-badge-sm.api-badge-obsolete { background: color-mix(in srgb, #ef4444 12%, var(--color-bg)); color: #ef4444; }
.api-signature { margin: 0.5rem 0 1.5rem; }
.api-namespace { font-size: 0.875rem; color: var(--color-text-secondary); margin-bottom: 1rem; }
.api-summary { margin-bottom: 1.5rem; font-size: 1.05rem; line-height: 1.7; }
.api-member-table { width: 100%; }
.api-member-table td:first-child { white-space: nowrap; }
.api-member-table td { vertical-align: top; padding: 0.5rem 1rem; }
.api-member-table td:last-child { color: var(--color-text-secondary); }
.api-member-table code { font-size: 0.8125rem; }
.api-member-table pre { white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.api-member-link { text-decoration: none; color: var(--color-primary); transition: opacity var(--transition); }
.api-member-link:hover { opacity: 0.8; }
.api-member-link code { color: inherit; background: none; padding: 0; font-weight: 500; }

/* Source viewer */
.source-viewer { margin-top: 2rem; border: 1px solid var(--color-border); border-radius: 8px; }
.source-viewer summary {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem;
    cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--color-text-secondary);
    user-select: none; list-style: none; transition: color 0.15s;
}
.source-viewer summary::-webkit-details-marker { display: none; }
.source-viewer summary::marker { display: none; content: ""; }
.source-viewer summary:hover { color: var(--color-primary); }
.source-viewer summary svg { flex-shrink: 0; }
.source-viewer[open] summary { border-bottom: 1px solid var(--color-border); }
.source-viewer pre { margin: 0; border: none; border-radius: 0 0 8px 8px; }

/* Blockquotes */
.page-content blockquote {
    margin: 1.5rem 0;
    padding: 0.75rem 1.25rem;
    border-left: 4px solid var(--color-primary);
    background: var(--color-bg-secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text-secondary);
}

/* Admonitions — Markdig renders ::: type as <div class="type"> */
.page-content > .note,
.page-content > .tip,
.page-content > .warning,
.page-content > .caution,
.page-content > .danger,
.page-content > .info,
.page-content > .important {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border-left: 4px solid;
}
.page-content > .note { border-color: #3b82f6; background: color-mix(in srgb, #3b82f6 8%, var(--color-bg)); }
.page-content > .tip { border-color: #22c55e; background: color-mix(in srgb, #22c55e 8%, var(--color-bg)); }
.page-content > .warning, .page-content > .caution { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 8%, var(--color-bg)); }
.page-content > .danger { border-color: #ef4444; background: color-mix(in srgb, #ef4444 8%, var(--color-bg)); }
.page-content > .info, .page-content > .important { border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 8%, var(--color-bg)); }

/* Tabs */
.tabs { margin: 1.5rem 0; border: 1px solid var(--color-border); border-radius: var(--radius); }
.tab-headers {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-x: auto;
}
.tab-header {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}
.tab-header:hover { color: var(--color-text); }
.tab-header.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { padding: 1rem 1.25rem; }
.tab-content[hidden] { display: none; }

/* UI Components — Card */
.component-card {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.component-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.component-card-info { border-left: 4px solid #3b82f6; }
.component-card-success { border-left: 4px solid #22c55e; }
.component-card-warning { border-left: 4px solid #f59e0b; }
.component-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}
.component-card-icon {
    display: flex;
    align-items: center;
    color: var(--color-primary);
    flex-shrink: 0;
}
.component-card-info .component-card-icon { color: #3b82f6; }
.component-card-success .component-card-icon { color: #22c55e; }
.component-card-warning .component-card-icon { color: #f59e0b; }
.component-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
}
.component-card-body {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    line-height: 1.65;
}
.component-card-body > *:first-child { margin-top: 0; }
.component-card-body > *:last-child { margin-bottom: 0; }

/* UI Components — Steps */
.component-steps {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.component-step {
    display: flex;
    gap: 1rem;
    position: relative;
}
.component-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}
.component-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.component-step:not(:last-child) .component-step-indicator::after {
    content: '';
    width: 2px;
    flex: 1;
    background: var(--color-border);
    margin-top: 0.25rem;
}
.component-step-content {
    padding-bottom: 1.5rem;
    min-width: 0;
    flex: 1;
}
.component-step:last-child .component-step-content {
    padding-bottom: 0;
}
.component-step-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0.25rem 0 0.5rem;
    line-height: 1.4;
}
.component-step-content > *:not(.component-step-title) {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
}
.component-step-content > *:last-child { margin-bottom: 0; }

/* UI Components — Link Cards */
.component-link-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0;
}
.component-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    text-decoration: none;
    transition: all var(--transition);
    gap: 0.75rem;
}
.component-link-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    color: var(--color-text);
}
.component-link-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.component-link-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.35;
}
.component-link-card-desc {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}
.component-link-card-arrow {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: transform var(--transition), color var(--transition);
}
.component-link-card:hover .component-link-card-arrow {
    color: var(--color-primary);
    transform: translateX(2px);
}

/* UI Components — Code Group */
.component-code-group .tab-content { padding: 0; }
.component-code-group .tab-content pre {
    margin: 0;
    border: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ToC Sidebar — "On this page" */
.toc-sidebar {
    position: sticky;
    top: var(--header-height);
    width: var(--toc-width);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 1.5rem 0 1.5rem 0;
    flex-shrink: 0;
    border-left: 1px solid var(--color-border);
}
.toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    padding: 0 1rem;
}
.toc-list { list-style: none; border-left: 2px solid var(--color-border); margin-left: 1rem; }
.toc-list ul { list-style: none; padding-left: 0; }
.toc-item a {
    display: block;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    transition: all var(--transition);
    line-height: 1.4;
    border-left: 2px solid transparent;
    margin-left: -2px;
}
.toc-item a:hover { color: var(--color-text); }
.toc-item a.active {
    color: var(--color-primary);
    font-weight: 500;
    border-left-color: var(--color-primary);
}
.toc-level-3 a { padding-left: 1.5rem; }
.toc-level-4 a { padding-left: 2.25rem; }

/* ToC progress indicator */
.toc-progress {
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.toc-progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.15s ease;
}

/* ToC expand/collapse for nested items */
.toc-item.has-children > a::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: 0.4em;
    opacity: 0.5;
    transition: transform 0.2s;
    vertical-align: middle;
}
.toc-item.has-children.collapsed > a::after {
    transform: rotate(-90deg);
}
.toc-item.has-children.collapsed > ul {
    display: none;
}

/* ToC section counter */
.toc-counter {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    padding: 0.5rem 0 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

/* ToC back-to-top link */
.toc-back-to-top {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.25rem;
    transition: color var(--transition);
}
.toc-back-to-top:hover { color: var(--color-primary); }

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}
.breadcrumbs ol {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    gap: 0;
}
.breadcrumbs li { display: flex; align-items: center; }
.breadcrumbs li:not(:last-child)::after {
    content: '/';
    margin: 0 0.5rem;
    color: var(--color-text-muted);
    opacity: 0.5;
}
.breadcrumbs a { color: var(--color-text-secondary); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs [aria-current="page"] { color: var(--color-text); font-weight: 500; }

/* Edit link / Last updated */
.edit-link, .last-updated {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.edit-link + .last-updated { margin-top: 0.5rem; padding-top: 0; border-top: none; }
.edit-link a { color: var(--color-text-secondary); display: inline-flex; align-items: center; gap: 0.375rem; }
.edit-link a:hover { color: var(--color-primary); }
.last-updated { display: flex; align-items: center; gap: 0.375rem; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem;
}
.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.built-with a { color: var(--color-text-secondary); }
.footer-social { display: flex; align-items: center; gap: 0.75rem; }
.footer-social a { color: var(--color-text-muted); transition: color var(--transition); display: flex; }
.footer-social a:hover { color: var(--color-primary); }

/* Heading anchor links */
.page-content h2, .page-content h3, .page-content h4 { position: relative; }
.heading-anchor {
    position: absolute; left: -1.5rem; top: 50%; transform: translateY(-50%);
    color: var(--color-text-muted); text-decoration: none; font-size: 0.875rem;
    opacity: 0; transition: opacity 0.15s; font-weight: 400;
}
.page-content h2:hover .heading-anchor,
.page-content h3:hover .heading-anchor,
.page-content h4:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--color-primary); }

/* Responsive */
@media (max-width: 1200px) {
    .toc-sidebar {
        display: none;
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 0;
        width: 280px;
        max-width: 80vw;
        background: var(--color-bg);
        border-left: 1px solid var(--color-border);
        box-shadow: -4px 0 24px rgba(0,0,0,0.1);
        z-index: 100;
        padding: 1.5rem;
        overflow-y: auto;
        transition: transform 0.3s ease;
        height: auto;
    }
    .toc-sidebar.open { display: block; }
    .toc-toggle-btn {
        display: flex;
        position: fixed;
        bottom: 5rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background: var(--color-primary);
        color: white;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        z-index: 99;
        transition: opacity 0.3s, transform 0.3s;
    }
    .toc-toggle-btn:hover { transform: scale(1.1); }
    .toc-toggle-btn svg { width: 20px; height: 20px; }
}
@media (min-width: 1201px) {
    .toc-toggle-btn { display: none; }
}

@media (max-width: 768px) {
    .sidebar { display: none; position: fixed; top: var(--header-height); left: 0; bottom: 0; z-index: 50; background: var(--color-bg); }
    .sidebar.open { display: block; }
    .mobile-nav-toggle { display: flex; }
    .content { padding: 1.5rem 1rem; }
    .search-label, .search-trigger kbd { display: none; }
    .search-trigger { padding: 0.375rem; }
    .header-inner { padding: 0 0.75rem; gap: 0.5rem; }
    .site-logo { gap: 0.375rem; min-width: 0; }
    .site-name { font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .header-actions { gap: 0.25rem; flex-shrink: 0; }
    .appearance-group { display: none; }
    .color-theme-selector, .code-theme-selector, .code-style-selector { display: none; }
    .search-modal { padding-top: 5vh; }
    .search-dialog { width: 95%; max-height: 70vh; }
    .footer-inner { flex-direction: column; gap: 0.5rem; align-items: center; }
}

/* Search Modal */
.search-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); }
.search-dialog {
    position: relative;
    width: 90%;
    max-width: 560px;
    max-height: 60vh;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--color-text);
}
.search-input::placeholder { color: var(--color-text-muted); }
.search-esc {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
}
.search-results {
    overflow-y: auto;
    padding: 0.5rem;
}
.search-results:empty::after {
    content: 'Type to search...';
    display: block;
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}
.search-results.has-query:empty::after { content: 'No results found.'; }
.search-result {
    display: block;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text);
    transition: background var(--transition);
}
.search-result:hover, .search-result.active { background: var(--color-bg-secondary); color: var(--color-text); }
.search-result-title { font-weight: 600; font-size: 0.875rem; }
.search-result-section { font-size: 0.8125rem; color: var(--color-primary); margin-left: 0.25rem; }
.search-result-category { font-size: 0.75rem; color: var(--color-text-muted); }
.search-result-snippet { font-size: 0.8125rem; color: var(--color-text-secondary); margin-top: 0.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-snippet mark { background: color-mix(in srgb, var(--color-accent) 30%, transparent); color: inherit; border-radius: 2px; }

/* Prev/Next page navigation */
.page-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: var(--content-max-width);
    margin: 2.5rem auto 0;
    padding: 1.5rem 2.5rem;
}
.page-nav-spacer { display: block; }
.page-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 8px);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.page-nav-link:hover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 4%, var(--color-bg));
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.page-nav-next { text-align: right; justify-content: flex-end; }
.page-nav-text { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.page-nav-label { font-size: 0.75rem; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.page-nav-title { font-size: 0.9375rem; font-weight: 600; color: var(--color-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-nav-arrow { flex-shrink: 0; color: var(--color-text-muted); transition: color var(--transition), transform var(--transition); }
.page-nav-link:hover .page-nav-arrow { color: var(--color-primary); }
.page-nav-prev:hover .page-nav-arrow { transform: translateX(-2px); }
.page-nav-next:hover .page-nav-arrow { transform: translateX(2px); }

/* Feedback widget */
.feedback-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: var(--content-max-width);
    margin: 2.5rem auto 0;
    padding: 1.5rem 2.5rem;
    text-align: center;
}
.feedback-prompt {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}
.feedback-buttons {
    display: flex;
    gap: 0.5rem;
}
.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 8px);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
}
.feedback-btn:hover { border-color: var(--color-text-muted); }
.feedback-btn-yes:hover { border-color: #22c55e; color: #16a34a; background: color-mix(in srgb, #22c55e 8%, transparent); }
.feedback-btn-no:hover { border-color: #ef4444; color: #dc2626; background: color-mix(in srgb, #ef4444 8%, transparent); }
.feedback-btn-yes.selected { border-color: #22c55e; color: #fff; background: #22c55e; }
.feedback-btn-no.selected { border-color: #ef4444; color: #fff; background: #ef4444; }
.feedback-btn:disabled { cursor: default; }
.feedback-btn-yes:disabled:not(.selected) { opacity: 0.4; }
.feedback-btn-no:disabled:not(.selected) { opacity: 0.4; }
.feedback-thanks {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    animation: feedbackFadeIn 0.3s ease;
}
@keyframes feedbackFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Back to top button */
.back-to-top { position: fixed; bottom: 2rem; right: 2rem; width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary); color: white; border: none; font-size: 1.25rem; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 50; box-shadow: var(--shadow-md); }
.back-to-top.visible { opacity: 1; pointer-events: auto; }

/* =============================== */
/* Landing Page                    */
/* =============================== */

.landing .landing-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Subtle hero background glow */
.landing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 500px;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--color-primary) 8%, transparent) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.landing { position: relative; }
.landing .landing-content { position: relative; z-index: 1; }

/* Hero — first h1 + first p */
.landing .landing-content > h1:first-child,
.landing .landing-content > h1:first-of-type {
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    font-weight: 800;
    text-align: center;
    margin: 5rem auto 1.25rem;
    max-width: 800px;
    letter-spacing: -0.03em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing .landing-content > h1:first-of-type + p {
    font-size: clamp(1.125rem, 2vw, 1.375rem);
    text-align: center;
    color: var(--color-text-secondary);
    max-width: 640px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

/* CTA buttons row — first ul after hero p, or a p with links */
.landing .landing-content > h1:first-of-type + p + p,
.landing .landing-content > h1:first-of-type + p + ul {
    text-align: center;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 auto 4rem;
}

.landing .landing-content > h1:first-of-type + p + p a,
.landing .landing-content > h1:first-of-type + p + ul a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all var(--transition);
}

.landing .landing-content > h1:first-of-type + p + p a:first-child,
.landing .landing-content > h1:first-of-type + p + ul a:first-of-type {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md);
}
.landing .landing-content > h1:first-of-type + p + p a:first-child:hover,
.landing .landing-content > h1:first-of-type + p + ul a:first-of-type:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.landing .landing-content > h1:first-of-type + p + p a:not(:first-child),
.landing .landing-content > h1:first-of-type + p + ul a:not(:first-of-type) {
    background: var(--color-bg-secondary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.landing .landing-content > h1:first-of-type + p + p a:not(:first-child):hover,
.landing .landing-content > h1:first-of-type + p + ul a:not(:first-of-type):hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Feature cards — h2 sections become cards */
.landing .landing-content > h2 {
    font-size: 1.75rem;
    text-align: center;
    margin: 4rem auto 2.5rem;
    font-weight: 700;
}

.landing .landing-content > ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0 auto 3rem;
    max-width: 960px;
}

.landing .landing-content > ul > li {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.landing .landing-content > ul > li:hover {
    border-color: var(--color-primary);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--color-primary) 12%, transparent);
    transform: translateY(-2px);
}

.landing .landing-content > ul > li strong {
    display: block;
    font-size: 1.0625rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.landing .landing-content > ul > li code {
    font-size: 0.8125rem;
}

/* Divider line — hr */
.landing .landing-content > hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 3rem auto;
    max-width: 200px;
}

/* Code blocks on landing */
.landing .landing-content > pre {
    max-width: 720px;
    margin: 2rem auto;
    border-radius: var(--radius);
}

/* General landing text */
.landing .landing-content > p {
    text-align: center;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    color: var(--color-text-secondary);
}

/* Landing code blocks — reuse page-content pre styles */
.landing-content pre { position: relative; margin: 2rem auto; padding: 1.25rem 1.5rem; border-radius: var(--radius); overflow-x: auto; border: 1px solid var(--color-border); max-width: 720px; background: var(--color-bg-secondary); }
.landing-content pre code { font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.7; background: none; padding: 0; border: none; }
.landing-content pre .copy-btn { position: absolute; top: 0.5rem; right: 0.5rem; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.75); padding: 0.25rem 0.625rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-family: var(--font-mono); cursor: pointer; transition: all var(--transition); }
.landing-content pre .copy-btn:hover { background: rgba(255,255,255,0.25); color: #fff; border-color: rgba(255,255,255,0.4); }
.landing-content pre:hover .code-lang { opacity: 0; }
.landing-content pre .code-lang { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 0.6875rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); user-select: none; transition: opacity var(--transition); }
.landing-content pre.has-line-numbers { padding-left: 3.5rem; }
.landing-content pre .line-numbers { position: absolute; top: 1.25rem; left: 0; width: 2.75rem; text-align: right; padding-right: 0.75rem; font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.7; color: var(--color-text-muted); border-right: 1px solid var(--color-border); user-select: none; }
.landing-content pre .line-numbers span { display: block; }

@media (max-width: 768px) {
    .landing .landing-content { padding: 0 1rem; }
    .landing .landing-content > h1:first-of-type { margin-top: 2rem; }
    .landing .landing-content > ul { grid-template-columns: 1fr; }
}

/* Version selector */
.version-selector { position: relative; }
.version-trigger {
    display: flex; align-items: center; gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-bg); color: var(--color-text);
    font-size: 0.8125rem; font-weight: 500;
    cursor: pointer; transition: all 150ms ease;
    white-space: nowrap;
}
.version-trigger:hover { border-color: var(--color-primary); }
.version-trigger[aria-expanded="true"] { border-color: var(--color-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent); }
.version-chevron { transition: transform 150ms ease; }
.version-trigger[aria-expanded="true"] .version-chevron { transform: rotate(180deg); }
.version-dropdown {
    position: absolute; top: calc(100% + 0.375rem); right: 0;
    min-width: 180px; max-height: 280px; overflow-y: auto;
    background: var(--color-bg); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    list-style: none; margin: 0; padding: 0.25rem;
    z-index: 100;
}
.version-dropdown[hidden] { display: none; }
.version-option {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem; border-radius: calc(var(--radius) - 2px);
    color: var(--color-text); text-decoration: none;
    font-size: 0.8125rem; transition: background 100ms ease;
}
.version-option:hover { background: var(--color-bg-secondary); color: var(--color-text); }
.version-option.active { color: var(--color-primary); font-weight: 600; }
.version-badge {
    font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
    padding: 0.0625rem 0.375rem; border-radius: 9999px;
    letter-spacing: 0.02em;
}
.version-badge-default { background: color-mix(in srgb, var(--color-primary) 15%, transparent); color: var(--color-primary); }
.version-badge-pre { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #d97706; }
@media (max-width: 768px) {
    .version-trigger .version-label { display: none; }
    .version-dropdown { right: auto; left: 0; }
}

/* Mermaid diagrams */
.mermaid {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
    background: transparent;
    border: none;
    overflow-x: auto;
}

/* ================================ */
/* Animations & Visual Polish       */
/* ================================ */

/* --- Keyframes --- */
@keyframes heroGradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideInLeft {
    from { width: 0; }
    to { width: 2px; }
}
@keyframes slideInFromBottom {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 1. Landing Page: Hero gradient animation --- */
.landing-hero::before {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--color-primary) 8%, transparent) 0%,
        color-mix(in srgb, #7c3aed 6%, transparent) 25%,
        color-mix(in srgb, #2563eb 5%, transparent) 50%,
        color-mix(in srgb, var(--color-primary) 7%, transparent) 75%,
        color-mix(in srgb, #06b6d4 5%, transparent) 100%) !important;
    background-size: 300% 300% !important;
    animation: heroGradientShift 12s ease infinite;
}

/* Hero dot/grid pattern overlay */
.landing-hero .hero-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--color-primary) 15%, transparent) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}
[data-theme="dark"] .landing-hero .hero-grid-pattern {
    opacity: 0.3;
}

/* Floating/pulsing hero icon */
.landing-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 1.5rem;
    border-radius: 18px;
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    color: var(--color-primary);
    font-size: 2rem;
    animation: heroFloat 4s ease-in-out infinite;
}

/* Staggered fade-in for hero elements */
.landing-hero-title {
    animation: fadeInUp 0.7s ease both;
    animation-delay: 0.1s;
}
.landing-hero-subtitle {
    animation: fadeInUp 0.7s ease both;
    animation-delay: 0.25s;
}
.landing-hero-actions {
    animation: fadeInUp 0.7s ease both;
    animation-delay: 0.4s;
}

/* Feature card hover lift */
.landing-feature-card {
    transition: border-color 200ms ease, box-shadow 300ms ease, transform 300ms ease !important;
}
.landing-feature-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 36px color-mix(in srgb, var(--color-primary) 14%, transparent) !important;
}

/* --- 2. Page transitions --- */
.page-content {
    animation: fadeIn 0.4s ease both;
}
.page-content h1,
.page-content h2,
.page-content h3 {
    animation: slideInFromBottom 0.5s ease both;
}

/* --- 3. Typography improvements --- */
.page-content h1 {
    font-size: 2.25rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    line-height: 1.15 !important;
    margin-bottom: 1.25rem !important;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.page-content h2 {
    font-size: 1.6rem !important;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.page-content h3 {
    font-size: 1.3rem !important;
    letter-spacing: -0.015em;
    line-height: 1.3;
}
.page-content p {
    line-height: 1.8;
    margin-bottom: 1.15rem;
}
.page-content li {
    line-height: 1.75;
}

/* Better inline code styling */
.page-content code {
    font-size: 0.84em !important;
    padding: 0.15rem 0.45rem !important;
    border-radius: 5px !important;
    border: 1px solid color-mix(in srgb, var(--color-primary-dark) 12%, var(--color-border));
    font-weight: 500;
}
.page-content pre code {
    border: none !important;
    font-weight: normal !important;
    font-size: 0.875rem !important;
    padding: 0 !important;
    border-radius: 0 !important;
    -webkit-text-fill-color: unset;
    background-clip: unset;
    -webkit-background-clip: unset;
    background: none !important;
}
/* Ensure h1 gradient doesn't break in code inside headings */
.page-content h1 code {
    -webkit-text-fill-color: var(--color-primary-dark);
}

/* --- 4. Sidebar polish --- */
.nav-children {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}
.nav-children:not(.expanded) {
    max-height: 0 !important;
    opacity: 0;
    display: block !important;
}
.nav-children.expanded {
    max-height: 2000px;
    opacity: 1;
}
.nav-link {
    transition: all 0.2s ease !important;
    border-left: 2px solid transparent;
    position: relative;
}
.nav-link.current {
    border-left-color: var(--color-primary) !important;
    transition: all 0.25s ease, border-left-color 0.3s ease !important;
}
.nav-link:hover {
    padding-left: calc(0.75rem + 2px) !important;
}
.nav-chevron-btn {
    transition: all 0.2s ease !important;
}

/* --- 5. Code block improvements --- */
.page-content pre .code-lang {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    font-size: 0.65rem !important;
    font-family: var(--font-mono) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    padding: 0.25rem 0.65rem !important;
    border-radius: 0 var(--radius) 0 var(--radius) !important;
    background: rgba(255,255,255,0.08) !important;
    color: rgba(255,255,255,0.5) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-left: 1px solid rgba(255,255,255,0.06);
    user-select: none;
    transition: opacity var(--transition);
    font-weight: 500;
}
[data-code-theme="catppuccin-latte"] .page-content pre .code-lang,
[data-code-theme="github-light"] .page-content pre .code-lang {
    background: rgba(0,0,0,0.04) !important;
    color: rgba(0,0,0,0.4) !important;
    border-bottom-color: rgba(0,0,0,0.06);
    border-left-color: rgba(0,0,0,0.06);
}

/* Better line number styling */
.page-content pre .line-numbers {
    opacity: 0.35 !important;
    border-right-color: rgba(255,255,255,0.08) !important;
    font-size: 0.8rem !important;
}
[data-code-theme="catppuccin-latte"] .page-content pre .line-numbers,
[data-code-theme="github-light"] .page-content pre .line-numbers {
    border-right-color: rgba(0,0,0,0.08) !important;
}

/* Code block toolbar integrated look */
.page-content pre .copy-btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.7rem !important;
    padding: 0.2rem 0.6rem !important;
    letter-spacing: 0.02em;
    transition: all 0.2s ease !important;
}

/* --- 6. TOC scroll spy --- */
.toc-item a {
    transition: all 0.25s ease !important;
    border-left: 2px solid transparent !important;
    margin-left: -2px;
}
.toc-item a.active {
    color: var(--color-primary) !important;
    font-weight: 600 !important;
    border-left-color: var(--color-primary) !important;
    background: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

/* --- 7. Back to top button polish --- */
.back-to-top {
    opacity: 0 !important;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease, box-shadow 0.2s ease !important;
}
.back-to-top.visible {
    opacity: 1 !important;
    transform: translateY(0);
    pointer-events: auto;
}
.back-to-top:hover {
    background: var(--color-primary-dark) !important;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--color-primary) 40%, transparent) !important;
    transform: translateY(-2px);
}

/* --- Landing page staggered content on markdown-based landing --- */
.landing .landing-content > h1:first-of-type {
    animation: fadeInUp 0.7s ease both;
    animation-delay: 0.1s;
}
.landing .landing-content > h1:first-of-type + p {
    animation: fadeInUp 0.7s ease both;
    animation-delay: 0.25s;
}
.landing .landing-content > h1:first-of-type + p + p,
.landing .landing-content > h1:first-of-type + p + ul {
    animation: fadeInUp 0.7s ease both;
    animation-delay: 0.4s;
}
.landing .landing-content > ul > li {
    transition: border-color 200ms ease, box-shadow 300ms ease, transform 300ms ease !important;
}
.landing .landing-content > ul > li:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 36px color-mix(in srgb, var(--color-primary) 14%, transparent) !important;
}

/* ── Reduced Motion ─────────────────────────────────────── */
/* Respects OS-level "reduce motion" + config showAnimations: false */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
[data-no-animations] *, [data-no-animations] *::before, [data-no-animations] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}
/* Landing page overrides */
body.landing { overflow-x: hidden; }
.landing-hero {
    position: relative;
    padding: 6rem 2rem 4rem;
    text-align: center;
    overflow: hidden;
}
.landing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--color-primary) 6%, transparent) 0%,
        color-mix(in srgb, #7c3aed 5%, transparent) 50%,
        color-mix(in srgb, #2563eb 4%, transparent) 100%);
    pointer-events: none;
    z-index: 0;
}
.landing-hero::after {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: min(900px, 200vw);
    height: 600px;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--color-primary) 12%, transparent) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.landing-hero > * { position: relative; z-index: 1; }
.landing-hero-title {
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 auto 1.25rem;
    max-width: 800px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--gradient-secondary) 50%, var(--gradient-tertiary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.landing-hero-subtitle {
    font-size: clamp(1.125rem, 2vw, 1.375rem);
    color: var(--color-text-secondary);
    max-width: 640px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}
.landing-hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.landing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 150ms ease;
    border: none;
    cursor: pointer;
    min-width: 200px;
}
.landing-btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--color-primary) 40%, transparent);
}
.landing-btn-primary:hover {
    background: var(--color-primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--color-primary) 50%, transparent);
}
.landing-btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    backdrop-filter: blur(4px);
}
.landing-btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
}
.landing-btn svg { width: 18px; height: 18px; }

/* Features grid */
.landing-features {
    max-width: 1080px;
    margin: 0 auto;
    padding: 4rem 2rem;
}
.landing-features-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
}
.landing-features-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: 3rem;
    font-size: 1.0625rem;
}
.landing-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}
.landing-feature-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    transition: border-color 150ms ease, box-shadow 200ms ease, transform 200ms ease;
    position: relative;
    overflow: hidden;
}
.landing-feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    opacity: 0;
    transition: opacity 200ms ease;
}
.landing-feature-card:hover {
    border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
    box-shadow: 0 8px 30px color-mix(in srgb, var(--color-primary) 10%, transparent);
    transform: translateY(-3px);
}
.landing-feature-card:hover::before { opacity: 1; }
.landing-feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}
.landing-feature-name {
    font-size: 1.0625rem;
    font-weight: 650;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}
.landing-feature-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Code preview section */
.landing-code-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    text-align: center;
}
.landing-code-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.landing-code-subtitle {
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    font-size: 1.0625rem;
}
.landing-code-block {
    position: relative;
    text-align: left;
    background: #1e293b;
    border-radius: var(--radius);
    padding: 1.5rem;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
[data-theme="dark"] .landing-code-block {
    background: #0c1222;
    border-color: #334155;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.landing-code-block pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    overflow: visible;
}
.landing-code-block code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.8;
    color: #e2e8f0;
    background: none;
    padding: 0;
    border: none;
}
.landing-code-block .code-comment { color: #64748b; }
.landing-code-block .code-key { color: #7dd3fc; }
.landing-code-block .code-string { color: #86efac; }
.landing-code-block .code-lang-badge {
    position: absolute;
    top: 0.625rem;
    right: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    user-select: none;
}

/* Landing copy button — high contrast on dark code blocks */
.landing-code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 150ms ease;
    opacity: 0;
}
.landing-code-block:hover .copy-btn { opacity: 1; }
.landing-code-block:hover .code-lang-badge { opacity: 0; }
.landing-code-block .copy-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border-color: rgba(255,255,255,0.35);
}

/* Markdown content area below hero */
.landing-md-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}
.landing-md-content h2 { text-align: center; font-size: 1.75rem; margin: 2.5rem 0 1rem; }
.landing-md-content table {
    width: 100%; border-collapse: collapse; font-size: 0.875rem; margin: 1rem 0;
    background: var(--color-bg); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--color-border);
}
.landing-md-content th { background: var(--color-bg-secondary); font-weight: 600; text-align: left; }
.landing-md-content th, .landing-md-content td { padding: 0.625rem 1rem; border: 1px solid var(--color-border); }
.landing-md-content tr:hover td { background: var(--color-bg-secondary); }

/* Landing footer */
.landing-footer {
    text-align: center;
    padding: 2.5rem 1rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}
.landing-footer-heart { color: var(--color-primary); }
.landing-footer a { color: var(--color-text-secondary); }
.landing-footer a:hover { color: var(--color-primary); }

/* Divider */
.landing-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    max-width: 200px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 900px) {
    .landing-features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .landing-hero { padding: 3rem 1rem 2.5rem; }
    .landing-features { padding: 2rem 1rem; }
    .landing-features-grid { grid-template-columns: 1fr; }
    .landing-code-section { padding: 1rem 1rem 2rem; }
    .landing-md-content { padding: 0 1rem 2rem; }
}