/* ================================
   LIMINAL SPIRIT WEBSITE V2
   Modern Cosmic Interface Design
   ================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Mono', monospace;
    background: var(--bg-deep-space);
    color: #ffffff;
    overflow-x: hidden;
    position: relative;
}

/* Vibrant animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(168, 85, 247, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(255, 0, 110, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse at 10% 80%, rgba(255, 0, 153, 0.3) 0%, transparent 45%),
        linear-gradient(135deg, #0a0e27 0%, #1a1042 50%, #2d1b69 100%);
    animation: vibrant-pulse 15s ease-in-out infinite;
}

@keyframes vibrant-pulse {
    0%, 100% {
        opacity: 0.8;
        filter: hue-rotate(0deg);
    }
    50% {
        opacity: 1;
        filter: hue-rotate(15deg);
    }
}

/* CSS Variables - VIBRANT COSMIC THEME */
:root {
    /* Background Colors - Deeper, more saturated */
    --bg-deep-space: #0a0e27;
    --bg-cosmic: #1a1042;
    --bg-nebula: #2d1b69;

    /* Accent Colors - Much more vibrant and saturated */
    --accent-cyan: #00d4ff;
    --accent-teal: #00fff2;
    --accent-magenta: #ff006e;
    --accent-purple: #a855f7;
    --accent-gold: #ffd700;
    --accent-pink: #ff0099;
    --accent-electric-blue: #00ffff;

    /* Glass Effects - More translucent with vibrant borders */
    --glass-bg: rgba(10, 14, 39, 0.4);
    --glass-border: rgba(0, 212, 255, 0.4);

    /* Glow Effects - Much stronger and more vibrant */
    --glow-cyan: rgba(0, 212, 255, 1);
    --glow-magenta: rgba(255, 0, 110, 0.8);
    --glow-purple: rgba(168, 85, 247, 0.9);
    --glow-white: rgba(255, 255, 255, 1);
    --glow-pink: rgba(255, 0, 153, 0.9);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.95);
    --text-accent: #00d4ff;
}

/* Cosmic Background Canvas */
#cosmic-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ================================
   NAVIGATION
   ================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(26, 31, 58, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(116, 185, 255, 0.1);
    padding: 1rem 0;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 0 10px var(--glow-cyan));
}

.logo-text {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px var(--glow-cyan);
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: rgba(116, 185, 255, 0.8);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-cyan);
    transition: width 0.3s ease;
}

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

.nav-link:hover::after {
    width: 100%;
}

.btn-cta {
    background: linear-gradient(135deg, #74b9ff, #81ecec);
    color: #0f0f1e;
    padding: 0.75rem 2rem;
    border-radius: 30px;
    border: none;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.5);
}

/* Hamburger Menu Button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: var(--accent-cyan);
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--glow-cyan);
}

.hamburger.active span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

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

.hamburger.active span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.nav-menu.mobile-active {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 100px 2rem 2rem;
    gap: 2rem;
    align-items: center;
    justify-content: flex-start;
    z-index: 999;
    animation: slide-in 0.3s ease-out;
}

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

.nav-menu.mobile-active .nav-link {
    font-size: 1.5rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px var(--glow-cyan);
}

/* Dropdown Menu Styles */
.nav-item.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 31, 58, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(116, 185, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    min-width: 220px;
    z-index: 1001;
    margin-top: 10px; /* Space between nav link and dropdown */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-item.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    visibility: visible;
}

.dropdown-content a {
    font-family: 'Roboto Mono', monospace;
    color: rgba(116, 185, 255, 0.8);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    text-align: left;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.dropdown-content a:hover {
    background: rgba(116, 185, 255, 0.1);
    color: var(--accent-cyan);
}

/* ================================
   HERO SECTION
   ================================ */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 120px 2rem 4rem;
    overflow: hidden;
}

/* Vibrant cosmic background overlay */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../images/vibrant-cosmic-background.png') center center / cover no-repeat;
    opacity: 0.3;
    z-index: 0;
    mix-blend-mode: screen;
    pointer-events: none;
}

/* Aurora Light Beams */
.aurora-beams {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.aurora-beam {
    position: absolute;
    width: 4px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--glow-cyan) 20%,
        var(--glow-purple) 50%,
        var(--glow-magenta) 80%,
        transparent 100%
    );
    filter: blur(50px);
    animation: auroraShift 8s ease-in-out infinite;
    opacity: 0.8;
}

.aurora-beam:nth-child(2) {
    animation-delay: 1s;
    animation-duration: 10s;
}

.aurora-beam:nth-child(3) {
    animation-delay: 2s;
    animation-duration: 12s;
}

.aurora-beam:nth-child(4) {
    animation-delay: 3s;
    animation-duration: 9s;
}

.aurora-beam:nth-child(5) {
    animation-delay: 4s;
    animation-duration: 11s;
}

@keyframes auroraShift {
    0%, 100% {
        transform: translateY(0) scaleY(1);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-50px) scaleY(1.1);
        opacity: 0.8;
    }
}

.hero-content {
    text-align: center;
    z-index: 10;
    max-width: 1200px;
}

.hero-headline {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #ffffff;
    text-shadow:
        0 0 40px var(--glow-cyan),
        0 0 80px var(--glow-purple),
        0 0 120px var(--glow-magenta);
    margin-bottom: 1.5rem;
    animation: heroFadeIn 1.5s ease-out, vibrantPulse 3s ease-in-out infinite;
}

@keyframes vibrantPulse {
    0%, 100% {
        text-shadow:
            0 0 40px var(--glow-cyan),
            0 0 80px var(--glow-purple),
            0 0 120px var(--glow-magenta);
    }
    50% {
        text-shadow:
            0 0 60px var(--glow-cyan),
            0 0 100px var(--glow-purple),
            0 0 140px var(--glow-pink);
    }
}

.hero-subheadline {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    font-weight: 400;
    letter-spacing: 0.2em;
    color: rgba(116, 185, 255, 0.9);
    text-transform: uppercase;
    animation: heroFadeIn 1.5s ease-out 0.3s both;
}

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

.hero-cta {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 3rem;
    animation: heroFadeIn 1.5s ease-out 0.6s both;
}

.btn-primary,
.btn-secondary {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem 2.5rem;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
    color: #0a0e27;
    box-shadow:
        0 4px 20px var(--glow-cyan),
        0 0 30px var(--glow-cyan);
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow:
        0 6px 30px var(--glow-cyan),
        0 0 50px var(--glow-cyan);
}

.btn-secondary {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    border: 2px solid var(--accent-purple);
}

.btn-secondary:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: var(--accent-purple);
    box-shadow: 0 0 30px var(--glow-purple);
    transform: translateY(-3px);
}

/* ================================
   FEATURE CARDS SECTION
   ================================ */

.features {
    padding: 6rem 2rem;
    position: relative;
}

.features-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
}

.feature-card {
    position: relative;
    padding: 3rem;
    border-radius: 20px;
    overflow: hidden;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-glass {
    position: absolute;
    inset: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 2px solid var(--glass-border);
    box-shadow:
        0 0 20px var(--glass-border),
        inset 0 0 40px rgba(0, 212, 255, 0.1);
    z-index: 0;
    border-radius: 20px;
}

/* Old brain card styles removed - replaced with enhanced interactive brain visualization */

/* ================================
   QUOTE SECTION
   ================================ */

.quote-section {
    background: linear-gradient(
        135deg,
        rgba(15, 15, 30, 1) 0%,
        rgba(26, 31, 58, 1) 50%,
        rgba(15, 31, 46, 1) 100%
    );
    padding: 8rem 2rem;
    position: relative;
    overflow: hidden;
}

.quote-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.sacred-geometry {
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#geometry-canvas {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 0 60px rgba(116, 185, 255, 0.6))
            drop-shadow(0 0 100px rgba(233, 30, 99, 0.3));
    touch-action: none; /* Enable pinch-to-zoom and prevent default touch behaviors */
    cursor: grab;
}

.tesla-quote {
    position: relative;
}

.quote-attribution {
    position: relative;
    margin-bottom: 2rem;
}

.quote-author {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: #74b9ff;
    letter-spacing: 0.1em;
    text-shadow: 0 0 30px rgba(116, 185, 255, 0.6);
}

.quote-icon {
    font-size: 8rem;
    color: rgba(116, 185, 255, 0.2);
    position: absolute;
    top: -4rem;
    left: -3rem;
    font-family: Georgia, serif;
    line-height: 1;
}

.quote-text {
    font-family: 'Space Mono', monospace;
    font-size: 1.2rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    font-style: italic;
    text-shadow: 0 0 10px rgba(116, 185, 255, 0.2);
}

/* ================================
   FOOTER
   ================================ */

.footer {
    background: rgba(15, 15, 30, 0.95);
    border-top: 1px solid rgba(116, 185, 255, 0.1);
    padding: 3rem 2rem;
    text-align: center;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}

.footer p {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.disclaimer {
    font-size: 0.8rem;
    opacity: 0.5;
}

/* ================================
   SECTION CONTAINERS
   ================================ */

.section-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    color: #ffffff;
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(116, 185, 255, 0.5);
}

.section-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ================================
   PHILOSOPHY SECTION
   ================================ */

.philosophy-section {
    padding: 6rem 2rem;
    position: relative;
}

.philosophy-card {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 4rem 3rem;
    border-radius: 20px;
    overflow: hidden;
}

.philosophy-content {
    position: relative;
    z-index: 1;
}

.definition {
    margin-bottom: 2.5rem;
    text-align: center;
}

.definition-word {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: #74b9ff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(116, 185, 255, 0.6);
}

.definition-pronunciation {
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    margin-bottom: 1rem;
}

.definition-meaning {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    font-style: italic;
}

.philosophy-text {
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 1.5rem;
    text-align: center;
}

.philosophy-text strong {
    color: #74b9ff;
    text-shadow: 0 0 10px rgba(116, 185, 255, 0.4);
}

.intent-warning {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(233, 30, 99, 0.1);
    border: 1px solid rgba(233, 30, 99, 0.3);
    border-radius: 12px;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

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

.intent-warning p {
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ================================
   TRAINING SECTION
   ================================ */

.training-section {
    padding: 6rem 2rem;
    position: relative;
}

.training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

.training-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    min-height: 300px;
    transition: all 0.3s ease;
}

.training-card:hover {
    transform: translateY(-5px);
}

/* Expandable card styles for mobile */
.expandable-card {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.expandable-card.expanded {
    min-height: auto;
    transform: scale(1.02);
}

.expand-indicator {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    color: var(--accent-cyan);
    transition: transform 0.3s ease;
}

.expanded .expand-indicator {
    transform: rotate(180deg);
}

.expandable-card:active {
    transform: scale(0.98);
}

.training-content {
    position: relative;
    z-index: 1;
    padding: 3rem 2.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.training-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 20px rgba(116, 185, 255, 0.6));
}

.training-title {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    color: #74b9ff;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 15px rgba(116, 185, 255, 0.5);
}

.training-description {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
}

/* ================================
   SCIENCE SECTION
   ================================ */

.science-section {
    padding: 6rem 2rem;
    background: linear-gradient(
        135deg,
        rgba(15, 15, 30, 0.8) 0%,
        rgba(26, 31, 58, 0.8) 100%
    );
}

.science-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

.science-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    min-height: 280px;
    transition: transform 0.3s ease;
}

.science-card:hover {
    transform: translateY(-5px);
}

.science-content {
    position: relative;
    z-index: 1;
    padding: 3rem 2.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.science-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(116, 185, 255, 0.5));
}

.science-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: #74b9ff;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 12px rgba(116, 185, 255, 0.4);
}

.science-description {
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.8);
}

/* ================================
   VISUALIZATION SECTION
   ================================ */

/* ================================
   BRAIN VISUALIZATION SECTION - ENHANCED
   ================================ */

.visualization-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1042 50%, #2d1b69 100%);
    overflow: hidden;
}

#viz-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.5) 90%);
}

#viz-container canvas {
    cursor: crosshair;
    touch-action: none; /* Prevent default touch behaviors */
}

#controls {
    width: 370px;
    padding: 2.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-left: 2px solid var(--glass-border);
    box-shadow:
        -5px 0 30px rgba(0, 0, 0, 0.5),
        inset 0 0 40px rgba(0, 212, 255, 0.05);
    z-index: 10;
    overflow-y: auto;
}

#controls h2 {
    margin: 0 0 0.5rem 0;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--accent-cyan);
    text-shadow: 0 0 20px var(--glow-cyan);
    font-size: 1.5rem;
}

.controls-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 1.5rem 0;
    line-height: 1.4;
}

#buttons-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.topic-btn {
    padding: 1rem 1.25rem;
    background: rgba(40, 40, 60, 0.4);
    border: 1px solid rgba(100, 100, 150, 0.3);
    border-left: 3px solid rgba(100, 100, 150, 0.5);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
}

.topic-btn:hover {
    background: rgba(60, 60, 90, 0.6);
    color: #ffffff;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
    transform: translateX(5px);
}

.topic-btn.active {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--accent-cyan);
    border-left-color: var(--accent-cyan);
    box-shadow:
        0 0 20px var(--glow-cyan),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
    color: #ffffff;
}

.btn-label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.3rem;
    font-size: 1.05rem;
    color: var(--accent-cyan);
}

.btn-desc {
    font-size: 0.85rem;
    opacity: 0.7;
    line-height: 1.4;
}

/* Scrollbar styling for controls */
#controls::-webkit-scrollbar {
    width: 8px;
}

#controls::-webkit-scrollbar-track {
    background: rgba(10, 10, 20, 0.5);
}

#controls::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
    border-radius: 4px;
}

#controls::-webkit-scrollbar-thumb:hover {
    background: var(--accent-teal);
}

/* Brain Info Overlay */
#brain-info-overlay {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    text-align: center;
    pointer-events: none; /* Let clicks pass through to canvas */
    z-index: 20;

    /* Typography */
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    line-height: 1.5;

    /* Glowing Blue Effect */
    color: var(--accent-cyan);
    text-shadow:
        0 0 10px var(--glow-cyan),
        0 0 20px rgba(0, 212, 255, 0.4);

    /* Transition for smooth appearance */
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: translate(-50%, 10px); /* Start slightly lower */
}

/* Active State */
#brain-info-overlay.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Mobile Adjustment */
@media (max-width: 768px) {
    #brain-info-overlay {
        bottom: 20px;
        font-size: 0.9rem;
        width: 90%;
    }
}

/* ================================
   DEMO SECTION
   iPhone 16 Dimensions: 430 x 932 pts (2.17:1 aspect ratio)
   ================================ */

.demo-section {
    padding: 6rem 2rem;
    background: linear-gradient(
        135deg,
        rgba(15, 15, 30, 0.9) 0%,
        rgba(26, 31, 58, 0.9) 100%
    );
}

.demo-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
}

.demo-content {
    position: relative;
    z-index: 1;
    padding: 3rem;
}

.demo-frame {
    position: relative;
    max-width: 430px;
    width: 100%;
    height: 932px;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(15, 15, 30, 0.9);
    margin: 0 auto 2rem;
    box-shadow:
        0 20px 60px rgba(0, 212, 255, 0.5),
        0 0 40px rgba(0, 212, 255, 0.4),
        0 0 80px rgba(168, 85, 247, 0.3),
        0 0 120px rgba(255, 0, 110, 0.2);
    animation: demo-glow-pulse 4s ease-in-out infinite;
}

/* Enhanced mystical glow aura */
.demo-frame::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        135deg,
        rgba(0, 212, 255, 0.4) 0%,
        rgba(168, 85, 247, 0.4) 50%,
        rgba(255, 0, 110, 0.4) 100%
    );
    border-radius: 20px;
    z-index: -1;
    filter: blur(15px);
    opacity: 0.6;
    animation: demo-aura-rotate 8s linear infinite;
}

@keyframes demo-aura-rotate {
    0% {
        filter: blur(15px) hue-rotate(0deg);
        opacity: 0.6;
    }
    50% {
        filter: blur(20px) hue-rotate(30deg);
        opacity: 0.8;
    }
    100% {
        filter: blur(15px) hue-rotate(0deg);
        opacity: 0.6;
    }
}

@keyframes demo-glow-pulse {
    0%, 100% {
        box-shadow:
            0 20px 60px rgba(0, 212, 255, 0.5),
            0 0 40px rgba(0, 212, 255, 0.4),
            0 0 80px rgba(168, 85, 247, 0.3),
            0 0 120px rgba(255, 0, 110, 0.2);
    }
    50% {
        box-shadow:
            0 25px 70px rgba(0, 212, 255, 0.6),
            0 0 50px rgba(0, 255, 255, 0.5),
            0 0 100px rgba(168, 85, 247, 0.4),
            0 0 150px rgba(255, 0, 110, 0.25);
    }
}

.app-iframe {
    position: relative;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
}

.demo-note {
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.demo-note strong {
    color: #74b9ff;
}

/* ================================
   QUOTES SECTION
   ================================ */

/* ================================
   QUOTES SECTION - ROTATING CAROUSEL
   ================================ */

.quotes-section {
    padding: 4rem 2rem;
    position: relative;
}

/* Centered Carousel Container */
.quote-carousel {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.quote-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    padding: 2rem 2rem;
    width: 100%;
}

.featured-quote {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: 350px;
}

.quote-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quote-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.quote-author {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 2rem;
    letter-spacing: 0.15em;
    text-shadow:
        0 0 30px var(--glow-cyan),
        0 0 50px var(--glow-cyan),
        0 0 70px rgba(0, 212, 255, 0.5);
    text-align: center;
    transition: opacity 0.5s ease;
}

.quote-text {
    font-family: 'Baskerville', 'Libre Baskerville', 'Baskerville Old Face', Georgia, serif;
    font-size: 2rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.95);
    font-style: italic;
    text-align: center;
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.8),
        0 0 40px var(--glow-purple),
        0 0 60px var(--glow-magenta),
        0 0 80px rgba(168, 85, 247, 0.4);
    transition: opacity 0.5s ease;
}

/* Fade animation for quote transitions */
.quote-content.fade-out .quote-author,
.quote-content.fade-out .quote-text {
    opacity: 0;
}

.quote-content.fade-in .quote-author,
.quote-content.fade-in .quote-text {
    opacity: 1;
}

/* ================================
   DOWNLOAD SECTION
   ================================ */

.download-section {
    padding: 6rem 2rem;
    background: linear-gradient(
        135deg,
        rgba(15, 15, 30, 1) 0%,
        rgba(26, 31, 58, 1) 50%,
        rgba(15, 31, 46, 1) 100%
    );
}

.download-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
}

.download-content {
    position: relative;
    z-index: 1;
    padding: 4rem 3rem;
    text-align: center;
}

.download-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 2.5rem;
    border-radius: 30px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.ios-btn {
    background: linear-gradient(135deg, #74b9ff, #81ecec);
    color: #0f0f1e;
    box-shadow: 0 4px 20px rgba(116, 185, 255, 0.4);
}

.ios-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(116, 185, 255, 0.6);
}

.android-btn {
    background: rgba(116, 185, 255, 0.15);
    color: #74b9ff;
    border: 2px solid rgba(116, 185, 255, 0.4);
}

.android-btn:hover {
    background: rgba(116, 185, 255, 0.25);
    border-color: rgba(116, 185, 255, 0.6);
    transform: translateY(-3px);
}

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

.download-note {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.beta-link {
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    color: #74b9ff;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.beta-link:hover {
    color: #81ecec;
    transform: translateX(5px);
}

/* ================================
   MUSIC TOGGLE BUTTON
   ================================ */

.music-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.7) 0%, rgba(168, 85, 247, 0.7) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 20px rgba(0, 212, 255, 0.4),
        0 0 40px rgba(0, 212, 255, 0.2);
    z-index: 9999;
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
}

.music-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow:
        0 6px 30px rgba(0, 212, 255, 0.6),
        0 0 60px rgba(0, 212, 255, 0.4);
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.85) 0%, rgba(168, 85, 247, 0.85) 100%);
}

.music-toggle:active {
    transform: scale(0.95);
}

/* Muted state */
.music-toggle.muted {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.4) 0%, rgba(168, 85, 247, 0.4) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.15);
}

.music-toggle.muted:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.6) 0%, rgba(168, 85, 247, 0.6) 100%);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.25);
}

/* Icon visibility */
.music-toggle .music-icon,
.music-toggle .music-icon-muted {
    transition: opacity 0.2s ease;
}

.music-toggle.muted .music-icon {
    display: none;
}

.music-toggle.muted .music-icon-muted {
    display: block !important;
}

/* Pulsing animation when music is playing */
@keyframes music-pulse {
    0%, 100% {
        box-shadow:
            0 4px 20px rgba(0, 212, 255, 0.4),
            0 0 40px rgba(0, 212, 255, 0.2);
        background: linear-gradient(135deg, rgba(0, 212, 255, 0.7) 0%, rgba(168, 85, 247, 0.7) 100%);
    }
    50% {
        box-shadow:
            0 6px 30px rgba(0, 212, 255, 0.6),
            0 0 60px rgba(0, 255, 255, 0.4);
        background: linear-gradient(135deg, rgba(0, 255, 255, 0.8) 0%, rgba(188, 105, 255, 0.8) 100%);
    }
}

.music-toggle.playing {
    animation: music-pulse 2s ease-in-out infinite;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 1024px) {
    .features-container {
        grid-template-columns: 1fr;
    }

    .training-grid,
    .science-grid {
        grid-template-columns: 1fr;
    }

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

    .featured-quote {
        grid-column: span 1;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .quote-visual {
        order: -1;
    }
}

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

    .hamburger {
        display: flex;
    }

    .btn-cta {
        display: none;
    }

    .navbar-container {
        padding: 0 1rem;
    }

    .hero {
        padding: 100px 1rem 3rem;
    }

    .hero-headline {
        font-size: 2.5rem;
        letter-spacing: 0.1em;
    }

    .hero-subheadline {
        font-size: 0.8rem;
        letter-spacing: 0.15em;
    }

    .hero-cta {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }

    .section-container {
        padding: 0 1rem;
    }

    .philosophy-section,
    .training-section,
    .science-section,
    .demo-section,
    .quotes-section,
    .download-section {
        padding: 4rem 1rem;
    }

    /* Enhanced Brain Visualization - Mobile Layout */
    .visualization-section {
        flex-direction: column;
        min-height: 100vh;
        padding: 4rem 0 2rem;
    }

    #viz-container {
        width: 100%;
        height: 70vh;
        min-height: 500px;
        flex-shrink: 0;
    }

    #brain-canvas {
        width: 100% !important;
        height: 100% !important;
    }

    #controls {
        width: 100%;
        padding: 2rem 1.5rem;
        border-left: none;
        border-top: 2px solid var(--glass-border);
        max-height: none;
        overflow-y: auto;
    }

    #controls h2 {
        font-size: 1.2rem;
    }

    .controls-subtitle {
        font-size: 0.75rem;
        margin-bottom: 1rem;
    }

    .topic-btn {
        padding: 0.85rem 1rem;
    }

    .btn-label {
        font-size: 0.95rem;
    }

    .btn-desc {
        font-size: 0.8rem;
    }

    .philosophy-card {
        padding: 2.5rem 2rem;
    }

    .definition-word {
        font-size: 2rem;
    }

    .philosophy-text {
        font-size: 1rem;
    }

    .training-grid,
    .science-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .training-card,
    .science-card {
        min-height: 250px;
    }

    /* Compact expandable cards on mobile */
    .expandable-card {
        min-height: 200px;
    }

    .expandable-card .expand-indicator {
        display: flex;
    }

    /* Hide expand indicator on desktop */
    @media (min-width: 769px) {
        .expand-indicator {
            display: none !important;
        }
    }

    .training-icon,
    .science-icon {
        font-size: 3rem;
    }

    .training-title,
    .science-title {
        font-size: 1.3rem;
    }

    .features {
        padding: 3rem 1rem;
    }

    .features-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .feature-card {
        padding: 2rem;
        min-height: 400px;
    }

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

    .ability-item {
        font-size: 1rem;
    }

    /* Quote Carousel - Mobile */
    .featured-quote {
        grid-template-columns: 1fr;
        gap: 2rem;
        min-height: auto;
        padding: 2rem 1.5rem;
    }

    .quote-visual {
        order: -1;
    }

    #geometry-canvas {
        width: 320px !important;
        height: 320px !important;
    }

    .quote-author {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    .quote-text {
        font-size: 1.5rem;
        line-height: 1.6;
    }

    .demo-frame {
        max-width: 100%;
        height: 800px;
    }

    /* Reduce glow intensity on mobile for performance */
    .demo-frame::before {
        filter: blur(10px);
    }

    @keyframes demo-glow-pulse {
        0%, 100% {
            box-shadow:
                0 15px 40px rgba(0, 212, 255, 0.4),
                0 0 30px rgba(0, 212, 255, 0.3),
                0 0 60px rgba(168, 85, 247, 0.2);
        }
        50% {
            box-shadow:
                0 20px 50px rgba(0, 212, 255, 0.5),
                0 0 40px rgba(0, 255, 255, 0.4),
                0 0 80px rgba(168, 85, 247, 0.3);
        }
    }

    .demo-content {
        padding: 2rem 1.5rem;
    }

    .quotes-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .quote-card {
        padding: 2rem 1.5rem;
        min-height: 200px;
    }

    .quote-author {
        font-size: 1.3rem;
    }

    .quote-text {
        font-size: 1rem;
    }

    .download-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .download-btn {
        width: 100%;
        max-width: 300px;
    }

    /* Reduce blur effects on mobile for performance */
    .card-glass {
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }

    .navbar {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* Music toggle - mobile */
    .music-toggle {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }

    .music-toggle svg {
        width: 20px;
        height: 20px;
    }
}

/* ================================
   VIBRANT ENHANCEMENTS
   ================================ */

/* Vibrant animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(168, 85, 247, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(255, 0, 110, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse at 10% 80%, rgba(255, 0, 153, 0.3) 0%, transparent 45%),
        linear-gradient(135deg, #0a0e27 0%, #1a1042 50%, #2d1b69 100%);
    animation: vibrant-pulse 15s ease-in-out infinite;
}

/* =========================================
   SCIENTIFIC RIGOR - GLASS MONOLITHS
   ========================================= */

.rigor-section {
    padding: 8rem 2rem;
    position: relative;
    background: radial-gradient(circle at 50% 0%, #1a1042 0%, #0a0e27 70%);
    overflow: hidden;
}

.rigor-header {
    text-align: center;
    margin-bottom: 6rem;
    position: relative;
    z-index: 2;
}

.rigor-header .section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
}

.rigor-header .accent-text {
    color: var(--accent-cyan);
    font-weight: 300;
    padding: 0 0.5rem;
}

/* THE MONOLITH GRID */
.monolith-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* THE CARD CONTAINER */
.monolith-card {
    position: relative;
    height: 100%;
    min-height: 450px;
    background: rgba(10, 14, 39, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 3rem 2.5rem;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    /* Corner clip effect using clip-path for a tech feel */
    clip-path: polygon(
        0 0,
        100% 0,
        100% calc(100% - 20px),
        calc(100% - 20px) 100%,
        0 100%
    );
}

/* Hover Effects */
.monolith-card:hover {
    transform: translateY(-10px);
    background: linear-gradient(
        180deg,
        rgba(10, 14, 39, 0.7) 0%,
        rgba(var(--card-color), 0.1) 100%
    );
    border-left: 1px solid rgb(var(--card-color));
}

/* Ambient colored glow behind the card */
.monolith-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgb(var(--card-color));
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.monolith-card:hover::before {
    opacity: 1;
    box-shadow: 0 0 30px rgb(var(--card-color));
}

/* INNER CONTENT */
.monolith-inner {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Large Index Number (01, 02) */
.monolith-index {
    font-family: 'Space Mono', monospace;
    font-size: 5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.03);
    position: absolute;
    top: -30px;
    right: -20px;
    line-height: 1;
    pointer-events: none;
    transition: all 0.4s ease;
}

.monolith-card:hover .monolith-index {
    color: rgba(255, 255, 255, 0.08);
    transform: translateX(-10px);
}

.monolith-icon {
    color: rgb(var(--card-color));
    margin-bottom: 2rem;
    /* Glow effect for icon */
    filter: drop-shadow(0 0 10px rgb(var(--card-color)));
}

.monolith-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.monolith-desc {
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    margin-top: auto; /* Pushes description to bottom if needed */
}

/* SCAN LINE ANIMATION */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(var(--card-color), 0.1),
        transparent
    );
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
}

.monolith-card:hover .scan-line {
    animation: scan 2s linear infinite;
    opacity: 1;
}

@keyframes scan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Responsive */
@media (max-width: 768px) {
    .rigor-section {
        padding: 4rem 1rem;
    }

    .rigor-header {
        margin-bottom: 4rem;
    }

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

    .monolith-card {
        min-height: auto;
    }

    .monolith-index {
        font-size: 4rem;
        top: -20px;
        right: -10px;
    }

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

    .monolith-desc {
        font-size: 0.9rem;
    }
}
