@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=Crimson+Pro:wght@400;600;700&display=swap');

:root {
            --primary: #1a1a2e;
            --secondary: #16213e;
            --accent: #0f4c75;
            --highlight: #3282b8;
            --text: #2d3436;
            --text-light: #636e72;
            --bg: #fdfefe;
            --bg-alt: #f8f9fa;
            --border: #dfe6e9;
            --success: #00b894;
            --warning: #fdcb6e;
            --code-bg: #2d3436;
            --code-text: #dfe6e9;
        }

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

        body {
            font-family: 'Crimson Pro', 'Crimson Text', Georgia, serif;
            line-height: 1.8;
            color: var(--text);
            background: var(--bg);
            font-size: 18px;
        }

        /* Typography */
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
            font-weight: 600;
            line-height: 1.3;
            color: var(--primary);
            margin-top: 2rem;
            margin-bottom: 1rem;
        }

        h1 {
            font-size: 3.5rem;
            letter-spacing: -0.02em;
            margin-top: 0;
        }

        h2 {
            font-size: 2.5rem;
            border-bottom: 3px solid var(--accent);
            padding-bottom: 0.5rem;
            margin-top: 3rem;
        }

        h3 {
            font-size: 1.8rem;
            color: var(--secondary);
        }

        h4 {
            font-size: 1.4rem;
            color: var(--accent);
        }

        /* Layout */
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 3rem 2rem;
            animation: fadeIn 0.6s ease-out;
        }

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

        /* Header */
        .lesson-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            color: white;
            padding: 4rem 2rem;
            margin: -3rem -2rem 3rem -2rem;
            border-radius: 0 0 2rem 2rem;
            box-shadow: 0 10px 40px rgba(0,0,0,0.1);
        }

        .lesson-header h1 {
            color: white;
            margin-bottom: 0.5rem;
        }

        .lesson-meta {
            display: flex;
            gap: 2rem;
            flex-wrap: wrap;
            margin-top: 1.5rem;
            font-size: 0.95rem;
            opacity: 0.9;
        }

        .lesson-meta-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .lesson-meta-item::before {
            content: "●";
            color: var(--highlight);
        }

        /* Navigation */
        .toc {
            background: var(--bg-alt);
            border-left: 4px solid var(--accent);
            padding: 1.5rem;
            margin: 2rem 0;
            border-radius: 0 8px 8px 0;
        }

        .toc h3 {
            margin-top: 0;
            font-size: 1.3rem;
        }

        .toc ul {
            list-style: none;
            margin-top: 1rem;
        }

        .toc li {
            padding: 0.4rem 0;
        }

        .toc a {
            color: var(--accent);
            text-decoration: none;
            transition: all 0.3s ease;
        }

        .toc a:hover {
            color: var(--highlight);
            padding-left: 0.5rem;
        }

        /* Content boxes */
        .info-box {
            background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
            border-left: 4px solid var(--accent);
            padding: 1.5rem;
            margin: 2rem 0;
            border-radius: 0 8px 8px 0;
        }

        .warning-box {
            background: linear-gradient(135deg, #fdcb6e15 0%, #e1705515 100%);
            border-left: 4px solid var(--warning);
            padding: 1.5rem;
            margin: 2rem 0;
            border-radius: 0 8px 8px 0;
        }

        .warning-box::before {
            content: "⚠️ ";
            font-size: 1.2em;
        }

        .success-box {
            background: linear-gradient(135deg, #00b89415 0%, #00cec915 100%);
            border-left: 4px solid var(--success);
            padding: 1.5rem;
            margin: 2rem 0;
            border-radius: 0 8px 8px 0;
        }

        /* Tables */
        table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            margin: 2rem 0;
            background: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 15px rgba(0,0,0,0.05);
        }

        th {
            background: var(--secondary);
            color: white;
            padding: 1rem;
            text-align: left;
            font-weight: 600;
        }

        td {
            padding: 1rem;
            border-bottom: 1px solid var(--border);
        }

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

        tr:hover {
            background: var(--bg-alt);
        }

        /* Lists */
        ul, ol {
            margin: 1rem 0 1rem 2rem;
        }

        li {
            margin: 0.5rem 0;
        }

        /* Math */
        .katex {
            font-size: 1.1em;
        }

        .katex-display {
            margin: 2rem 0;
            overflow-x: auto;
            overflow-y: hidden;
        }

        /* Problem sections */
        .problem {
            background: white;
            border: 2px solid var(--border);
            border-radius: 12px;
            padding: 2rem;
            margin: 2rem 0;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            transition: all 0.3s ease;
        }

        .problem:hover {
            box-shadow: 0 5px 20px rgba(0,0,0,0.1);
            transform: translateY(-2px);
        }

        .problem-header {
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 1rem;
            font-size: 1.2rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .problem-difficulty {
            display: inline-block;
            padding: 0.2rem 0.8rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
            margin-left: auto;
        }

        .difficulty-basic {
            background: #dfe6e9;
            color: #2d3436;
        }

        .difficulty-intermediate {
            background: #fdcb6e;
            color: #2d3436;
        }

        .difficulty-exam {
            background: #d63031;
            color: white;
        }

        .solution {
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 2px dashed var(--border);
        }

        .solution-header {
            font-weight: 700;
            color: var(--success);
            margin-bottom: 1rem;
            font-size: 1.1rem;
        }

        /* Code blocks */
        pre {
            background: var(--code-bg);
            color: var(--code-text);
            padding: 1.5rem;
            border-radius: 8px;
            overflow-x: auto;
            margin: 1.5rem 0;
            font-family: 'Fira Code', 'Consolas', monospace;
            font-size: 0.9em;
            line-height: 1.6;
        }

        code {
            background: var(--code-bg);
            color: var(--code-text);
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
            font-family: 'Fira Code', 'Consolas', monospace;
            font-size: 0.9em;
        }

        pre code {
            padding: 0;
            background: none;
        }

        /* Summary section */
        .summary {
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            color: white;
            padding: 2rem;
            border-radius: 12px;
            margin: 3rem 0;
        }

        .summary h2 {
            color: white;
            border-bottom: 3px solid var(--highlight);
            margin-top: 0;
        }

        .summary h3 {
            color: var(--highlight);
        }

        .summary ul {
            margin-left: 1.5rem;
        }

        .summary table {
            background: rgba(255, 255, 255, 0.1);
        }

        .summary th {
            background: rgba(0, 0, 0, 0.2);
        }

        .summary td {
            border-bottom-color: rgba(255, 255, 255, 0.1);
        }

        .summary tr:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        /* Footer */
        .lesson-footer {
            margin-top: 4rem;
            padding-top: 2rem;
            border-top: 2px solid var(--border);
            text-align: center;
            color: var(--text-light);
            font-style: italic;
        }

        /* Responsive */
        @media (max-width: 768px) {
            body {
                font-size: 16px;
            }

            h1 {
                font-size: 2.5rem;
            }

            h2 {
                font-size: 2rem;
            }

            .container {
                padding: 2rem 1rem;
            }

            .lesson-header {
                padding: 3rem 1rem;
                margin: -2rem -1rem 2rem -1rem;
            }

            table {
                font-size: 0.9rem;
            }

            th, td {
                padding: 0.75rem;
            }
        }

        /* Smooth scroll */
        html {
            scroll-behavior: smooth;
        }

        /* Link styles */
        a {
            color: var(--accent);
            text-decoration: none;
            border-bottom: 2px solid transparent;
            transition: border-color 0.3s ease;
        }

        a:hover {
            border-bottom-color: var(--highlight);
        }

        /* Strong emphasis */
        strong {
            color: var(--primary);
            font-weight: 700;
        }

        em {
            color: var(--accent);
            font-style: italic;
        }

        /* Section divider */
        hr {
            border: none;
            height: 2px;
            background: linear-gradient(90deg, transparent, var(--border), transparent);
            margin: 3rem 0;
        }

        /* Google Fonts */

/* Shared reading and symbol explanation patterns for all four lessons. */
.level-key {
    padding: 1rem 1.2rem;
    margin: 1.25rem 0 2rem;
    border-left: 4px solid var(--highlight);
    background: var(--bg-alt);
}
.toc h2 {
    margin: 0;
    border: 0;
    padding: 0;
    font-size: 1.45rem;
}
main > h2[id^="high-school"], main > h2[id^="undergraduate"],
main > h2[id^="masters"], main > h2[id^="phd"] {
    margin-top: 3.5rem;
    padding-top: 0.4rem;
}
.math-explainer {
    margin: 1rem 0 1.7rem;
    padding: 0.35rem 1.2rem 0.65rem;
    border: 2px solid var(--border);
    border-left: 4px solid var(--highlight);
    border-radius: 8px;
    background: var(--bg-alt);
}
.math-explainer[open] { border-color: var(--highlight); }
.math-explainer summary {
    cursor: pointer;
    min-height: 44px;
    padding: 0.55rem 0;
    color: var(--accent);
    font-weight: 700;
    touch-action: manipulation;
}
.math-explainer summary:hover { color: var(--highlight); }
.math-explainer summary:focus-visible,
.toc a:focus-visible,
.lesson-navigation a:focus-visible,
.table-scroll:focus-visible {
    outline: 3px solid var(--highlight);
    outline-offset: 3px;
}
.math-explainer p { margin: 0.5rem 0; }
.math-explainer dl {
    display: grid;
    grid-template-columns: minmax(7rem, max-content) 1fr;
    column-gap: 1rem;
    row-gap: 0.3rem;
    margin: 0.6rem 0;
}
.math-explainer dt { font-weight: 700; }
.math-explainer dd { margin: 0; }
.table-scroll { max-width: 100%; overflow-x: auto; margin: 1.5rem 0; contain: paint; }
.table-scroll table { margin: 0; width: max-content; min-width: 100%; }
.table-scroll { overscroll-behavior-inline: contain; }
html, body { overflow-x: clip; }
.lesson-navigation { display: flex; flex-wrap: wrap; gap: 0.9rem 1.5rem; margin-top: 3rem; }
@media (max-width: 600px) {
    .lesson-header h1 { overflow-wrap: anywhere; }
    .math-explainer dl { grid-template-columns: 1fr; }
    .math-explainer dd { margin-bottom: 0.45rem; }
    .table-scroll::before {
        content: "Swipe or scroll for more columns if needed";
        display: block;
        width: max-content;
        margin-bottom: 0.35rem;
        color: var(--text-light);
        font-size: 0.85rem;
    }
}
