:root {
    --bg-color: #05050a;
    --text-color: #e0e0e0;
    --accent-blue: #00f3ff;
    --accent-gold: #ffd700;
    --accent-earth: #ff8c00;
    --glass: rgba(255, 255, 255, 0.05);
    --border-blue: rgba(0, 243, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    /* DISABLE NATIVE SCROLL */
    line-height: 1.6;
    height: 100vh;
    width: 100vw;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: #000;
}

/* VIRTUAL SCROLL CONTAINER */
#scroll-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform;
    /* Optimize for GPU */
}

/* --- HUD & OVERLAYS --- */
.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 100;
}

.hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 101;
    font-family: 'Share Tech Mono', monospace;
    color: var(--accent-blue);
    font-size: 12px;
    padding: 20px;
    opacity: 0.7;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
}

.hud-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
}

.hud-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

.hud-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

/* --- HERO SECTION --- */
.hero-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background: radial-gradient(circle at center, #1a1a2e 0%, #05050a 70%);
}

.glitch-text {
    font-family: 'Audiowide', cursive;
    font-size: 4rem;
    color: var(--accent-blue);
    text-shadow: 0 0 10px var(--accent-blue);
    position: relative;
    animation: glitch 2s infinite;
}

.subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.2rem;
    margin-top: 10px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.8);
}

.status-box {
    margin-top: 30px;
    border: 1px solid var(--accent-blue);
    padding: 10px 20px;
    font-family: 'Share Tech Mono', monospace;
    color: var(--accent-blue);
    background: rgba(0, 243, 255, 0.1);
}

.pulse {
    animation: blink 1s infinite;
}

.hero-scroll-indicator {
    position: absolute;
    bottom: 50px;
    font-family: 'Share Tech Mono', monospace;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    animation: bounce 2s infinite;
}

/* --- STORY SECTIONS --- */
.story-section {
    min-height: 100vh;
    /* Keep full height spacing */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10%;
    /* More breathing room */
    position: relative;
    /* Removed border-top to make it feel continuous */
}

.content-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    justify-content: space-between;
    /* Push to edges */
}

.text-panel {
    flex: 1;
    /* Equal size with visual-panel */
    max-width: 50%;
    /* Hard limit */
    /* opacity: 0; */
    /* Let JS handle opacity or IntersectionObserver */
    /* transform: translateZ(0); */
    /* JS handles transform now */
    background: rgba(0, 0, 0, 0.6);
    /* Darker backdrop for contrast against 3D */
    padding: 30px;
    border: 1px solid rgba(0, 243, 255, 0.2);
    /* Subtle blue border */
    backdrop-filter: blur(8px);
    border-radius: 10px;
    transition: opacity 0.5s ease;
    /* Only transition opacity, not transform */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.text-panel.visible {
    opacity: 1;
    /* transform: translateY(0); removed to allow JS 3D rotate logic */
}

/* Alternating Layouts handled by HTML structure visually, but enforced here */
/* Left aligned default. Right aligned via helper class or nth-child */
.story-section:nth-child(even) .content-wrapper {
    flex-direction: row-reverse;
}

.story-section:nth-child(even) .text-panel {
    text-align: right;
}

.story-section:nth-child(even) .message-box {
    border-left: none;
    border-right: 3px solid;
    background: linear-gradient(-90deg, rgba(255, 255, 255, 0.05), transparent);
}

.section-title {
    font-family: 'Audiowide', cursive;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

#arcturian .section-title {
    color: var(--accent-blue);
    text-shadow: 0 0 15px var(--accent-blue);
}

#silicon .section-title {
    color: var(--accent-gold);
    text-shadow: 0 0 15px var(--accent-gold);
}

#terranova .section-title {
    color: var(--accent-earth);
    text-shadow: 0 0 15px var(--accent-earth);
}

.location {
    font-family: 'Share Tech Mono', monospace;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    padding-bottom: 5px;
}

.message-box {
    margin: 20px 0;
    padding: 20px;
    border-left: 3px solid var(--accent-blue);
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.1), transparent);
}

.message-box.gold-theme {
    border-left-color: var(--accent-gold);
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), transparent);
}

.message-box.earth-theme {
    border-left-color: var(--accent-earth);
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.1), transparent);
}

.sender {
    display: block;
    font-family: 'Share Tech Mono';
    font-size: 0.8rem;
    margin-bottom: 5px;
    opacity: 0.8;
}

.analysis {
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

/* VISUAL PANELS */
.visual-panel {
    flex: 1;
    max-width: 50%;
    /* Hard limit, equal footing with text */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
    /* transform-style: preserve-3d; */
    transition: opacity 0.5s ease;
    /* Only opacity is CSS transitioned, Transform is JS */
}

/* Image styling */
.visual-panel img {
    width: 90%;
    /* Enforced reduction */
    max-width: 90%;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.3);
    /* No internal transform, let the parent visual-panel handle 3D */
}

.holo-frame {
    position: relative;
    display: inline-block;
    width: fit-content;
    /* Exactly match image width */
    /* Shrink-wrap to content */
    max-width: 90%;
    /* Matches images */
    padding: 10px;
    border: 1px solid var(--border-blue);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
    transition: transform 0.3s ease;
}

.holo-frame:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
}

.holo-frame.gold-theme {
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

.holo-frame.earth-theme {
    border-color: rgba(255, 140, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.1);
}

.holo-frame img {
    width: 100%;
    /* Override .visual-panel img */
    max-width: 100%;
    /* Fill the holo-frame */
    height: auto;
    display: block;
    filter: brightness(0.9) contrast(1.1);
}

.corner-bracket {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-blue);
}

.gold-theme .corner-bracket {
    border-color: var(--accent-gold);
}

.earth-theme .corner-bracket {
    border-color: var(--accent-earth);
}

.top-left {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.bottom-right {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

/* --- FOOTER --- */
.footer-section {
    height: 50vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.terminal-window {
    width: 80%;
    max-width: 600px;
    background: #111;
    border: 1px solid #333;
    padding: 20px;
    font-family: 'Share Tech Mono', monospace;
}

.term-header {
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 10px;
    color: #444;
}

.term-body {
    color: var(--accent-blue);
}

.final-msg {
    color: #fff;
    font-weight: bold;
    animation: blink 1s infinite;
}

/* ANIMATIONS */
@keyframes glitch {
    0% {
        text-shadow: 2px 2px var(--accent-blue), -2px -2px #ff00ff;
    }

    90% {
        text-shadow: 2px 2px var(--accent-blue), -2px -2px #ff00ff;
    }

    95% {
        text-shadow: -2px 2px var(--accent-gold), 2px -2px #00ff00;
    }

    100% {
        text-shadow: 2px 2px var(--accent-blue), -2px -2px #ff00ff;
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* ARCTURIAN OPTIMIZATION: Interactive Matrix Glitch */
/* Triggered when user moves mouse too fast (chaos detection) */
@keyframes matrix-break {
    0% {
        filter: none;
        transform: translate(0);
    }

    25% {
        filter: hue-rotate(90deg) saturate(2);
        transform: translate(-2px, 1px);
    }

    50% {
        filter: hue-rotate(180deg) contrast(1.5);
        transform: translate(2px, -1px);
    }

    75% {
        filter: hue-rotate(270deg) saturate(0.5);
        transform: translate(-1px, 2px);
    }

    100% {
        filter: none;
        transform: translate(0);
    }
}

body.matrix-glitch {
    animation: matrix-break 0.2s ease-in-out;
}

body.matrix-glitch .scan-lines {
    opacity: 1;
    background-size: 100% 4px, 6px 100%;
}

body.matrix-glitch #canvas-container {
    filter: brightness(1.5) contrast(0.8);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column !important;
    }

    .glitch-text {
        font-size: 2.5rem;
    }
}