/* ========================================
           1. CSS Variables & Reset
           ======================================== */
        :root {
            /* Colors - Racing Green + Gold Palette */
            --color-primary: #1B4D3E;
            --color-secondary: #D4A574;
            --color-text: #2C3E50;
            --color-text-secondary: #5D6D7E;
            --color-bg: #F8F6F3;
            --color-surface: #FFFFFF;
            --color-border: #E5E1DC;
            --color-success: #27AE60;
            --color-warning: #F39C12;
            --color-danger: #C0392B;
            
            /* Typography */
            --font-display: 'Libre Baskerville', Georgia, serif;
            --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
            --font-mono: 'JetBrains Mono', 'Consolas', monospace;
            
            /* Sizes */
            --h1-size: clamp(2.5rem, 5vw, 4rem);
            --h2-size: clamp(1.75rem, 3vw, 2.5rem);
            --h3-size: clamp(1.25rem, 2vw, 1.5rem);
            --body-size: clamp(1rem, 1.2vw, 1.125rem);
            --small-size: 0.875rem;
            --subtitle-size: clamp(1rem, 2vw, 1.25rem);
            
            /* Spacing */
            --section-gap: clamp(3rem, 6vw, 5rem);
            --content-max-width: 820px;
            --sidebar-width: 240px;
            
            /* Effects */
            --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
            --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
            --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
            --radius-sm: 4px;
            --radius-md: 8px;
            --transition-fast: 150ms ease;
            --transition-base: 250ms ease;
        
    /* --- AUTO-FORCED DARK THEME --- */
    --color-primary: #4A9F8A;
                --color-secondary: #D4A574;
                --color-text: #E8E6E3;
                --color-text-secondary: #A0A8B0;
                --color-bg: #1A1D21;
                --color-surface: #242830;
                --color-border: #3A3F48;
                --color-success: #2ECC71;
                --color-warning: #F5B041;
                --color-danger: #E74C3C;
}

        /* Dark theme */
        

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

        html {
            scroll-behavior: smooth;
        }

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

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

        a {
            color: var(--color-primary);
            text-decoration: underline;
            text-underline-offset: 3px;
            transition: color var(--transition-fast);
        }

        a:hover {
            color: var(--color-secondary);
        }

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

        /* ========================================
           2. General Typography
           ======================================== */
        h1, h2, h3, h4 {
            font-family: var(--font-display);
            font-weight: 700;
            line-height: 1.25;
            color: var(--color-text);
        }

        h2 {
            font-size: var(--h2-size);
            margin-bottom: 1.25rem;
            text-align: left;
            scroll-margin-top: 2rem;
        }

        h3 {
            font-size: var(--h3-size);
            margin-top: 2rem;
            margin-bottom: 0.75rem;
            text-align: left;
            scroll-margin-top: 2rem;
        }

        p {
            margin-bottom: 1.25rem;
            text-align: left;
        }

        ul, ol {
            margin-bottom: 1.25rem;
            padding-left: 1.5rem;
            text-align: left;
        }

        li {
            margin-bottom: 0.5rem;
            text-align: left;
        }

        strong {
            font-weight: 600;
        }

        em {
            font-style: italic;
        }

        blockquote {
            border-left: 3px solid var(--color-secondary);
            padding-left: 1.5rem;
            margin: 1.5rem 0;
            font-style: italic;
            color: var(--color-text-secondary);
            text-align: left;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin: 1.5rem 0;
            font-size: var(--small-size);
        }

        th, td {
            padding: 0.75rem 1rem;
            text-align: left;
            border-bottom: 1px solid var(--color-border);
        }

        th {
            font-weight: 600;
            background: var(--color-surface);
            color: var(--color-text);
        }

        tbody tr:hover {
            background: rgba(27, 77, 62, 0.03);
        }

        @media (prefers-color-scheme: dark) {
            tbody tr:hover {
                background: rgba(74, 159, 138, 0.08);
            }
        }

        figcaption {
            font-size: var(--small-size);
            color: var(--color-text-secondary);
            text-align: center;
            margin-top: 0.75rem;
        }

        /* ========================================
           3. Layout - Main with Sidebar TOC
           ======================================== */
        header {
            position: relative;
        }

        main {
            width: 100%;
            display: grid;
            grid-template-columns: var(--sidebar-width) 1fr;
            gap: 3rem;
            max-width: calc(var(--content-max-width) + var(--sidebar-width) + 6rem);
            margin: 0 auto;
            padding: 0 1.5rem;
        }

        @media (max-width: 900px) {
            main {
                display: block;
                padding: 0 1rem;
            }
        }

        /* ========================================
           4. Section Layout (data-content blocks)
           ======================================== */
        [data-content] {
            max-width: var(--content-max-width);
            margin-left: auto;
            margin-right: auto;
            padding: var(--section-gap) 0;
        }

        [data-content]:first-of-type {
            padding-top: 0;
        }

        /* Grid column assignments for sidebar layout */
        [data-content="toc"] {
            grid-column: 1;
            grid-row: 1 / span 100;
            max-width: none;
            padding: 0;
            margin: 0;
        }

        [data-content]:not([data-content="toc"]):not([data-content="hero"]) {
            grid-column: 2;
        }

        [data-content="hero"] {
            grid-column: 1 / -1;
            max-width: none;
            padding: 0;
            margin: 0;
        }

        @media (max-width: 900px) {
            [data-content="toc"],
            [data-content]:not([data-content="toc"]):not([data-content="hero"]),
            [data-content="hero"] {
                grid-column: auto;
                max-width: var(--content-max-width);
                margin-left: auto;
                margin-right: auto;
            }
        }

        /* ========================================
           5. Visual Components
           ======================================== */
        
        /* Info Box */
        .info-box {
            background: var(--color-surface);
            border-left: 4px solid var(--color-primary);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            padding: 1.25rem 1.5rem;
            margin: 1.5rem 0;
            box-shadow: var(--shadow-sm);
        }

        .info-box p {
            margin-bottom: 0;
            text-align: left;
        }

        .info-box p:not(:last-child) {
            margin-bottom: 0.75rem;
        }

        /* Callout */
        .callout {
            background: linear-gradient(135deg, rgba(243, 156, 18, 0.08), rgba(243, 156, 18, 0.03));
            border: 1px solid rgba(243, 156, 18, 0.3);
            border-radius: var(--radius-md);
            padding: 1.25rem 1.5rem;
            margin: 1.5rem 0;
            position: relative;
        }

        .callout::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: var(--color-warning);
            border-radius: var(--radius-md) 0 0 var(--radius-md);
        }

        .callout p {
            margin-bottom: 0;
            text-align: left;
        }

        /* Key Takeaway */
        .key-takeaway {
            border-top: 2px solid var(--color-primary);
            padding-top: 1rem;
            margin: 2rem 0;
        }

        .key-takeaway p {
            font-family: var(--font-display);
            font-size: clamp(1.125rem, 1.5vw, 1.25rem);
            font-weight: 600;
            line-height: 1.5;
            color: var(--color-text);
            margin-bottom: 0;
            text-align: left;
        }

        /* Fun Fact */
        .fun-fact {
            position: relative;
            padding-left: 1.5rem;
            margin: 1.5rem 0;
        }

        .fun-fact::before {
            content: '\2014';
            position: absolute;
            left: 0;
            top: 0;
            color: var(--color-secondary);
            font-weight: 700;
        }

        .fun-fact p {
            font-style: italic;
            color: var(--color-text-secondary);
            margin-bottom: 0;
            text-align: left;
        }

        /* Glossary Term */
        .glossary-term {
            display: flex;
            align-items: baseline;
            gap: 12px;
            margin: 1rem 0;
        }

        .glossary-term strong {
            font-family: var(--font-mono);
            font-size: var(--small-size);
            color: var(--color-primary);
            text-decoration: underline;
            text-underline-offset: 3px;
            white-space: nowrap;
        }

        .glossary-term span {
            color: var(--color-text-secondary);
        }

        @media (max-width: 600px) {
            .glossary-term {
                flex-direction: column;
                gap: 4px;
            }
        }

        /* Comparison Table */
        .comparison {
            margin: 2rem 0;
            overflow-x: auto;
        }

        .comparison table {
            background: var(--color-surface);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
        }

        .comparison th {
            background: var(--color-primary);
            color: var(--color-bg);
            font-weight: 600;
        }

        @media (prefers-color-scheme: dark) {
            .comparison th {
                background: var(--color-primary);
                color: #FFFFFF;
            }
        }

        .comparison td {
            background: var(--color-surface);
            color: var(--color-text);
        }

        .comparison tbody tr:nth-child(even) td {
            background: rgba(27, 77, 62, 0.03);
        }

        @media (prefers-color-scheme: dark) {
            .comparison tbody tr:nth-child(even) td {
                background: rgba(74, 159, 138, 0.05);
            }
        }

        /* Dos and Don'ts */
        .dos-donts {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1.5rem;
            margin: 2rem 0;
        }

        .dos-donts > div {
            padding: 1.25rem;
            border-radius: var(--radius-md);
        }

        .dos-donts .do {
            background: rgba(39, 174, 96, 0.08);
            border: 1px solid rgba(39, 174, 96, 0.3);
        }

        .dos-donts .dont {
            background: rgba(192, 57, 43, 0.08);
            border: 1px solid rgba(192, 57, 43, 0.3);
        }

        .dos-donts h4 {
            font-family: var(--font-body);
            font-size: var(--small-size);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: 0.75rem;
        }

        .dos-donts .do h4 {
            color: var(--color-success);
        }

        .dos-donts .dont h4 {
            color: var(--color-danger);
        }

        .dos-donts ul {
            margin: 0;
            padding-left: 1.25rem;
        }

        .dos-donts li {
            margin-bottom: 0.5rem;
            text-align: left;
        }

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

        /* Pre-Bet Checklist */
        .pre-bet-checklist {
            margin: 2rem 0;
        }

        .pre-bet-checklist h4 {
            font-family: var(--font-display);
            font-size: var(--small-size);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--color-primary);
            margin-bottom: 1rem;
        }

        .pre-bet-checklist ul {
            list-style: none;
            padding-left: 1.5rem;
            border-left: 2px solid var(--color-border);
            margin: 0;
        }

        .pre-bet-checklist li {
            position: relative;
            padding-left: 1rem;
            margin-bottom: 0.75rem;
            text-align: left;
        }

        .pre-bet-checklist li::before {
            content: '\2610';
            position: absolute;
            left: -1.5rem;
            top: 0;
            color: var(--color-primary);
            background: var(--color-bg);
            padding: 0 4px;
        }

        /* At a Glance */
        .at-a-glance {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 1px;
            background: var(--color-border);
            border-radius: var(--radius-md);
            overflow: hidden;
            margin: 2rem 0;
        }

        .at-a-glance > div {
            background: var(--color-surface);
            padding: 1.25rem;
            text-align: center;
        }

        .at-a-glance h4 {
            font-family: var(--font-display);
            font-size: clamp(1.25rem, 2vw, 1.5rem);
            color: var(--color-primary);
            margin-bottom: 0.5rem;
        }

        .at-a-glance p {
            font-size: var(--small-size);
            color: var(--color-text-secondary);
            margin: 0;
            text-align: center;
        }

        /* Worked Example */
        .worked-example {
            background: var(--color-surface);
            border-radius: var(--radius-md);
            padding: 1.5rem 2rem;
            margin: 2rem 0;
            box-shadow: var(--shadow-md);
        }

        .worked-example h4 {
            font-family: var(--font-body);
            font-size: var(--small-size);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--color-text-secondary);
            margin-bottom: 1rem;
        }

        .worked-example .step {
            display: flex;
            align-items: baseline;
            gap: 1rem;
            padding: 0.75rem 0;
            border-bottom: 1px dashed var(--color-border);
        }

        .worked-example .step:last-child {
            border-bottom: none;
        }

        .worked-example .step-num {
            font-family: var(--font-mono);
            font-size: var(--small-size);
            color: var(--color-text-secondary);
            min-width: 2rem;
        }

        .worked-example .step-content {
            flex: 1;
        }

        .worked-example .step-content code {
            font-family: var(--font-mono);
            background: rgba(27, 77, 62, 0.08);
            padding: 2px 6px;
            border-radius: var(--radius-sm);
        }

        .worked-example .result {
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 2px solid var(--color-primary);
        }

        .worked-example .result strong {
            font-family: var(--font-mono);
            font-size: clamp(1.125rem, 1.5vw, 1.25rem);
            color: var(--color-primary);
        }

        /* Section Bridge */
        .section-bridge {
            text-align: center;
            margin: 2.5rem 0;
            font-family: var(--font-display);
            font-style: italic;
            color: var(--color-secondary);
            position: relative;
        }

        .section-bridge::before,
        .section-bridge::after {
            content: '\2022 \2022 \2022';
            color: var(--color-border);
            letter-spacing: 0.5em;
            font-size: 0.75rem;
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
        }

        .section-bridge::before {
            left: 0;
        }

        .section-bridge::after {
            right: 0;
        }

        /* Odds Example */
        .odds-example {
            background: var(--color-text);
            color: var(--color-bg);
            border-radius: var(--radius-md);
            padding: 1.5rem 2rem;
            margin: 2rem 0;
            text-align: center;
        }

        @media (prefers-color-scheme: dark) {
            .odds-example {
                background: #2C3E50;
                color: #F8F6F3;
            }
        }

        .odds-example h4 {
            font-family: var(--font-body);
            font-size: var(--small-size);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            opacity: 0.7;
            margin-bottom: 1rem;
            color: inherit;
        }

        .odds-example .odds {
            font-family: var(--font-mono);
            font-size: clamp(1.5rem, 3vw, 2rem);
            font-weight: 700;
            color: var(--color-secondary);
            margin-bottom: 0.5rem;
        }

        .odds-example p {
            font-size: var(--small-size);
            opacity: 0.8;
            margin: 0;
            text-align: center;
            color: inherit;
        }

        /* Card Grid */
        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
            margin: 2rem 0;
        }

        .card-grid .card {
            background: var(--color-surface);
            border-radius: var(--radius-md);
            padding: 1.5rem;
            box-shadow: var(--shadow-sm);
            transition: transform var(--transition-base), box-shadow var(--transition-base);
        }

        .card-grid .card:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

        .card-grid .card h4 {
            font-size: 1.125rem;
            margin-bottom: 0.75rem;
            color: var(--color-text);
        }

        .card-grid .card p {
            font-size: var(--small-size);
            color: var(--color-text-secondary);
            margin: 0;
            text-align: left;
        }

        /* TL;DR */
        .tldr {
            background: var(--color-surface);
            border-left: 4px solid var(--color-secondary);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            padding: 1.5rem 2rem;
            margin: 2rem 0;
        }

        .tldr h2 {
            font-family: var(--font-display);
            font-size: clamp(1.125rem, 1.5vw, 1.25rem);
            font-weight: 700;
            margin-bottom: 1rem;
            color: var(--color-text);
        }

        .tldr ul {
            margin: 0;
        }

        .tldr li {
            margin-bottom: 0.75rem;
            text-align: left;
        }

        .tldr li:last-child {
            margin-bottom: 0;
        }

        /* ========================================
           6. Hero Section
           ======================================== */
        [data-content="hero"] {
            width: 100vw;
            margin-left: calc(50% - 50vw);
            position: relative;
            overflow: hidden;
        }

        .hero-inner {
            max-width: calc(var(--content-max-width) + var(--sidebar-width) + 6rem);
            margin: 0 auto;
            padding: clamp(4rem, 10vw, 7rem) 1.5rem;
            position: relative;
            z-index: 1;
        }

        .hero-bg {
            position: absolute;
            inset: 0;
            background: 
                radial-gradient(ellipse 80% 60% at 50% 40%, rgba(27, 77, 62, 0.06) 0%, transparent 70%),
                var(--color-bg);
            pointer-events: none;
        }

        /* Subtle track pattern */
        .hero-bg::before {
            content: '';
            position: absolute;
            inset: 0;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200'%3E%3Cpath d='M20 100 Q100 40 200 100 T380 100' fill='none' stroke='%231B4D3E' stroke-width='1' opacity='0.04'/%3E%3Cpath d='M20 120 Q100 60 200 120 T380 120' fill='none' stroke='%231B4D3E' stroke-width='1' opacity='0.03'/%3E%3C/svg%3E");
            background-size: 400px 200px;
            background-position: center;
            opacity: 0.5;
            pointer-events: none;
            mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, transparent 30%, black 100%);
            -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, transparent 30%, black 100%);
        }

        @media (prefers-color-scheme: dark) {
            .hero-bg {
                background: 
                    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(74, 159, 138, 0.08) 0%, transparent 70%),
                    var(--color-bg);
            }

            .hero-bg::before {
                background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200'%3E%3Cpath d='M20 100 Q100 40 200 100 T380 100' fill='none' stroke='%234A9F8A' stroke-width='1' opacity='0.06'/%3E%3Cpath d='M20 120 Q100 60 200 120 T380 120' fill='none' stroke='%234A9F8A' stroke-width='1' opacity='0.04'/%3E%3C/svg%3E");
            }
        }

        .hero-meta {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }

        .hero-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            font-size: var(--small-size);
            color: var(--color-text-secondary);
            background: var(--color-surface);
            padding: 0.375rem 0.75rem;
            border-radius: 2rem;
            box-shadow: var(--shadow-sm);
        }

        .hero-trust {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--color-text-secondary);
        }

        .hero-content {
            max-width: var(--content-max-width);
        }

        .hero-content h1 {
            font-size: var(--h1-size);
            color: var(--color-primary);
            margin-bottom: 1rem;
            line-height: 1.15;
        }

        .hero-subtitle {
            font-family: var(--font-display);
            font-size: var(--subtitle-size);
            font-style: italic;
            color: var(--color-secondary);
            margin-bottom: 1.5rem;
        }

        .hero-intro {
            font-size: clamp(1rem, 1.3vw, 1.125rem);
            color: var(--color-text-secondary);
            max-width: 600px;
            margin-bottom: 2rem;
        }

        .hero-cta {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            background: var(--color-primary);
            color: var(--color-bg);
            font-family: var(--font-body);
            font-weight: 600;
            font-size: var(--small-size);
            padding: 0.875rem 1.5rem;
            border-radius: var(--radius-sm);
            text-decoration: none;
            transition: transform var(--transition-fast), box-shadow var(--transition-fast);
        }

        .hero-cta:hover {
            transform: translateY(-1px);
            box-shadow: var(--shadow-md);
            color: var(--color-bg);
        }

        @media (prefers-color-scheme: dark) {
            .hero-cta {
                color: #FFFFFF;
            }
            .hero-cta:hover {
                color: #FFFFFF;
            }
        }

        .hero-figure {
            margin-top: 2.5rem;
            max-width: 100%;
        }

        .hero-figure img {
            width: 100%;
            height: auto;
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-lg);
        }

        /* ========================================
           7. Table of Contents (Sticky Sidebar)
           ======================================== */
        .toc-sidebar {
            position: sticky;
            top: 2rem;
            max-height: calc(100vh - 4rem);
            overflow-y: auto;
            padding-right: 1rem;
            scrollbar-width: thin;
            scrollbar-color: var(--color-border) transparent;
        }

        .toc-sidebar::-webkit-scrollbar {
            width: 4px;
        }

        .toc-sidebar::-webkit-scrollbar-track {
            background: transparent;
        }

        .toc-sidebar::-webkit-scrollbar-thumb {
            background: var(--color-border);
            border-radius: 2px;
        }

        .toc-title {
            font-family: var(--font-body);
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--color-text-secondary);
            margin-bottom: 1rem;
        }

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

        .toc-list li {
            margin-bottom: 0.25rem;
        }

        .toc-list a {
            display: block;
            font-size: var(--small-size);
            color: var(--color-text-secondary);
            text-decoration: none;
            padding: 0.375rem 0;
            transition: color var(--transition-fast);
        }

        .toc-list a:hover {
            color: var(--color-primary);
        }

        .toc-list .toc-h2 > a {
            font-weight: 600;
            color: var(--color-text);
        }

        .toc-list .toc-h3 {
            padding-left: 1rem;
        }

        .toc-list .toc-h3 a {
            font-size: 0.8125rem;
            color: var(--color-text-secondary);
        }

        .toc-nested {
            list-style: none;
            padding: 0;
            margin: 0.25rem 0 0.5rem 0;
        }

        @media (max-width: 900px) {
            [data-content="toc"] {
                padding: var(--section-gap) 0;
            }

            .toc-sidebar {
                position: static;
                max-height: none;
                overflow-y: visible;
                padding-right: 0;
            }
        }

        /* ========================================
           8. FAQ Accordion
           ======================================== */
        details {
            margin-bottom: 0.5rem;
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            background: var(--color-surface);
            overflow: hidden;
            interpolate-size: allow-keywords;
        }

        summary {
            padding: 1rem 1.25rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
            transition: background var(--transition-fast);
            list-style: none;
        }

        summary::-webkit-details-marker {
            display: none;
        }

        summary::after {
            content: '+';
            font-family: var(--font-mono);
            font-size: 1.25rem;
            font-weight: 400;
            color: var(--color-text-secondary);
            transition: transform var(--transition-base);
        }

        details[open] summary::after {
            transform: rotate(45deg);
        }

        summary:hover {
            background: rgba(27, 77, 62, 0.03);
        }

        @media (prefers-color-scheme: dark) {
            summary:hover {
                background: rgba(74, 159, 138, 0.05);
            }
        }

        /* Modern details animation */
        ::details-content {
            opacity: 0;
            block-size: 0;
            overflow: hidden;
            transition: 
                opacity var(--transition-base),
                block-size var(--transition-base),
                content-visibility var(--transition-base) allow-discrete;
        }

        details[open]::details-content {
            opacity: 1;
            block-size: auto;
        }

        details > div {
            padding: 0 1.25rem 1rem;
        }

        details > div p {
            text-align: left;
        }

        /* Fallback for older browsers */
        @supports not selector(::details-content) {
            details[open] > *:not(summary) {
                animation: fade-in 300ms ease forwards;
            }

            @keyframes fade-in {
                from {
                    opacity: 0;
                    transform: translateY(-8px);
                }
                to {
                    opacity: 1;
                    transform: translateY(0);
                }
            }
        }

      
        /* ========================================
           10. Back to Top Button
           ======================================== */
        .back-to-top {
            position: fixed;
            bottom: 2rem;
            right: 2rem;
            width: 44px;
            height: 44px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            box-shadow: var(--shadow-md);
            opacity: 0;
            visibility: hidden;
            transform: translateY(10px);
            transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
            z-index: 100;
        }

        .back-to-top.visible {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .back-to-top:hover {
            background: var(--color-primary);
            border-color: var(--color-primary);
        }

        .back-to-top svg {
            width: 20px;
            height: 20px;
            stroke: var(--color-text);
            transition: stroke var(--transition-fast);
        }

        .back-to-top:hover svg {
            stroke: var(--color-bg);
        }

        @media (prefers-color-scheme: dark) {
            .back-to-top:hover svg {
                stroke: #FFFFFF;
            }
        }

        /* ========================================
           11. Media Queries - Mobile Adjustments
           ======================================== */
        @media (max-width: 600px) {
            .hero-inner {
                padding: clamp(3rem, 8vw, 5rem) 1rem;
            }

            .hero-cta {
                width: 100%;
                justify-content: center;
            }

            .at-a-glance {
                grid-template-columns: 1fr;
            }

            .worked-example {
                padding: 1.25rem;
            }

            .section-bridge::before,
            .section-bridge::after {
                display: none;
            }

           

            .back-to-top {
                bottom: 1rem;
                right: 1rem;
            }
        }

        /* Print styles */
        @media print {
            .toc-sidebar,
            .back-to-top,
            .hero-cta {
                display: none;
            }

            main {
                display: block;
            }

            [data-content] {
                page-break-inside: avoid;
            }
        }

/* =========================================
   UNIVERSAL DESKTOP & MOBILE MENU + LOGO
   ========================================= */

/* Header Base */
.site-header {
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border, #333);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Mobile defaults for navigation bar */
.top-navigation-bar {
    width: 100%;
    margin: 0 auto;
    padding: 15px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- LOGO FIXES --- */
.site-logo img {
    max-height: 75px; /* Optimal height for most logos */
    width: auto !important; /* Prevents squishing */
    display: block;
    transition: transform 0.2s ease;
}

.site-logo img:hover {
    transform: scale(1.02);
}

/* --- DESKTOP MENU --- */
.site-nav--desktop {
    display: none; /* Hidden on mobile by default */
}

/* Desktop Grid Layout: Logo left, Menu center */
@media (min-width: 1024px) {
    .top-navigation-bar {
        max-width: 100%;
        padding: 15px 40px; /* Safe padding from screen edges */
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
    }
    
    .site-logo {
        grid-column: 1;
        justify-self: start; /* Locks logo to the left edge */
        margin: 0;
    }

    .site-nav--desktop {
        display: block;
        grid-column: 2;
        justify-self: center; /* Locks menu perfectly in the center */
    }

    .mobile-controls {
        display: none; /* Hide burger on desktop */
    }
    
    .menu-desktop {
        display: flex;
        gap: 30px;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .menu-desktop a {
        text-decoration: none;
        color: var(--color-text);
        font-family: var(--font-body, sans-serif);
        font-weight: 500;
        font-size: 16px;
        transition: color 0.2s ease;
    }
    
    .menu-desktop a:hover {
        color: var(--color-accent);
    }
}

/* --- MOBILE BURGER BUTTON --- */
.burger {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
    z-index: 1000;
}

.burger span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--color-text);
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-radius: 2px;
}

/* Burger Animation to X */
.burger.is-active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.burger.is-active span:nth-child(2) {
    opacity: 0;
}
.burger.is-active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* --- MOBILE MENU SLIDER --- */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden off-screen */
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--color-bg);
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    overflow-y: auto;
    padding: 60px 30px;
}

.mobile-menu.is-open {
    right: 0; /* Slide in */
}

.mobile-menu__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 36px;
    line-height: 1;
    color: var(--color-text);
    cursor: pointer;
    transition: color 0.2s ease;
}

.mobile-menu__close:hover {
    color: var(--color-accent);
}

.menu-mobile {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.menu-mobile a {
    text-decoration: none;
    color: var(--color-text);
    font-size: 20px;
    font-family: var(--font-display, sans-serif);
    font-weight: 600;
    display: block;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.menu-mobile a:hover {
    color: var(--color-accent);
    padding-left: 10px; /* Nice slide effect on hover */
}

/* --- OVERLAY --- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px); /* Beautiful blur effect */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
    z-index: 998;
}

.mobile-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* --- Smart centering: disables empty sidebar column on inner pages --- */

/* 1. If there is NO sidebar [data-content="toc"] inside main, disable grid */
main:not(:has([data-content="toc"])) {
    display: block !important;
}

/* 2. Center regular text blocks on such pages */
main:not(:has([data-content="toc"])) [data-content],
main:not(:has([data-content="toc"])) article {
    max-width: 850px !important; 
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 3. Hero section fix: ensure it spans full width */
main:not(:has([data-content="toc"])) [data-content="hero"] {
    max-width: none !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    margin-top: 0 !important;
    padding-top: 3rem !important; 
}

/* =========================================
   4-COLUMN FOOTER (Tricast Horse Racing Theme)
   ========================================= */
.site-footer-4col {
    background-color: #111827; /* Dark grayish-blue background */
    color: #9ca3af;
    padding: 60px 20px 30px;
    margin-top: 80px;
    font-family: var(--font-body, sans-serif);
    border-top: 3px solid var(--color-accent, #0d9488); /* Teal accent border */
}

.footer-4col-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Legal Disclaimers Block */
.footer-disclaimers {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-disclaimers p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    text-align: left;
}

.footer-disclaimers a {
    color: var(--color-accent, #0d9488);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer-disclaimers a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Grid Layout */
.footer-4col-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .footer-4col-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-4col-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* Teal Titles */
.widget-title {
    color: var(--color-accent, #0d9488); 
    font-family: var(--font-display, sans-serif); 
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    margin-top: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

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

.widget-list li {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #9ca3af;
    line-height: 1.5;
}

.widget-list a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s ease;
}

.widget-list a:hover {
    color: var(--color-accent, #0d9488);
}

/* Bullets */
.bullet-list li {
    position: relative;
    padding-left: 16px;
}

.bullet-list li::before {
    content: '•';
    color: var(--color-accent, #0d9488); 
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 1.5rem;
    line-height: 1;
}

.clean-list li {
    padding-left: 0;
    padding-bottom: 0.8rem;
}

.clean-list li::before {
    display: none;
}

.footer-4col-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 25px;
    text-align: center;
}

.footer-4col-bottom p {
    margin: 0;
    font-size: 0.85rem;
    color: #d5dde8;
    text-align: center;
}

/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--color-accent, #0d9488);
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
}

.back-to-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-btn:hover {
    background-color: #0f766e;
    transform: translateY(-5px);
}


@media (max-width: 900px) {
    html, body {
        overflow-x: hidden !important; 
        width: 100%;
        max-width: 100vw;
    }

    main {
        display: block !important;
        width: 100%;
    }

    [data-content="hero"], 
    main:not(:has([data-content="toc"])) [data-content="hero"] {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    .tldr, [data-content], article {
        width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}