/* ═════════════════════════════════════════════════════════════
   ATMOSPHERIC EFFECTS - GetStarNews v4
   Light shafts, haze, and depth enhancements
   ═════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   ATMOSPHERIC HAZE OVERLAY
   ───────────────────────────────────────────────────────────── */
.atmosphere-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.4;
    background: radial-gradient(
        ellipse 80% 50% at 50% 120%,
        rgba(100, 120, 150, 0.15) 0%,
        rgba(80, 100, 130, 0.08) 40%,
        transparent 70%
    );
    mix-blend-mode: screen;
    transition: opacity 2s ease, background 2s ease;
}

/* ─────────────────────────────────────────────────────────────
   LIGHT SHAFTS (Dawn/Dusk)
   ───────────────────────────────────────────────────────────── */
.light-shafts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    background: 
        repeating-conic-gradient(
            from 215deg at 50% 100%,
            rgba(255, 200, 150, 0.03) 0deg 8deg,
            transparent 8deg 16deg
        );
    mix-blend-mode: screen;
    filter: blur(20px);
    transition: opacity 1.5s ease;
}

/* Active during dawn/dusk */
body.dawn .light-shafts,
body.dusk .light-shafts {
    opacity: 0.6;
    animation: shaft-rotate 60s linear infinite;
}

@keyframes shaft-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────
   HORIZON GLOW
   ───────────────────────────────────────────────────────────── */
#horizon {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35vh;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 20, 40, 0.4) 30%,
        transparent 70%
    );
    box-shadow: 
        0 -20px 60px 20px rgba(0, 120, 200, 0.08),
        0 -10px 30px 10px rgba(255, 180, 100, 0.05);
    transition: box-shadow 2s ease;
}

/* Dawn horizon */
body.dawn #horizon {
    background: linear-gradient(
        to top,
        rgba(255, 100, 50, 0.3) 0%,
        rgba(255, 150, 80, 0.2) 30%,
        rgba(100, 80, 150, 0.15) 60%,
        transparent 80%
    );
    box-shadow: 
        0 -20px 80px 30px rgba(255, 150, 50, 0.4),
        0 -10px 40px 15px rgba(255, 200, 100, 0.2);
}

/* Dusk horizon */
body.dusk #horizon {
    background: linear-gradient(
        to top,
        rgba(255, 80, 30, 0.35) 0%,
        rgba(255, 120, 60, 0.25) 30%,
        rgba(80, 50, 100, 0.2) 60%,
        transparent 80%
    );
    box-shadow: 
        0 -20px 80px 30px rgba(255, 100, 50, 0.35),
        0 -10px 40px 15px rgba(255, 150, 80, 0.2);
}

/* Night horizon */
body.nighttime #horizon {
    background: linear-gradient(
        to top,
        rgba(0, 5, 20, 0.5) 0%,
        rgba(0, 10, 30, 0.3) 40%,
        transparent 70%
    );
    box-shadow: 
        0 -20px 60px 20px rgba(0, 50, 100, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   DEPTH LAYERS - Mountain Enhancement
   ───────────────────────────────────────────────────────────── */
.mountain-layer {
    transition: filter 2s ease, opacity 2s ease;
}

/* Add atmospheric perspective to mountains */
#ridge {
    filter: blur(0.5px) contrast(0.95);
}

#ridge-back {
    opacity: 0.6;
    filter: blur(1.5px);
}

#ridge-mid {
    opacity: 0.8;
    filter: blur(0.8px);
}

/* ─────────────────────────────────────────────────────────────
   TIME-OF-DAY ATMOSPHERE CLASSES
   ───────────────────────────────────────────────────────────── */

/* Day - bright, clear */
body.daytime {
    --atmo-brightness: 1.0;
    --atmo-haze: 0.3;
}

body.daytime .atmosphere-overlay {
    opacity: 0.15;
    background: radial-gradient(
        ellipse 60% 40% at 50% 100%,
        rgba(135, 206, 235, 0.1) 0%,
        transparent 60%
    );
}

body.daytime #bg-scene {
    filter: brightness(1.1) saturate(1.1);
}

/* Dawn - warm, orange glow */
body.dawn {
    --atmo-brightness: 0.9;
    --atmo-haze: 0.5;
}

body.dawn .atmosphere-overlay {
    opacity: 0.35;
    background: radial-gradient(
        ellipse 80% 60% at 50% 100%,
        rgba(255, 150, 80, 0.2) 0%,
        rgba(255, 100, 50, 0.1) 40%,
        rgba(100, 80, 150, 0.08) 70%,
        transparent 100%
    );
}

body.dawn #bg-scene {
    filter: brightness(0.95) saturate(1.2) sepia(0.15);
}

/* Dusk - purple/orange blend */
body.dusk {
    --atmo-brightness: 0.85;
    --atmo-haze: 0.45;
}

body.dusk .atmosphere-overlay {
    opacity: 0.35;
    background: radial-gradient(
        ellipse 80% 60% at 50% 100%,
        rgba(255, 100, 50, 0.18) 0%,
        rgba(150, 80, 120, 0.12) 40%,
        rgba(80, 60, 120, 0.1) 70%,
        transparent 100%
    );
}

body.dusk #bg-scene {
    filter: brightness(0.9) saturate(1.15) sepia(0.1);
}

/* Night - dark, cool blue */
body.nighttime {
    --atmo-brightness: 0.7;
    --atmo-haze: 0.2;
}

body.nighttime .atmosphere-overlay {
    opacity: 0.5;
    background: radial-gradient(
        ellipse 90% 50% at 50% 110%,
        rgba(10, 20, 40, 0.3) 0%,
        rgba(5, 10, 25, 0.2) 50%,
        transparent 80%
    );
}

body.nighttime #bg-scene {
    filter: brightness(0.6) saturate(0.9) contrast(1.1);
}

/* Twilight (general) */
body.twilight {
    --atmo-brightness: 0.8;
    --atmo-haze: 0.4;
}

/* ─────────────────────────────────────────────────────────────
   STAR TWINKLE ENHANCEMENT
   ───────────────────────────────────────────────────────────── */
#stars {
    transition: opacity 2s ease;
}

body.daytime #stars {
    opacity: 0;
}

body.dawn #stars,
body.dusk #stars {
    opacity: 0.3;
}

body.nighttime #stars {
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   WEATHER-BASED ATMOSPHERE
   ───────────────────────────────────────────────────────────── */

/* Stormy - dark, desaturated */
body.stormy .atmosphere-overlay {
    opacity: 0.6;
    background: radial-gradient(
        ellipse 100% 60% at 50% 100%,
        rgba(40, 45, 60, 0.4) 0%,
        rgba(30, 35, 50, 0.3) 50%,
        transparent 80%
    );
}

body.stormy #bg-scene {
    filter: brightness(0.6) saturate(0.7) contrast(1.1);
}

body.stormy #horizon {
    background: linear-gradient(
        to top,
        rgba(20, 25, 35, 0.6) 0%,
        rgba(30, 40, 55, 0.4) 40%,
        transparent 70%
    );
}

/* Rainy - slight blue tint */
body.rainy .atmosphere-overlay {
    opacity: 0.45;
    background: radial-gradient(
        ellipse 80% 50% at 50% 100%,
        rgba(80, 100, 130, 0.25) 0%,
        rgba(60, 80, 110, 0.15) 50%,
        transparent 75%
    );
}

/* Snow - bright white overlay */
body.snowing .atmosphere-overlay {
    opacity: 0.3;
    background: radial-gradient(
        ellipse 70% 40% at 50% 100%,
        rgba(220, 230, 245, 0.15) 0%,
        transparent 60%
    );
}

/* ─────────────────────────────────────────────────────────────
   SEASONAL EFFECTS
   ───────────────────────────────────────────────────────────── */

/* Spring - slightly warm */
body.season-spring .atmosphere-overlay {
    background: radial-gradient(
        ellipse 70% 50% at 50% 100%,
        rgba(180, 200, 150, 0.1) 0%,
        transparent 60%
    );
}

/* Summer - warm, bright */
body.season-summer .atmosphere-overlay {
    opacity: 0.2;
    background: radial-gradient(
        ellipse 60% 40% at 50% 100%,
        rgba(255, 220, 150, 0.12) 0%,
        transparent 50%
    );
}

/* Autumn - orange/red tints */
body.season-autumn .atmosphere-overlay {
    background: radial-gradient(
        ellipse 75% 50% at 50% 100%,
        rgba(200, 140, 80, 0.12) 0%,
        transparent 55%
    );
}

/* Winter - cool, desaturated */
body.season-winter .atmosphere-overlay {
    background: radial-gradient(
        ellipse 70% 45% at 50% 100%,
        rgba(180, 190, 210, 0.1) 0%,
        transparent 55%
    );
}

/* ─────────────────────────────────────────────────────────────
   PERFORMANCE OPTIMIZATIONS
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .light-shafts {
        display: none;
    }
    
    .atmosphere-overlay {
        opacity: 0.25;
    }
}

@media (prefers-reduced-motion: reduce) {
    .light-shafts,
    .atmosphere-overlay,
    #horizon {
        transition: none;
        animation: none;
    }
}
