/* ========================================
   CSS Variables - Theme Colors
   ======================================== */

:root[data-theme="light"] {
    /* Backgrounds - Soft White */
    --bg-primary: #fafafa;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #eeeeee;
    --bg-code: #f8f8f8;
    --bg-hover: #e8e8e8;

    /* Text - Soft Black */
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #6a6a6a;
    --text-muted: #9a9a9a;

    /* Borders */
    --border-primary: #e0e0e0;
    --border-secondary: #d0d0d0;

    /* Accents */
    --accent-primary: #2a2a2a;
    --accent-hover: #3a3a3a;

    /* Links */
    --link-color: #2563eb;
    --link-hover: #1d4ed8;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

:root[data-theme="dark"] {
    /* Backgrounds - Soft Black */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333333;
    --bg-code: #252525;
    --bg-hover: #3a3a3a;

    /* Text - Brighter for readability */
    --text-primary: #ffffff;
    --text-secondary: #e8e8e8;
    --text-tertiary: #d0d0d0;
    --text-muted: #b0b0b0;

    /* Borders */
    --border-primary: #3a3a3a;
    --border-secondary: #4a4a4a;

    /* Accents */
    --accent-primary: #e5e5e5;
    --accent-hover: #f5f5f5;

    /* Links - Brighter blue for better contrast */
    --link-color: #7bb3ff;
    --link-hover: #a5cfff;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* ========================================
   Base Styles
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.2s ease, color 0.2s ease;
    width: 100%;
    max-width: 100vw;
}

/* ========================================
   Layout
   ======================================== */

.container {
    display: grid;
    grid-template-columns: 280px 1fr 240px;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 260px 1fr;
    }

    .sidebar-right {
        display: none;
    }
}

/* ========================================
   Sidebar - Left (Navigation)
   ======================================== */

.sidebar-left {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.site-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.site-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

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

.theme-icon::before {
    content: "◐";
    font-size: 1.2rem;
    color: var(--text-primary);
}

[data-theme="dark"] .theme-icon::before {
    content: "◑";
    color: #ffffff;
}

/* Navigation */
.navigation {
    margin: 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-list-nested {
    margin-left: 0.5rem;
    margin-top: 0.25rem;
}

.nav-item {
    margin: 0.25rem 0;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active > .nav-link {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
    font-weight: 500;
}

.nav-section {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding-top: 60px;
        gap: 0;
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .sidebar-left {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        width: 280px;
        z-index: 100;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .sidebar-left.open {
        left: 0;
    }

    .main-content {
        padding: 0.75rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .page-nav {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .page-nav-link {
        padding: 0.75rem;
    }

    .page-header {
        padding: 0.75rem;
        margin: 0;
    }

    .markdown-body {
        font-size: 0.95rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
        overflow-x: hidden;
    }

    .markdown-body > * {
        max-width: 100%;
    }

    .markdown-body h1 {
        font-size: 1.75rem;
    }

    .markdown-body h2 {
        font-size: 1.5rem;
    }

    .markdown-body h3 {
        font-size: 1.25rem;
    }

    .markdown-body table {
        display: block;
        overflow-x: auto;
        width: 100%;
        max-width: 100%;
    }

    .markdown-body pre {
        font-size: 0.85rem;
        max-width: 100%;
        width: 100%;
        padding: 0.75rem;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    .chroma {
        max-width: 100%;
        width: 100%;
        padding: 0.75rem;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    .markdown-body img,
    .markdown-body video,
    .markdown-body iframe {
        max-width: 100%;
        height: auto;
    }

    .markdown-body code {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .markdown-body a {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .markdown-body p,
    .markdown-body li,
    .markdown-body td,
    .markdown-body th {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .page-content,
    .page-content > * {
        max-width: 100%;
    }
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
    padding: 2rem;
    max-width: 800px;
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.page-updated {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    font-style: italic;
}

.page-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.875rem;
}

/* ========================================
   Markdown Content
   ======================================== */

.markdown-body {
    line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.markdown-body h1 { font-size: 2rem; }
.markdown-body h2 { font-size: 1.75rem; border-bottom: 1px solid var(--border-primary); padding-bottom: 0.5rem; }
.markdown-body h3 { font-size: 1.5rem; }
.markdown-body h4 { font-size: 1.25rem; }
.markdown-body h5 { font-size: 1.125rem; }
.markdown-body h6 { font-size: 1rem; }

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

.markdown-body a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.markdown-body a:hover {
    color: var(--link-hover);
    border-bottom-color: var(--link-hover);
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body code {
    padding: 0.2rem 0.4rem;
    background-color: var(--bg-code);
    border-radius: 3px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

.markdown-body pre {
    padding: 1rem;
    background-color: var(--bg-code);
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border-primary);
}

.markdown-body pre code {
    padding: 0;
    background-color: transparent;
}

/* Code Copy Button */
.code-block-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
    opacity: 0;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.code-copy-btn:active {
    transform: scale(0.95);
}

.code-copy-btn.copied {
    color: #49cc90;
    border-color: #49cc90;
    opacity: 1;
}

.code-block-wrapper pre {
    margin: 0;
}

.markdown-body blockquote {
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 4px solid var(--border-secondary);
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

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

.markdown-body table th[align="left"],
.markdown-body table td[align="left"] {
    text-align: left;
}

.markdown-body table th[align="center"],
.markdown-body table td[align="center"] {
    text-align: center;
}

.markdown-body table th[align="right"],
.markdown-body table td[align="right"] {
    text-align: right;
}

.markdown-body table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1rem 0;
}

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

/* Admonitions (Info, Warning, Question, etc.) */
.admonition {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid;
    border-radius: 4px;
    background-color: var(--bg-secondary);
}

.admonition-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admonition-content {
    color: var(--text-primary);
}

.admonition-content p:last-child {
    margin-bottom: 0;
}

.admonition.info {
    border-left-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.admonition.info .admonition-title {
    color: #3b82f6;
}

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

.admonition.warning .admonition-title {
    color: #f59e0b;
}

.admonition.question {
    border-left-color: #8b5cf6;
    background-color: rgba(139, 92, 246, 0.1);
}

.admonition.question .admonition-title {
    color: #8b5cf6;
}

.admonition.danger {
    border-left-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.admonition.danger .admonition-title {
    color: #ef4444;
}

.admonition.success {
    border-left-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
}

.admonition.success .admonition-title {
    color: #10b981;
}

.admonition.note {
    border-left-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.1);
}

.admonition.note .admonition-title {
    color: #6366f1;
}

/* ========================================
   Page Navigation (Prev/Next)
   ======================================== */

.page-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
}

.page-nav-link {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s ease, background-color 0.2s ease;
    min-width: 0;
    width: 100%;
}

.page-nav-link:hover {
    border-color: var(--border-secondary);
    background-color: var(--bg-secondary);
}

.page-nav-prev {
    text-align: left;
    grid-column: 1;
}

.page-nav-next {
    text-align: right;
    grid-column: 2;
}

.page-nav-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.page-nav-title {
    font-weight: 500;
    color: var(--text-primary);
}

/* ========================================
   Sidebar - Right (Table of Contents)
   ======================================== */

.sidebar-right {
    padding: 2rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.toc-header {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list-nested {
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.toc-item {
    margin: 0.25rem 0;
}

.toc-link {
    display: block;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    border-left: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover {
    color: var(--text-primary);
    border-left-color: var(--border-secondary);
}

.toc-link.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    font-weight: 500;
}

/* Indent nested TOC items */
.toc-level-1 { font-weight: 500; }
.toc-level-2 { padding-left: 0.25rem; font-size: 0.85rem; }
.toc-level-3 { padding-left: 0.5rem; font-size: 0.8rem; }
.toc-level-4 { padding-left: 0.75rem; font-size: 0.8rem; }
.toc-level-5 { padding-left: 1rem; font-size: 0.8rem; }
.toc-level-6 { padding-left: 1.25rem; font-size: 0.8rem; }

/* ========================================
   Scrollbar Styling
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ========================================
   API Navigation
   ======================================== */

.api-link-separator {
    margin: 1.5rem 0;
    border-top: 1px solid var(--border-primary);
}

.api-navigation {
    margin-bottom: 1.5rem;
}

.api-nav-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
}

/* ========================================
   Sidebar Footer
   ======================================== */

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-align: center;
}

.sidebar-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sidebar-footer a:hover {
    color: var(--link-color);
}

/* ========================================
   Mobile Menu Toggle
   ======================================== */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
    background-color: var(--bg-hover);
}

.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    position: relative;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle span::before,
.mobile-menu-toggle span::after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    position: absolute;
    left: 0;
    transition: transform 0.2s ease;
}

.mobile-menu-toggle span::before {
    top: -6px;
}

.mobile-menu-toggle span::after {
    top: 6px;
}

.mobile-menu-toggle.open span {
    background-color: transparent;
}

.mobile-menu-toggle.open span::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-menu-toggle.open span::after {
    transform: rotate(-45deg);
    top: 0;
}

.mobile-menu-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-backdrop.open {
        display: block;
    }

    .sidebar-left {
        background-color: var(--bg-primary);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
}

/* ========================================
   Anchor Links
   ======================================== */

.header-anchor {
    opacity: 0;
    margin-left: 0.5rem;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.markdown-body h1:hover .header-anchor,
.markdown-body h2:hover .header-anchor,
.markdown-body h3:hover .header-anchor,
.markdown-body h4:hover .header-anchor,
.markdown-body h5:hover .header-anchor,
.markdown-body h6:hover .header-anchor {
    opacity: 1;
}

.header-anchor:hover {
    color: var(--link-color);
}

/* ========================================
   Syntax Highlighting (Chroma)
   ======================================== */

.chroma {
    background-color: var(--bg-code);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-primary);
}

.chroma .err { color: #f48771; }
.chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
.chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
.chroma .hl { background-color: var(--bg-hover); }
.chroma .ln { color: var(--text-tertiary); padding: 0 0.4em; }
.chroma .k { color: #66d9ef; } /* Keyword */
.chroma .kc { color: #66d9ef; } /* KeywordConstant */
.chroma .kd { color: #66d9ef; } /* KeywordDeclaration */
.chroma .kn { color: #f92672; } /* KeywordNamespace */
.chroma .kp { color: #66d9ef; } /* KeywordPseudo */
.chroma .kr { color: #66d9ef; } /* KeywordReserved */
.chroma .kt { color: #66d9ef; } /* KeywordType */
.chroma .na { color: #a6e22e; } /* NameAttribute */
.chroma .nb { color: #f8f8f2; } /* NameBuiltin */
.chroma .nc { color: #a6e22e; } /* NameClass */
.chroma .no { color: #66d9ef; } /* NameConstant */
.chroma .nd { color: #a6e22e; } /* NameDecorator */
.chroma .ni { color: #f8f8f2; } /* NameEntity */
.chroma .ne { color: #a6e22e; } /* NameException */
.chroma .nf { color: #a6e22e; } /* NameFunction */
.chroma .nl { color: #f8f8f2; } /* NameLabel */
.chroma .nn { color: #f8f8f2; } /* NameNamespace */
.chroma .nx { color: #a6e22e; } /* NameOther */
.chroma .py { color: #f8f8f2; } /* NameProperty */
.chroma .nt { color: #f92672; } /* NameTag */
.chroma .nv { color: #f8f8f2; } /* NameVariable */
.chroma .s { color: #e6db74; } /* LiteralString */
.chroma .sa { color: #e6db74; } /* LiteralStringAffix */
.chroma .sb { color: #e6db74; } /* LiteralStringBacktick */
.chroma .sc { color: #e6db74; } /* LiteralStringChar */
.chroma .dl { color: #e6db74; } /* LiteralStringDelimiter */
.chroma .sd { color: #e6db74; } /* LiteralStringDoc */
.chroma .s2 { color: #e6db74; } /* LiteralStringDouble */
.chroma .se { color: #ae81ff; } /* LiteralStringEscape */
.chroma .sh { color: #e6db74; } /* LiteralStringHeredoc */
.chroma .si { color: #e6db74; } /* LiteralStringInterpol */
.chroma .sx { color: #e6db74; } /* LiteralStringOther */
.chroma .sr { color: #e6db74; } /* LiteralStringRegex */
.chroma .s1 { color: #e6db74; } /* LiteralStringSingle */
.chroma .ss { color: #e6db74; } /* LiteralStringSymbol */
.chroma .m { color: #ae81ff; } /* LiteralNumber */
.chroma .mb { color: #ae81ff; } /* LiteralNumberBin */
.chroma .mf { color: #ae81ff; } /* LiteralNumberFloat */
.chroma .mh { color: #ae81ff; } /* LiteralNumberHex */
.chroma .mi { color: #ae81ff; } /* LiteralNumberInteger */
.chroma .il { color: #ae81ff; } /* LiteralNumberIntegerLong */
.chroma .mo { color: #ae81ff; } /* LiteralNumberOct */
.chroma .o { color: #f92672; } /* Operator */
.chroma .ow { color: #f92672; } /* OperatorWord */
.chroma .c { color: #75715e; } /* Comment */
.chroma .ch { color: #75715e; } /* CommentHashbang */
.chroma .cm { color: #75715e; } /* CommentMultiline */
.chroma .c1 { color: #75715e; } /* CommentSingle */
.chroma .cs { color: #75715e; } /* CommentSpecial */
.chroma .cp { color: #75715e; } /* CommentPreproc */
.chroma .cpf { color: #75715e; } /* CommentPreprocFile */
.chroma .gd { color: #f92672; } /* GenericDeleted */
.chroma .ge { font-style: italic; } /* GenericEmph */
.chroma .gi { color: #a6e22e; } /* GenericInserted */
.chroma .gs { font-weight: bold; } /* GenericStrong */
.chroma .gu { color: #75715e; } /* GenericSubheading */

/* Light Mode Syntax Highlighting Overrides */
:root[data-theme="light"] .chroma .err { color: #a61717; }
:root[data-theme="light"] .chroma .k { color: #0000ff; } /* Keyword */
:root[data-theme="light"] .chroma .kc { color: #0000ff; } /* KeywordConstant */
:root[data-theme="light"] .chroma .kd { color: #0000ff; } /* KeywordDeclaration */
:root[data-theme="light"] .chroma .kn { color: #0000ff; } /* KeywordNamespace */
:root[data-theme="light"] .chroma .kp { color: #0000ff; } /* KeywordPseudo */
:root[data-theme="light"] .chroma .kr { color: #0000ff; } /* KeywordReserved */
:root[data-theme="light"] .chroma .kt { color: #445588; } /* KeywordType */
:root[data-theme="light"] .chroma .na { color: #008080; } /* NameAttribute */
:root[data-theme="light"] .chroma .nb { color: #0086b3; } /* NameBuiltin */
:root[data-theme="light"] .chroma .nc { color: #445588; } /* NameClass */
:root[data-theme="light"] .chroma .no { color: #008080; } /* NameConstant */
:root[data-theme="light"] .chroma .nd { color: #3c5d5d; } /* NameDecorator */
:root[data-theme="light"] .chroma .ni { color: #800080; } /* NameEntity */
:root[data-theme="light"] .chroma .ne { color: #990000; } /* NameException */
:root[data-theme="light"] .chroma .nf { color: #990000; } /* NameFunction */
:root[data-theme="light"] .chroma .nl { color: #990000; } /* NameLabel */
:root[data-theme="light"] .chroma .nn { color: #555555; } /* NameNamespace */
:root[data-theme="light"] .chroma .nx { color: #000000; } /* NameOther */
:root[data-theme="light"] .chroma .py { color: #000000; } /* NameProperty */
:root[data-theme="light"] .chroma .nt { color: #000080; } /* NameTag */
:root[data-theme="light"] .chroma .nv { color: #008080; } /* NameVariable */
:root[data-theme="light"] .chroma .s { color: #dd1144; } /* LiteralString */
:root[data-theme="light"] .chroma .sa { color: #dd1144; } /* LiteralStringAffix */
:root[data-theme="light"] .chroma .sb { color: #dd1144; } /* LiteralStringBacktick */
:root[data-theme="light"] .chroma .sc { color: #dd1144; } /* LiteralStringChar */
:root[data-theme="light"] .chroma .dl { color: #dd1144; } /* LiteralStringDelimiter */
:root[data-theme="light"] .chroma .sd { color: #dd1144; } /* LiteralStringDoc */
:root[data-theme="light"] .chroma .s2 { color: #dd1144; } /* LiteralStringDouble */
:root[data-theme="light"] .chroma .se { color: #dd1144; } /* LiteralStringEscape */
:root[data-theme="light"] .chroma .sh { color: #dd1144; } /* LiteralStringHeredoc */
:root[data-theme="light"] .chroma .si { color: #dd1144; } /* LiteralStringInterpol */
:root[data-theme="light"] .chroma .sx { color: #dd1144; } /* LiteralStringOther */
:root[data-theme="light"] .chroma .sr { color: #009926; } /* LiteralStringRegex */
:root[data-theme="light"] .chroma .s1 { color: #dd1144; } /* LiteralStringSingle */
:root[data-theme="light"] .chroma .ss { color: #990073; } /* LiteralStringSymbol */
:root[data-theme="light"] .chroma .m { color: #009999; } /* LiteralNumber */
:root[data-theme="light"] .chroma .mb { color: #009999; } /* LiteralNumberBin */
:root[data-theme="light"] .chroma .mf { color: #009999; } /* LiteralNumberFloat */
:root[data-theme="light"] .chroma .mh { color: #009999; } /* LiteralNumberHex */
:root[data-theme="light"] .chroma .mi { color: #009999; } /* LiteralNumberInteger */
:root[data-theme="light"] .chroma .il { color: #009999; } /* LiteralNumberIntegerLong */
:root[data-theme="light"] .chroma .mo { color: #009999; } /* LiteralNumberOct */
:root[data-theme="light"] .chroma .o { color: #000000; } /* Operator */
:root[data-theme="light"] .chroma .ow { color: #000000; } /* OperatorWord */
:root[data-theme="light"] .chroma .c { color: #999988; } /* Comment */
:root[data-theme="light"] .chroma .ch { color: #999988; } /* CommentHashbang */
:root[data-theme="light"] .chroma .cm { color: #999988; } /* CommentMultiline */
:root[data-theme="light"] .chroma .c1 { color: #999988; } /* CommentSingle */
:root[data-theme="light"] .chroma .cs { color: #999999; } /* CommentSpecial */
:root[data-theme="light"] .chroma .cp { color: #999999; } /* CommentPreproc */
:root[data-theme="light"] .chroma .cpf { color: #999999; } /* CommentPreprocFile */
:root[data-theme="light"] .chroma .gd { color: #000000; background-color: #ffdddd; } /* GenericDeleted */
:root[data-theme="light"] .chroma .gi { color: #000000; background-color: #ddffdd; } /* GenericInserted */
:root[data-theme="light"] .chroma .gu { color: #aaaaaa; } /* GenericSubheading */

/* ========================================
   Search Modal
   ======================================== */

.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 200;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.search-modal.open {
    display: flex;
}

.search-modal-content {
    background-color: var(--bg-primary);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-primary);
}

.search-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-primary);
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: var(--link-color);
}

.search-close {
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.search-close:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-secondary);
}

.search-results {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem;
}

.search-result-item {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid transparent;
}

.search-result-item:hover,
.search-result-item.selected {
    background-color: var(--bg-hover);
    border-color: var(--border-primary);
}

.search-result-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--link-color);
    margin-bottom: 0.25rem;
}

.search-result-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.search-result-content {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
}

.search-kbd {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    font-family: monospace;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    margin-left: 0.5rem;
}

/* ========================================
   Search Button
   ======================================== */

.search-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-button:hover {
    background-color: var(--bg-hover);
    border-color: var(--link-color);
    color: var(--text-primary);
}

.search-icon {
    font-size: 1.2rem;
    color: var(--text-tertiary);
}

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

.search-kbd-hint {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    color: var(--text-tertiary);
}

@media (max-width: 768px) {
    .search-kbd-hint {
        display: none;
    }
}
