/* weather.css */

/* --- Weather Container --- */
.weather-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

/* Foggy ambience while rain is falling (ties to drops via :has) */
.weather-container:has(.raindrop)::before,
.weather-container:has(.raindrop)::after {
    content: '';
    position: absolute;
    inset: -15%;
    pointer-events: none;
    z-index: 0;
}

.weather-container:has(.raindrop)::before {
    background:
        radial-gradient(ellipse 130% 85% at 50% 105%, rgba(165, 185, 205, 0.42) 0%, rgba(140, 158, 178, 0.08) 42%, transparent 58%),
        radial-gradient(ellipse 70% 55% at 15% 35%, rgba(200, 212, 228, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse 65% 45% at 88% 55%, rgba(188, 200, 218, 0.12) 0%, transparent 48%);
    opacity: 0.88;
    filter: blur(1.5px);
    animation: weatherFogDrift 22s ease-in-out infinite alternate;
}

.weather-container:has(.raindrop)::after {
    background:
        radial-gradient(ellipse 100% 70% at 60% 90%, rgba(150, 168, 188, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 55% 40% at 40% 25%, rgba(210, 218, 232, 0.08) 0%, transparent 45%);
    opacity: 0.72;
    filter: blur(3px);
    mix-blend-mode: soft-light;
    animation: weatherFogDriftSlow 32s ease-in-out infinite alternate-reverse;
}

@keyframes weatherFogDrift {
    from {
        transform: translate(-1.5%, -0.5%) scale(1.02);
        opacity: 0.78;
    }
    to {
        transform: translate(2%, 1.2%) scale(1.06);
        opacity: 0.94;
    }
}

@keyframes weatherFogDriftSlow {
    from {
        transform: translate(1%, 0%) rotate(-0.5deg) scale(1.03);
        opacity: 0.62;
    }
    to {
        transform: translate(-2.5%, 1%) rotate(0.5deg) scale(1.08);
        opacity: 0.88;
    }
}

/* --- Rain Effect --- */
@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

.raindrop {
    position: absolute;
    bottom: 100%;
    width: 2px;
    height: 62px;
    z-index: 2;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(185, 215, 238, 0.58),
        rgba(235, 245, 255, 0.78)
    );
    box-shadow:
        0 0 4px rgba(190, 215, 235, 0.45),
        0 0 12px rgba(200, 220, 240, 0.18);
    animation: fall linear infinite;
}

.raindrop-fine {
    width: 1px;
    height: 38px;
    opacity: 0.72;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(200, 225, 245, 0.42),
        rgba(230, 240, 255, 0.55)
    );
    box-shadow: 0 0 2px rgba(200, 220, 235, 0.35);
}

/* --- Thunder Effect --- */
@keyframes flash {
    0%, 100% {
        opacity: 0;
    }
    10%, 20%, 30%, 100% {
        opacity: 0;
    }
    12%, 22%, 33% {
        opacity: 0.15;
        background-color: #8a92a0;
    }
}

.thunder-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    opacity: 0;
    z-index: 0;
    animation: flash 6s infinite;
    pointer-events: none;
}

/* --- Snow Effect --- */
@keyframes fall-snow {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

.snowflake {
    position: absolute;
    top: -20px;
    color: #fff;
    font-size: 1rem;
    animation: fall-snow linear infinite;
    opacity: 0.8;
    text-shadow: 0 0 5px #fff;
}

/* --- Falling Leaves Effect --- */
@keyframes fall-leaves {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

.leaf {
    position: absolute;
    top: -20px;
    color: #ff8c00;
    font-size: 1.2rem;
    animation: fall-leaves linear infinite;
}

/* --- Shift+W manual sky picker (legacy theme) --- */
.weather-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 100004;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(ellipse at center, rgba(15, 20, 30, 0.55) 0%, rgba(5, 8, 14, 0.82) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.weather-picker-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.weather-picker-panel {
    width: min(22rem, 94vw);
    max-height: min(86vh, 28rem);
    overflow: auto;
    border-radius: 14px;
    padding: 1rem 1.05rem 1.15rem;
    font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
    color: #2c2418;
    background:
        linear-gradient(165deg, rgba(255, 252, 245, 0.96) 0%, rgba(232, 220, 198, 0.98) 45%, rgba(210, 195, 170, 0.96) 100%);
    border: 2px solid #c4a574;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.65),
        inset 0 -3px 8px rgba(80, 60, 40, 0.12),
        0 10px 0 rgba(110, 85, 55, 0.55),
        0 18px 32px rgba(0, 0, 0, 0.45),
        0 2px 0 rgba(255, 248, 230, 0.35);
}

.weather-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.weather-picker-panel h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #3d3228;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.weather-picker-close {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    border: 1px solid #a08058;
    background: linear-gradient(180deg, #f7efdfff 0%, #dfc9a8 45%, #c9ae82 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.85),
        0 2px 0 rgba(90, 70, 45, 0.35),
        0 3px 6px rgba(0, 0, 0, 0.2);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: #4a3f33;
}

.weather-picker-close:hover {
    filter: brightness(1.05);
}

.weather-picker-close:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(60, 45, 30, 0.35);
}

.weather-picker-hint {
    margin: 0 0 0.85rem;
    font-size: 0.82rem;
    color: #5c5248;
    line-height: 1.35;
}

.weather-picker-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.weather-picker-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid #b69872;
    background: linear-gradient(180deg, #fffefb 0%, #ebe1d2 48%, #d9cbb8 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.85),
        0 2px 0 rgba(110, 90, 65, 0.25),
        0 2px 6px rgba(30, 24, 18, 0.15);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #3d342c;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
}

.weather-picker-option:hover:not(:disabled) {
    filter: brightness(1.04);
    border-color: #9e7f54;
}

.weather-picker-option:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(70, 55, 40, 0.22);
}

.weather-picker-option:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.weather-picker-option.is-active {
    border-color: #7cb893;
    background: linear-gradient(180deg, #eefaf3 0%, #cfeadd 55%, #b8dfc9 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.9),
        0 0 0 2px rgba(90, 160, 120, 0.35),
        0 2px 0 rgba(70, 110, 85, 0.35);
}

.weather-picker-random {
    margin-top: 0.25rem;
    border-style: dashed;
}

@media (prefers-reduced-motion: reduce) {
    .weather-picker-overlay {
        transition: none;
    }
    .weather-picker-option {
        transition: none;
    }

    .weather-container:has(.raindrop)::before,
    .weather-container:has(.raindrop)::after {
        animation: none;
        opacity: 0.82;
    }
}
