/* ========================================================================
   Paz Corpus - Modern Design System
   ======================================================================== */

/* ========== CSS VARIABLES ========== */
:root {
    /* Colors - Warm Light Theme (easier on eyes) */
    --color-bg: #fffdf9;
    /* Warm off-white instead of cool gray */
    --color-bg-alt: #faf8f0;
    /* Warm cream instead of gray */
    --color-bg-card: #fffef8;
    /* Warm white instead of pure white */
    --color-text: #1a1a2e;
    --color-text-muted: #64648c;
    --color-text-light: #9191ab;
    --color-accent: #6366f1;
    --color-accent-light: rgba(99, 102, 241, 0.1);
    --color-accent-hover: #4f46e5;
    --color-link: #6366f1;
    --color-border: #e8e4d9;
    /* Warmer border */
    --color-border-light: #f5f2e8;
    /* Warmer border light */
    --color-success: #10b981;
    --color-warning: #f59e0b;

    /* Subject Colors */
    --color-database: #6366f1;
    --color-coa: #10b981;
    --color-networks: #f59e0b;
    --color-os: #ec4899;

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --content-width: 1140px;
    --card-radius: 16px;
    --transition-fast: 0.15s ease;
    --transition-medium: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 20px 60px rgba(99, 102, 241, 0.15);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2);
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg: #0a0a0f;
    --color-bg-alt: #12121a;
    --color-bg-card: #1a1a24;
    --color-text: #e8e8ed;
    --color-text-muted: #9191ab;
    --color-text-light: #64648c;
    --color-border: #2a2a3a;
    --color-border-light: #1f1f2a;
    --color-accent-light: rgba(99, 102, 241, 0.15);
    --shadow-hover: 0 20px 60px rgba(99, 102, 241, 0.25);
}

/* ========== RESET & BASE ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-hover);
}

/* ========== LAYOUT ========== */
.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* ========== HEADER ========== */
.site-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 255, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    box-shadow: 0 2px 20px rgba(99, 102, 241, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme="dark"] .site-header {
    background: linear-gradient(135deg, rgba(18, 18, 28, 0.98), rgba(25, 20, 40, 0.95));
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 1140px;
    margin: 0 auto;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-left: 1rem;
}

.site-logo .logo-image,
.site-logo .logo-icon {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.logo-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.logo-title,
.gradient-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--color-accent), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--color-accent);
    /* Fallback */
}

.logo-tagline {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.01em;
}

.site-logo:hover .logo-title {
    opacity: 0.9;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.site-logo:hover .logo-text {
    color: var(--color-accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-accent);
}

.theme-toggle {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.6rem;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-accent-light);
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* ========== HERO SECTION ========== */
.hero {
    position: relative;
    padding: 6rem 0 4rem;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(236, 72, 153, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(16, 185, 129, 0.08), transparent);
    z-index: -1;
}

.hero-content {
    position: relative;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.badge-icon {
    font-size: 1rem;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.hero h1 .highlight {
    background: linear-gradient(135deg, var(--color-accent), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    max-width: 640px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

/* Hero Stats */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.hero-stats .stat {
    text-align: center;
}

.hero-stats .stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1.2;
}

.hero-stats .stat-label {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Trust Badges */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.trust-badge:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.trust-badge svg {
    width: 18px;
    height: 18px;
    color: var(--color-accent);
}

/* ========== SEARCH BAR ========== */
.search-container {
    max-width: 480px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: 14px;
    padding: 0.875rem 1.5rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.search-box:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-accent-light), var(--shadow-md);
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--color-text);
    outline: none;
    font-family: var(--font-sans);
}

.search-box input::placeholder {
    color: var(--color-text-light);
}

.search-box svg {
    width: 20px;
    height: 20px;
    color: var(--color-text-muted);
    margin-right: 0.75rem;
}

/* ========== STATS SECTION ========== */
.stats-section {
    padding: 3rem 0;
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--color-bg-card);
    border-radius: var(--card-radius);
    border: 1px solid var(--color-border);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-accent);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    display: block;
    margin-top: 0.25rem;
}

.stat-note {
    font-size: 0.8rem;
    color: var(--color-text-light);
    display: block;
    margin-top: 0.25rem;
}

/* ========== SUBJECTS SECTION ========== */
.subjects-section {
    padding: 5rem 0;
}

.section-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    text-align: center;
    letter-spacing: -0.02em;
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.subject-card {
    position: relative;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 2rem;
    text-decoration: none;
    transition: all var(--transition-medium);
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--subject-color, var(--color-accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-medium);
}

.subject-card.active-subject:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.subject-card.active-subject:hover::before {
    transform: scaleX(1);
}

/* Coming Soon Cards */
.subject-card.coming-soon {
    cursor: default;
    opacity: 0.7;
}

.coming-soon-overlay {
    position: absolute;
    inset: 0;
    background: rgba(250, 250, 250, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

[data-theme="dark"] .coming-soon-overlay {
    background: rgba(10, 10, 15, 0.7);
}

.subject-card.coming-soon:hover .coming-soon-overlay {
    opacity: 1;
}

.coming-soon-overlay span {
    background: var(--color-text);
    color: var(--color-bg);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

.subject-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    background: var(--color-accent-light);
    color: var(--subject-color, var(--color-accent));
}

.subject-card h3 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.subject-card p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.subject-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

/* ========== ABOUT SECTION ========== */
.about-section {
    padding: 5rem 0;
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
}

.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.about-content h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.about-content p {
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.about-content p strong {
    color: var(--color-text);
}

.about-features {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.feature {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.feature-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.feature div strong {
    display: block;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.feature div p {
    margin: 0;
    font-size: 0.9rem;
}

/* Inspiration Card */
.inspiration-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 2rem;
    text-align: center;
}

.inspiration-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--color-accent), #818cf8);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.inspiration-icon svg {
    width: 32px;
    height: 32px;
}

.inspiration-card h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.inspiration-card p {
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.inspiration-card a {
    font-weight: 600;
}

.inspiration-quote {
    font-style: italic;
    color: var(--color-text-light);
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.95rem;
}

/* ========== FOOTER ========== */
.site-footer {
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: 4rem 0 2rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-text);
    transition: transform var(--transition-fast);
    text-align: left;
    /* Ensure text aligns left in flex container */
}


.footer-logo .logo-image {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.footer-tagline {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-copyright {
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in:nth-child(1) {
    animation-delay: 0.1s;
}

.fade-in:nth-child(2) {
    animation-delay: 0.2s;
}


.fade-in:nth-child(3) {

    animation-delay: 0.3s;
}

.fade-in:nth-child(4) {
    animation-delay: 0.4s;
}

.fade-in:nth-child(5) {
    animation-delay: 0.5s;
}

.fade-in:nth-child(6) {
    animation-delay: 0.6s;
}

.fade-in.visible {
    opacity: 1;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero .subtitle {
        font-size: 1.05rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Header handled in final mobile override section */

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .trust-badges {
        gap: 0.75rem;
    }

    .trust-badge {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }
}


/* Automaton / Graphviz */
pre.automaton {
    display: none;
}

.automaton-svg {
    margin: 2rem auto;
    text-align: center;
    background: #fff;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.automaton-svg:hover {
    transform: scale(1.02);
}

.automaton-svg svg {
    max-width: 100%;
    height: auto;
}


/* ========== LECTURE LIST ========== */
.lectures-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lecture-card {
    display: block;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 1.5rem 2rem;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.lecture-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.lecture-card h4 {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.lecture-card p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.lecture-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.lecture-meta .type {
    color: var(--color-accent);
    font-weight: 600;
}

.lecture-meta .date {
    color: var(--color-text-light);
}

/* ========== BREADCRUMB ========== */
.breadcrumb-nav {
    padding: 1.5rem 0;
    font-size: 0.9rem;
}

.breadcrumb-nav a {
    color: var(--color-text-muted);
}

.breadcrumb-nav a:hover {
    color: var(--color-accent);
}

.breadcrumb-nav .separator {
    color: var(--color-text-light);
    margin: 0 0.5rem;
}

.breadcrumb-nav .current {
    color: var(--color-text);
    font-weight: 500;
}

/* ========== TOPIC HEADER ========== */
.topic-header {
    padding: 3rem 0;
    background: var(--color-bg-alt);
    margin-bottom: 2rem;
}

.topic-header h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.topic-header .subject-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--color-accent-light);
    color: var(--color-accent);
    margin-bottom: 1rem;
}

/* ========== UPDATE BADGE ========== */
.update-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--color-accent);
    color: white;
    letter-spacing: 0.03em;
}

/* ========== RECENT UPDATES ========== */
.recent-section {
    padding: 3rem 0;
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.recent-item:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}

.recent-date {
    min-width: 60px;
    text-align: center;
}

.recent-date .day {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    display: block;
}

.recent-date .month {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.recent-content h4 {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.recent-content .breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.recent-tag {
    margin-left: auto;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--color-accent-light);
    color: var(--color-accent);
}

/* ========================================================================
   ONBOARDING TUTORIAL SYSTEM
   ======================================================================== */

.tutorial-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.75);
    transition: opacity var(--transition-medium);
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-spotlight {
    position: absolute;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    background: transparent;
    transition: all 0.4s ease;
    z-index: 9999;
    pointer-events: none;
}

.tutorial-tooltip {
    position: absolute;
    width: 300px;
    background: var(--color-bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    transition: all 0.3s ease;
}

.tooltip-content {
    padding: 1.25rem;
}

.tooltip-content p {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.6;
}

.tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.tooltip-progress {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.tooltip-buttons {
    display: flex;
    gap: 0.5rem;
}

.tooltip-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.tooltip-btn.skip {
    background: transparent;
    color: var(--color-text-muted);
}

.tooltip-btn.skip:hover {
    color: var(--color-text);
}

.tooltip-btn.next {
    background: var(--color-accent);
    color: white;
}

.tooltip-btn.next:hover {
    background: var(--color-accent-hover);
}

.tooltip-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-bg-card);
    transform: rotate(45deg);
    left: 50%;
    margin-left: -6px;
}

.tooltip-arrow.arrow-top {
    top: -6px;
}

.tooltip-arrow.arrow-bottom {
    bottom: -6px;
}

/* ========================================================================
   PAGE TEMPLATES (About, Author)
   ======================================================================== */

.page-header {
    padding: 4rem 0 3rem;
    background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

.page-content {
    padding: 3rem 0 4rem;
}

.content-section {
    margin-bottom: 3rem;
}

.content-section h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.content-section p {
    color: var(--color-text-muted);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.content-section p strong {
    color: var(--color-text);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-fast);
}

.feature-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-card .feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.feature-card p {
    font-size: 0.9rem;
    margin: 0;
}

/* Highlight Section */
.highlight-section {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 2rem;
}

.experiment-details {
    display: grid;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.experiment-item {
    background: var(--color-bg-card);
    border-radius: 10px;
    padding: 1.25rem;
}

.experiment-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.experiment-item p {
    margin: 0;
    font-size: 0.9rem;
}

.note {
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* Inspiration Section */
.inspiration-section {
    background: linear-gradient(135deg, var(--color-accent-light), rgba(129, 140, 248, 0.05));
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 2rem;
}

.inspiration-content blockquote {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-style: italic;
    color: var(--color-text-muted);
    border-left: 3px solid var(--color-accent);
    padding-left: 1.5rem;
    margin: 1rem 0 0;
}

.inspiration-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.inspiration-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.inspiration-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

/* Giants Grid (Credits Section) */
.giants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.giants-category {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.giants-category h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.giants-category p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    color: var(--color-text-muted);
}

/* Buttons */
.cta-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ========== AUTHOR PAGE ========== */
.author-section {
    text-align: center;
}

.author-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.author-avatar {
    width: 120px;
    height: 120px;
    background: var(--color-bg-alt);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    border: 3px solid var(--color-border);
    overflow: hidden;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-avatar svg {
    width: 48px;
    height: 48px;
}

.author-info h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.author-role {
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: 1rem !important;
}

.author-bio {
    max-width: 500px;
    margin: 0 auto;
}

/* Vision Points */
.vision-points {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.vision-item {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    text-align: left;
}

.vision-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    opacity: 0.5;
    line-height: 1;
}

.vision-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-text);
}

.vision-item p {
    margin: 0;
    font-size: 0.95rem;
}

/* Contact Links */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.contact-link:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.contact-link svg {
    width: 20px;
    height: 20px;
}

/* ========== QUICK LINKS SECTION ========== */
.quick-links-section {
    padding: 4rem 0;
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.quick-link-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.quick-link-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.quick-link-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.quick-link-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.quick-link-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* ========== RESPONSIVE ADDITIONS ========== */
@media (max-width: 768px) {
    .tutorial-tooltip {
        width: 280px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .quick-links-grid {
        grid-template-columns: 1fr;
    }

    .author-card {
        text-align: center;
    }

    .cta-buttons {
        justify-content: center;
    }
}

/* ========== ARTICLE/BLOG STYLES (Distill.pub Inspired) ========== */
article {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem 1.5rem 6rem;
    line-height: 1.85;
    font-family: var(--font-serif, 'Libre Baskerville', Georgia, serif);
}

/* Article Figures and Images */
article figure {
    margin: 2rem auto;
    max-width: 50%;
    text-align: center;
    display: block;
}

article figure img {
    max-width: 100%;
    max-height: 350px;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

article figure img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

article figure figcaption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-style: italic;
    font-family: var(--font-sans);
}

/* Header / Title Block */
.article-header {
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.article-meta-bar {
    border-bottom: none;
}

.article-meta {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.article-header h1 {
    font-family: var(--font-serif, 'Libre Baskerville', Georgia, serif);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.8rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.subtitle {

    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 400;
    font-style: italic;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ========== TIMELINE JOURNEY SECTION ========== */
.timeline-section {
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

/* Vertical Line */
.timeline-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: linear-gradient(to bottom,
            transparent,
            var(--color-border) 10%,
            var(--color-border) 90%,
            transparent);
    z-index: 1;
}

/* Phase Block */
.phase-block {
    margin-bottom: 6rem;
    position: relative;
    z-index: 2;
}

.phase-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 4rem;
    background: var(--color-bg);
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.phase-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Phase Colors */
.phase-1 .phase-badge {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Green */
.phase-2 .phase-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Yellow */
.phase-3 .phase-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Red */
.phase-4 .phase-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* Blue */

.phase-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.phase-desc {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Timeline Nodes */
.timeline-nodes {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.timeline-node {
    display: flex;
    align-items: center;
    gap: 3rem;
    position: relative;
}

/* Alternating Layout */
.timeline-node:nth-child(odd) {
    flex-direction: row-reverse;
    text-align: right;
}

.timeline-node:nth-child(even) {
    flex-direction: row;
    text-align: left;
}

/* Center Dot */
.node-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 4px solid var(--color-accent);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    box-shadow: 0 0 0 4px var(--color-bg);
}

.phase-1 .node-dot {
    border-color: #10b981;
}

.phase-2 .node-dot {
    border-color: #f59e0b;
}

.phase-3 .node-dot {
    border-color: #ef4444;
}

.phase-4 .node-dot {
    border-color: #3b82f6;
}

/* Content Card */
.node-content {
    flex: 1;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 2rem;
    transition: all var(--transition-medium);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.node-content:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

/* Hover Accent Line */
.node-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-border);
    transition: background var(--transition-fast);
}

.timeline-node:nth-child(odd) .node-content::before {
    left: auto;
    right: 0;
}

.phase-1 .node-content:hover::before {
    background: #10b981;
}

.phase-2 .node-content:hover::before {
    background: #f59e0b;
}

.phase-3 .node-content:hover::before {
    background: #ef4444;
}

.phase-4 .node-content:hover::before {
    background: #3b82f6;
}

.node-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: var(--color-text-light);
}

.node-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.node-desc {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.node-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .timeline-track {
        left: 20px;
    }

    .timeline-nodes {
        gap: 3rem;
    }

    .timeline-node {
        flex-direction: column !important;
        align-items: flex-start;
        text-align: left !important;
        padding-left: 50px;
    }

    .node-dot {
        left: 20px;
    }

    .node-content {
        width: 100%;
    }

    .node-content::before {
        left: 0 !important;
        right: auto !important;
    }
}


.author-block {
    margin-top: 2rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.author-name {
    font-weight: 600;
    color: var(--color-text);
}

.author-affiliation {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.read-time {
    color: var(--color-accent);
    font-weight: 500;
}

/* Table of Contents - Distill Style */
.toc {
    background: var(--color-bg-alt);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin: 2rem 0 3rem;
}

.toc-title,
.toc h3 {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.toc ol {
    list-style: none;
    counter-reset: toc-counter;
    padding-left: 0;
}

.toc li {
    counter-increment: toc-counter;
    margin-bottom: 0.5rem;
}

.toc li::before {
    content: counter(toc-counter) ".";
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--color-accent);
    margin-right: 0.5rem;
}

.toc a {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.toc a:hover {
    color: var(--color-accent);
}

/* Typography */
article h2 {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 700;
    margin-top: 3.5rem;
    margin-bottom: 1.2rem;
    color: var(--color-text);
    line-height: 1.3;
}

article h3 {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

article p {
    margin-bottom: 1.4rem;
    text-align: justify;
    hyphens: auto;
    color: var(--color-text);
}

article strong {
    font-weight: 700;
    color: var(--color-text);
}

article em {
    font-style: italic;
}

article a {
    color: var(--color-link, #2563eb);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

article a:hover {
    color: var(--color-accent);
}

/* Lists */
article ul,
article ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

article li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

article ul li::marker {
    color: var(--color-accent);
}

article ol li::marker {
    color: var(--color-accent);
    font-weight: 600;
}

/* Wide Figures - Distill.pub Signature */
article figure {
    margin: 3rem -2rem;
    max-width: calc(100% + 4rem);
}

@media (min-width: 800px) {
    article figure {
        margin: 3rem -5rem;
        max-width: calc(100% + 10rem);
    }
}

article figure img {
    width: 100%;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

article figcaption {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-top: 1rem;
    padding: 0 2rem;
    text-align: left;
}

/* Term Highlighting */
.term {
    background: var(--color-bg-alt);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 0.92em;
    font-weight: 600;
}

/* Diagram Placeholder */
.diagram-placeholder {
    background: var(--color-bg-alt);
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    margin: 2rem 0;
    color: var(--color-text-muted);
}

/* Article Footer */
.article-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Smooth Scroll Anchor Offset */
article h2[id],
article h3[id] {
    scroll-margin-top: 2rem;
}

/* Article Mobile Responsive */
@media (max-width: 600px) {
    article {
        padding: 1.5rem 1rem 4rem;
    }

    .article-header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    article h2 {
        font-size: 1.4rem;
    }

    article figure {
        margin: 2rem -1rem;
        max-width: calc(100% + 2rem);
    }

    article figcaption {
        padding: 0 1rem;
    }

    .toc {
        padding: 1rem;
    }
}

/* ========== SUBJECT LANDING PAGES ========== */
.subject-hero {
    padding: 5rem 1.5rem 3rem;
    text-align: center;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
}

.subject-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, var(--color-accent), #a855f7);
    color: white;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.subject-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

.why-learn {
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-text-muted);
}

.applications {
    padding: 3rem 1.5rem;
    background: var(--color-bg);
}

.applications h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.app-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.app-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.app-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.app-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.roadmap-section {
    padding: 3rem 1.5rem 4rem;
    background: var(--color-bg-alt);
}

.roadmap-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.module-grid {
    display: grid;
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.module-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: 8px;
    padding: 1.5rem;
}

.module-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.module-card .what,
.module-card .why {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.module-card strong {
    color: var(--color-text);
}

/* GATE Syllabus Tags */
.syllabus-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.syllabus-tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.article-list {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.article-item {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-border-light);
}

.article-item:last-child {
    border-bottom: none;
}

.article-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.article-title-row>span:first-child {
    flex: 1;
    text-align: left;
}

.widget-preview {
    font-size: 0.75rem;
    color: var(--color-text-light);
    font-style: italic;
    margin-top: 0.25rem;
    padding-left: 1rem;
}

.widget-preview::before {
    content: "🎮 ";
}

.article-item a {
    color: var(--color-text);
    text-decoration: none;
}

.article-item a:hover {
    color: var(--color-accent);
}

.article-item .status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    background: var(--color-bg-alt);
    color: var(--color-text-light);
    flex-shrink: 0;
    margin-left: 1rem;
}

.article-item .status.complete {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.cta-section {
    padding: 3rem 1.5rem 4rem;
    background: var(--color-bg);
    text-align: center;
}

.cta-section .btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--color-accent), #a855f7);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.cta-section .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Subject Landing Mobile */
@media (max-width: 700px) {
    .subject-hero h1 {
        font-size: 1.75rem;
    }

    .why-learn {
        font-size: 1rem;
    }
}

/* ========== UTILITY CLASSES ========== */
/* Logo wrapper utilities */
.logo-wrapper {
    display: flex;
    align-items: center;
}

.logo-image-lg {
    height: 60px;
    width: auto;
    margin-right: 0.75rem;
}

.logo-image-md {
    height: 48px;
    width: auto;
    margin-right: 0.75rem;
}

.logo-image-sm {
    height: 40px;
    width: auto;
    margin-right: 0.5rem;
}

/* Section heading utilities */
.section-heading {
    text-align: center;
    margin-bottom: 2rem;
}

/* Applications section h2 */
.applications h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

/* ========== CSS-BASED LOGO ICONS ========== */
/* Header logo icon (larger) */
.logo-icon-header {
    width: 48px;
    height: 48px;
    background: url('../images/logo.webp') center/contain no-repeat;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

/* Footer logo icon (smaller) */
.logo-icon-footer {
    width: 40px;
    height: 40px;
    background: url('../images/logo.webp') center/contain no-repeat;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

/* Homepage logo icon (largest) */
.logo-icon-hero {
    width: 60px;
    height: 60px;
    background: url('../Logo/logo.webp') center/contain no-repeat;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

/* ========== SEARCH MODAL ========== */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.search-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: var(--color-bg-card, #fff);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.search-modal-header svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.search-modal-header input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1.1rem;
    color: var(--color-text);
    outline: none;
}

.search-modal-header input::placeholder {
    color: var(--color-text-muted);
}

.search-modal-header kbd {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.search-modal-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.search-hint {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--color-accent-light);
}

.search-result-item h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.search-result-item p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

.search-modal-footer {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.search-modal-footer kbd {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

/* ========== DIAGRAM ZOOM MODAL ========== */
.diagram-placeholder,
.diagram-figure,
.automaton-svg {
    cursor: zoom-in;
}

.diagram-zoom-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    cursor: zoom-out;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.diagram-zoom-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-zoom-content {
    max-width: 95vw;
    max-height: 95vh;
    padding: 20px;
    transform-origin: center center;
}

.diagram-zoom-content svg {
    max-width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
}

.diagram-zoom-content img {
    max-width: 100%;
    max-height: 85vh;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background: white;
}

.diagram-zoom-close {
    position: fixed;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-zoom-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    opacity: 0.7;
}

.diagram-zoom-controls {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10001;
}

.diagram-zoom-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.diagram-zoom-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.diagram-zoom-level {
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    min-width: 50px;
    justify-content: center;
}

@media (max-width: 768px) {
    .diagram-zoom-controls {
        display: none;
    }
}

/* ========== COLLAPSIBLE SIDEBAR ========== */
.sidebar-toggle {
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--color-bg-alt);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-text-muted);
    transition: transform 0.3s ease;
}

/* Sidebar collapsed state */
.article-layout.sidebar-collapsed .article-sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.article-layout.sidebar-collapsed .article-content {
    margin-left: 0;
    max-width: 1100px;
}

.article-layout.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.article-layout.sidebar-collapsed .sidebar-toggle {
    left: 0.5rem;
}

/* Smooth transitions for sidebar */
.article-sidebar {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.article-content {
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: none;
    }
}

/* ========== ARTICLE PAGE COMPONENTS ========== */

/* Compact Header for Articles */
.site-header.article-header-compact {
    padding: 0 1.5rem;
}

.site-header.article-header-compact .header-inner {
    max-width: 100%;
    padding: 0.5rem 0;
}

.site-header.article-header-compact .logo-icon-header {
    width: 32px;
    height: 32px;
}

.site-header.article-header-compact .logo-wrapper {
    gap: 0.5rem;
}

.site-header.article-header-compact .logo-title {
    font-size: 1.1rem;
}

.site-header.article-header-compact .logo-tagline {
    font-size: 0.7rem;
}

.logo-text-column {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Breadcrumb Navigation */
.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .current {
    color: var(--color-accent);
}

/* Section Label (e.g., "Section 1.2") */
.section-label {
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    color: var(--color-accent);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* Article Title */
.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

/* Article Meta Bar */
.article-meta-bar {
    display: flex;
    gap: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

/* Article Navigation Footer */
.article-nav-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.article-nav-footer .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.article-nav-footer a {
    text-decoration: none;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.article-nav-footer a:hover {
    color: var(--color-accent);
}

.article-nav-footer a.next {
    color: var(--color-accent);
    font-weight: 600;
    text-align: right;
}

/* Mobile Prev/Next Navigation */
@media (max-width: 768px) {
    .article-nav-footer {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .article-nav-footer .nav-links {
        flex-direction: column;
        gap: 0.75rem;
    }

    .article-nav-footer .nav-links a {
        display: flex !important;
        align-items: center;
        padding: 0.875rem 1rem;
        background: var(--color-bg-card);
        border: 1px solid var(--color-border);
        border-radius: 10px;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--color-text-muted);
    }

    .article-nav-footer .nav-links a:not(.next)::before {
        content: '←';
        margin-right: 0.5rem;
    }

    .article-nav-footer .nav-links a.next {
        text-align: left;
        justify-content: space-between;
        color: var(--color-accent);
    }

    .article-nav-footer .nav-links a.next::after {
        content: '→';
        margin-left: 0.5rem;
    }
}

/* Search Icon Button */
.search-icon-btn {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.search-icon-btn:hover {
    background: var(--color-border);
}

/* Inactive Sidebar Module */
.sidebar-module.inactive {
    margin-top: 2rem;
    opacity: 0.5;
}

.sidebar-module .article-count {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    padding: 0.5rem;
}

/* Widget Container (Placeholder) */
.widget-container {
    text-align: center;
    color: var(--color-text-muted);
}

.widget-container button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
}

/* ========== ARTICLE PAGE LAYOUT ========== */

/* Article Layout Grid */
.article-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    transition: grid-template-columns 0.3s ease;
}

/* Collapsed sidebar: single column layout */
.article-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
    padding-left: 4rem;
    padding-right: 4rem;
}

.article-layout.sidebar-collapsed .article-sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.article-layout.sidebar-collapsed .article-content {
    max-width: 1150px;
    width: 100%;
    margin: 0 auto;
}

/* Sticky Sidebar */
.article-sidebar {
    position: sticky;
    top: 5rem;
    height: calc(100vh - 6rem);
    overflow-y: auto;
    border-right: 1px solid var(--color-border);
    padding-right: 1.5rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Sidebar Styling */
.sidebar-module-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    font-weight: 700;
}

.sidebar-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: var(--color-bg-alt);
}

.sidebar-link.active {
    background: rgba(var(--color-accent-rgb), 0.1);
    color: var(--color-accent);
    font-weight: 600;
}

.sidebar-check {
    margin-right: 0.5rem;
    color: #22c55e;
    opacity: 0;
}

.sidebar-link.read .sidebar-check {
    opacity: 1;
}

/* Main Content Area */
.article-content {
    max-width: 1000px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

/* Article Typography */
article p {
    font-family: var(--font-serif, 'Libre Baskerville', serif);
    font-size: 1.15rem;
    line-height: 1.85;
    text-align: justify;
    hyphens: auto;
    margin-bottom: 1.8rem;
    color: var(--color-text);
}

article h2 {
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 1.75rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

article h3 {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--color-accent);
}

/* Figures */
article figure {
    margin: 2rem 0;
    width: 100%;
}

article figure img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

article figcaption {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

/* Section Divider */
.section-divider {
    border: none;
    border-top: 2px solid var(--color-accent-light);
    margin: 3rem 0;
}

/* Part Header */
.part-header {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

/* Interactive Container */
#interactive-container {
    min-height: 300px;
    background: var(--color-bg-alt);
    border: 1px dashed var(--color-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 3rem 0;
    position: relative;
}

.interactive-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--color-accent);
}

/* Theme Toggle Icons (Article Page) */
.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

/* Responsive: Mobile */
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .article-sidebar {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    .header-search {
        display: none;
    }
}

/* ========== QUIZ COMPONENT ========== */
.quiz-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--color-border);
}

.quiz-section h2 {
    margin-bottom: 0.5rem;
}

.quiz-intro {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.quiz-container {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.quiz-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.quiz-progress {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.quiz-question {
    margin-bottom: 1.5rem;
}

.quiz-question p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
}

.quiz-option.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.quiz-option.incorrect {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.option-letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent-light);
    color: var(--color-accent);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.quiz-feedback {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
}

.quiz-feedback.correct {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #16a34a;
}

.quiz-feedback.incorrect {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #dc2626;
}

[data-theme="dark"] .quiz-feedback.correct {
    color: #4ade80;
}

[data-theme="dark"] .quiz-feedback.incorrect {
    color: #f87171;
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.quiz-score {
    font-weight: 600;
    color: var(--color-accent);
}

.quiz-next {
    padding: 0.5rem 1rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.quiz-next:hover {
    opacity: 0.9;
}

.quiz-results {
    text-align: center;
    padding: 1rem;
}

.quiz-results h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
}

.quiz-results button {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* ========================================================================
   RESPONSIVE DESIGN - MOBILE COMPATIBILITY
   ======================================================================== */

/* ========== TABLET (max-width: 1024px) ========== */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .article-layout {
        padding-left: 0;
    }

    .sidebar-wrapper {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }
}

/* ========== MOBILE (max-width: 768px) ========== */
@media (max-width: 768px) {

    /* Base adjustments */
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 1rem;
    }

    /* Header - Mobile */
    .header-inner {
        padding: 0.75rem 0;
    }

    .site-logo .logo-image,
    .site-logo .logo-icon {
        height: 36px;
    }

    .logo-title,
    .gradient-text {
        font-size: 1.2rem;
    }

    .logo-tagline {
        display: none;
    }

    /* Navigation - Keep container visible, hide only text links */
    .nav-links a:not(.search-icon-btn):not(.theme-toggle) {
        display: none;
    }

    /* Mobile menu button placeholder */
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        background: none;
        border: none;
        cursor: pointer;
    }

    .mobile-menu-btn span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--color-text);
        transition: var(--transition-fast);
    }

    /* Theme toggle smaller */
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* Hero Section */
    .hero-section {
        padding: 3rem 0;
    }

    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .trust-badges {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Subjects Grid */
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .subject-card {
        padding: 1.25rem;
    }

    /* Stats Section */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    /* Section headers */
    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Search box */
    .search-box {
        max-width: 100%;
    }

    /* Module Grid */
    .module-grid {
        grid-template-columns: 1fr;
    }

    /* Article Page */
    article {
        padding: 1rem 0;
        line-height: 1.55;
        /* Compact line-height for mobile */
    }

    article p {
        margin-bottom: 1rem;
        line-height: 1.65;
        /* Override explicit paragraph line-height */
    }

    .article-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
        /* Reduced from 1.5rem */
    }

    .article-header h1 {
        font-size: 1.8rem;
    }

    .article-meta-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding-bottom: 1rem;
        /* Reduced from 2rem */
        margin-bottom: 1.5rem;
        /* Reduced from 3rem */
    }

    article figure {
        max-width: 100%;
        margin: 1.25rem auto;
        /* Reduced from 2rem */
    }

    article figure img {
        max-height: 250px;
    }

    /* Tighter heading spacing on mobile */
    article h2 {
        margin-top: 2rem;
        margin-bottom: 0.75rem;
    }

    article h3 {
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
    }

    /* Tables - horizontal scroll */
    article .table-wrapper,
    article table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Quiz section */
    .quiz-container {
        padding: 1rem;
    }

    .quiz-option {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Footer */
    .site-footer {
        padding: 2rem 0;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Diagram zoom controls */
    .diagram-zoom-controls {
        display: none;
    }

    /* Mobile zoom hint - override JS-generated text via CSS */
    .diagram-zoom-hint {
        font-size: 0;
        /* Hide original text */
    }

    .diagram-zoom-hint::after {
        content: 'Tap outside to close • Pinch to zoom • Swipe to pan';
        font-size: 0.8rem;
    }
}

/* ========== SMALL MOBILE (max-width: 480px) ========== */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 0.75rem;
    }

    .hero-content h1 {
        font-size: 1.6rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .subject-card {
        padding: 1rem;
    }

    .subject-icon {
        width: 40px;
        height: 40px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    article h2 {
        font-size: 1.4rem;
    }

    article h3 {
        font-size: 1.2rem;
    }

    /* Code blocks */
    pre,
    code {
        font-size: 0.8rem;
    }

    /* Interactive widgets */
    .interactive-container {
        padding: 1rem;
    }
}

/* ========== TOUCH DEVICE ENHANCEMENTS ========== */
@media (hover: none) and (pointer: coarse) {

    /* Larger tap targets */
    .nav-links a,
    .footer-links a {
        padding: 0.5rem;
    }

    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
    }

    .quiz-option {
        min-height: 48px;
    }

    /* Disable hover effects on touch */
    .subject-card:hover {
        transform: none;
    }

    /* Article images - larger tap for zoom */
    article figure img {
        cursor: zoom-in;
    }
}

/* ========== PRINT STYLES ========== */
@media print {

    .site-header,
    .site-footer,
    .nav-links,
    .theme-toggle,
    .sidebar-wrapper,
    .diagram-zoom-overlay,
    .quiz-container {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    article {
        max-width: 100%;
        padding: 0;
    }

    a {
        color: inherit;
        text-decoration: underline;
    }
}

/* ========================================================================
   MOBILE HAMBURGER MENU
   ======================================================================== */

/* Hamburger Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 101;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger animation when active */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80%;
    height: 100%;
    background: var(--color-bg);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

[data-theme="dark"] .mobile-menu-content {
    background: var(--color-bg-alt);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

.mobile-menu-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* Mobile Navigation Links */
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 4rem;
}

.mobile-nav-links a {
    display: block;
    padding: 1rem;
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

/* Show hamburger on mobile */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
}

/* ========================================================================
   MOBILE SIDEBAR TOGGLE (Article Pages)
   ======================================================================== */

.mobile-sidebar-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 99;
    transition: all 0.2s ease;
}

.mobile-sidebar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.mobile-sidebar-btn.active {
    background: var(--color-text);
}

/* Mobile sidebar visible state */
@media (max-width: 1024px) {
    .mobile-sidebar-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-wrapper.mobile-visible {
        display: block !important;
        position: fixed;
        left: 0;
        top: 0;
        width: 300px;
        max-width: 85%;
        height: 100%;
        background: var(--color-bg);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 98;
        padding: 1rem;
        overflow-y: auto;
        animation: slideInLeft 0.3s ease;
    }

    [data-theme="dark"] .sidebar-wrapper.mobile-visible {
        background: var(--color-bg-alt);
    }

    /* Article left margin on mobile */
    .article-layout {
        margin-left: 0;
        padding: 0 1rem;
    }

    article {
        padding: 1rem 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* ========== MOBILE HEADER & LAYOUT ========== */
@media (max-width: 768px) {

    /* Reduce container padding on mobile */
    .container {
        padding: 0 0.75rem;
    }

    /* Header layout: logo left, icons right - ALL on same line */
    .header-inner {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap !important;
        padding: 0.5rem 0;
        gap: 0.5rem;
    }

    /* Nav links - show container but hide text links */
    .nav-links {
        display: flex !important;
        align-items: center;
        gap: 0.25rem;
        margin-left: auto;
    }

    .nav-links a {
        display: none !important;
    }

    /* Show search and theme buttons */
    .nav-links .search-icon-btn,
    .nav-links .theme-toggle {
        display: flex !important;
        flex-shrink: 0;
    }

    /* Hamburger button - after nav icons */
    .mobile-menu-btn {
        display: flex !important;
        flex-shrink: 0;
    }

    /* Logo stays on left, can shrink */
    .site-logo {
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
    }

    /* Smaller logo on mobile */
    .site-logo .logo-icon-header {
        width: 32px;
        height: 32px;
    }

    .logo-title {
        font-size: 1.25rem;
    }

    /* Hide tagline on mobile */
    .logo-tagline,
    .site-logo>div>span:not(.logo-title) {
        display: none !important;
    }

    /* Article layout adjustments */
    .article-layout {
        padding: 0 1rem;
    }

    article {
        padding: 1rem 0;
    }

    .article-header {
        padding: 0;
    }

    .article-content {
        padding: 0;
    }

    /* Force show sidebar toggle on article pages */
    .mobile-sidebar-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* Sidebar on mobile - overlay style */
@media (max-width: 1024px) {

    .sidebar-wrapper,
    .article-sidebar {
        display: none;
    }

    .sidebar-wrapper.mobile-visible,
    .article-sidebar.mobile-visible {
        display: block !important;
        position: fixed;
        left: 0;
        top: 0;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        background: var(--color-bg);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 98;
        padding: 1rem;
        padding-top: 80px;
        overflow-y: auto;
        animation: slideInLeft 0.3s ease;
    }

    [data-theme="dark"] .sidebar-wrapper.mobile-visible,
    [data-theme="dark"] .article-sidebar.mobile-visible {
        background: var(--color-bg-alt);
    }
}

/* ==========================================================================
   FINAL MOBILE HEADER OVERRIDE - Highest specificity, applied last
   ========================================================================== */
@media screen and (max-width: 768px) {

    /* Force header to be single-line flex */
    .site-header .header-inner,
    .site-header .container.header-inner,
    header.site-header .header-inner {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    /* Logo container - stay left */
    .site-header .site-logo {
        flex: 0 1 auto !important;
        max-width: 60% !important;
    }

    /* Nav links container - stay right, show as flex */
    .site-header .nav-links {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.25rem !important;
        flex-shrink: 0 !important;
    }

    /* Hide text links inside nav */
    .site-header .nav-links>a {
        display: none !important;
    }

    /* Show icons */
    .site-header .nav-links .search-icon-btn,
    .site-header .nav-links .theme-toggle,
    .site-header .nav-links .mobile-menu-btn {
        display: flex !important;
    }
}

/* ==========================================================================
   MOBILE FOOTER STYLES
   ========================================================================== */
@media screen and (max-width: 768px) {
    .site-footer {
        padding: 2rem 0 !important;
    }

    .site-footer>div {
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        gap: 1.5rem !important;
        padding: 0 1rem !important;
    }

    /* Branding section - left */
    .site-footer>div>div:first-child {
        align-items: flex-start !important;
    }

    .site-footer>div>div:first-child a {
        justify-content: flex-start !important;
    }

    /* Footer nav links - wrap, left aligned */
    .site-footer nav {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        gap: 0.5rem 1rem !important;
    }

    /* Contact section - left */
    .site-footer>div>div:last-child {
        text-align: left !important;
    }
}

/* ========== METAPHOR CALLOUT ========== */
/* Distinctive styling for analogies and metaphors in articles */
.metaphor {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(13, 148, 136, 0.05));
    border-left: 4px solid #14b8a6;
    border-radius: 0 12px 12px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    line-height: 1.8;
}

.metaphor-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0d9488;
    margin: 0 0 0.75rem 0;
}

.metaphor-heading::before {
    content: '🌿';
    font-size: 1rem;
}

.metaphor p {
    margin: 0;
    font-style: italic;
    color: var(--color-text-muted);
}

.metaphor em {
    color: var(--color-text);
    font-style: italic;
}

/* Dark mode adjustments */
[data-theme="dark"] .metaphor {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(13, 148, 136, 0.08));
    border-left-color: #2dd4bf;
}

[data-theme="dark"] .metaphor-heading {
    color: #2dd4bf;
}

/* ========== KEY INSIGHT CALLOUT ========== */
/* For important takeaways and insights */
.key-insight {
    background: linear-gradient(135deg, var(--color-accent-light), rgba(99, 102, 241, 0.05));
    border-left: 4px solid var(--color-accent);
    border-radius: 0 12px 12px 0;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.key-insight h4 {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    margin: 0 0 0.5rem 0;
}

.key-insight p {
    margin: 0;
    color: var(--color-text);
    line-height: 1.7;
}

/* ========== DISTILL-STYLE ENHANCEMENTS ========== */

/* --- Margin Notes (Tufte-style sidenotes) --- */
.sidenote {
    float: right;
    clear: right;
    width: 220px;
    margin-right: -260px;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--color-text-muted);
    padding-left: 1rem;
    border-left: 2px solid var(--color-border);
}

.sidenote-number {
    font-size: 0.7rem;
    vertical-align: super;
    color: var(--color-accent);
    cursor: help;
}

/* Mobile: sidenotes become inline callouts */
@media (max-width: 1200px) {
    .sidenote {
        display: block;
        float: none;
        width: 100%;
        margin: 1.25rem 0;
        margin-right: 0;
        padding: 1rem 1rem 1rem 2.75rem;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(129, 140, 248, 0.04));
        border: 1px solid rgba(99, 102, 241, 0.15);
        border-left: 4px solid var(--color-accent);
        border-radius: 0 10px 10px 0;
        font-size: 0.85rem;
        font-style: normal;
        line-height: 1.6;
        color: var(--color-text-muted);
        position: relative;
    }

    .sidenote::before {
        content: '📝';
        position: absolute;
        left: 0.75rem;
        top: 1rem;
        font-size: 1rem;
    }

    .sidenote-number {
        display: none;
    }
}


/* --- Interactive Widget Base Styles --- */
.interactive-widget {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.widget-icon {
    font-size: 1.5rem;
}

.widget-title {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.widget-description {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
}

/* --- Data Evolution Slider Widget --- */
.evolution-slider {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.evolution-track {
    position: relative;
    height: 80px;
    background: var(--color-bg-card);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.evolution-stage {
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0.4;
}

.evolution-stage.active {
    opacity: 1;
}

.evolution-stage .stage-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.evolution-stage .stage-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.evolution-slider input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, var(--color-accent), #818cf8);
    border-radius: 4px;
    cursor: pointer;
}

.evolution-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.evolution-explanation {
    background: var(--color-bg-card);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border-left: 3px solid var(--color-accent);
    font-size: 0.95rem;
    line-height: 1.7;
    min-height: 80px;
}

/* --- Database Types Explorer --- */
.db-types-explorer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.db-types-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.db-type-tab {
    padding: 0.6rem 1rem;
    background: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.db-type-tab:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
}

.db-type-tab.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.db-type-content {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
    min-height: 120px;
}

.db-type-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--color-text);
}

.db-type-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.db-type-example {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--color-bg-alt);
    border-radius: 8px;
    font-size: 0.85rem;
}

.db-type-example strong {
    color: var(--color-accent);
}

/* --- Three-Level Architecture Interactive --- */
.architecture-layers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.arch-layer {
    background: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.arch-layer:hover {
    border-color: var(--color-accent);
    transform: translateX(8px);
}

.arch-layer.expanded {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
}

.arch-layer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.arch-layer-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
}

.arch-layer-icon {
    font-size: 1.25rem;
}

.arch-layer-chevron {
    transition: transform 0.3s ease;
    color: var(--color-text-muted);
}

.arch-layer.expanded .arch-layer-chevron {
    transform: rotate(180deg);
}

.arch-layer-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.arch-layer.expanded .arch-layer-details {
    max-height: 200px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.arch-layer-details p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ==========================================================================
   MOBILE TOC ACCORDION - For article pages on mobile
   ========================================================================== */

/* Hide accordion on desktop */
.mobile-toc-accordion {
    display: none;
}

/* Hide sidebar toggle on mobile */
@media (max-width: 1024px) {

    .sidebar-toggle,
    .sidebar-toggle-btn,
    .hide-on-mobile {
        display: none !important;
    }

    .mobile-toc-accordion {
        display: block;
        margin: 1.5rem 0;
        border: 1px solid var(--color-border);
        border-radius: 12px;
        background: var(--color-bg-card);
        overflow: hidden;
    }

    .mobile-toc-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 1rem 1.25rem;
        background: var(--color-bg-alt);
        border: none;
        cursor: pointer;
        color: var(--color-text);
        font-size: 1rem;
        font-weight: 600;
        text-align: left;
        transition: background-color var(--transition-fast);
    }

    .mobile-toc-header:hover {
        background: var(--color-border-light);
    }

    .mobile-toc-title {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-toc-chevron {
        transition: transform 0.3s ease;
        color: var(--color-text-muted);
    }

    .mobile-toc-accordion.open .mobile-toc-chevron {
        transform: rotate(180deg);
    }

    .mobile-toc-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .mobile-toc-content.expanded {
        max-height: 500px;
        overflow-y: auto;
    }

    /* Style the cloned sidebar modules inside accordion */
    .mobile-toc-content .sidebar-module {
        padding: 1rem 1.25rem;
        border-top: 1px solid var(--color-border);
    }

    .mobile-toc-content .sidebar-module:first-child {
        border-top: none;
    }

    .mobile-toc-content .sidebar-module-title {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--color-text);
        margin-bottom: 0.75rem;
    }

    .mobile-toc-content .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-toc-content .sidebar-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        color: var(--color-text-muted);
        text-decoration: none;
        transition: all var(--transition-fast);
    }

    .mobile-toc-content .sidebar-link:hover,
    .mobile-toc-content .sidebar-link.active {
        background: var(--color-accent-light);
        color: var(--color-accent);
    }

    .mobile-toc-content .article-count {
        font-size: 0.8rem;
        color: var(--color-text-light);
    }
}