/* Word Game - Animation Keyframes and Classes */

/* CSS Custom Properties for animation timing */
:root {
    --anim-flip-duration: 500ms;
    --anim-flip-delay: 250ms;
    --anim-bounce-duration: 1000ms;
    --anim-shake-duration: 500ms;
    --anim-pop-duration: 100ms;
}

/* Tile Flip Animation — 3D flip with color reveal at halfway point */
@keyframes flip {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.tile-flip {
    animation: flip var(--anim-flip-duration) ease-in-out forwards;
}

/* Bounce Animation — vertical bounce for winning tiles */
@keyframes bounce {
    0%, 20% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    50% {
        transform: translateY(5px);
    }
    60% {
        transform: translateY(-15px);
    }
    80% {
        transform: translateY(2px);
    }
    100% {
        transform: translateY(0);
    }
}

.tile-bounce {
    animation: bounce var(--anim-bounce-duration) ease forwards;
}

/* Shake Animation — horizontal shake for invalid word */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.row-shake {
    animation: shake var(--anim-shake-duration) ease-in-out forwards;
}

/* Pop Animation — scale-up pop for key press */
@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.tile-pop {
    animation: pop var(--anim-pop-duration) ease-in-out forwards;
}

/* Reduced motion: disable animations but preserve color feedback */
@media (prefers-reduced-motion: reduce) {
    .tile-flip,
    .tile-bounce,
    .row-shake,
    .tile-pop {
        animation: none !important;
    }
}
