/* ============================================================
   JigPic Solitaire — animations & transitions
   ============================================================ */

/* Card shake on invalid moves */
@keyframes card-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(3px); }
}

/* Picture piece reveal */
@keyframes piece-reveal {
    0% {
        transform: scale(0.55) rotate(4deg);
        opacity: 0.3;
    }
    60% {
        transform: scale(1.08) rotate(-1deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.piece.revealed {
    animation: piece-reveal 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

/* Particles */
@keyframes particle-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(var(--rot, 360deg));
    }
}

@keyframes confetti-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0.1;
        transform: translate(var(--dx), var(--dy)) rotate(var(--rx, 720deg)) scale(0.85);
    }
}

/* Foundation completion glow */
.found-complete [data-pile] {
    animation: found-pulse 0.8s ease;
}

@keyframes found-pulse {
    0% { box-shadow: 0 0 0 4px var(--gold), 0 0 40px var(--gold); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Combo punch when active */
.combo-stat.active b {
    animation: combo-pop 0.3s ease;
}

@keyframes combo-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Banner pop */
#banner.show {
    animation: banner-pop 0.3s ease;
}

@keyframes banner-pop {
    0% { transform: translate(-50%, -50%) scale(0.7); }
    60% { transform: translate(-50%, -50%) scale(1.06); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* ---------------- Settings: no animations ---------------- */
body.no-anim *,
body.no-anim *::before,
body.no-anim *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
        scroll-behavior: auto !important;
    }
}