/* ===================================================================
 * Process Flow Animations - Animated Connection Lines + Sequential Reveal
 * Fancy animated lines connecting process steps with flowing particles
 * ================================================================ */

/* ===================================================================
 * SEQUENTIAL REVEAL - Cards fade in one by one
 * ================================================================ */

#how-it-works .process-step {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#how-it-works .process-step.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for sequential reveal */
#how-it-works .process-step:nth-child(1) {
    transition-delay: 0ms;
}

#how-it-works .process-step:nth-child(2) {
    transition-delay: 150ms;
}

#how-it-works .process-step:nth-child(3) {
    transition-delay: 300ms;
}

#how-it-works .process-step:nth-child(4) {
    transition-delay: 450ms;
}

#how-it-works .process-step:nth-child(5) {
    transition-delay: 600ms;
}

/* ===================================================================
 * NUMBER BADGE PULSE - When card appears
 * ================================================================ */

#how-it-works .process-step.is-visible .process-number {
    animation: badgePulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===================================================================
 * CONNECTION LINES - SVG paths between cards
 * ================================================================ */

#how-it-works .process-grid {
    position: relative;
}

/* Connection line container */
#how-it-works .process-step::after {
    content: '';
    position: absolute;
    top: 16px; /* Align with number badge center */
    left: calc(24px + 72px + 8px); /* Start after number badge: left position + width + gap */
    width: calc(100% - 24px - 72px - 8px); /* Fill remaining space */
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 100%
    );
    z-index: 0;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Don't show line after last card */
#how-it-works .process-step:last-child::after {
    display: none;
}

/* Animated line when card is visible */
#how-it-works .process-step.is-visible::after {
    opacity: 1;
    transform: scaleX(1);
    transition-delay: 0.4s;
}

/* Sequential line glow - brightens when energy flows through */
#how-it-works .process-step.is-visible::after {
    animation: lineGlowPulse 7.5s ease-in-out infinite;
}

#how-it-works .process-step:nth-child(1).is-visible::after {
    animation-delay: 0s;
}

#how-it-works .process-step:nth-child(2).is-visible::after {
    animation-delay: 1.5s;
}

#how-it-works .process-step:nth-child(3).is-visible::after {
    animation-delay: 3s;
}

#how-it-works .process-step:nth-child(4).is-visible::after {
    animation-delay: 4.5s;
}

@keyframes lineGlowPulse {
    0%, 19% {
        background: linear-gradient(90deg, 
            rgba(255, 255, 255, 0.3) 0%,
            rgba(255, 255, 255, 0.1) 100%
        );
        box-shadow: none;
    }
    20% {
        background: linear-gradient(90deg, 
            rgba(255, 255, 255, 0.8) 0%,
            rgba(255, 255, 255, 0.6) 100%
        );
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    21%, 100% {
        background: linear-gradient(90deg, 
            rgba(255, 255, 255, 0.3) 0%,
            rgba(255, 255, 255, 0.1) 100%
        );
        box-shadow: none;
    }
}

/* Animated dashed line effect */
#how-it-works .process-step::before {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(24px + 72px + 8px); /* Match base line position */
    width: calc(100% - 24px - 72px - 8px); /* Match base line width */
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    z-index: 1;
    opacity: 0;
    animation: flowingLine 2s linear infinite;
}

#how-it-works .process-step:last-child::before {
    display: none;
}

#how-it-works .process-step.is-visible::before {
    opacity: 1;
    animation-delay: 0.6s;
}

@keyframes flowingLine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===================================================================
 * FLOATING PARTICLES - Along connection lines
 * ================================================================ */

/* Particle 1 */
#how-it-works .process-step .connection-particle-1 {
    content: '';
    position: absolute;
    top: 12px;
    left: calc(24px + 72px + 8px); /* Start at beginning of line */
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    border-radius: 50%;
    z-index: 2;
    opacity: 0;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

#how-it-works .process-step.is-visible .connection-particle-1 {
    animation: particleFlow1 1.5s ease-in-out 1;
}

/* Sequential particle flow - synced with card glow */
#how-it-works .process-step:nth-child(1).is-visible .connection-particle-1 {
    animation: particleFlow1 1.5s ease-in-out infinite;
    animation-delay: 0s;
}

#how-it-works .process-step:nth-child(2).is-visible .connection-particle-1 {
    animation: particleFlow1 1.5s ease-in-out infinite;
    animation-delay: 1.5s;
}

#how-it-works .process-step:nth-child(3).is-visible .connection-particle-1 {
    animation: particleFlow1 1.5s ease-in-out infinite;
    animation-delay: 3s;
}

#how-it-works .process-step:nth-child(4).is-visible .connection-particle-1 {
    animation: particleFlow1 1.5s ease-in-out infinite;
    animation-delay: 4.5s;
}

@keyframes particleFlow1 {
    0% {
        transform: translateX(0) scale(0);
        opacity: 0;
    }
    5% {
        opacity: 1;
        transform: scale(1);
    }
    95% {
        opacity: 1;
    }
    100% {
        transform: translateX(calc(100% - 24px - 72px - 8px)) scale(0);
        opacity: 0;
    }
}

/* Particle 2 - Delayed */
#how-it-works .process-step .connection-particle-2 {
    content: '';
    position: absolute;
    top: 14px;
    left: calc(24px + 72px + 8px); /* Start at beginning of line */
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.7) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    border-radius: 50%;
    z-index: 2;
    opacity: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

#how-it-works .process-step.is-visible .connection-particle-2 {
    animation: particleFlow2 1.5s ease-in-out 1;
}

/* Sequential particle 2 flow - slightly delayed from particle 1 */
#how-it-works .process-step:nth-child(1).is-visible .connection-particle-2 {
    animation: particleFlow2 1.5s ease-in-out infinite;
    animation-delay: 0.3s;
}

#how-it-works .process-step:nth-child(2).is-visible .connection-particle-2 {
    animation: particleFlow2 1.5s ease-in-out infinite;
    animation-delay: 1.8s;
}

#how-it-works .process-step:nth-child(3).is-visible .connection-particle-2 {
    animation: particleFlow2 1.5s ease-in-out infinite;
    animation-delay: 3.3s;
}

#how-it-works .process-step:nth-child(4).is-visible .connection-particle-2 {
    animation: particleFlow2 1.5s ease-in-out infinite;
    animation-delay: 4.8s;
}

@keyframes particleFlow2 {
    0% {
        transform: translateX(0) scale(0);
        opacity: 0;
    }
    5% {
        opacity: 0.8;
        transform: scale(1);
    }
    95% {
        opacity: 0.8;
    }
    100% {
        transform: translateX(calc(100% - 24px - 72px - 8px)) scale(0);
        opacity: 0;
    }
}

/* ===================================================================
 * SEQUENTIAL GLOW EFFECT - Flows from card to card
 * ================================================================ */

#how-it-works .process-step.is-visible .process-number {
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Sequential wave glow - each card glows in sequence */
#how-it-works .process-step.is-visible .process-number::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.2) 40%,
        transparent 70%
    );
    z-index: -1;
    opacity: 0;
    animation: sequentialGlow 7.5s ease-in-out infinite;
}

/* Card 1 - starts immediately */
#how-it-works .process-step:nth-child(1).is-visible .process-number::after {
    animation-delay: 0s;
}

/* Card 2 - glows after card 1 */
#how-it-works .process-step:nth-child(2).is-visible .process-number::after {
    animation-delay: 1.5s;
}

/* Card 3 - glows after card 2 */
#how-it-works .process-step:nth-child(3).is-visible .process-number::after {
    animation-delay: 3s;
}

/* Card 4 - glows after card 3 */
#how-it-works .process-step:nth-child(4).is-visible .process-number::after {
    animation-delay: 4.5s;
}

/* Card 5 - glows after card 4 */
#how-it-works .process-step:nth-child(5).is-visible .process-number::after {
    animation-delay: 6s;
}

@keyframes sequentialGlow {
    0% {
        opacity: 0;
        transform: scale(1);
    }
    10% {
        opacity: 1;
        transform: scale(1.15);
    }
    20% {
        opacity: 0;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* Enhanced glow on active card */
#how-it-works .process-step.is-visible .process-number {
    animation: cardGlowPulse 7.5s ease-in-out infinite;
}

#how-it-works .process-step:nth-child(1).is-visible .process-number {
    animation-delay: 0s;
}

#how-it-works .process-step:nth-child(2).is-visible .process-number {
    animation-delay: 1.5s;
}

#how-it-works .process-step:nth-child(3).is-visible .process-number {
    animation-delay: 3s;
}

#how-it-works .process-step:nth-child(4).is-visible .process-number {
    animation-delay: 4.5s;
}

#how-it-works .process-step:nth-child(5).is-visible .process-number {
    animation-delay: 6s;
}

@keyframes cardGlowPulse {
    0% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    10% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(255, 255, 255, 0.4),
            0 0 60px rgba(255, 255, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    20% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    100% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
}

/* ===================================================================
 * CARD ENTRANCE ANIMATION - Slight bounce
 * ================================================================ */

#how-it-works .process-step.is-visible .process-card {
    animation: cardEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardEntrance {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    60% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===================================================================
 * MOBILE RESPONSIVE - Adjust for smaller screens
 * ================================================================ */

@media (max-width: 768px) {
    /* Hide connection lines on mobile */
    #how-it-works .process-step::after,
    #how-it-works .process-step::before {
        display: none !important;
    }
    
    #how-it-works .process-step.is-visible::after {
        transform: scaleY(1);
        opacity: 1;
        animation: lineGlowPulseMobile 7.5s ease-in-out infinite;
    }
    
    #how-it-works .process-step:nth-child(1).is-visible::after {
        animation-delay: 0s;
    }
    
    #how-it-works .process-step:nth-child(2).is-visible::after {
        animation-delay: 1.5s;
    }
    
    #how-it-works .process-step:nth-child(3).is-visible::after {
        animation-delay: 3s;
    }
    
    #how-it-works .process-step:nth-child(4).is-visible::after {
        animation-delay: 4.5s;
    }
    
    @keyframes lineGlowPulseMobile {
        0%, 19% {
            background: linear-gradient(180deg, 
                rgba(255, 255, 255, 0.5) 0%,
                rgba(255, 255, 255, 0.2) 100%
            );
            box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
        }
        20% {
            background: linear-gradient(180deg, 
                rgba(255, 255, 255, 0.9) 0%,
                rgba(255, 255, 255, 0.7) 100%
            );
            box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
        }
        21%, 100% {
            background: linear-gradient(180deg, 
                rgba(255, 255, 255, 0.5) 0%,
                rgba(255, 255, 255, 0.2) 100%
            );
            box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
        }
    }
    
    #how-it-works .process-step::before {
        background: linear-gradient(180deg, 
            transparent 0%,
            transparent 40%,
            rgba(255, 255, 255, 0.6) 50%,
            transparent 60%,
            transparent 100%
        );
        background-size: 100% 200%;
    }
    
    @keyframes flowingLine {
        0% {
            background-position: 0 200%;
        }
        100% {
            background-position: 0 -200%;
        }
    }
    
    /* Hide particles on mobile */
    #how-it-works .process-step .connection-particle-1,
    #how-it-works .process-step .connection-particle-2 {
        display: none !important;
    }
    
    @keyframes particleFlow1 {
        0% {
            transform: translateY(0) scale(0);
            opacity: 0;
        }
        10% {
            opacity: 1;
            transform: scale(1);
        }
        90% {
            opacity: 1;
        }
        100% {
            transform: translateY(2rem) scale(0);
            opacity: 0;
        }
    }
    
    @keyframes particleFlow2 {
        0% {
            transform: translateY(0) scale(0);
            opacity: 0;
        }
        10% {
            opacity: 0.8;
            transform: scale(1);
        }
        90% {
            opacity: 0.8;
        }
        100% {
            transform: translateY(2rem) scale(0);
            opacity: 0;
        }
    }
}

@media (max-width: 480px) {
    /* Reduce animation intensity on small screens */
    #how-it-works .process-step {
        transform: translateY(20px);
    }
    
    #how-it-works .process-step::after,
    #how-it-works .process-step::before {
        height: 1.5rem;
    }
}
