/* Live Background Container */
.live-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.1); /* Slight zoom for potential parallax */
    transition: filter 0.5s ease;
}

/* Page Specific Backgrounds */
.home-bg { background-image: url('../images/hd_storm_background.png'); }
.about-bg { background-image: url('../images/mountain_journey_background.png'); }
.projects-bg { background-image: url('../images/galactic_projects_background.png'); }
.contact-bg { background-image: url('../images/abstract_tech_background.png'); }

/* Storm/Lightning Animation */
@keyframes lightningFlash {
    0%, 95%, 98%, 100% { opacity: 0; }
    96% { opacity: 0.1; }
    97% { opacity: 0.3; }
    99% { opacity: 0.2; }
}

.lightning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
}

.home-bg .lightning-overlay {
    animation: lightningFlash 8s infinite;
}

.about-bg .lightning-overlay {
    animation: lightningFlash 12s infinite 2s;
}

.projects-bg .lightning-overlay {
    animation: lightningFlash 10s infinite 1s;
}

.contact-bg .lightning-overlay {
    animation: lightningFlash 15s infinite 3s;
}

/* Subtle Drift Animation */
@keyframes drift {
    0% { transform: scale(1.1) translate(0, 0); }
    50% { transform: scale(1.15) translate(-1%, -1%); }
    100% { transform: scale(1.1) translate(0, 0); }
}

.live-bg:not(.home-bg) {
    animation: drift 20s ease-in-out infinite;
}

/* Overlay to ensure readability */
.live-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4); /* Dark overlay */
}

/* Darker overlays for specific pages */
.about-bg::after, .projects-bg::after {
    background: rgba(2, 6, 23, 0.85) !important; /* Very dark for "Digital" feel */
}

/* Digital Grid Overlay for "Digital" theme */
.about-bg::before, .projects-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 0;
    pointer-events: none;
}

/* Dark theme adjustment */
[data-theme="dark"] .live-bg::after {
    background: rgba(2, 6, 23, 0.9);
}
