/*
 * WeedRain - Pixel Rain Animation
 * Pure CSS animated rain effect
 */

/* ==========================================
   RAIN CONTAINER
   ========================================== */

.rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: var(--z-rain, -1);
}

/* Reduce rain when forms are focused */
body.rain-reduced .rain-container {
    opacity: 0.3;
}


/* ==========================================
   RAINDROPS
   ========================================== */

.raindrop {
    position: absolute;
    width: 2px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(100, 200, 255, 0.3) 20%,
        rgba(100, 200, 255, 0.6) 50%,
        rgba(100, 200, 255, 0.3) 80%,
        transparent 100%
    );
    animation: fall linear infinite;
    will-change: transform;
}

/* Different raindrop sizes */
.raindrop-sm {
    height: 8px;
    opacity: 0.4;
}

.raindrop-md {
    height: 12px;
    opacity: 0.6;
}

.raindrop-lg {
    height: 16px;
    opacity: 0.8;
}


/* ==========================================
   FALL ANIMATION
   ========================================== */

@keyframes fall {
    0% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(100vh);
    }
}


/* ==========================================
   GENERATED RAINDROPS
   These are positioned across the screen width
   with varied animation durations and delays
   ========================================== */

/* Row 1 */
.raindrop:nth-child(1) { left: 2%; animation-duration: 0.8s; animation-delay: 0s; }
.raindrop:nth-child(2) { left: 5%; animation-duration: 0.9s; animation-delay: 0.1s; }
.raindrop:nth-child(3) { left: 8%; animation-duration: 0.7s; animation-delay: 0.3s; }
.raindrop:nth-child(4) { left: 11%; animation-duration: 1s; animation-delay: 0.2s; }
.raindrop:nth-child(5) { left: 14%; animation-duration: 0.85s; animation-delay: 0.4s; }
.raindrop:nth-child(6) { left: 17%; animation-duration: 0.75s; animation-delay: 0.15s; }
.raindrop:nth-child(7) { left: 20%; animation-duration: 0.95s; animation-delay: 0.35s; }
.raindrop:nth-child(8) { left: 23%; animation-duration: 0.8s; animation-delay: 0.5s; }
.raindrop:nth-child(9) { left: 26%; animation-duration: 0.9s; animation-delay: 0.25s; }
.raindrop:nth-child(10) { left: 29%; animation-duration: 0.7s; animation-delay: 0.45s; }

/* Row 2 */
.raindrop:nth-child(11) { left: 32%; animation-duration: 0.85s; animation-delay: 0.1s; }
.raindrop:nth-child(12) { left: 35%; animation-duration: 0.95s; animation-delay: 0.3s; }
.raindrop:nth-child(13) { left: 38%; animation-duration: 0.75s; animation-delay: 0.2s; }
.raindrop:nth-child(14) { left: 41%; animation-duration: 0.8s; animation-delay: 0.4s; }
.raindrop:nth-child(15) { left: 44%; animation-duration: 0.9s; animation-delay: 0.15s; }
.raindrop:nth-child(16) { left: 47%; animation-duration: 0.7s; animation-delay: 0.35s; }
.raindrop:nth-child(17) { left: 50%; animation-duration: 1s; animation-delay: 0.5s; }
.raindrop:nth-child(18) { left: 53%; animation-duration: 0.85s; animation-delay: 0.25s; }
.raindrop:nth-child(19) { left: 56%; animation-duration: 0.75s; animation-delay: 0.45s; }
.raindrop:nth-child(20) { left: 59%; animation-duration: 0.95s; animation-delay: 0.1s; }

/* Row 3 */
.raindrop:nth-child(21) { left: 62%; animation-duration: 0.8s; animation-delay: 0.3s; }
.raindrop:nth-child(22) { left: 65%; animation-duration: 0.9s; animation-delay: 0.2s; }
.raindrop:nth-child(23) { left: 68%; animation-duration: 0.7s; animation-delay: 0.4s; }
.raindrop:nth-child(24) { left: 71%; animation-duration: 0.85s; animation-delay: 0.15s; }
.raindrop:nth-child(25) { left: 74%; animation-duration: 0.95s; animation-delay: 0.35s; }
.raindrop:nth-child(26) { left: 77%; animation-duration: 0.75s; animation-delay: 0.5s; }
.raindrop:nth-child(27) { left: 80%; animation-duration: 1s; animation-delay: 0.25s; }
.raindrop:nth-child(28) { left: 83%; animation-duration: 0.8s; animation-delay: 0.45s; }
.raindrop:nth-child(29) { left: 86%; animation-duration: 0.9s; animation-delay: 0.1s; }
.raindrop:nth-child(30) { left: 89%; animation-duration: 0.7s; animation-delay: 0.3s; }

/* Row 4 */
.raindrop:nth-child(31) { left: 92%; animation-duration: 0.85s; animation-delay: 0.2s; }
.raindrop:nth-child(32) { left: 95%; animation-duration: 0.95s; animation-delay: 0.4s; }
.raindrop:nth-child(33) { left: 98%; animation-duration: 0.75s; animation-delay: 0.15s; }
.raindrop:nth-child(34) { left: 3%; animation-duration: 0.8s; animation-delay: 0.55s; }
.raindrop:nth-child(35) { left: 7%; animation-duration: 0.9s; animation-delay: 0.35s; }
.raindrop:nth-child(36) { left: 12%; animation-duration: 0.7s; animation-delay: 0.6s; }
.raindrop:nth-child(37) { left: 16%; animation-duration: 1s; animation-delay: 0.25s; }
.raindrop:nth-child(38) { left: 21%; animation-duration: 0.85s; animation-delay: 0.5s; }
.raindrop:nth-child(39) { left: 25%; animation-duration: 0.75s; animation-delay: 0.1s; }
.raindrop:nth-child(40) { left: 30%; animation-duration: 0.95s; animation-delay: 0.4s; }

/* Row 5 - Extra coverage */
.raindrop:nth-child(41) { left: 34%; animation-duration: 0.8s; animation-delay: 0.65s; }
.raindrop:nth-child(42) { left: 39%; animation-duration: 0.9s; animation-delay: 0.2s; }
.raindrop:nth-child(43) { left: 43%; animation-duration: 0.7s; animation-delay: 0.55s; }
.raindrop:nth-child(44) { left: 48%; animation-duration: 0.85s; animation-delay: 0.3s; }
.raindrop:nth-child(45) { left: 52%; animation-duration: 0.95s; animation-delay: 0.6s; }
.raindrop:nth-child(46) { left: 57%; animation-duration: 0.75s; animation-delay: 0.15s; }
.raindrop:nth-child(47) { left: 61%; animation-duration: 1s; animation-delay: 0.45s; }
.raindrop:nth-child(48) { left: 66%; animation-duration: 0.8s; animation-delay: 0.7s; }
.raindrop:nth-child(49) { left: 70%; animation-duration: 0.9s; animation-delay: 0.25s; }
.raindrop:nth-child(50) { left: 75%; animation-duration: 0.7s; animation-delay: 0.5s; }


/* ==========================================
   SPLASH EFFECT (optional)
   ========================================== */

.rain-splash {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        to top,
        rgba(100, 200, 255, 0.2) 0%,
        transparent 100%
    );
    pointer-events: none;
}


/* ==========================================
   LIGHTNING FLASH (optional effect)
   ========================================== */

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

.lightning-overlay.flash {
    animation: lightning-flash 0.2s ease-out;
}

@keyframes lightning-flash {
    0% { opacity: 0.8; }
    20% { opacity: 0; }
    40% { opacity: 0.4; }
    100% { opacity: 0; }
}


/* ==========================================
   GREEN WEED DROPS (occasional accent)
   ========================================== */

.weeddrop {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--pixel-green, #00ff66);
    box-shadow: 0 0 4px var(--pixel-green, #00ff66);
    animation: weed-fall linear infinite;
    opacity: 0.8;
}

@keyframes weed-fall {
    0% {
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Weed drop positions - fewer, more special */
.weeddrop:nth-child(1) { left: 10%; animation-duration: 2s; animation-delay: 1s; }
.weeddrop:nth-child(2) { left: 30%; animation-duration: 2.5s; animation-delay: 3s; }
.weeddrop:nth-child(3) { left: 50%; animation-duration: 2.2s; animation-delay: 5s; }
.weeddrop:nth-child(4) { left: 70%; animation-duration: 2.8s; animation-delay: 2s; }
.weeddrop:nth-child(5) { left: 90%; animation-duration: 2.4s; animation-delay: 4s; }


/* ==========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* Reduce animations on reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .rain-container {
        display: none;
    }
}

/* Pause rain when tab not visible */
.rain-paused .raindrop,
.rain-paused .weeddrop {
    animation-play-state: paused;
}


/* ==========================================
   MOBILE OPTIMIZATIONS
   ========================================== */

@media (max-width: 768px) {
    /* Reduce number of visible raindrops on mobile */
    .raindrop:nth-child(n+30) {
        display: none;
    }

    .weeddrop:nth-child(n+3) {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Further reduce on small screens */
    .raindrop:nth-child(n+20) {
        display: none;
    }
}
