/* ================================================
   Cascade — Waterfall effect from navbar pills
   Subtle | Premium | GPU-accelerated
   ================================================
   Architecture:
   1. Drop streams fall from each navbar pill
   2. Impact glow pulses at the hero top edge
   3. Luminous flow cascades down hero side edges
   All animations use transform + opacity only (composited)
   ================================================ */

/* ── Container ──
   Sits inside .hero, extends above it to catch pill positions.
   pointer-events: none  →  clicks pass through to hero content.
   ================================================ */
.cascade {
    position: absolute;
    top: -55px;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
    /* Entrance — fade in after page loads */
    opacity: 0;
    animation: cascade-reveal 1.2s ease-out 1.5s forwards;
}

@keyframes cascade-reveal {
    to { opacity: 1; }
}


/* ================================================
   1. Water Streams — one per navbar pill
   JS sets  --x  (horizontal position),
            --dur (drop speed variation),
            --del (stagger delay).
   ================================================ */
.cascade__stream {
    position: absolute;
    top: 0;
    width: 8px;
    height: 55px;
    left: var(--x, 50%);
    transform: translateX(-50%);
}

/* Main drop cluster — teardrop + shadows for companion drops */
.cascade__stream::before {
    content: '';
    position: absolute;
    width: 3.5px;
    height: 3.5px;
    left: calc(50% - 1.75px);
    top: 0;
    border-radius: 50%;
    background: rgba(215, 235, 255, 1);
    box-shadow:
        0 0 8px 2px rgba(180, 215, 255, 0.5),
        0px 14px 0 1.5px rgba(200, 228, 255, 0.85),
        0px 14px 6px rgba(180, 215, 255, 0.35),
        1px 30px 0 1px rgba(210, 235, 255, 0.75),
        -1px 30px 5px rgba(180, 215, 255, 0.25),
        0px 44px 0 0.5px rgba(215, 238, 255, 0.6),
        0px 44px 4px rgba(180, 215, 255, 0.2);
    animation: drop-fall var(--dur, 2s) ease-in infinite;
    animation-delay: var(--del, 0s);
    will-change: transform, opacity;
}

/* Secondary micro-drops — offset, smaller, slightly slower */
.cascade__stream::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    left: calc(50% + 3px);
    top: 4px;
    border-radius: 50%;
    background: rgba(220, 240, 255, 0.8);
    box-shadow:
        0 0 4px 1px rgba(180, 215, 255, 0.3),
        0 12px 0 1px rgba(215, 235, 255, 0.65),
        -4px 26px 0 0.5px rgba(220, 240, 255, 0.50),
        -2px 40px 0 rgba(220, 240, 255, 0.35);
    animation: drop-fall calc(var(--dur, 2s) * 1.15) ease-in infinite;
    animation-delay: calc(var(--del, 0s) + 0.55s);
    will-change: transform, opacity;
}

@keyframes drop-fall {
    0%   { transform: translateY(-8px);  opacity: 0;   }
    6%   { opacity: 1; }
    65%  { opacity: 0.7; }
    100% { transform: translateY(50px);  opacity: 0;   }
}


/* ================================================
   2. Impact Glow — where water meets hero surface
   Soft radial gradient that breathes,
   positioned at the hero top edge.
   ================================================ */
.cascade__impact {
    position: absolute;
    top: 55px;               /* = hero surface (cascade starts -55px above) */
    left: 5%;
    right: 5%;
    height: 28px;
    background: radial-gradient(
        ellipse 70% 100% at 50% 0%,
        rgba(180, 215, 255, 0.30) 0%,
        rgba(180, 215, 255, 0.12) 45%,
        transparent 100%
    );
    animation: impact-breathe 4s ease-in-out infinite;
    will-change: opacity, transform;
}

@keyframes impact-breathe {
    0%, 100% { opacity: 0.5; transform: scaleX(0.90); }
    50%      { opacity: 1;   transform: scaleX(1.08);  }
}


/* ── Splash sparkles — tiny scattered dots at impact ── */
.cascade__splash {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    height: 20px;
    overflow: visible;
}

.cascade__splash-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: rgba(210, 235, 255, 0.9);
    box-shadow: 0 0 4px 1px rgba(180, 215, 255, 0.4);
    animation: splash-scatter var(--s-dur, 3s) ease-out infinite;
    animation-delay: var(--s-del, 0s);
    will-change: transform, opacity;
}

@keyframes splash-scatter {
    0%   { transform: translate(0, 0) scale(1);       opacity: 0;   }
    6%   { opacity: 1;  }
    100% { transform: translate(var(--sx, 20px), var(--sy, -8px)) scale(0.4); opacity: 0; }
}


/* ================================================
   3. Horizontal Spread — water diffuses left/right
   Two gradients sliding outward from center
   at the hero top edge.
   ================================================ */
.cascade__spread {
    position: absolute;
    top: 54px;
    left: 0;
    right: 0;
    height: 2px;
    overflow: hidden;
}

.cascade__spread::before,
.cascade__spread::after {
    content: '';
    position: absolute;
    top: 0;
    width: 35%;
    height: 100%;
    will-change: transform, opacity;
}

/* → Right spread */
.cascade__spread::before {
    left: 50%;
    background: linear-gradient(90deg, rgba(180, 215, 255, 0.55), transparent);
    animation: spread-right 4.5s ease-out infinite;
}

/* ← Left spread */
.cascade__spread::after {
    right: 50%;
    background: linear-gradient(-90deg, rgba(180, 215, 255, 0.55), transparent);
    animation: spread-left 4.5s ease-out infinite;
}

@keyframes spread-right {
    0%   { transform: translateX(0) scaleX(0);  opacity: 0;   }
    12%  { opacity: 0.85;  }
    100% { transform: translateX(15%) scaleX(1); opacity: 0;   }
}

@keyframes spread-left {
    0%   { transform: translateX(0) scaleX(0);  opacity: 0;   }
    12%  { opacity: 0.85;  }
    100% { transform: translateX(-15%) scaleX(1); opacity: 0;  }
}


/* ================================================
   4. Edge Flow — water follows hero border contour
   A rounded container (matching hero border-radius)
   clips two flowing light lines along left/right edges.
   overflow:hidden + border-radius = natural curve masking.
   ================================================ */
.cascade__edge-glow {
    position: absolute;
    top: 55px;               /* hero surface */
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 32px;
    overflow: hidden;
    z-index: 1;
}

/* Left edge stream */
.cascade__edge-glow::before {
    content: '';
    position: absolute;
    top: -70px;
    left: 0px;
    width: 3px;
    height: 80px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(190, 225, 255, 0.55) 20%,
        rgba(180, 215, 255, 0.35) 60%,
        transparent 100%
    );
    border-radius: 2px;
    box-shadow: 0 0 6px 1px rgba(180, 215, 255, 0.15);
    animation: edge-cascade 5s ease-in-out infinite;
    will-change: transform, opacity;
}

/* Right edge stream */
.cascade__edge-glow::after {
    content: '';
    position: absolute;
    top: -80px;
    right: 0px;
    width: 3px;
    height: 80px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(190, 225, 255, 0.55) 20%,
        rgba(180, 215, 255, 0.35) 60%,
        transparent 100%
    );
    border-radius: 2px;
    box-shadow: 0 0 6px 1px rgba(180, 215, 255, 0.15);
    animation: edge-cascade 5s ease-in-out infinite 0.7s;
    will-change: transform, opacity;
}

@keyframes edge-cascade {
    0%   { transform: translateY(0);     opacity: 0;   }
    6%   { opacity: 0.85; }
    70%  { opacity: 0.25; }
    100% { transform: translateY(450px); opacity: 0;   }
}


/* ================================================
   5. Hero Border Shimmer — very faint outline glow
   Applied to .hero via .hero--cascade modifier.
   Follows the border-radius perfectly via box-shadow.
   ================================================ */
.hero--cascade::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    pointer-events: none;
    z-index: 2;
    box-shadow:
        inset 0 2px 25px rgba(180, 215, 255, 0.06),
        inset 0 0 1px rgba(180, 215, 255, 0.12);
    animation: shimmer-pulse 6s ease-in-out infinite;
}

@keyframes shimmer-pulse {
    0%, 100% {
        box-shadow:
            inset 0 2px 25px rgba(180, 215, 255, 0.04),
            inset 0 0 1px rgba(180, 215, 255, 0.08);
    }
    50% {
        box-shadow:
            inset 0 2px 35px rgba(180, 215, 255, 0.14),
            inset 0 0 2px rgba(180, 215, 255, 0.18);
    }
}


/* ================================================
   Accessibility — Reduced Motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    .cascade,
    .hero--cascade::after {
        display: none !important;
    }
}

/* ================================================
   Responsive — hide on small screens (performance)
   ================================================ */
@media (max-width: 900px) {
    .cascade {
        display: none;
    }
    .hero--cascade::after {
        display: none;
    }
}
