/**
 * Ava CMS Documentation Theme Stylesheet
 * 
 * Structure:
 *   1. CSS Custom Properties
 *   2. CSS Reset & Base
 *   3. Topbar
 *   4. Layout
 *   5. Sidebar Navigation
 *   6. Main Content & Typography
 *   7. Code & Syntax
 *   8. Tables & Callouts
 *   9. Search Overlay
 *   10. Homepage Hero
 *   11. Footer
 *   12. Content Components
 *   13. GitHub Star Toast
 *   14. External Links
 */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================================== */

:root {
    /* Backgrounds - cleaner whites with subtle warmth */
    --bg: #f8f8f9;
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-surface: #f4f4f6;
    --bg-hover: #ebebed;
    --bg-subtle: #f5f5f7;
    --bg-code: #f0f0f2;
    --bg-code-block: #1a1a1c;
    
    /* Borders - more visible */
    --border: #d4d4d8;
    --border-light: #e4e4e7;
    --border-code-block: #27272a;
    
    /* Text - stronger contrast */
    --text: #09090b;
    --text-primary: #09090b;
    --text-secondary: #27272a;
    --text-muted: #52525b;
    --text-tertiary: #71717a;
    
    /* Accent */
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-light: #a78bfa;
    --accent-subtle: rgba(124, 58, 237, 0.08);
    --accent-rgb: 124, 58, 237;
    
    /* Theme colors */
    --theme-color: #7c3aed;
    --theme-color-dark: #6d28d9;
    --theme-color-light: #a78bfa;
    --theme-color-rgb: 124, 58, 237;
    
    /* Status */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Typography */
    --font-sans: 'Mona Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', ui-monospace, Menlo, Monaco, Consolas, monospace;
    --font-heading: 'Hubot Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    
    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.425rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    
    /* Radii */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Layout */
    --topbar-height: 3.75rem;
    --sidebar-width: 16.25rem;
    --toc-width: 17.5rem;
    --content-max-width: 1200px;
    
    /* Transitions */
    --transition-fast: 0.12s ease;
    --transition-normal: 0.2s ease;
    
    /* Callouts */
    --callout-info-bg: rgba(124, 58, 237, 0.08);
    --callout-info-border: var(--theme-color);
    --callout-info-text: #4c1d95;
    --callout-warning-bg: rgba(245, 158, 11, 0.06);
    --callout-warning-border: #f59e0b;
    --callout-warning-text: #92400e;
    --callout-beginner-bg: rgba(124, 58, 237, 0.06);
    --callout-beginner-border: var(--theme-color);
    --callout-beginner-text: #5b21b6;
    
    /* Selection highlight */
    --highlight-bg: rgba(124, 58, 237, 0.2);
    --highlight-text: inherit;
}

[data-theme="dark"] {
    --bg: #09090b;
    --bg-body: #0f0f11;
    --bg-card: #18181b;
    --bg-surface: #1f1f23;
    --bg-hover: #27272a;
    --bg-subtle: #18181b;
    --bg-code: #27272a;
    --bg-code-block: #18181b;
    
    --border: #27272a;
    --border-light: #3f3f46;
    --border-code-block: #2a2a2a;
    
    --text: #fafafa;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-tertiary: #8b8ba1;
    
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-light: #ddd6fe;
    --accent-subtle: rgba(167, 139, 250, 0.12);
    
    --theme-color: #a78bfa;
    --theme-color-dark: #8b5cf6;
    --theme-color-light: #c4b5fd;
    
    --callout-info-bg: rgba(59, 130, 246, 0.1);
    --callout-info-border: #60a5fa;
    --callout-info-text: #93c5fd;
    --callout-warning-bg: rgba(245, 158, 11, 0.1);
    --callout-warning-border: #fbbf24;
    --callout-warning-text: #fcd34d;
    --callout-beginner-bg: rgba(167, 139, 250, 0.1);
    --callout-beginner-text: #ddd6fe;
    
    /* Selection highlight */
    --highlight-bg: rgba(167, 139, 250, 0.3);
    --highlight-text: inherit;
}

/* ==========================================================================
   2. CSS RESET & BASE
   ========================================================================== */

::selection {
    background: var(--highlight-bg);
    color: var(--highlight-text);
}

::-moz-selection {
    background: var(--highlight-bg);
    color: var(--highlight-text);
}

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

html {
    font-size: 17px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    scroll-padding-top: calc(var(--topbar-height) + 2rem);
}

@media(max-width: 1500px) {
    html {
        font-size: 16px;
    }
}

@media (max-width: 1024px) {
    html {
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14.5px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

body {
    font-family: var(--font-sans);
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
    color: var(--text-secondary);
    background-color: var(--bg);
    background-image: radial-gradient(circle at 50% 0%, rgba(var(--theme-color-rgb), 0.08), transparent 40%);
    background-attachment: fixed;
    line-height: 1.7;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-tertiary) transparent;
    
    &::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    &::-webkit-scrollbar-track {
        background: transparent;
    }
    
    &::-webkit-scrollbar-thumb {
        background: var(--text-tertiary);
        border-radius: 3px;
        
        &:hover {
            background: var(--text-muted);
        }
    }
}

img, video, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
    
    &:hover {
        color: var(--accent-hover);
    }
}

mark {
    background: rgba(var(--accent-rgb), 0.25);
    color: inherit;
    padding: 0 0.1em;
    border-radius: 0.2em;
}

/* Utility: Visually-hidden text for accessibility */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   3. TOPBAR
   ========================================================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);

    [data-theme="dark"] & {
        background: rgba(15, 15, 17, 0.85);
    }
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 0 var(--sp-6);

    @media (max-width: 768px) {
        padding: 0 var(--sp-4);
    }
    
    @media (max-width: 500px) {
        padding: 0 var(--sp-3);
    }
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--sp-10);

    @media (max-width: 768px) {
        gap: var(--sp-4);
    }
    
    @media (max-width: 500px) {
        gap: var(--sp-3);
    }
}

.topbar-logo {
    display: flex;
    align-items: center;
    font-size: 1.125rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-decoration: none;
    transition: color var(--transition-fast);

    &:hover {
        color: var(--theme-color);
    }
}

.topbar-version {
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-heading);
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-left: var(--sp-3);
    font-variant-numeric: tabular-nums;
    
    @media (max-width: 500px) {
        display: none;
    }
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);

    @media (max-width: 1024px) {
        display: none;
    }

    & a {
        display: flex;
        align-items: center;
        font-size: 0.9375rem;
        font-weight: 500;
        color: var(--text-muted);
        padding: var(--sp-2) var(--sp-3);
        border-radius: var(--radius-md);
        transition: color var(--transition-fast), background-color var(--transition-fast);

        &:hover {
            color: var(--text-primary);
            background: var(--bg-hover);
        }
        
        &.active {
            color: var(--accent);
            background: var(--accent-subtle);
        }
    }
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    
    @media (max-width: 500px) {
        gap: var(--sp-2);
    }
}

.topbar-social {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    padding-right: var(--sp-3);
    margin-right: var(--sp-3);
    border-right: 1px solid var(--border);

    @media (max-width: 370px) {
        display: none;
    }

    & a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: var(--radius-md);
        color: var(--text-muted);
        transition: all var(--transition-fast);

        &:hover {
            color: var(--text);
            background: var(--bg-hover);
        }
    }

    & svg {
        width: 20px;
        height: 20px;
    }
}

.search-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.875rem;
    height: 38px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9375rem;

    &:hover {
        color: var(--text);
        border-color: var(--text-muted);
        background: var(--bg-hover);
    }
    
    & svg {
        width: 18px;
        height: 18px;
    }

    & kbd {
        padding: 0.125rem 0.375rem;
        background: var(--bg-subtle);
        border: 1px solid var(--border);
        border-radius: 4px;
        font-size: 0.75rem;
        font-family: var(--font-mono);
        color: var(--text-muted);
        
        @media (max-width: 800px) {
            display: none;
        }
    }
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);

    &:hover {
        color: var(--text);
        border-color: var(--accent);
    }
    
    & svg {
        width: 18px;
        height: 18px;
    }

    & .icon-moon {
        display: block;
    }
    
    & .icon-sun {
        display: none;
    }

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

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);

    &:hover {
        color: var(--text-primary);
        border-color: var(--accent);
    }
    
    & svg {
        width: 20px;
        height: 20px;
    }

    @media (max-width: 1024px) {
        display: flex;
    }
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */

.docs-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--topbar-height);

    &.no-sidebar {
        & .docs-main {
            margin-left: 0;
        }
        
        & .sidebar {
            display: none;
        }
    }
}

.docs-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    transition: margin-left var(--transition-normal), background-color var(--transition-normal);

    @media (max-width: 1024px) {
        margin-left: 0;
    }
    
    .no-sidebar-body & {
        margin-left: 0;
    }
}

/* Hide desktop sidebar on non-docs pages but allow mobile menu to work */
@media (min-width: 1025px) {
    .hide-sidebar-desktop {
        & .sidebar {
            display: none;
        }
        
        & .docs-main {
            margin-left: 0;
        }
    }
}

.docs-content-wrapper {
    display: flex;
    flex: 1;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

.docs-content {
    flex: 1;
    min-width: 0;
    max-width: var(--content-max-width);
    padding: var(--sp-10) var(--sp-8);

    @media (max-width: 1024px) {
        padding: var(--sp-8) var(--sp-6);
    }
    
    @media (max-width: 768px) {
        padding: var(--sp-6) var(--sp-5);
    }
    
    @media (max-width: 480px) {
        padding: var(--sp-5) var(--sp-4);
    }
}

/* ==========================================================================
   5. SIDEBAR NAVIGATION
   ========================================================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-body);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: background-color var(--transition-normal), transform var(--transition-normal);

    @media (max-width: 1024px) {
        transform: translateX(-100%);

        &.open {
            transform: translateX(0);
            box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
            
            [data-theme="dark"] & {
                box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
            }
        }
    }

    &.mobile-nav-only {
        display: none;

        @media (max-width: 1024px) {
            display: block;
            padding-top: var(--sp-4);

            & .sidebar-mobile-nav {
                border-bottom: none;
                margin-bottom: 0;
            }
        }
    }
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-6) 0;
}

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

    & li {
        margin: 0;
    }

    & a {
        display: flex;
        align-items: center;
        padding: var(--sp-2) var(--sp-6);
        color: var(--text);
        font-size: 0.9375rem;
        font-weight: 500;
        transition: all var(--transition-fast);
        position: relative;

        &::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 0;
            background: var(--accent);
            border-radius: 0 2px 2px 0;
            transition: height var(--transition-fast);
        }

        &:hover {
            color: var(--text-primary);
            background: var(--bg-hover);
        }
        
        &.active {
            color: var(--accent);
            background: var(--accent-subtle);
            
            &::before {
                height: 20px;
            }
        }
    }
}

.nav-heading {
    padding: var(--sp-6) var(--sp-6) var(--sp-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.08em;

    &:first-child {
        margin-top: 0;
        padding-top: 0;
    }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);

    &.active {
        display: block;
        opacity: 1;
    }
}

.sidebar-mobile-nav {
    display: none;

    @media (max-width: 1024px) {
        display: flex;
        flex-wrap: wrap;
        gap: var(--sp-2);
        padding: var(--sp-4);
        border-bottom: 1px solid var(--border);
        margin-bottom: var(--sp-2);

        & a {
            display: inline-flex;
            align-items: center;
            padding: var(--sp-2) var(--sp-3);
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--text);
            background: var(--bg-subtle);
            border-radius: var(--radius-md);
            transition: all var(--transition-fast);

            &:hover {
                color: var(--text-primary);
                background: var(--bg-hover);
            }
            
            &.active {
                color: var(--accent);
                background: var(--accent-subtle);
            }
            
            &.icon-link {
                justify-content: center;
                width: 34px;
                height: 34px;
                background: transparent;
                
                & svg {
                    width: 18px;
                    height: 18px;
                }
                
                &:hover {
                    color: var(--text);
                    background: var(--bg-hover);
                }
            }
        }
    }
}

/* ==========================================================================
   6. MAIN CONTENT & TYPOGRAPHY
   ========================================================================== */

.markdown-section {
    max-width: var(--content-max-width);
    text-wrap: pretty;

    & img {
        border-radius: var(--radius-md);
        margin: var(--sp-4) 0;
    }
    
    & h1 {
        font-size: clamp(1.75rem, 1.5rem + 1.25vw, 2.25rem);
        font-weight: 550;
        color: var(--text-primary);
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        margin: 0 0 var(--sp-5) 0;
        line-height: 1.2;
        letter-spacing: 0.01em;

        @media (max-width: 768px) {
            font-size: 1.625rem;
        }
    }
    
    & h2 {
        font-size: clamp(1.375rem, 1.25rem + 0.5vw, 1.625rem);
        font-weight: 550;
        color: var(--text-primary);
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        margin: var(--sp-12) 0 var(--sp-4) 0;
        padding-top: var(--sp-8);
        border-top: 1px solid var(--border);
        letter-spacing: 0.01em;

        &:first-child {
            margin-top: 0;
            border-top: none;
            padding-top: 0;
        }

        @media (max-width: 768px) {
            font-size: 1.375rem;
        }
    }
    
    & h3 {
        font-size: clamp(1.125rem, 1rem + 0.375vw, 1.25rem);
        font-weight: 550;
        color: var(--text-primary);
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        margin: var(--sp-8) 0 var(--sp-3) 0;
        letter-spacing: 0.01em;
    }
    
    & h4,
    & h5,
    & h6 {
        font-size: 1.25rem;
        font-weight: 550;
        color: var(--text-primary);
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        margin: var(--sp-6) 0 var(--sp-4) 0;
        letter-spacing: 0.01em;
    }
    
    & p {
        margin: 0 0 var(--sp-4) 0;
    }
    
    & strong {
        color: var(--text-primary);
        font-weight: 600;
    }
    
    & a {
        font-weight: 500;
        text-decoration: underline;
        text-decoration-color: rgba(var(--accent-rgb), 0.3);
        text-underline-offset: 2px;

        &:hover {
            text-decoration-color: var(--accent);
        }
    }
    
    & ul,
    & ol {
        padding-left: var(--sp-6);
        margin: 0 0 var(--sp-4) 0;
    }
    
    & li {
        margin: var(--sp-1) 0;
        
        & > ul,
        & > ol {
            margin: var(--sp-1) 0;
        }
    }
    
    & blockquote {
        margin: var(--sp-6) 0;
        padding: var(--sp-4) var(--sp-5);
        border-left: 3px solid var(--border);
        background: var(--bg-subtle);
        border-radius: 0 var(--radius-md) var(--radius-md) 0;
        color: var(--text-secondary);

        & p {
            margin: 0;
        }
    }
    
    & hr {
        border: none;
        border-top: 1px solid var(--border);
        margin: var(--sp-10) 0;
    }
    
    /* Inline images in paragraphs (badges) */
    & p > a > img {
        display: inline-block;
        border-radius: var(--radius-sm);
        margin: 0 var(--sp-1) var(--sp-1) 0;
        vertical-align: middle;
    }
}

.page-title {
    font-size: clamp(2rem, 1.75rem + 1.25vw, 2.5rem);
    font-weight: 550;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-variation-settings: "wdth" 95, "wght" 550;
    margin: 0 0 var(--sp-6) 0;
    line-height: 1.15;
    letter-spacing: 0.01em;

    @media (max-width: 768px) {
        font-size: 1.75rem;
    }
    
    & + .markdown-section h2:first-child {
        margin-top: 0;
        border-top: none;
        padding-top: 0;
    }
}

/* Table of Contents Sidebar */
.toc-sidebar {
    width: var(--toc-width);
    flex-shrink: 0;
    padding: var(--sp-10) var(--sp-6) var(--sp-10) var(--sp-4);
    position: sticky;
    top: var(--topbar-height);
    max-height: calc(100vh - var(--topbar-height));
    overflow-y: auto;

    @media (max-width: 1280px) {
        display: none;
    }
}

.toc-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: var(--sp-4);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid var(--border);

    & li {
        margin: 0;
    }

    & a {
        display: block;
        padding: var(--sp-2) var(--sp-4);
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text-muted);
        border-left: 2px solid transparent;
        margin-left: -1px;
        transition: all var(--transition-fast);
        line-height: 1.5;

        &:hover {
            color: var(--text-primary);
            border-left-color: var(--border-light);
        }
        
        &.active {
            color: var(--accent);
            border-left-color: var(--accent);
        }
        
        &[data-level="3"] {
            padding-left: var(--sp-6);
            font-size: 0.8125rem;
        }
    }
}

/* ==========================================================================
   7. CODE & SYNTAX
   ========================================================================== */

.markdown-section code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-code);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--theme-color-dark);
    font-weight: 500;
    
    [data-theme="dark"] & {
        color: var(--theme-color-light);
    }
}

.markdown-section pre {
    background: radial-gradient(circle at top right, rgba(var(--theme-color-rgb), 0.1), rgba(var(--theme-color-rgb), 0) 80%), var(--bg-code-block);
    border: 1px solid var(--border-code-block);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    margin: var(--sp-5) 0;
    overflow-x: auto;
    color: #e5e5e5;
    line-height: 1;

    & code {
        background: transparent;
        padding: 0;
        font-size: 0.8125rem;
        line-height: 1.6;
        color: #e5e5e5;
        font-weight: normal;
    }
}

/* Prism syntax - light theme */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #6b7280;
}

.token.punctuation {
    color: #a1a1aa;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
    color: #d4d4d8;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin {
    color: #c4b5fd;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #e5e7eb;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: var(--theme-color-light);
}

.token.function,
.token.class-name {
    color: var(--theme-color);
}

.token.regex,
.token.important,
.token.variable {
    color: #eab308;
}

/* Prism syntax - dark theme (One Dark inspired) */
[data-theme="dark"] {
    & .token.comment,
    & .token.prolog,
    & .token.doctype,
    & .token.cdata {
        color: #5c6370;
        font-style: italic;
    }
    
    & .token.punctuation {
        color: #abb2bf;
    }
    
    & .token.property,
    & .token.tag,
    & .token.boolean,
    & .token.number,
    & .token.constant,
    & .token.symbol {
        color: #d19a66;
    }
    
    & .token.selector,
    & .token.attr-name,
    & .token.string,
    & .token.char,
    & .token.builtin {
        color: #98c379;
    }
    
    & .token.operator,
    & .token.entity,
    & .token.url {
        color: #56b6c2;
    }
    
    & .language-css .token.string,
    & .style .token.string {
        color: #56b6c2;
    }
    
    & .token.atrule,
    & .token.attr-value,
    & .token.keyword {
        color: #c678dd;
    }
    
    & .token.function {
        color: #61afef;
    }
    
    & .token.class-name {
        color: #e5c07b;
    }
    
    & .token.regex,
    & .token.important,
    & .token.variable {
        color: #56b6c2;
    }
}

/* Terminal output - CLI samples */
.markdown-section pre:has(samp) {
    background: #1c1924 !important;
    border-radius: var(--radius-md) !important;
    padding: var(--sp-5) !important;
    margin: var(--sp-5) 0 !important;
    overflow-x: auto !important;
    border: 1px solid #2a2b3d !important;
}

.markdown-section pre samp {
    background: #1c1924 !important;
    color: #a9b1d6 !important;
    font-family: var(--font-mono) !important;
    font-size: 0.8rem !important;
    line-height: 1.15 !important;
    white-space: pre !important;
    letter-spacing: -0.5px;
    display: block !important;
    
    & .t-green { color: #9ece6a !important; }
    & .t-red { color: #f7768e !important; }
    & .t-yellow { color: #e0af68 !important; }
    & .t-blue { color: #7aa2f7 !important; }
    & .t-cyan { color: var(--theme-color) !important; }
    & .t-magenta { color: #bb9af7 !important; }
    & .t-dim { color: #565f89 !important; }
    & .t-bold { font-weight: 600 !important; color: #c0caf5 !important; }
    & .t-white { color: #c0caf5 !important; }
}

/* ==========================================================================
   8. TABLES & CALLOUTS
   ========================================================================== */

.markdown-section table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    margin: var(--sp-6) 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.markdown-section th {
    background: var(--bg-subtle);
    font-weight: 600;
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.8125rem;
    
    &:last-child {
        border-right: none;
    }
}

.markdown-section td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    
    &:last-child {
        border-right: none;
    }
    
    & code {
        font-size: 0.75rem;
    }
}

.markdown-section tr:last-child td {
    border-bottom: none;
}

/* Callouts */
.callout-info {
    background: var(--callout-info-bg);
    border-left: 3px solid var(--callout-info-border);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-5);
    margin: var(--sp-6) 0;
    color: var(--callout-info-text);
    line-height: 1.6;
    font-family: var(--font-heading);

    &::before {
        content: "ℹ️ ";
    }
    
    & a {
        color: var(--callout-info-border);
        font-weight: 600;
    }
    
    & code {
        background: rgba(var(--accent-rgb), 0.12);
        color: var(--callout-info-text);
    }
}

.callout-warning {
    background: var(--callout-warning-bg);
    border-left: 3px solid var(--callout-warning-border);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-5);
    margin: var(--sp-6) 0;
    color: var(--callout-warning-text);
    line-height: 1.6;
    font-family: var(--font-heading);

    &::before {
        content: "⚠️ ";
    }
    
    & a {
        color: var(--callout-warning-border);
        font-weight: 600;
    }
    
    & code {
        background: rgba(245, 158, 11, 0.12);
        color: var(--callout-warning-text);
    }
}

/* Beginner Box */
.beginner-box {
    background: var(--callout-beginner-bg);
    border: 1px solid rgba(var(--theme-color-rgb), 0.2);
    border-radius: var(--radius-lg);
    margin: var(--sp-8) 0;
    line-height: 1.7;
    font-family: var(--font-heading);
    
    & > *:first-child {
        margin-top: 0;
    }
    
    & > *:last-child {
        margin-bottom: 0;
    }
    
    & .beginner-box-content {
        & > *:first-child {
            margin-top: 0;
        }
        
        & > *:last-child {
            margin-bottom: 0;
        }
    }
    
    & h2,
    & h3 {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        color: var(--theme-color-dark);
        font-size: 1.125rem;
        font-variation-settings: "wdth" 95, "wght" 550;
        letter-spacing: 0.01em;
        
        [data-theme="dark"] & {
            color: var(--theme-color-light);
        }
    }
    
    & strong {
        color: var(--theme-color-dark);
        
        [data-theme="dark"] & {
            color: var(--theme-color-light);
        }
    }
    
    & ul,
    & ol {
        margin: var(--sp-2) 0 var(--sp-4) 0;
    }
    
    & pre {
        background: var(--bg-body) !important;
        border: 1px solid var(--border);
        margin: var(--sp-4) 0 !important;
    }
    
    & code {
        background: rgba(var(--theme-color-rgb), 0.12);
    }
    
    /* Non-details beginner box */
    &:not(details) {
        padding: var(--sp-6) 0;
    }
}

/* Beginner box as collapsible details/summary */
details.beginner-box {
    padding: 0;
    
    & summary {
        display: flex;
        align-items: center;
        gap: var(--sp-3);
        padding: var(--sp-4) var(--sp-6);
        cursor: pointer;
        font-weight: 550;
        font-size: 1.125rem;
        color: var(--theme-color-dark);
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        letter-spacing: 0.01em;
        list-style: none;
        user-select: none;
        transition: background-color var(--transition-fast);
        
        &::-webkit-details-marker {
            display: none;
        }

        &::before {
            content: '';
            width: 0;
            height: 0;
            border-left: 6px solid currentColor;
            border-top: 5px solid transparent;
            border-bottom: 5px solid transparent;
            transition: transform var(--transition-fast);
            flex-shrink: 0;
        }
        
        &:hover {
            background: rgba(var(--theme-color-rgb), 0.05);
        }
        
        [data-theme="dark"] & {
            color: var(--theme-color-light);
        }
    }
    
    &[open] summary::before {
        transform: rotate(90deg);
    }
    
    & .beginner-box-content {
        padding: 0 var(--sp-6) var(--sp-6);
        
        & h3:first-child {
            display: none;
        }
    }
}

/* Badges */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin: var(--sp-4) 0;
    
    & img {
        margin: 0 !important;
    }
}

/* ==========================================================================
   9. SEARCH OVERLAY
   ========================================================================== */

.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 1rem 1rem;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    @media (max-width: 768px) {
        padding: 5vh 1rem 1rem;
    }
    
    &.initialized {
        transition: opacity 0.2s ease, visibility 0.2s ease;
        
        & .search-overlay-content {
            transition: transform 0.2s ease;
        }
    }
    
    &.active {
        visibility: visible;
        opacity: 1;
        pointer-events: all;
        
        & .search-overlay-content {
            transform: translateY(0);
        }
    }
}

.search-overlay-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);

    @media (max-width: 768px) {
        max-height: 80vh;
    }
}

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

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

#search-overlay-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    
    &::placeholder {
        color: var(--text-muted);
    }
}

.search-shortcut {
    padding: 0.25rem 0.5rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

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

.search-result {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s ease;
    
    &:hover,
    &.selected {
        background: var(--bg-hover);
    }
}

.search-result-title {
    font-weight: 550;
    font-family: var(--font-heading);
    font-variation-settings: "wdth" 95, "wght" 550;
    color: var(--text);
    margin-bottom: 0.25rem;
    letter-spacing: 0.01em;
}

.search-result-meta {
    display: none;
}

.search-result-excerpt {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    line-height: 1.4;
}

.search-hint {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    
    & kbd {
        display: inline-block;
        padding: 0.125rem 0.375rem;
        background: var(--bg-subtle);
        border: 1px solid var(--border);
        border-radius: 3px;
        font-size: 0.75rem;
        font-family: var(--font-mono);
        margin: 0 0.25rem;
    }
}

.search-overlay-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    border-radius: 0 0 12px 12px;
}

/* ==========================================================================
   10. HOMEPAGE HERO
   ========================================================================== */

/* Base body styles for homepage */
body.home-hero-page {
    --hero-bg: #0f0f11;
    --hero-surface: rgba(15, 15, 17, 0.92);
    --hero-border: rgba(255, 255, 255, 0.08);
    --hero-text-strong: #ffffff;
    --hero-text: rgba(255, 255, 255, 0.86);
    --hero-text-muted: rgba(255, 255, 255, 0.65);
    --hero-card-bg: rgba(255, 255, 255, 0.04);
    --hero-card-border: rgba(255, 255, 255, 0.1);

    background-color: var(--hero-bg);
    overflow-x: hidden;
    
    &::before,
    &::after {
        display: none;
    }
    
    /* Override docs layout for homepage */
    & .docs-layout {
        display: block;
    }
    
    & .docs-main {
        margin-left: 0;
        max-width: none;
        background: transparent;
    }
    
    /* Topbar styling */
    & .topbar {
        background: var(--hero-surface);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom-color: var(--hero-border);
    }

    & .topbar-logo {
        color: var(--hero-text-strong);
    }

    & .topbar-version {
        color: var(--hero-text-muted);
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.12);
    }

    & .topbar-nav a {
        color: var(--hero-text-muted);
        background: transparent;

        &:hover {
            color: var(--hero-text-strong);
            background: rgba(255, 255, 255, 0.08);
        }

        &.active {
            color: var(--hero-text-strong);
            background: rgba(255, 255, 255, 0.12);
        }
    }

    & .topbar-social {
        border-right-color: rgba(255, 255, 255, 0.12);
    }

    & .topbar-social a {
        color: var(--hero-text-muted);

        &:hover {
            color: var(--hero-text-strong);
            background: rgba(255, 255, 255, 0.08);
        }
    }

    & .search-button,
    & .theme-toggle,
    & .sidebar-toggle {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.12);
        color: var(--hero-text);

        &:hover {
            color: var(--hero-text-strong);
            border-color: rgba(255, 255, 255, 0.3);
            background: rgba(255, 255, 255, 0.12);
        }
    }
    
    /* Footer styling */
    & .docs-footer {
        background: var(--bg);
        border-top: 1px solid var(--border);
    }

    /* Dark homepage feature cards */
    & .home-feature {
        background: var(--hero-card-bg);
        border-color: var(--hero-card-border);

        &:hover {
            border-color: rgba(255, 255, 255, 0.2);
        }
    }

    & .home-feature h3 {
        color: var(--hero-text-strong);
    }

    & .home-feature p {
        color: var(--hero-text-muted);
    }

    & .home-badge {
        color: var(--hero-text);
        background: rgba(255, 255, 255, 0.08);
        border-color: var(--hero-border);
    }

    & .home-tagline-lead {
        color: var(--hero-text-strong);
    }

    & .home-tagline {
        color: var(--hero-text);
    }

    & .home-requirements {
        color: var(--hero-text-muted);
    }

    /* Dark homepage CTA buttons */
    & .home-cta .cta-primary {
        background: rgb(var(--theme-color-rgb));
        border-color: rgb(var(--theme-color-rgb));
        color: #ffffff;

        &:hover {
            background: var(--theme-color-dark);
            border-color: var(--theme-color-dark);
        }
    }

    & .home-cta .cta-secondary {
        background: transparent;
        color: var(--hero-text-strong);
        border-color: rgba(255, 255, 255, 0.3);

        &:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.6);
        }
    }
}

/* Hero Section */
.home-hero {
    min-height: calc(100vh - var(--topbar-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
    will-change: transform;
    background: radial-gradient(circle at 50% 30%, rgba(var(--theme-color-rgb), 0.15), transparent 70%), rgba(var(--theme-color-rgb), 0);
}

.home-hero-inner {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Decorative corners */
.hero-corner {
    position: absolute;
    font-family: var(--font-sans);
    color: var(--hero-text-muted);
    font-size: 2rem;
    font-weight: 200;
    line-height: 1;
    user-select: none;
    pointer-events: none;
    
    &.top-left { top: 2rem; left: 2rem; }
    &.top-right { top: 2rem; right: 2rem; }
    &.bottom-left { bottom: 2rem; left: 2rem; }
    &.bottom-right { bottom: 2rem; right: 2rem; }
    
    opacity: 0.6;
}

/* Hero brand */
.hero-brand {
    position: relative;
    display: inline-block;
    margin-bottom: 2.5rem;
    
    & h1 {
        font-size: clamp(9rem, 18vw, 13rem);
        font-weight: 800;
        line-height: 0.85;
        color: var(--hero-text-strong);
        font-family: 'Mona Sans', var(--font-sans);
        margin: 0;
        letter-spacing: -0.03em;
        text-transform: uppercase;
        font-variation-settings: "wght" 800, "wdth" 120;
    }
    
    & svg {
        margin: -10% auto 0;
        z-index: 2;
        width: 60%;
        position: relative;
        display: block;
    }
}

/* Home Badge */
.home-badge {
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    font-weight: 500;
}

/* Taglines */
.home-tagline-lead {
    font-family: var(--font-heading);
    font-size: clamp(1.375rem, 1.25rem + 0.75vw, 1.75rem);
    font-variation-settings: "wdth" 95, "wght" 550;
    line-height: 1.35;
    color: var(--text-primary);
    margin: 0.5rem auto 1.25rem;
    font-weight: 550;
    letter-spacing: 0.01em;
    
    strong {
        font-variation-settings: "wdth" 100, "wght" 900;
    }
}

.home-tagline {
    font-family: var(--font-sans);
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 auto 2.5rem;
    max-width: 540px;

    @media (max-width: 768px) {
        font-size: 1rem;
        margin-bottom: 1.75rem;
    }
    
}

/* Requirements */
.home-requirements {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    
}

/* CTA Buttons */
.home-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;

    @media (max-width: 768px) {
        flex-direction: column;
        align-items: center;
    }
    
    & a {
        padding: 0.875rem 1.75rem;
        font-family: var(--font-heading);
        font-size: 0.9375rem;
        font-weight: 550;
        font-variation-settings: "wdth" 95, "wght" 550;
        text-decoration: none;
        letter-spacing: 0.02em;
        border-radius: 6px;
        transition: all 0.2s;

        @media (max-width: 768px) {
            width: 100%;
            max-width: 280px;
            text-align: center;
        }
    }
    
    & .cta-primary {
        background: rgb(var(--theme-color-rgb));
        color: #ffffff;
        border: 1px solid rgb(var(--theme-color-rgb));
        
        &:hover {
            background: var(--theme-color-dark);
            color: #ffffff;
            border-color: var(--theme-color-dark);
        }
    }
    
    & .cta-secondary {
        background: transparent;
        color: var(--text-primary);
        border: 1px solid var(--border);
        
        &:hover {
            background: var(--bg-hover);
            border-color: var(--text-muted);
        }
        
        [data-theme="dark"] & {
            background: transparent;
            color: #fff;
            border: 1px solid rgba(255, 255, 255, 0.4);
            
            &:hover {
                background: rgba(255, 255, 255, 0.1);
                border-color: #fff;
            }
        }
    }
}

/* Feature Grid */
.home-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: left;
    margin: 3rem 0;

    @media (max-width: 1024px) {
        grid-template-columns: repeat(2, 1fr);
    }

    @media (max-width: 600px) {
        grid-template-columns: 1fr;
    }
}

.home-feature {
    padding: 1rem 1.5rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    backdrop-filter: blur(2px);
    
    &:hover {
        border-color: var(--text-muted);
    }
    
    [data-theme="dark"] & {
        background: rgba(0, 0, 0, 0.1);
    }
}

.home-feature-icon {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 0.4rem;
}

.home-feature h3 {
    font-size: 1rem;
    font-weight: 550;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-variation-settings: "wdth" 95, "wght" 550;
    margin: 0 0 0.5rem;
    letter-spacing: 0.01em;
    
    [data-theme="dark"] & {
        color: #fff;
    }
}

.home-feature p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

/* Breakdown Section */
.home-breakdown-section {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 6rem 2rem;
    
    [data-theme="dark"] & {
        background: #151518;
        border-top-color: #27272a;
    }
}

.home-breakdown {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6rem;
}

.home-breakdown-row {
    display: flex;
    align-items: center;
    gap: 4rem;
    position: relative;
    
    &:nth-child(even) {
        flex-direction: row-reverse;
    }

    /* Ambient glow behind the visual side */
    &::before {
        content: '';
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 45%;
        height: 120%;
        background: radial-gradient(circle at center, rgba(var(--theme-color-rgb), 0.08), transparent 70%);
        z-index: 0;
        pointer-events: none;
        filter: blur(40px);
    }
    
    /* Position glow on left for odd rows, right for even */
    &:nth-child(odd)::before { left: -5%; }
    &:nth-child(even)::before { right: -5%; }

    @media (max-width: 900px) {
        flex-direction: column;
        gap: 2rem;
        
        &:nth-child(even) {
            flex-direction: column;
        }

        &::before {
            display: none;
        }
    }
}

.home-breakdown-text {
    flex: 1;
    
    & h3 {
        font-size: clamp(1.5rem, 1.25rem + 0.75vw, 1.875rem);
        font-weight: 550;
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        margin: 0 0 1rem;
        color: var(--text-primary);
        line-height: 1.2;
        letter-spacing: 0.01em;
        
        [data-theme="dark"] & {
            color: #fff;
        }
    }
    
    & p {
        font-size: 1.0625rem;
        color: var(--text-secondary);
        margin: 0 0 1.25rem;
        line-height: 1.6;
    }
}

.breakdown-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--theme-color);
    text-decoration: none;
    transition: color var(--transition-fast);
    
    &:hover {
        color: var(--theme-color-dark);
    }
    
    [data-theme="dark"] & {
        color: var(--theme-color-light);
        
        &:hover {
            color: #fff;
        }
    }
}

.home-breakdown-visual {
    flex: 1;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    aspect-ratio: 16 / 10;
    overflow: hidden;
    will-change: transform;
    position: relative;
    box-shadow: 
        0 28px 60px -24px rgba(0, 0, 0, 0.2),
        0 20px 80px -20px rgba(var(--theme-color-rgb), 0.1);
    z-index: 1;
    
    [data-theme="dark"] & {
        background: var(--bg-card);
        box-shadow: 
            0 20px 40px -10px rgba(0, 0, 0, 0.4),
            0 20px 80px -20px rgba(var(--theme-color-rgb), 0.15);
    }

    @media (max-width: 900px) {
        width: 100%;
        max-width: 500px;
    }
    
    /* CLI Visual styling */
    &.cli-visual {
        display: flex;
        align-items: stretch;
        
        & pre {
            margin: 0;
            padding: 1.25rem;
            width: 100%;
            font-size: 0.75rem;
            line-height: 1.15;
            overflow: auto;
            background: radial-gradient(circle at top right, rgba(var(--theme-color-rgb), 0.1), rgba(var(--theme-color-rgb), 0) 80%), #121212;
            border: none;
            border-radius: var(--radius-lg);
        }
        
        & samp {
            font-family: var(--font-mono);
            white-space: pre;
            display: block;
            letter-spacing: -0.5px;
            
            & .t-cyan { color: var(--theme-color) !important; }
            & .t-dim { color: #8a8a8a !important; }
            & .t-bold { font-weight: 600 !important; }
            & .t-white { color: #e6e6e6 !important; }
        }
    }
}

/* Compare Slider */
.compare-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: ew-resize;
    user-select: none;
    border-radius: inherit;
    
    & img.compare-after {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: top left;
        pointer-events: none;
    }
}

.compare-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: flex;
    align-items: stretch;
    pointer-events: none;
    background: radial-gradient(circle at top right, rgba(var(--theme-color-rgb), 0.1), rgba(var(--theme-color-rgb), 0) 80%), var(--bg-code-block);
    
    [data-theme="dark"] & {
        background: radial-gradient(circle at top right, rgba(var(--theme-color-rgb), 0.1), rgba(var(--theme-color-rgb), 0) 80%), #111;
    }
    
    & pre {
        margin: 0;
        padding: 1.25rem;
        width: 100%;
        height: 100%;
        font-size: 0.78rem;
        line-height: 1.6;
        overflow: hidden;
        background: transparent;
        border: none;
        border-radius: 0;
    }
    
    & code {
        font-family: var(--font-mono);
        color: #e5e5e5;
    }

    & samp {
        font-family: var(--font-mono);
        color: #e5e5e5;
        white-space: pre;
        display: block;
        letter-spacing: -0.4px;

        & .t-cyan { color: var(--theme-color) !important; }
        & .t-dim { color: #9ca3af !important; }
        & .t-bold { font-weight: 600 !important; }
        & .t-white { color: #f5f5f5 !important; }
        & .t-red { color: #f87171 !important; }
        & .t-yellow { color: #fbbf24 !important; }
        & .t-green { color: #34d399 !important; }
    }
}

.compare-after {
    z-index: 1;
    clip-path: inset(0 0 0 50%);
}

.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    margin-left: -2px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.compare-handle-line {
    flex: 1;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.compare-handle-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    
    & svg {
        width: 20px;
        height: 20px;
    }
    
    [data-theme="dark"] & {
        background: var(--bg-surface);
        border-color: var(--border-light);
        color: var(--text-primary);
    }
}

/* ==========================================================================
   11. FOOTER
   ========================================================================== */

.docs-footer {
    margin-top: auto;
    padding: var(--sp-4) var(--sp-6);
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border);
    background: var(--bg);
    height: auto;
    
    [data-theme="dark"] & {
        background: var(--bg-surface);
    }

    @media (max-width: 768px) {
        padding: var(--sp-6) var(--sp-4);
        flex-direction: column;
        gap: var(--sp-4);
    }
    
    & .footer-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.875rem;
        color: var(--text-muted);
        width: 100%;
        gap: var(--sp-4);

        @media (max-width: 768px) {
            flex-direction: column;
            gap: var(--sp-2);
            text-align: center;
        }
    }
    
    & .footer-links {
        display: flex;
        gap: 1.5rem;
        align-items: center;
    }
    
    & a {
        transition: color var(--transition-fast);
        font-weight: 500;
        
        &:hover {
            color: var(--accent);
        }
    }
}

/* ==========================================================================
   12. CONTENT COMPONENTS
   ========================================================================== */

/* Feature Lists */
.feature-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: var(--sp-6) 0;
    
    & li {
        position: relative;
        padding-left: 1.5rem;
        margin: var(--sp-2) 0;
        line-height: 1.6;
        
        &::before {
            content: '✓';
            position: absolute;
            left: 1px;
            top: 0;
            color: var(--success);
            font-weight: 600;
        }
    }
    
    &.stars li::before { content: '★'; color: var(--warning); }
    &.arrows li::before { content: '→'; color: var(--accent); }
    &.dots li::before { content: '◆'; color: var(--theme-color); }
}

/* Philosophy Grid */
.philosophy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin: var(--sp-6) 0;

    @media (max-width: 640px) {
        grid-template-columns: 1fr;
    }
}

.philosophy-grid-item {
    padding: var(--sp-6);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    
    &:nth-child(-n+2) { padding-top: 0; }
    &:nth-last-child(-n+2) { padding-bottom: 0; }
    &:nth-child(2n+1) { padding-left: 0; }
    &:nth-child(2n) { border-right: none; padding-right: 0; }
    &:nth-last-child(-n+2) { border-bottom: none; }
    &:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: none; }
    
    & strong {
        display: block;
        font-size: 1.0625rem;
        font-weight: 550;
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        color: var(--text-primary);
        margin-bottom: var(--sp-2);
        letter-spacing: 0.01em;
    }
    
    & p {
        margin: 0;
        font-size: 1rem;
        color: var(--text-secondary);
        line-height: 1.7;
    }

    @media (max-width: 640px) {
        border-right: none;
        border-bottom: 1px solid var(--border) !important;
        padding: var(--sp-6);

        &:last-child {
            border-bottom: none !important;
        }

        &:first-child {
            padding-top: var(--sp-6);
        }

        &:last-child {
            padding-bottom: var(--sp-6);
        }
    }
}
/* Mobile-specific override: ensure stacked philosophy grid items have equal
   top/bottom padding and no side padding, with stronger specificity to
   defeat any conflicting nth-child rules elsewhere in the stylesheet. */
@media (max-width: 640px) {
    .philosophy-grid .philosophy-grid-item {
        padding: var(--sp-6) 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .philosophy-grid .philosophy-grid-item:last-child {
        border-bottom: none !important;
    }
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-6);
    margin: var(--sp-8) 0;

    @media (max-width: 768px) {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-6);
    transition: all var(--transition-fast);
    
    &:hover {
        border-color: var(--text-muted);
        
        [data-theme="dark"] & {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }
    }
    
    & h3 {
        margin: 0 0 var(--sp-3) 0;
        font-size: 1.125rem;
        font-weight: 550;
        font-family: var(--font-heading);
        font-variation-settings: "wdth" 95, "wght" 550;
        color: var(--text-primary);
        letter-spacing: 0.01em;
    }
    
    & p {
        margin: 0;
        color: var(--text-secondary);
    }
    
    & .card-meta {
        font-size: 0.875rem;
        color: var(--text-muted);
        margin-top: var(--sp-3);
    }
}

/* Preview Cards - for showcasing websites */
.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
    
    &:hover {
        border-color: var(--accent);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        transform: translateY(-2px);
        
        [data-theme="dark"] & {
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        }
    }
}

.preview-card-image {
    aspect-ratio: 5 / 4;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    
    & img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        margin: 0 !important;
        border-radius: 0 !important;
    }
}

.preview-card-content {
    padding: var(--sp-5);
}

.markdown-section .preview-card-title {
    font-size: 1.0625rem;
    font-weight: 550;
    font-family: var(--font-heading);
    font-variation-settings: "wdth" 95, "wght" 550;
    color: var(--text-primary);
    margin: 0 0 var(--sp-2) 0;
    letter-spacing: 0.01em;
    
    & a {
        color: inherit;
        text-decoration: none;
        
        &:hover {
            color: var(--accent);
        }
    }
}

.preview-card-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 0 var(--sp-3) 0;
    line-height: 1.55;
}

.preview-card-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0 !important;
    
    & a {
        color: var(--text-muted);
        
        &:hover {
            color: var(--accent);
        }
    }
}

/* Showcase Grid */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-6);
    margin: var(--sp-8) 0;

    @media (max-width: 1024px) {
        grid-template-columns: 1fr;
        gap: var(--sp-5);
    }
}

/* Screenshot Window - scrollable preview frame */
.screenshot-window {
    margin: var(--sp-8) 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    
    [data-theme="dark"] & {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    }
    
    /* Window title bar */
    &::before {
        content: '';
        display: block;
        height: 36px;
        background: var(--bg-hover);
        border-bottom: 1px solid var(--border);
        background-image: radial-gradient(circle, var(--text-tertiary) 6px, transparent 6px),
                          radial-gradient(circle, var(--text-tertiary) 6px, transparent 6px),
                          radial-gradient(circle, var(--text-tertiary) 6px, transparent 6px);
        background-size: 12px 12px;
        background-position: 14px center, 34px center, 54px center;
        background-repeat: no-repeat;
    }
    
    & a {
        display: block;
        max-height: 500px;
        overflow-y: auto;
        background: var(--bg-subtle);
        
        &:hover {
            opacity: 0.95;
        }
    }
    
    & img {
        margin: 0 !important;
    }
}

/* ==========================================================================
   13. GITHUB STAR TOAST
   ========================================================================== */

.github-toast {
    position: fixed;
    bottom: var(--sp-6);
    right: var(--sp-6);
    max-width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: var(--sp-5);
    z-index: 300;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;

    @media (max-width: 768px) {
        left: var(--sp-4);
        right: var(--sp-4);
        max-width: none;
        bottom: var(--sp-4);
    }
    
    [data-theme="dark"] & {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }
    
    &.visible {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
}

.github-toast-close {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    
    &:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }
}

.github-toast-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-3);
    color: var(--accent);
    
    & svg {
        width: 18px;
        height: 18px;
    }
}

.github-toast-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 550;
    font-variation-settings: "wdth" 95, "wght" 550;
    color: var(--text-primary);
    margin-bottom: var(--sp-2);
    padding-right: var(--sp-6);
    letter-spacing: 0.01em;
}

.github-toast-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: var(--sp-4);
}

.github-toast-actions {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
}

.github-star-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    background: var(--text-primary);
    color: var(--bg-body);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    
    &:hover {
        background: var(--accent);
        color: white;
        transform: translateY(-1px);
    }
    
    & svg {
        width: 16px;
        height: 16px;
    }
}

.github-toast-dismiss {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--sp-2);
    transition: color var(--transition-fast);
    
    &:hover {
        color: var(--text-primary);
    }
}

/* ==========================================================================
   14. EXTERNAL LINKS
   ========================================================================== */

/* Add external link icon to links in content area that don't point to local domain */
.markdown-section a[href^="http"]:not([href*="ava.addy.zone"])::after,
.markdown-section a[target="_blank"]::after {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-left: 0.25rem;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'%3E%3C/path%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cline x1='10' y1='14' x2='21' y2='3'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'%3E%3C/path%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cline x1='10' y1='14' x2='21' y2='3'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
    opacity: 0.5;
    vertical-align: middle;
}

/* Exclude images/cards link wrappers */
.markdown-section a:has(img)::after,
.preview-card a::after {
    display: none !important;
}
