/* ==========================================================================
   Xinh Effects Engine — effects.css
   Reusable visual effect primitives: ripple, particles, glow, confetti,
   cursor effects, shimmer, magnetic hover, gradient border, glass lift.
   Honors prefers-reduced-motion and --motion-intensity.
   ========================================================================== */

/* ==========================================================================
   1. Keyframes
   ========================================================================== */

@keyframes effectRipple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.35;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

@keyframes effectParticleFloat {
    0% {
        transform: translate(0, 0) scale(0.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--px), var(--py)) scale(1.2) rotate(var(--pr));
        opacity: 0;
    }
}

@keyframes effectConfetti {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: translateY(-30vh) translateX(15px) rotate(180deg) scale(0.9);
        opacity: 0.9;
    }
    50% {
        transform: translateY(-60vh) translateX(-10px) rotate(360deg) scale(0.8);
        opacity: 0.7;
    }
    75% {
        transform: translateY(-80vh) translateX(20px) rotate(540deg) scale(0.6);
        opacity: 0.4;
    }
    100% {
        transform: translateY(-100vh) translateX(-25px) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

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

@keyframes effectBorderGlow {
    0%, 100% {
        border-color: rgba(255, 45, 85, 0.5);
        box-shadow: 0 0 8px rgba(255, 45, 85, 0.2), inset 0 0 8px rgba(255, 45, 85, 0.05);
    }
    50% {
        border-color: rgba(255, 45, 85, 0.9);
        box-shadow: 0 0 20px rgba(255, 45, 85, 0.4), inset 0 0 12px rgba(255, 45, 85, 0.1);
    }
}

/* ==========================================================================
   2. Ripple Effect
   ========================================================================== */

.effect-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 45, 85, 0.2);
    pointer-events: none;
    z-index: 5;
    animation: effectRipple 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ==========================================================================
   3. Particle Container
   ========================================================================== */

.effect-particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.effect-particle {
    position: absolute;
    pointer-events: none;
    animation: effectParticleFloat var(--pd, 0.8s) ease-out forwards;
}

/* ==========================================================================
   4. Glow Utilities
   ========================================================================== */

.effect-glow-primary {
    box-shadow: var(--shadow-glow-primary);
    transition: box-shadow var(--motion-normal) var(--ease-standard);
}

.effect-glow-accent {
    box-shadow: var(--shadow-glow-accent-2);
    transition: box-shadow var(--motion-normal) var(--ease-standard);
}

.effect-glow-pulse {
    animation: pulseGlow 2s infinite;
}

.effect-glow-card {
    position: relative;
    transition: transform var(--motion-normal) var(--ease-emphasized),
                box-shadow var(--motion-normal) var(--ease-standard);
}

.effect-glow-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 10px 30px -5px rgba(255, 45, 85, 0.25);
    opacity: 0;
    transition: opacity var(--motion-normal) var(--ease-standard);
    pointer-events: none;
    z-index: -1;
}

.effect-glow-card:hover::after {
    opacity: 1;
}

.effect-glow-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-2);
}

/* ==========================================================================
   5. Confetti
   ========================================================================== */

.effect-confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
}

.effect-confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    animation: effectConfetti var(--cd, 2s) ease-in forwards;
}

/* ==========================================================================
   6. Desktop Cursor Glow
   ========================================================================== */

.effect-cursor-glow {
    position: fixed;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 45, 85, 0.12) 0%,
        rgba(255, 45, 85, 0.04) 40%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
}

.effect-cursor-glow.visible {
    opacity: 1;
}

/* ==========================================================================
   7. Magnetic Hover
   ========================================================================== */

.effect-magnetic {
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   8. Shimmer Wave
   ========================================================================== */

.effect-shimmer-wave {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 25%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.08) 75%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: effectShimmerSweep 0.8s ease-in-out forwards;
}

/* ==========================================================================
   9. Gradient Border
   ========================================================================== */

.effect-border-gradient {
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.effect-border-gradient::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--gradient-primary);
    background-size: 200% 200%;
    animation: gradientSpin 4s ease infinite;
    z-index: -1;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
}

/* ==========================================================================
   10. Glass Lift
   ========================================================================== */

.effect-glass-lift {
    background: var(--glass-bg, rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-lg);
    transition: transform var(--motion-normal) var(--ease-emphasized),
                box-shadow var(--motion-normal) var(--ease-standard);
}

.effect-glass-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(255, 45, 85, 0.15);
}

/* ==========================================================================
   11. Heart Particle (reusable, replaces inline mini-hearts)
   ========================================================================== */

.effect-heart-particle {
    position: absolute;
    color: #FF2D55;
    pointer-events: none;
    z-index: 50;
    animation: effectParticleFloat var(--pd, 0.8s) ease-out forwards;
}

/* ==========================================================================
   12. Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .effect-ripple,
    .effect-particle,
    .effect-confetti-piece,
    .effect-heart-particle,
    .effect-shimmer-wave {
        animation: none !important;
        display: none;
    }

    .effect-cursor-glow {
        display: none;
    }

    .effect-glow-card:hover {
        transform: none;
    }

    .effect-glass-lift:hover {
        transform: none;
    }
}