/* ==================== TERMINAL CRT DESIGN SYSTEM ==================== */
/* Neural Matter Networks - A retro-futuristic terminal aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Press+Start+2P&display=swap');

/* CSS Variables - Terminal Theme */
:root {
    /* Base colors */
    --bg: #050505;
    --bg-primary: #050505;
    --bg-secondary: #0a0f0a;
    --bg-tertiary: #0f1a12;
    --bg-card: rgba(10, 20, 15, 0.95);
    --panel-bg: rgba(10, 20, 15, 0.95);

    /* Accent colors - Terminal green palette */
    --primary: #4ff975;
    --primary-glow: rgba(79, 249, 117, 0.4);
    --secondary: #4deeea;
    --secondary-glow: rgba(77, 238, 234, 0.4);
    --accent: #f9d71c;
    --accent-glow: rgba(249, 215, 28, 0.4);
    --success: #4ff975;
    --error: #ff4f4f;

    /* Legacy aliases for compatibility */
    --accent-cyan: #4deeea;
    --accent-magenta: #ff4f9a;
    --accent-purple: #a855f7;
    --accent-blue: #4deeea;
    --accent-green: #4ff975;
    --accent-orange: #f9d71c;
    --accent-yellow: #f9d71c;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-secondary: linear-gradient(135deg, var(--secondary), var(--primary));
    --gradient-glow: radial-gradient(ellipse at center, rgba(79, 249, 117, 0.15) 0%, transparent 70%);

    /* Text colors */
    --text: #e0e0e0;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #606060;

    /* Borders */
    --border: #2a3a30;
    --border-dim: #1a2a20;
    --border-color: #2a3a30;
    --border-glow: rgba(79, 249, 117, 0.3);

    /* Typography - Monospace terminals */
    --font-display: 'Press Start 2P', 'Share Tech Mono', monospace;
    --font-body: 'Share Tech Mono', 'Inter', monospace;
    --font-mono: 'Share Tech Mono', monospace;
    --font-tifinagh: 'Noto Sans Tifinagh', sans-serif;

    /* Spacing */
    --section-padding: 100px;
    --container-max: 1400px;

    /* Effects */
    --shadow: 0 0 30px rgba(79, 249, 117, 0.15);
    --transition: all 0.3s steps(6);
    --transition-fast: 0.15s steps(4);
    --transition-base: 0.3s steps(6);
    --transition-slow: 0.5s steps(8);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* CRT Scanline Effects */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.01), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.01));
    background-size: 100% 3px, 3px 100%;
}

/* Scanline Animation */
body::after {
    content: '';
    position: fixed;
    width: 100%;
    height: 100px;
    z-index: 9998;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(79, 249, 117, 0.03) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.3;
    bottom: 100%;
    animation: scanline 12s linear infinite;
    pointer-events: none;
}

@keyframes scanline {
    0% {
        bottom: 100%;
    }

    100% {
        bottom: -100px;
    }
}

/* Grid Background Pattern */
.section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(79, 249, 117, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 249, 117, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Utility Classes */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* Yat Symbol Styling */
.yat-symbol {
    font-family: var(--font-tifinagh);
    color: var(--primary);
    font-weight: normal;
    text-shadow: 0 0 8px var(--primary-glow);
}

.yat-symbol-large {
    font-family: var(--font-tifinagh);
    font-size: 3rem;
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary-glow), 0 0 60px var(--primary-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }
}

/* ========================================
   Navigation - Terminal Style
   ======================================== */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 1rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
    letter-spacing: 1px;
}

.nav-logo .yat-symbol {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--accent-cyan);
}

.nav-blog {
    position: relative;
    color: var(--accent-cyan) !important;
}

.nav-blog::after {
    content: '📚';
    margin-left: 4px;
    font-size: 0.8em;
}

.nav-github {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: background var(--transition-fast);
}

.nav-github:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Active nav link */
.nav-links a.active {
    color: var(--primary) !important;
    text-shadow: 0 0 8px var(--primary-glow);
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 1001;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Mobile Hamburger Menu */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    cursor: pointer;
    z-index: 1002;
}

.nav-hamburger span {
    width: 24px;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s ease;
}

.nav-hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav Drawer */
.nav-drawer {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    flex-direction: column;
    gap: 16px;
    z-index: 999;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-drawer.open {
    transform: translateY(0);
    opacity: 1;
}

.nav-drawer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-dim);
    transition: color 0.2s;
}

.nav-drawer a:hover {
    color: var(--primary);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.back-to-top:hover {
    background: rgba(79, 249, 117, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-drawer {
        display: flex;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* ========================================
   Hero Section - Terminal CRT Theme
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px 24px 60px;
    background: var(--bg-primary);
    overflow: hidden;
}

/* CRT phosphor grid background */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        /* Vertical scanlines */
        repeating-linear-gradient(90deg,
            rgba(79, 249, 117, 0.03) 0px,
            rgba(79, 249, 117, 0.03) 1px,
            transparent 1px,
            transparent 3px),
        /* Horizontal scanlines */
        repeating-linear-gradient(0deg,
            rgba(79, 249, 117, 0.02) 0px,
            rgba(79, 249, 117, 0.02) 1px,
            transparent 1px,
            transparent 2px),
        /* Main grid */
        linear-gradient(rgba(79, 249, 117, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 249, 117, 0.02) 1px, transparent 1px);
    background-size: 3px 3px, 3px 2px, 60px 60px, 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Animated glow orbs */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        /* Top-left terminal green glow */
        radial-gradient(ellipse 600px 400px at 15% 20%, rgba(79, 249, 117, 0.12) 0%, transparent 60%),
        /* Center cyan subtle glow */
        radial-gradient(ellipse 400px 300px at 50% 50%, rgba(77, 238, 234, 0.06) 0%, transparent 50%),
        /* Bottom-right accent glow */
        radial-gradient(ellipse 500px 350px at 85% 75%, rgba(249, 215, 28, 0.05) 0%, transparent 60%),
        /* Vignette */
        radial-gradient(ellipse 80% 80% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 0;
    animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.hero-content {
    text-align: center;
    max-width: 900px;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(79, 249, 117, 0.1);
    border: 1px solid var(--primary);
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 32px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--primary-glow);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 10px var(--primary-glow);
    }

    50% {
        box-shadow: 0 0 20px var(--primary-glow), 0 0 30px var(--primary-glow);
    }
}

.hero-title {
    margin-bottom: 40px;
}

.title-line {
    display: block;
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    font-weight: 400;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    margin-bottom: 20px;
    text-shadow: 0 0 40px var(--primary-glow);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% {
        filter: drop-shadow(0 0 5px var(--primary-glow));
    }

    100% {
        filter: drop-shadow(0 0 15px var(--primary-glow));
    }
}

.title-subtitle {
    display: block;
    font-family: var(--font-mono);
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    font-weight: 400;
    color: var(--text-secondary);
    font-style: normal;
    letter-spacing: 0.05em;
}

/* Hero Equation */
.hero-equation {
    margin: 48px 0;
}

.equation-box {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 24px 48px;
    background: rgba(79, 249, 117, 0.03);
    border: 1px solid var(--primary);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--text-primary);
    box-shadow: 0 0 20px var(--primary-glow), inset 0 0 30px rgba(79, 249, 117, 0.02);
    position: relative;
}

/* Corner decorations for equation box */
.equation-box::before,
.equation-box::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--secondary);
}

.equation-box::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.equation-box::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.equation-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.frac-num,
.frac-den {
    padding: 4px 12px;
}

.frac-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
}

.hero-abstract {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

.hero-abstract em {
    color: var(--secondary);
    font-style: normal;
    text-shadow: 0 0 8px var(--secondary-glow);
}

/* Hero Actions */
.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    position: relative;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Terminal corner decorations */
.btn::before,
.btn::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border: 1px solid var(--secondary);
}

.btn::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.btn::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--bg);
    border-color: var(--primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--primary-glow), 0 0 60px var(--primary-glow);
}

.btn-secondary {
    background: var(--panel-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-glow);
}

/* Hero Stats */
.hero-stats {
    display: flex;
    gap: 60px;
    justify-content: center;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 400;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--secondary);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: bounce 2s steps(8) infinite;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--secondary);
    border-bottom: 2px solid var(--secondary);
    transform: rotate(45deg);
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* ========================================
   Sections
   ======================================== */
.section {
    padding: var(--section-padding) 0;
    position: relative;
}

.section-dark {
    background: var(--bg-secondary);
}

.section-title {
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 400;
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 700px;
    margin: 0 auto 60px;
    font-family: var(--font-mono);
}

/* ========================================
   Introduction Section
   ======================================== */
.intro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

.intro-text .lead {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.8;
}

.intro-text p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.problem-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.problem-card {
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.problem-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.problem-card h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.problem-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.manifold-viz-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.manifold-viz-container h4 {
    font-family: var(--font-display);
    margin-bottom: 20px;
    color: var(--text-primary);
}

.manifold-img {
    max-width: 100%;
    border-radius: 8px;
}

.caption {
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Mini Manifold Visualization (embedded in intro) */
.manifold-controls-mini {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.terminal-select-mini {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.terminal-select-mini:hover {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.terminal-select-mini:focus {
    outline: none;
    border-color: var(--secondary);
}

.terminal-select-mini option {
    background: var(--bg);
    color: var(--text-primary);
}

.manifold-demo-mini {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 12px;
}

.manifold-mini-panel {
    text-align: center;
}

.manifold-3d-mini {
    width: 100%;
    height: 180px;
    background: var(--bg);
    border: 1px solid var(--border-dim);
    margin-bottom: 4px;
}

.mini-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   YAT Product Section
   ======================================== */
.yat-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 60px;
}

.yat-intro .lead {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

.equation-showcase {
    text-align: center;
    margin-bottom: 60px;
}

.equation-main {
    font-size: 1.8rem;
    margin-bottom: 40px;
    padding: 40px;
    background: rgba(0, 212, 255, 0.03);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 20px;
}

.equation-breakdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.breakdown-item {
    text-align: center;
    padding: 24px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    min-width: 240px;
}

.breakdown-formula {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

.breakdown-label {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.breakdown-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.breakdown-divider {
    font-size: 2rem;
    color: var(--text-muted);
}

/* Properties Grid */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.property-card {
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all var(--transition-base);
}

.property-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px);
}

.property-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.property-icon {
    font-size: 1.5rem;
}

.property-card h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.property-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.theorem-ref {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-purple);
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 4px;
    display: inline-block;
}

/* ========================================
   Visualization Blocks - Terminal CRT Style
   ======================================== */
.viz-block {
    margin-bottom: 80px;
    position: relative;
}

.viz-title {
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary-glow);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.viz-title::before {
    content: '>';
    color: var(--primary);
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.viz-desc {
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 900px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Heatmap Controls - Terminal Panel */
.heatmap-controls {
    display: flex;
    gap: 40px;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    align-items: center;
    position: relative;
}

.heatmap-controls::before,
.heatmap-controls::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--secondary);
}

.heatmap-controls::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.heatmap-controls::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.heatmap-controls label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.heatmap-controls input[type="range"] {
    width: 120px;
    accent-color: var(--primary);
    background: var(--bg-secondary);
}

/* Visualization Grids */
.heatmap-grid,
.gradient-grid,
.levelset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

/* Row Labels - Terminal Style */
.row-label {
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: 0.6rem;
    color: var(--secondary);
    margin-bottom: 16px;
    padding-left: 16px;
    position: relative;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--secondary-glow);
}

.row-label::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: var(--primary);
    animation: pulse-arrow 1.5s ease-in-out infinite;
}

@keyframes pulse-arrow {

    0%,
    100% {
        opacity: 1;
        transform: translateX(0);
    }

    50% {
        opacity: 0.5;
        transform: translateX(3px);
    }
}

.row-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

/* Visualization Cards - Terminal Display */
.heatmap-item,
.gradient-item,
.levelset-item {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 16px;
    text-align: center;
    position: relative;
    transition: var(--transition);
    overflow: hidden;
}

/* Corner Decorations */
.heatmap-item::before,
.heatmap-item::after,
.gradient-item::before,
.gradient-item::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid var(--secondary);
    transition: var(--transition);
}

.heatmap-item::before,
.gradient-item::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.heatmap-item::after,
.gradient-item::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

/* Hover Effects */
.heatmap-item:hover,
.gradient-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 30px var(--primary-glow), inset 0 0 30px rgba(79, 249, 117, 0.03);
}

.heatmap-item:hover::before,
.heatmap-item:hover::after,
.gradient-item:hover::before,
.gradient-item:hover::after {
    border-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Scanline Effect on Cards */
.heatmap-item::selection,
.gradient-item::selection {
    background: var(--primary-glow);
}

/* Show fullscreen button on hover */
.heatmap-item:hover .fullscreen-btn,
.gradient-item:hover .fullscreen-btn {
    opacity: 1;
}

/* Fullscreen Button - Terminal Style */
.fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--panel-bg);
    color: var(--secondary);
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
    z-index: 10;
}

.fullscreen-btn:hover {
    opacity: 1;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Fullscreen Visualization Modal - Terminal Style */
.fullscreen-viz-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 5, 0.98);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 40px;
}

.fullscreen-viz-overlay.active {
    display: flex;
}

.fullscreen-viz-container {
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--primary);
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 0 60px var(--primary-glow), 0 0 100px rgba(79, 249, 117, 0.1);
}

/* Fullscreen container corner brackets */
.fullscreen-viz-container::before,
.fullscreen-viz-container::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--secondary);
}

.fullscreen-viz-container::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.fullscreen-viz-container::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.fullscreen-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--error);
    border-radius: 0;
    background: var(--panel-bg);
    color: var(--error);
    font-size: 16px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.fullscreen-close-btn:hover {
    background: var(--error);
    color: var(--bg);
    box-shadow: 0 0 20px rgba(255, 79, 79, 0.5);
}

#fullscreen-canvas {
    border: 1px solid var(--border);
    cursor: crosshair;
    max-width: 100%;
    max-height: calc(90vh - 100px);
}

.fullscreen-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dotted var(--border);
}

#fullscreen-label {
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: 0.7rem;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary-glow);
    letter-spacing: 1px;
}

.fullscreen-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Visualization Canvases */
.heatmap-item canvas,
.gradient-item canvas,
.levelset-item canvas {
    width: 100%;
    height: auto;
    border: 1px solid var(--border-dim);
    cursor: crosshair;
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
}

/* Visualization Labels */
.heatmap-label {
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: 0.55rem;
    margin-top: 12px;
    color: var(--secondary);
    text-shadow: 0 0 8px var(--secondary-glow);
    letter-spacing: 1px;
}

.heatmap-formula {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--primary);
    margin-top: 6px;
    text-shadow: 0 0 8px var(--primary-glow);
}

/* Coupled Visualization Grid (Heatmap + Gradient pairs) */
.coupled-viz-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.coupled-viz-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.viz-pair {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.viz-pair canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: crosshair;
}

.viz-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
    padding: 12px 24px;
    background: var(--bg-card);
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-dot.heatmap {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
}

.legend-dot.gradient {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid var(--accent-cyan);
}

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

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

/* XOR Demo */
.xor-demo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.xor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.xor-panel h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.xor-panel canvas {
    border-radius: 8px;
    background: #0d0d12;
}

.xor-result {
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

.xor-fail {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.xor-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.xor-explanation {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.xor-table table {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-collapse: collapse;
}

.xor-table th,
.xor-table td {
    padding: 12px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.xor-table th {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.highlight-zero {
    color: var(--accent-orange);
    font-weight: 600;
}

.highlight-positive {
    color: var(--accent-green);
    font-weight: 600;
}

/* Decision Boundary */
.boundary-demo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.boundary-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.boundary-panel h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.boundary-panel canvas {
    border-radius: 8px;
    background: #0d0d12;
}

.boundary-desc {
    margin-top: 16px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Loss Landscape 3D */
.loss-landscape-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.loss-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.loss-panel h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.loss-3d-canvas {
    width: 100%;
    height: 350px;
    border-radius: 8px;
    background: #0d0d12;
}

/* ========================================
   Architecture Section
   ======================================== */
.arch-intro {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 60px;
}

.arch-intro .lead {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.arch-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 60px;
}

.arch-card {
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.arch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.arch-header h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-primary);
}

.arch-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 10px;
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-cyan);
    border-radius: 4px;
}

.arch-equation {
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow-x: auto;
}

.arch-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.impl-table {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
}

.impl-table h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.impl-table table {
    width: 100%;
    border-collapse: collapse;
}

.impl-table th,
.impl-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.impl-table th {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.impl-table td {
    color: var(--text-secondary);
}

/* ========================================
   Results Section
   ======================================== */
.results-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

.results-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
}

.results-block h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.results-table th {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.results-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.results-table .highlight-row {
    background: rgba(0, 212, 255, 0.05);
}

.results-table strong {
    color: var(--accent-green);
}

/* Language Results */
.lang-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.lang-card {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    text-align: center;
}

.lang-card h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.highlight-card {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.highlight-card h4 {
    color: var(--accent-cyan);
}

.lang-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.lang-stat {
    text-align: center;
}

.lang-stat .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.lang-stat .stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lang-stat .stat-value.better {
    color: var(--accent-green);
}

.improvement {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--accent-green);
    font-weight: 500;
}

/* Training Curves */
.training-curves,
.mnist-prototypes {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    margin-bottom: 40px;
}

.training-curves h3,
.mnist-prototypes h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.training-img,
.prototypes-img {
    max-width: 100%;
    border-radius: 8px;
}

/* ========================================
   Code Section
   ======================================== */
.install-block {
    margin-bottom: 60px;
}

.install-block h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.code-block {
    background: #0d0d12;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.code-block pre {
    padding: 24px;
    margin: 0;
    overflow-x: auto;
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Code Tabs */
.code-examples {
    margin-bottom: 60px;
}

.code-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

.code-tab {
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.code-tab:hover {
    color: var(--text-primary);
}

.code-tab.active {
    background: #0d0d12;
    color: var(--accent-cyan);
    border-color: var(--border-glow);
}

.code-panels {
    background: #0d0d12;
    border: 1px solid var(--border-color);
    border-radius: 0 12px 12px 12px;
}

.code-panel {
    display: none;
}

.code-panel.active {
    display: block;
}

.code-panel pre {
    padding: 24px;
    margin: 0;
    overflow-x: auto;
}

.code-panel code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Layers Grid */
.layer-support h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.layers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.layer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.layer-name {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.layer-type {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border-radius: 4px;
}

/* ========================================
   Citation Section
   ======================================== */
.citation-block {
    position: relative;
    background: #0d0d12;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 700px;
    margin: 0 auto;
}

.citation-block pre {
    padding: 24px;
    padding-right: 80px;
    margin: 0;
    overflow-x: auto;
}

.citation-block code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.copy-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: 60px 0;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-brand .yat-symbol {
    font-size: 1.5rem;
}

.footer-links {
    display: flex;
    gap: 32px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-cyan);
}

.footer-copy {
    text-align: right;
}

.footer-copy p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 4px 0;
}

.footer-copy a {
    color: var(--accent-cyan);
    text-decoration: none;
}

/* ========================================
   Theory/Blog Section
   ======================================== */

/* Force blog/theory section to be visible */
#theory,
#theory .container,
#theory .section-title,
#theory .section-subtitle,
.theory-nav,
.blog-cards,
.blog-card,
.theory-summary {
    opacity: 1 !important;
    transform: none !important;
}

/* ========================================
   Blog Modal System
   ======================================== */

/* Blog Cards Grid */
.blog-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin: 48px 0;
}

.blog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.blog-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.1);
}

.blog-card:hover::before {
    opacity: 1;
}

.blog-card-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--bg-primary);
    margin-bottom: 16px;
}

.blog-card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.blog-card-preview {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-card-tag {
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.blog-card-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent-cyan);
}

.blog-card-cta svg {
    transition: transform var(--transition-fast);
}

.blog-card:hover .blog-card-cta svg {
    transform: translateX(4px);
}

/* Modal Overlay */
.blog-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.blog-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.blog-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.blog-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.blog-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.blog-modal-header-content {
    flex: 1;
}

.blog-modal-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bg-primary);
    margin-bottom: 12px;
}

.blog-modal-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.blog-modal-close {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-left: 16px;
}

.blog-modal-close:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

/* Modal Body */
.blog-modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

/* Modal Navigation */
.blog-modal-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.blog-modal-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.blog-modal-nav-btn:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.blog-modal-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Expanded Blog Content Styles
   ======================================== */

/* ELI5 Section */
.eli5-section {
    background: linear-gradient(135deg, rgba(255, 184, 0, 0.1) 0%, rgba(255, 107, 107, 0.1) 100%);
    border: 1px solid rgba(255, 184, 0, 0.3);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
}

.eli5-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.eli5-icon {
    font-size: 1.5rem;
}

.eli5-header h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #ffb800;
    margin: 0;
}

.eli5-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.eli5-content p {
    margin-bottom: 12px;
}

.eli5-content ul {
    list-style: none;
    padding-left: 0;
}

.eli5-content li {
    margin-bottom: 8px;
    padding-left: 8px;
}

/* Consequences Grid */
.consequences-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 24px 0;
}

.consequence-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.consequence-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 12px;
}

.consequence-item h5 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent-cyan);
    margin: 0 0 8px 0;
}

.consequence-item p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* Proof Steps */
.proof-step {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-magenta);
    padding: 16px 20px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.proof-step strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.proof-step p {
    margin: 8px 0;
    color: var(--text-secondary);
}

.proof-step ul,
.proof-step ol {
    margin: 8px 0;
    padding-left: 20px;
}

.proof-step li {
    margin-bottom: 4px;
}

/* Math Blocks */
.math-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
}

/* Comparison Boxes */
.comparison-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.comparison-item {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
}

.comparison-item h5 {
    font-family: var(--font-display);
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.comparison-item p {
    margin: 4px 0;
    font-size: 0.95rem;
}

.comparison-note {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    font-style: italic;
}

.comparison-divider {
    font-size: 2rem;
    color: var(--accent-cyan);
    font-weight: bold;
}

/* Problem Items */
.problem-item {
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.success-item {
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
}

/* Two Worlds */
.two-worlds {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 24px 0;
}

.world-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.world-item h5 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--accent-cyan);
    margin: 0 0 12px 0;
}

.world-item p {
    margin: 8px 0;
    color: var(--text-secondary);
}

.world-note {
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
}

/* Problem Visualization */
.problem-comparison,
.problem-visualization {
    margin: 24px 0;
}

.problem-comparison {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.problem-comparison .problem-item {
    background: var(--bg-card);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 12px;
    padding: 20px;
}

.problem-comparison .problem-item h5 {
    color: #ff6b6b;
    margin: 0 0 12px 0;
}

/* Visual Comparison */
.visual-comparison {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 24px 0;
}

.visual-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.visual-item h5 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    text-align: center;
}

.visual-desc {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.visual-icon {
    font-size: 2rem;
}

.visual-desc ul {
    list-style: none;
    padding: 0;
    text-align: left;
    width: 100%;
}

.visual-desc li {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.linear-viz {
    border-color: rgba(255, 107, 107, 0.3);
}

.yat-viz {
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
}

/* Physics Analogy */
.physics-analogy {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(0, 212, 255, 0.1) 100%);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
}

.physics-analogy h5 {
    color: var(--accent-magenta);
    margin: 0 0 12px 0;
}

/* Journey Summary */
.journey-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.journey-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 8px;
}

.journey-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bg-primary);
    flex-shrink: 0;
}

.journey-arrow {
    text-align: center;
    color: var(--accent-cyan);
    font-size: 1.2rem;
}

.journey-conclusion {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(138, 43, 226, 0.1) 100%);
    border-radius: 8px;
}

/* Corollary Section */
.corollary-section {
    margin: 24px 0;
}

.corollary-section>p {
    margin-top: 12px;
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
}

/* Responsive for expanded content */
@media (max-width: 768px) {

    .consequences-grid,
    .two-worlds,
    .problem-comparison,
    .visual-comparison,
    .comparison-box {
        grid-template-columns: 1fr;
    }

    .comparison-box {
        flex-direction: column;
    }

    .comparison-divider {
        transform: rotate(90deg);
    }
}

/* Hide original theorem posts when using modal */
.theorem-post {
    display: none;
}

/* Theory Navigation */
.theory-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 48px 0;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.theory-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.theory-nav-item:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.theory-nav-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bg-primary);
}

.theory-nav-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Theorem Posts */
.theorem-post {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 48px;
    margin-bottom: 48px;
    transition: border-color var(--transition-base);
}

.theorem-post:hover {
    border-color: var(--border-glow);
}

.theorem-header {
    margin-bottom: 32px;
}

.theorem-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bg-primary);
    margin-bottom: 16px;
}

.theorem-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Theorem Statement Box */
.theorem-statement {
    margin-bottom: 32px;
}

.theorem-box {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-left: 4px solid var(--accent-cyan);
    padding: 24px;
    border-radius: 0 12px 12px 0;
    font-size: 1.05rem;
    line-height: 1.8;
}

.theorem-box ol {
    margin: 16px 0 0 20px;
}

.theorem-box ol li {
    margin: 8px 0;
}

/* Theorem Content */
.theorem-content h4 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--accent-cyan);
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.theorem-content p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.theorem-list {
    margin: 16px 0 24px 24px;
}

.theorem-list li {
    margin: 12px 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Insight Box */
.insight-box {
    display: flex;
    gap: 16px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
}

.insight-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.insight-box strong {
    color: var(--accent-orange);
}

/* Benefits List */
.benefits-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
    list-style: none;
    padding: 0;
}

.benefits-list li {
    background: var(--bg-tertiary);
    padding: 16px 20px;
    border-radius: 10px;
    border-left: 3px solid var(--accent-green);
    color: var(--text-secondary);
    line-height: 1.6;
}

.benefits-list li strong {
    color: var(--accent-green);
}

/* Corollary Box */
.corollary-box {
    background: rgba(139, 92, 246, 0.1);
    border-left: 4px solid var(--accent-purple);
    padding: 20px;
    border-radius: 0 12px 12px 0;
    margin: 16px 0;
    font-size: 0.95rem;
}

/* Proof Sketch */
.proof-sketch {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.proof-sketch ol {
    margin: 16px 0 0 20px;
}

.proof-sketch li {
    margin: 12px 0;
    color: var(--text-secondary);
}

/* Dual Box for properties */
.dual-box {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 24px 0;
}

.property-mini {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.property-mini h5 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent-purple);
    margin-bottom: 12px;
}

.property-mini p {
    font-size: 0.9rem;
    margin: 0;
}

/* Connection Diagram for Info Theory */
.connection-diagram {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 32px 0;
}

.connection-item {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.connection-value {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

.connection-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin: 8px 0;
}

.connection-meaning {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Orthogonality Table */
.orthogonality-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.95rem;
}

.orthogonality-table th,
.orthogonality-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.orthogonality-table th {
    font-family: var(--font-display);
    color: var(--accent-cyan);
    font-weight: 600;
    background: var(--bg-tertiary);
}

.orthogonality-table td {
    color: var(--text-secondary);
}

/* Visual Comparison for Topology */
.visual-comparison {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin: 32px 0;
}

.visual-item {
    text-align: center;
}

.visual-diagram {
    height: 150px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.linear-diagram {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.2) 49%,
            var(--border-color) 49%, var(--border-color) 51%,
            rgba(59, 130, 246, 0.2) 51%, rgba(59, 130, 246, 0.2) 100%);
}

.half-space {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-secondary);
}

.boundary-line {
    width: 3px;
    height: 100%;
    background: var(--text-muted);
}

.yat-diagram {
    background: var(--bg-tertiary);
    position: relative;
}

.vortex {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    animation: pulse-vortex 2s ease-in-out infinite;
}

.vortex.v1 {
    top: 30%;
    left: 20%;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.6) 0%, rgba(239, 68, 68, 0.1) 70%);
    color: #ef4444;
    animation-delay: 0s;
}

.vortex.v2 {
    top: 50%;
    right: 20%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.6) 0%, rgba(59, 130, 246, 0.1) 70%);
    color: #3b82f6;
    animation-delay: 0.5s;
}

.vortex.v3 {
    bottom: 20%;
    left: 40%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.6) 0%, rgba(16, 185, 129, 0.1) 70%);
    color: #10b981;
    animation-delay: 1s;
}

@keyframes pulse-vortex {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Theorem Navigation Links */
.theorem-nav-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.theorem-nav-links a {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent-cyan);
    text-decoration: none;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.theorem-nav-links a:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

.nav-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Theory Summary */
.theory-summary {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 2px solid var(--accent-cyan);
    border-radius: 20px;
    padding: 48px;
    margin-top: 48px;
    text-align: center;
}

.theory-summary h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.theory-summary>p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.summary-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 32px 0;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
}

.summary-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--bg-primary);
    flex-shrink: 0;
}

.summary-text {
    color: var(--text-secondary);
    text-align: left;
}

.summary-text strong {
    color: var(--accent-cyan);
}

.summary-arrow {
    color: var(--accent-cyan);
    font-size: 1.2rem;
}

.summary-conclusion {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 32px;
    font-style: italic;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .intro-grid {
        grid-template-columns: 1fr;
    }

    .heatmap-grid,
    .gradient-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .arch-cards {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .dual-box {
        grid-template-columns: 1fr;
    }

    .connection-diagram {
        grid-template-columns: 1fr;
    }

    .visual-comparison {
        grid-template-columns: 1fr;
    }

    .theory-nav {
        gap: 4px;
    }

    .theory-nav-arrow {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 80px;
    }

    .nav-links a:not(.nav-github) {
        display: none;
    }

    .hero-stats {
        flex-direction: column;
        gap: 24px;
    }

    .heatmap-grid,
    .gradient-grid {
        grid-template-columns: 1fr;
    }

    .xor-demo-container,
    .boundary-demo-container,
    .loss-landscape-container {
        grid-template-columns: 1fr;
    }

    .equation-breakdown {
        flex-direction: column;
    }

    .breakdown-divider {
        display: none;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-copy {
        text-align: center;
    }

    /* Theory section mobile */
    .theorem-post {
        padding: 24px;
    }

    .theorem-title {
        font-size: 1.5rem;
    }

    .theorem-box {
        padding: 16px;
        font-size: 0.95rem;
    }

    .benefits-list {
        grid-template-columns: 1fr;
    }

    .theory-nav-item {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .theory-nav-item span:last-child {
        display: none;
    }

    .theorem-nav-links {
        flex-direction: column;
        text-align: center;
    }

    .summary-item {
        padding: 12px 16px;
    }

    .theory-summary {
        padding: 24px;
    }

    .orthogonality-table {
        font-size: 0.85rem;
    }

    .orthogonality-table th,
    .orthogonality-table td {
        padding: 10px 12px;
    }
}

/* ========================================
   KaTeX Overrides
   ======================================== */
.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 1em 0;
}

/* ========================================
   Topological Distortion Visualization
   ======================================== */
.manifold-controls {
    display: flex;
    gap: 32px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.manifold-control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.manifold-control-group label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.terminal-select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.terminal-select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.terminal-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 15px var(--secondary-glow);
}

.terminal-select option {
    background: var(--bg);
    color: var(--text-primary);
}

.manifold-demo-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin-bottom: 32px;
}

.manifold-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    position: relative;
}

/* Terminal corner decorations */
.manifold-panel::before,
.manifold-panel::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid var(--secondary);
    transition: var(--transition);
}

.manifold-panel::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.manifold-panel::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.manifold-panel:hover {
    border-color: var(--primary);
    box-shadow: 0 0 25px var(--primary-glow);
}

.manifold-panel:hover::before,
.manifold-panel:hover::after {
    border-color: var(--primary);
    width: 16px;
    height: 16px;
}

.manifold-panel h4 {
    font-family: 'Press Start 2P', var(--font-mono);
    font-size: 0.55rem;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary-glow);
    letter-spacing: 1px;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.manifold-3d-canvas {
    width: 100%;
    height: 280px;
    background: var(--bg);
    border: 1px solid var(--border-dim);
    margin-bottom: 12px;
}

.manifold-desc {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.manifold-insight {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.insight-box {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(249, 215, 28, 0.08);
    border: 1px solid var(--accent);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
}

.insight-box::before,
.insight-box::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--accent);
}

.insight-icon {
    font-size: 1.2rem;
}

.insight-text {
    max-width: 600px;
}

/* Responsive */
@media (max-width: 900px) {
    .manifold-demo-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .manifold-3d-canvas {
        height: 250px;
    }
}

/* ========================================
   Interactive Tooltips - Premium Card Style
   ======================================== */
.tooltip-term {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--primary);
    color: var(--primary);
    transition: var(--transition);
    font-weight: 500;
}

.tooltip-term:hover {
    color: var(--secondary);
    border-color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary-glow);
}

.tooltip-term::before,
.tooltip-term::after {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

/* Tooltip arrow */
.tooltip-term::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--primary);
    margin-bottom: -16px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Tooltip card container */
.tooltip-term::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;

    /* Card styling */
    padding: 16px 20px;
    min-width: 280px;
    max-width: 360px;

    /* Background with gradient */
    background: linear-gradient(145deg,
            rgba(10, 15, 12, 0.98) 0%,
            rgba(5, 10, 8, 0.98) 100%);

    /* Border and glow */
    border: 1px solid var(--primary);
    border-top: 2px solid var(--primary);

    /* Text */
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.7;
    text-align: left;
    white-space: normal;

    /* Effects */
    box-shadow:
        0 0 30px var(--primary-glow),
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(79, 249, 117, 0.1),
        inset 0 0 60px rgba(79, 249, 117, 0.02);

    /* Backdrop blur for modern browsers */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Corner decorations for tooltip card */
.tooltip-term[data-tooltip]::after {
    background-image:
        /* Top-left corner */
        linear-gradient(135deg, var(--primary) 4px, transparent 4px),
        linear-gradient(225deg, transparent 4px, transparent 4px),
        /* Top-right corner */
        linear-gradient(45deg, transparent 4px, transparent 4px),
        linear-gradient(-45deg, var(--primary) 4px, transparent 4px),
        /* Bottom corners */
        linear-gradient(-135deg, var(--primary) 4px, transparent 4px),
        linear-gradient(135deg, transparent 4px, transparent 4px),
        /* Background gradient */
        linear-gradient(145deg, rgba(10, 15, 12, 0.98) 0%, rgba(5, 10, 8, 0.98) 100%);
    background-position:
        0 0, 0 0,
        100% 0, 100% 0,
        100% 100%, 0 100%,
        0 0;
    background-size:
        12px 12px, 12px 12px,
        12px 12px, 12px 12px,
        12px 12px, 12px 12px,
        100% 100%;
    background-repeat: no-repeat;
}

/* Wide tooltips for longer explanations */
.tooltip-term.tooltip-wide::after {
    min-width: 320px;
    max-width: 400px;
}

/* Show on hover */
.tooltip-term:hover::before,
.tooltip-term:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Animation slide up */
.tooltip-term:hover::after {
    transform: translateX(-50%) translateY(-4px);
}

.tooltip-term:hover::before {
    transform: translateX(-50%) translateY(-4px);
}

/* Tooltip positioned below for overflow prevention */
.tooltip-term.tooltip-bottom::before {
    bottom: auto;
    top: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--primary);
    margin-top: -12px;
    margin-bottom: 0;
}

.tooltip-term.tooltip-bottom::after {
    bottom: auto;
    top: 100%;
    margin-top: 6px;
    margin-bottom: 0;
}

.tooltip-term.tooltip-bottom:hover::after,
.tooltip-term.tooltip-bottom:hover::before {
    transform: translateX(-50%) translateY(4px);
}

/* Color variants */
.tooltip-term.tooltip-cyan {
    border-color: var(--secondary);
    color: var(--secondary);
}

.tooltip-term.tooltip-cyan::before {
    border-top-color: var(--secondary);
}

.tooltip-term.tooltip-cyan::after {
    border-color: var(--secondary);
    box-shadow: 0 0 20px var(--secondary-glow);
}

.tooltip-term.tooltip-yellow {
    border-color: var(--accent);
    color: var(--accent);
}

.tooltip-term.tooltip-yellow::before {
    border-top-color: var(--accent);
}

.tooltip-term.tooltip-yellow::after {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(249, 215, 28, 0.3);
}

/* Responsive tooltips */
@media (max-width: 768px) {
    .tooltip-term::after {
        left: 0;
        transform: translateX(0);
        max-width: 220px;
    }

    .tooltip-term:hover::after {
        transform: translateX(0) translateY(-4px);
    }

    .tooltip-term::before {
        left: 20px;
    }
}

/* Mobile-friendly tables */
.results-table,
.impl-table table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {

    .results-grid,
    .impl-table {
        overflow-x: auto;
    }

    .results-table,
    .impl-table table {
        min-width: 600px;
    }

    .results-table th,
    .results-table td,
    .impl-table th,
    .impl-table td {
        white-space: nowrap;
        padding: 8px 12px;
    }
}