/* WATCHOUT Wiki/User Guide - Stylesheet */
/* Using the same visual style as the shortcuts page */

@font-face {
    font-family: 'Futura Now Headline';
    src: url('fonts/FuturaNowHeadline-Rg.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-glass: rgba(30, 30, 45, 0.7);
    --accent-primary: #6B25DD;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #c4b5fd;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #8494a7;
    --key-bg: linear-gradient(145deg, #1e1e2e, #16161f);
    --key-border: #2a2a3a;
    --cat-general: #22c55e;
    --cat-edit: #3b82f6;
    --cat-timeline: #f59e0b;
    --cat-stage: #ec4899;
    --cat-property: #06b6d4;
    --cat-camera: #84cc16;
    --cat-effect: #f43f5e;
    --cat-table: #a855f7;
    --cat-warp: #14b8a6;
    --font-family: 'Futura Now Headline', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-header: 'Futura Now Headline', sans-serif;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --sidebar-width: 320px;
    /* Theme-specific */
    --bg-gradient-1: rgba(99, 102, 241, 0.15);
    --bg-gradient-2: rgba(139, 92, 246, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-bg-hover: rgba(255, 255, 255, 0.08);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --table-header-bg: rgba(107, 37, 221, 0.15);
    --table-row-hover: rgba(107, 37, 221, 0.1);
    --code-bg: rgba(139, 92, 246, 0.2);
    --surface-elevated: #1a1a25;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #6a6a6a;
    --scrollbar-thumb-hover: #8a8a8a;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-glass: #ffffff;
    --accent-primary: #6200EA;
    --accent-secondary: #7C3AFF;
    --accent-tertiary: #B388FF;
    --accent-glow: rgba(98, 0, 234, 0.10);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --key-bg: linear-gradient(145deg, #ffffff, #f1f5f9);
    --key-border: #cbd5e1;
    --bg-gradient-1: rgba(98, 0, 234, 0.03);
    --bg-gradient-2: rgba(124, 58, 255, 0.02);
    --border-subtle: #cbd5e1;
    --input-bg: #ffffff;
    --input-bg-hover: #f1f5f9;
    --hover-bg: #e2e8f0;
    --shadow-color: rgba(100, 116, 139, 0.12);
    --table-header-bg: #f8fafc;
    --table-row-hover: #f1f5f9;
    --code-bg: #f1f5f9;
    --surface-elevated: #ffffff;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #94a3b8;
    --scrollbar-thumb-hover: #64748b;
}

/* Midnight Theme (OLED / High Contrast) */
[data-theme="midnight"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #121212;
    --bg-glass: rgba(10, 10, 10, 0.9);
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-tertiary: #93c5fd;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --text-muted: #a3a3a3;
    --key-bg: linear-gradient(145deg, #171717, #0a0a0a);
    --key-border: #262626;
    --bg-gradient-1: rgba(59, 130, 246, 0.1);
    --bg-gradient-2: rgba(37, 99, 235, 0.05);
    --border-subtle: #262626;
    --input-bg: #171717;
    --input-bg-hover: #262626;
    --hover-bg: #171717;
    --shadow-color: rgba(0, 0, 0, 0.8);
    --table-header-bg: #171717;
    --table-row-hover: #0a0a0a;
    --code-bg: #171717;
    --surface-elevated: #0a0a0a;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #525252;
    --scrollbar-thumb-hover: #737373;
}

/* Rust Theme (Warm / Earthy) */
[data-theme="rust"] {
    --bg-primary: #1c1917;
    --bg-secondary: #292524;
    --bg-tertiary: #44403c;
    --bg-glass: rgba(28, 25, 23, 0.8);
    --accent-primary: #d16636;
    --accent-secondary: #e07d52;
    --accent-tertiary: #f2b89b;
    --accent-glow: rgba(209, 102, 54, 0.24);
    --text-primary: #f5f5f4;
    --text-secondary: #a8a29e;
    --text-muted: #78716c;
    --key-bg: linear-gradient(145deg, #292524, #1c1917);
    --key-border: #44403c;
    --bg-gradient-1: rgba(234, 88, 12, 0.05);
    --bg-gradient-2: rgba(249, 115, 22, 0.03);
    --border-subtle: #44403c;
    --input-bg: #292524;
    --input-bg-hover: #44403c;
    --hover-bg: #292524;
    --shadow-color: rgba(28, 25, 23, 0.5);
    --table-header-bg: #292524;
    --table-row-hover: #1c1917;
    --code-bg: #292524;
    --surface-elevated: #292524;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #44403D;
    --scrollbar-thumb-hover: var(--accent-primary);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    line-height: 1.6;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 20% 20%, var(--bg-gradient-1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, var(--bg-gradient-2) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s ease, min-width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.sidebar.collapsed .logo,
.sidebar.collapsed .search-container,
.sidebar.collapsed .toc-chapter-title,
.sidebar.collapsed .toc-chapter-arrow,
.sidebar.collapsed .toc-subsections,
.sidebar.collapsed .sidebar-footer .nav-link span:not(.logo-icon) {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .toc-chapter-header {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .toc-chapter-icon {
    margin: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-link {
    color: inherit;
    text-decoration: none;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

.logo h1 {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .highlight {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.search-container {
    position: relative;
    padding: 16px 20px;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px var(--accent-glow);
}

.search-icon {
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.search-clear.visible {
    display: flex;
}

/* Table of Contents Navigation */
.toc-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
    isolation: isolate;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.toc-chapter {
    margin-bottom: 4px;
    position: relative;
}

.toc-chapter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-header);
    font-size: 0.9rem;
    line-height: 22px;
    font-weight: 400;
    cursor: pointer;
    width: 100%;
    text-align: left;
    position: relative;
    z-index: 1;
}

.toc-chapter-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toc-chapter-header.active {
    background: var(--accent-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    z-index: 2;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.toc-chapter-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.toc-chapter-header.active .toc-chapter-icon {
    color: #ffffff;
}

.toc-chapter-arrow {
    margin-left: auto;
    transition: transform var(--transition-fast);
}

.toc-chapter-header.expanded .toc-chapter-arrow {
    transform: rotate(90deg);
}

.toc-subsections {
    display: grid;
    grid-template-rows: 0fr;
    padding-top: 0;
    margin: 0;
    overflow: hidden;
}

.toc-chapter.expanded .toc-subsections {
    grid-template-rows: 1fr;
    padding-top: 4px;
}

.toc-subsections-inner {
    overflow: hidden;
    min-height: 0;
}

.toc-subsection {
    display: block;
    padding: 8px 12px 8px 50px;
    /* Restored indentation */
    color: var(--text-muted);
    /* Was secondary, moved to muted which is usually lighter/clearer or change to primary? Let's verify */
    /* Wait, usually 'muted' is darker. 'secondary' is 94a3b8. 'primary' is f8fafc. 
       The user said "darker font" as a complaint. They want it brighter?
       Let's try var(--text-secondary) but maybe bump opacity or use a brighter color?
       Actually, let's look at :root. 
       --text-primary: #f8fafc (white-ish)
       --text-secondary: #94a3b8 (grey-ish)
       If they say "use darker font" they might mean "it currently uses darker font and I don't want that".
       "the subchapters ... use darker font" -> implies this is bad.
       So I should use --text-primary or something closer to it.
       Let's use a custom color or just --text-primary with slight opacity to distinguish?
       Or just --text-secondary but maybe it's too dark on their screen.
       Let's try setting it to --text-primary but maybe 0.9 opacity? 
       Or just stick to --text-primary for high visibility given the complaint.
    */
    color: var(--text-primary);
    opacity: 0.8;
    font-size: 0.85rem;
    line-height: 20px;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
}

.toc-subsection:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    opacity: 1;
}

.toc-subsection.active {
    background: var(--accent-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    opacity: 1;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.toc-group-label {
    padding: 10px 12px 4px 36px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
}

.toc-group-label:first-child {
    padding-top: 4px;
}

/* Disabled state */
.toc-chapter.disabled .toc-chapter-header,
.toc-chapter.disabled .toc-subsections,
.toc-card.disabled,
.quick-link-card.disabled {
    opacity: 0.4;
    cursor: default;
    filter: grayscale(1);
    pointer-events: none;
}

.toc-chapter.disabled .toc-chapter-header:hover,
.toc-card.disabled:hover,
.quick-link-card.disabled:hover {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.06);
    transform: none;
    box-shadow: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed~.main-content {
    margin-left: 60px;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 50;
}

.header-logo {
    height: 24px;
    width: auto;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.header-home-link {
    margin-left: auto;
    display: flex;
    align-items: center;
}

[data-theme="light"] .header-logo {
    filter: brightness(0) invert(0);
}

.mobile-menu-btn {
    display: none;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-item.current {
    color: var(--accent-tertiary);
}

.content-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.content-body > * {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 40px;
}

/* Welcome Section */
.welcome-section {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLogo {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 0.95;
        transform: translateY(0);
    }
}

.welcome-hero {
    text-align: center;
    padding: 60px 40px;
    margin-bottom: 40px;
}

.hero-media {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.hero-media video {
    max-width: 100%;
    width: 640px;
    border-radius: 16px;
    box-shadow: 0 20px 50px var(--shadow-color);
    border: 1px solid var(--border-subtle);
    display: block;
    animation: fadeIn 1s ease-out;
}

.hero-solid-bg {
    max-width: 100%;
    width: 640px;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    box-shadow: 0 20px 50px var(--shadow-color);
    border: 1px solid var(--border-subtle);
    display: block;
    animation: fadeIn 1s ease-out;
    background: #6B25DD;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    border-radius: 16px;
    /* Match video border radius */
}

.hero-logo {
    width: 90%;
    max-width: 600px;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
    border-radius: 16px;
    opacity: 0.5;
    animation: fadeInLogo 1.5s ease-out;
}

.hero-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /*font-family: var(--font-header);*/
    font-size: 5rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.1em;
    z-index: 20;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 8px 30px rgba(0, 0, 0, 0.6);
    opacity: 0;
    animation: fadeInText 1s ease-out 0.5s forwards;
    pointer-events: none;
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.quick-links {
    margin-bottom: 50px;
}

.quick-links h2,
.toc-preview h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.quick-link-card {
    padding: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.quick-link-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: white;
}

.toc-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-link-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.quick-link-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.toc-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toc-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.toc-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toc-card-badge {
    padding: 2px 8px;
    background: var(--accent-primary);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
}

.toc-card-subsections {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.toc-card-subsection {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Section Content Styles */
.section-content {
    animation: fadeIn 0.4s ease;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
}

.section-body {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 32px;
    min-height: 300px;
}

.section-body h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.section-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-tertiary);
    margin: 24px 0 12px;
}

.section-body p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.content-image {
    width: 50%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 16px 0;
    display: block;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.content-video {
    width: 200px;
    height: auto;
    border-radius: var(--border-radius);
    margin: 0 0 16px 24px;
    float: right;
    clear: right;
    box-shadow: 0 4px 6px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-video:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px var(--shadow-color);
}

.video-placeholder {
    width: 200px;
    height: 112px;
    /* Approx 16:9 ratio of 200px width */
    background: var(--bg-tertiary);
    border: 1px dashed var(--text-muted);
    border-radius: var(--border-radius);
    margin: 0 0 16px 24px;
    float: right;
    clear: right;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    pointer-events: none;
    user-select: none;
}

/* Video Modal Overlay */
.video-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.video-modal.active {
    display: flex;
}

.video-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.video-modal-close:hover {
    opacity: 1;
}

/* Info and Warning Boxes */
.info-box,
.warning-box {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin: 24px 0;
    border-left: 4px solid;
}

.info-box {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--accent-primary);
}

.info-box p,
.warning-box p {
    margin-bottom: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.info-box strong,
.warning-box strong {
    color: var(--accent-tertiary);
}

.warning-box {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
}

.warning-box strong {
    color: #fbbf24;
}

.note-box {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin: 24px 0;
    border-left: 4px solid;
    background: rgba(20, 184, 166, 0.1);
    /* Turquoise background */
    border-left-color: #14b8a6;
    /* Turquoise border */
}

.note-box p {
    margin-bottom: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.note-box strong {
    color: #2dd4bf;
    /* Lighter turquoise for strong text */
}

/* Horizontal Divider / Splitter */
.section-body hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--border-subtle) 15%,
            var(--accent-primary) 50%,
            var(--border-subtle) 85%,
            transparent 100%);
    margin: 32px 0;
    opacity: 0.6;
}

/* h4 headings in section body */
.section-body h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 10px;
}

.subsection-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.subsection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.subsection-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.subsection-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.subsection-details {
    flex: 1;
}

.subsection-details h4 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.subsection-details span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.subsection-description {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.section-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.section-nav .nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.section-nav .nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.section-nav .nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.content-footer {
    padding: 12px 40px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Scrollbar */
.content-body::-webkit-scrollbar,
.toc-nav::-webkit-scrollbar {
    width: 8px;
}

.content-body::-webkit-scrollbar-track,
.toc-nav::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.content-body::-webkit-scrollbar-thumb,
.toc-nav::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 1px solid var(--scrollbar-track);
    border-radius: 4px;
}

.content-body::-webkit-scrollbar-thumb:hover,
.toc-nav::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sidebar-toggle {
        display: flex;
    }

    .content-body > * {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .welcome-hero {
        padding: 40px 24px;
    }

    .welcome-hero h1 {
        font-size: 1.75rem;
    }

    .hero-icon {
        font-size: 3rem;
    }

    .links-grid {
        grid-template-columns: 1fr;
    }

    .toc-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header h1 {
        font-size: 1.5rem;
    }

    .section-nav {
        flex-direction: column;
        gap: 12px;
    }

    .section-nav .nav-btn {
        justify-content: center;
    }
}

/* Search Results Highlighting */
.search-highlight {
    background: linear-gradient(135deg, rgba(107, 37, 221, 0.3), rgba(139, 92, 246, 0.2));
    color: var(--text-primary);
    padding: 2px 4px;
    border-radius: 4px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.no-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* Reduced Motion Support - Apple HIG Accessibility */
@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;
    }
}

/* Global Focus-Visible Styles */
.toc-chapter-header:focus-visible,
.toc-subsection:focus-visible,
.nav-link:focus-visible,
.quick-link-card:focus-visible,
.toc-card:focus-visible,
.subsection-item:focus-visible,
.sidebar-toggle:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Section Content Body - Wiki Content Styles */
.section-content-body {
    line-height: 1.8;
    color: var(--text-primary);
}

.section-content-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 32px 0 16px 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.section-content-body h2:first-child {
    margin-top: 0;
}

.section-content-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 24px 0 12px 0;
    color: var(--text-primary);
}

.section-content-body h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 10px 0;
    color: var(--text-secondary);
}

.section-content-body p {
    margin: 12px 0;
    color: var(--text-secondary);
}

.section-content-body ul,
.section-content-body ol {
    margin: 12px 0;
    padding-left: 24px;
    color: var(--text-secondary);
}

.section-content-body li {
    margin: 8px 0;
    line-height: 1.6;
}

.section-content-body strong,
.section-content-body b {
    font-weight: 600;
    color: var(--text-primary);
}

.section-content-body em,
.section-content-body i {
    font-style: italic;
    color: var(--text-secondary);
}

.section-content-body code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9em;
    color: var(--accent-tertiary);
}

.section-content-body pre {
    background: var(--surface-elevated);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-subtle);
}

.section-content-body pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.section-content-body blockquote {
    border-left: 3px solid var(--accent-primary);
    margin: 16px 0;
    padding: 12px 16px;
    background: rgba(107, 37, 221, 0.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.section-content-body a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.section-content-body a:hover {
    color: var(--accent-tertiary);
    text-decoration: underline;
}

.section-content-body hr {
    border: none;
    height: 1px;
    background: var(--border-subtle);
    margin: 24px 0;
}

.section-content-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 0.95rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.section-content-body th,
.section-content-body td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
}

.section-content-body tr th:last-child,
.section-content-body tr td:last-child {
    border-right: none;
}

.section-content-body tr:last-child th,
.section-content-body tr:last-child td {
    border-bottom: none;
}

.section-content-body th {
    background: var(--table-header-bg);
    font-weight: 600;
    color: var(--text-primary);
}

.section-content-body td {
    color: var(--text-secondary);
}

.section-content-body tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.section-content-body tr:hover td {
    background: var(--table-row-hover);
}

.section-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

/* Section Overview (legacy fallback for chapters without grouped links) */
.section-overview {
    background: linear-gradient(135deg, rgba(107, 37, 221, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(107, 37, 221, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.section-overview p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.7;
}

/* Chapter Landing — git-graph progress rail with grouped article links */

/* Section color palette — progresses through the spectrum */
.chapter-landing {
    --rail-color-0: #8b5cf6;
}

/* violet */
.chapter-landing {
    --rail-color-1: #3b82f6;
}

/* blue */
.chapter-landing {
    --rail-color-2: #06b6d4;
}

/* cyan */
.chapter-landing {
    --rail-color-3: #22c55e;
}

/* green */
.chapter-landing {
    --rail-color-4: #f59e0b;
}

/* amber */

/* Container — left padding for the rail */
.chapter-landing {
    position: relative;
    padding-left: 36px;
    --rail-line-left: -30px;
    --rail-center-x: -29px;
    --small-dot-size: 8px;
    --small-dot-top: 17px;
}

/* --- Section headings (large milestone dots) --- */
.chapter-landing h3 {
    position: relative;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 0 0;
    padding-bottom: 6px;
    border-bottom: none;
}

/* Large dot */
.chapter-landing h3::before {
    content: '';
    position: absolute;
    left: calc(var(--rail-center-x) - 7px);
    top: 7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--rail-color-0);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--rail-color-0);
    z-index: 2;
}

/* Vertical line segment extending down from h3 */
.chapter-landing h3::after {
    content: '';
    position: absolute;
    left: var(--rail-line-left);
    top: 21px;
    width: 2px;
    bottom: 0;
    background: var(--rail-color-0);
    opacity: 0.4;
    z-index: 1;
}

/* --- Intro paragraph between h3 and ul --- */
.chapter-landing h3+p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
    padding-bottom: 12px;
    line-height: 1.5;
    position: relative;
}

/* Continue the line through the intro paragraph */
.chapter-landing h3+p::before {
    content: '';
    position: absolute;
    left: var(--rail-line-left);
    top: 0;
    width: 2px;
    bottom: 0;
    background: var(--rail-color-0);
    opacity: 0.4;
    z-index: 1;
}

/* --- Article lists --- */
.chapter-landing ul {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

/* Vertical line running through the list */
.chapter-landing ul::before {
    content: '';
    position: absolute;
    left: var(--rail-line-left);
    top: 0;
    width: 2px;
    bottom: 0;
    background: var(--rail-color-0);
    opacity: 0.4;
    z-index: 1;
}

/* Connect sections and then end rail after final list */
.chapter-landing>ul:not(:last-child)::before {
    bottom: -38px;
}

.chapter-landing>ul:last-child::before {
    bottom: 0;
    background: linear-gradient(to bottom,
            var(--_c, var(--rail-color-0)) 0%,
            var(--_c, var(--rail-color-0)) calc(100% - 18px),
            transparent 100%);
}

/* If a section has no intro paragraph, bridge h3 directly to ul */
.chapter-landing h3+ul::before {
    top: -6px;
}

/* --- Article items (small dots) --- */
.chapter-landing ul li {
    margin: 0;
    padding: 12px 16px 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

/* Small dot on each list item */
.chapter-landing ul li::before {
    content: '';
    position: absolute;
    left: calc(var(--rail-center-x) - (var(--small-dot-size) / 2));
    top: var(--small-dot-top);
    width: var(--small-dot-size);
    height: var(--small-dot-size);
    border-radius: 50%;
    background: var(--rail-color-0);
    z-index: 2;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.chapter-landing ul li:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.chapter-landing ul li:hover::before {
    transform: translateX(-4px) scale(1.35);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--_c, var(--rail-color-0)) 22%, transparent);
}

.chapter-landing ul li:focus-within::before,
.chapter-landing ul li:active::before {
    transform: scale(1.35);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--_c, var(--rail-color-0)) 22%, transparent);
}

.chapter-landing ul li a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.93rem;
}

.chapter-landing ul li a:hover {
    color: var(--accent-secondary);
}

/* --- Color progression per section --- */
.chapter-landing h3[data-section="0"]::before,
.chapter-landing h3[data-section="0"]::after,
.chapter-landing h3[data-section="0"]+p::before,
.chapter-landing ul[data-section="0"]::before,
.chapter-landing ul[data-section="0"] li::before {
    --_c: var(--rail-color-0);
}

.chapter-landing h3[data-section="1"]::before,
.chapter-landing h3[data-section="1"]::after,
.chapter-landing h3[data-section="1"]+p::before,
.chapter-landing ul[data-section="1"]::before,
.chapter-landing ul[data-section="1"] li::before {
    --_c: var(--rail-color-1);
}

.chapter-landing h3[data-section="2"]::before,
.chapter-landing h3[data-section="2"]::after,
.chapter-landing h3[data-section="2"]+p::before,
.chapter-landing ul[data-section="2"]::before,
.chapter-landing ul[data-section="2"] li::before {
    --_c: var(--rail-color-2);
}

.chapter-landing h3[data-section="3"]::before,
.chapter-landing h3[data-section="3"]::after,
.chapter-landing h3[data-section="3"]+p::before,
.chapter-landing ul[data-section="3"]::before,
.chapter-landing ul[data-section="3"] li::before {
    --_c: var(--rail-color-3);
}

.chapter-landing h3[data-section="4"]::before,
.chapter-landing h3[data-section="4"]::after,
.chapter-landing h3[data-section="4"]+p::before,
.chapter-landing ul[data-section="4"]::before,
.chapter-landing ul[data-section="4"] li::before {
    --_c: var(--rail-color-4);
}

/* Apply the section color variable to all rail elements */
.chapter-landing h3::before {
    background: var(--_c, var(--rail-color-0));
    box-shadow: 0 0 0 2px var(--_c, var(--rail-color-0));
}

.chapter-landing h3::after,
.chapter-landing h3+p::before,
.chapter-landing ul::before {
    background: var(--_c, var(--rail-color-0));
}

.chapter-landing ul li::before {
    background: var(--_c, var(--rail-color-0));
}

/* --- Light theme overrides --- */
[data-theme="light"] .chapter-landing h3::before {
    border-color: var(--bg-primary);
}

[data-theme="light"] .chapter-landing ul li {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 3px var(--shadow-color);
}

[data-theme="light"] .chapter-landing ul li:hover {
    box-shadow: 0 4px 8px -2px var(--shadow-color);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

/* Glossary and Legal chapter exception: use plain flow (no rail/dots/cards) */
body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing {
    padding-left: 0;
}

body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing h3 {
    margin-top: 24px;
    padding-bottom: 0;
}

body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing h3::before,
body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing h3::after,
body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing h3+p::before,
body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing ul::before,
body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing ul li::before {
    content: none;
}

body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing h3+p {
    margin: 8px 0 16px;
    padding-bottom: 0;
    color: var(--text-secondary);
}

body[data-page-id="legal"] .chapter-landing p {
    margin: 8px 0 16px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.7;
}

body[data-page-id="legal"] .chapter-landing p a {
    color: var(--accent-secondary);
    text-decoration: none;
    font-weight: 500;
}

body[data-page-id="legal"] .chapter-landing p a:hover {
    color: var(--accent-tertiary);
    text-decoration: underline;
}

body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing ul {
    display: block;
    list-style: disc;
    margin: 8px 0 16px 22px;
}

body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing ul li {
    margin: 0 0 6px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: default;
    transform: none;
}

body:is([data-page-id="glossary"], [data-page-id="legal"]) .chapter-landing ul li:hover {
    background: transparent;
    border: 0;
    transform: none;
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links::before {
    content: none;
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links li {
    margin: 0;
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    transform: none;
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links li span {
    color: var(--text-secondary);
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links li a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    word-break: break-word;
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links li a:hover {
    color: var(--accent-secondary);
}

body[data-page-id="legal"] .chapter-landing ul.legal-support-links li:hover {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--accent-primary);
    transform: none;
}

body[data-page-id="glossary"] .glossary-search {
    margin: 4px 0 20px;
    padding: 14px;
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
}

body[data-page-id="glossary"] .glossary-search-row {
    display: block;
}

body[data-page-id="glossary"] .glossary-search-input-wrap {
    position: relative;
}

body[data-page-id="glossary"] .glossary-search-input {
    width: 100%;
    min-width: 0;
    padding: 10px 38px 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--input-bg);
    color: var(--text-primary);
    font: inherit;
}

body[data-page-id="glossary"] .glossary-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

body[data-page-id="glossary"] .glossary-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

body[data-page-id="glossary"] .glossary-search-clear-x {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 0;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

body[data-page-id="glossary"] .glossary-search-clear-x.visible {
    opacity: 1;
    pointer-events: auto;
}

body[data-page-id="glossary"] .glossary-search-clear-x:hover {
    color: var(--text-secondary);
}

body[data-page-id="glossary"] .glossary-search-meta {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

body[data-page-id="glossary"] .glossary-search-empty {
    color: #f59e0b;
    display: none;
}

.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-theme-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.sidebar-theme-toggle:active {
    transform: scale(0.95);
}

.sidebar-theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* Light theme specific adjustments */
[data-theme="light"] .sidebar {
    box-shadow: 2px 0 20px var(--shadow-color);
}

[data-theme="light"] .search-input {
    background: var(--input-bg);
    border-color: var(--border-subtle);
}

[data-theme="light"] .search-input:focus {
    background: var(--input-bg-hover);
}

[data-theme="light"] .toc-chapter-header:hover {
    background: var(--hover-bg);
}

[data-theme="light"] .section-content-body tr:nth-child(even) td {
    background: var(--bg-tertiary);
}

[data-theme="light"] .feature-card {
    background: var(--bg-secondary);
    border-color: var(--border-subtle);
    box-shadow: 0 4px 15px var(--shadow-color);
}

[data-theme="light"] .chapter-card {
    background: var(--bg-secondary);
    border-color: var(--border-subtle);
}

[data-theme="light"] .chapter-card:hover {
    box-shadow: 0 10px 30px var(--shadow-color);
}

[data-theme="light"] .toc-card,
[data-theme="light"] .quick-link-card,
[data-theme="light"] .section-body,
[data-theme="light"] .subsection-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 3px var(--shadow-color);
}

[data-theme="light"] .toc-card:hover,
[data-theme="light"] .quick-link-card:hover,
[data-theme="light"] .subsection-item:hover {
    box-shadow: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -2px var(--shadow-color);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

[data-theme="light"] .toc-card-subsection {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
}

[data-theme="light"] .content-header {
    box-shadow: 0 4px 20px -5px var(--shadow-color);
}

[data-theme="light"] .section-nav .nav-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 2px var(--shadow-color);
    color: var(--text-secondary);
}

[data-theme="light"] .section-nav .nav-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    color: var(--text-primary);
}

[data-theme="light"] .subsection-icon {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

[data-theme="light"] .subsection-item:hover .subsection-icon {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Theme Icons Switcher Logic */
#theme-toggle svg {
    display: none;
}

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

[data-theme="light"] #theme-toggle .sun-icon {
    display: block;
}

[data-theme="midnight"] #theme-toggle .midnight-icon {
    display: block;
}

[data-theme="rust"] #theme-toggle .rust-icon {
    display: block;
}

/* Search Results Styles */
.search-results-header {
    padding: 10px 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.search-result-item {
    display: block;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-primary);
    transform: translateX(2px);
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.search-result-subtitle {
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-result-snippet {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article Status Header */
.article-status {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-draft {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-content-verified {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.status-content-finished {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-edit-finished {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.status-final {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Article Metadata */
.article-metadata {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.article-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* Reset previous margin since we are using flex gap */
    margin-bottom: 0;
}

.article-author {
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-author::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    opacity: 0.5;
}

/* Article Author Badge */
.article-author-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
    white-space: nowrap;
}

/* Quality Check Badge */
.article-qc-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(45, 212, 191, 0.15);
    color: #2dd4bf;
    border: 1px solid rgba(45, 212, 191, 0.3);
    white-space: nowrap;
}

/* Last Edit Badge */
.article-date-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

/* Editor Badge */
.article-editor-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
    white-space: nowrap;
}

/* Source MD Badge */
.article-source-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(107, 37, 221, 0.1);
    color: #8b5cf6;
    border: 1px solid rgba(107, 37, 221, 0.2);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.article-source-badge:hover {
    background: rgba(107, 37, 221, 0.2);
    border-color: #8b5cf6;
    transform: translateY(-1px);
}

/* Interactive Widgets */
.interactive-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 20px auto;
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
}

.interactive-widget canvas {
    display: block;
    margin: 0 auto;
    background: #000;
    border-radius: 4px;
    max-width: 100%;
}

.widget-controls {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
}

.widget-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s ease;
}

.widget-controls label:hover {
    color: var(--text-primary);
}

.widget-controls input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.widget-controls input[type="range"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.widget-controls select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-controls select:hover,
.widget-controls select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--bg-gradient-1);
}

.widget-controls button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.widget-controls button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.widget-controls button:active {
    transform: translateY(1px);
}

.widget-explainer {
    margin-top: 15px;
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.05);
    /* very subtle primary tint */
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: center;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

.widget-explainer strong {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Word Cloud Styles */
.word-cloud span {
    transition: all var(--transition-normal);
    cursor: default;
    color: var(--text-primary);
    line-height: 1;
}

.word-cloud span:hover {
    transform: scale(1.2);
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--accent-glow);
    z-index: 10;
}

.word-cloud span:hover {
    opacity: 1 !important;
}

.interactive-widget {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: 30px;
    margin: 30px auto;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 4px 20px var(--shadow-color);
}

/* Tabs */
.tab-container {
    margin: 30px 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.tab-buttons {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
    /* Hide scrollbar for cleaner look */
}

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

.tab-btn {
    padding: 16px 24px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

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

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Adjust table spacing inside tabs */
.tab-content table {
    margin-top: 0;
    width: 100%;
}

.tab-content h3 {
    margin-top: 0;
}
