/* --- Global Reset & Variables --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-muted: #8b949e;
    --accent-blue: #58a6ff;
    --accent-glow: #1f6feb;
    --white: #ffffff;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Header / Navigation --- */
.site-header {
    background-color: rgba(13, 17, 23, 0.95);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 0;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--accent-blue);
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.main-nav a:hover, 
.main-nav a.active {
    color: var(--accent-blue);
}

/* --- Hero Section --- */
.hero-section {
    padding: 8rem 0 6rem 0;
    text-align: center;
    background: radial-gradient(circle at top, rgba(31, 111, 235, 0.15) 0%, transparent 60%);
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--white);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto 2.5rem auto;
}

.hero-cta-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-glow);
    color: var(--white);
    border: 1px solid var(--accent-glow);
}

.btn-primary:hover {
    background-color: #238636; /* Accent dynamic shift */
    border-color: #238636;
}

.btn-secondary {
    background-color: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(48, 54, 61, 0.5);
    border-color: var(--text-muted);
}

/* --- Segmented Track Blocks --- */
.tracks-section {
    padding: 4rem 0 6rem 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 3rem;
}

.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.track-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.track-card:hover {
    transform: translateY(-4px);
    border-color: var(--text-muted);
}

.track-card.Highlighted {
    border-color: rgba(88, 166, 255, 0.4);
    box-shadow: 0 4px 20px rgba(31, 111, 235, 0.1);
}

.track-icon {
    font-size: 2rem;
    margin-bottom: 1.2rem;
}

.track-card h3 {
    font-size: 1.35rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.track-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.track-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.track-link:hover {
    text-decoration: underline;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sub-footer {
    margin-top: 0.5rem;
    font-family: "Courier New", Courier, monospace;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    .hero-content h1 {
        font-size: 2.2rem;
    }
    .hero-cta-group {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}
/* ==========================================================================
   Responsive Breakpoints & Layout Optimization
   ========================================================================== */

/* --- Tablet / Medium Screen Optimization (Under 992px) --- */
@media (max-width: 992px) {
    .container {
        width: 92%; /* Slightly wider padding for smaller screens */
    }

    .hero-section {
        padding: 6rem 0 4rem 0;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .tracks-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* --- Mobile Viewport / Smartphone Optimization (Under 768px) --- */
@media (max-width: 768px) {
    /* Global Elements */
    body {
        font-size: 0.95rem; /* Slight scale down for compact reading */
    }

    /* Navigation Menu */
    .navbar {
        flex-direction: column;
        gap: 1.2rem;
        text-align: center;
        padding: 1.5rem 0;
    }

    .main-nav ul {
        gap: 1.2rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-nav a {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }

    /* Hero Section Component */
    .hero-section {
        padding: 4.5rem 0 3.5rem 0;
    }

    .hero-content h1 {
        font-size: 2rem;
        letter-spacing: -0.5px;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 1.05rem;
        margin-bottom: 2rem;
    }

    .hero-cta-group {
        flex-direction: column;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        gap: 0.8rem;
    }

    .btn {
        width: 100%;
        text-align: center;
        padding: 0.9rem;
    }

    /* Track Layout Fixes */
    .tracks-section {
        padding: 2.5rem 0 4rem 0;
    }

    .section-title {
        font-size: 1.6rem;
        margin-bottom: 2rem;
    }

    .track-card {
        padding: 1.8rem;
    }

    /* Bookshelf Loop Rows & Alignments */
    .book-showcase-row {
        flex-direction: column !important; /* Forces vertical stack on mobile */
        gap: 1.8rem !important;
        padding: 1.5rem !important;
        margin-bottom: 3.5rem !important;
    }

    .book-cover-placeholder {
        min-height: 320px !important;
        width: 100%;
    }

    .book-details h2 {
        font-size: 1.6rem !important;
    }

    /* Video Curation Grid Fixes */
    .video-grid {
        grid-template-columns: 1fr !important; /* Lock to single column display */
        gap: 2rem !important;
    }

    .video-card {
        max-width: 100%;
    }

    /* Pricing Layout & Registration Form */
    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        margin-bottom: 3.5rem !important;
    }

    #register-form {
        padding: 1.8rem !important;
    }

    #register-form form {
        gap: 1.2rem;
    }

    #register-form div style {
        grid-template-columns: 1fr !important; /* Splits first/last name grid */
    }

    /* Specialized MathJax / LaTeX Security Containment */
    .MathJax_Display, .MathJax, mjx-container {
        max-width: 100% !important;
        overflow-x: auto !important; /* Creates smooth horizontal scroll instead of breaking elements */
        overflow-y: hidden !important;
        padding: 0.5rem 0;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- Ultra-Small Displays / Older Phones (Under 400px) --- */
@media (max-width: 400px) {
    .hero-content h1 {
        font-size: 1.75rem;
    }
    
    #register-form div style {
        display: flex !important;
        flex-direction: column;
    }
}

/* Navigation Structural Blueprint */
.site-header {
    background-color: #11111b;
    border-bottom: 1px solid #313244;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 2rem;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.site-logo a {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: bold;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
    margin-left: 2rem;
}

.nav-link {
    color: #cdd6f4;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link:hover, .nav-link:focus {
    color: #89b4fa; /* Soft accent blue for focus states */
}

/* Dropdown Menu Engine */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #1e1e2e;
    border: 1px solid #313244;
    border-radius: 6px;
    padding: 0.5rem 0;
    min-width: 240px;
    list-style: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.2rem;
    color: #cdd6f4;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.dropdown-menu a:hover {
    background-color: #313244;
    color: #ffffff;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

/* Premium Primary Call-To-Action Button */
.nav-btn {
    display: inline-block;
    background-color: #f38ba8;
    color: #11111b;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.nav-btn:hover {
    background-color: #f5e0dc;
}

/* Science Behind Things - Article Theme Overrides */

/* Core Theme Box Setup */
body {
    background-color: #11111b !important;
    color: #cdd6f4 !important;
}

/* Post Container Adjustments */
.post-content h1, .post-content h2, .post-content h3 {
    color: #ffffff !important;
    font-weight: 700;
    margin-top: 2rem;
}

/* Ensure Embedded Manim MathTex Formulas Are Highly Visible */
.post-content .math, 
.post-content MathJax,
.post-content .katex {
    color: #a6e3a1 !important; /* Vivid accent for mathematical symbols */
    font-size: 1.05em;
    overflow-x: auto;
    white-space: nowrap;
}

/* Responsive Container for Manim Video Iframe */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000000;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    border: 1px solid #313244;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Premium Course Conversion Box */
.funnel-cta-box {
    background-color: #1e1e2e !important;
    border-left: 4px solid #f38ba8 !important;
    padding: 2rem;
    margin-top: 3.5rem;
    margin-bottom: 2rem;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.funnel-cta-box h3 {
    color: #f38ba8 !important;
    margin-top: 0 !important;
    font-size: 1.4rem;
}

.funnel-cta-box p {
    color: #cdd6f4 !important;
    font-size: 1.05rem;
    line-height: 1.6;
}

.funnel-cta-box a {
    display: inline-block;
    background-color: #f38ba8 !important;
    color: #11111b !important;
    padding: 0.75rem 1.75rem;
    text-decoration: none !important;
    font-weight: bold;
    border-radius: 4px;
    margin-top: 0.75rem;
    transition: background-color 0.2s ease-in-out;
}

.funnel-cta-box a:hover {
    background-color: #f5e0dc !important; /* Smooth contrast change on hover */
}