/* ==========================================================================
   Westerosdle - Animations & Keyframes
   3D Card Flip, Reveal Delays, Shake, Glow & Micro-interactions
   ========================================================================== */

/* 3D Flip Reveal for Result Cells */
@keyframes flipReveal {
  0% {
    transform: rotateX(0deg);
  }
  45% {
    transform: rotateX(90deg);
  }
  55% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

.cell.flip-animate {
  animation: flipReveal 0.65s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards;
  backface-visibility: hidden;
}

/* Staggered Flip Delays for Columns */
.cell.delay-0 { animation-delay: 0.00s; }
.cell.delay-1 { animation-delay: 0.20s; }
.cell.delay-2 { animation-delay: 0.40s; }
.cell.delay-3 { animation-delay: 0.60s; }
.cell.delay-4 { animation-delay: 0.80s; }
.cell.delay-5 { animation-delay: 1.00s; }
.cell.delay-6 { animation-delay: 1.20s; }
.cell.delay-7 { animation-delay: 1.40s; }

/* Shake Error Animation (Invalid Input or Already Guessed) */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake {
  animation: shakeError 0.4s ease-in-out;
}

/* Pop In Animation for List/Cards */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.pop-in {
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Pulse Victory Glow */
@keyframes victoryPulse {
  0%, 100% {
    box-shadow: 0 0 15px var(--gold-primary), 0 0 30px rgba(212, 175, 55, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 25px var(--gold-light), 0 0 50px rgba(212, 175, 55, 0.7);
    transform: scale(1.02);
  }
}

.victory-glow {
  animation: victoryPulse 2s infinite ease-in-out;
}

/* Fade In / Out for Toasts */
@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-15px) scale(0.9);
  }
}

.toast.enter {
  animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.exit {
  animation: toastOut 0.2s ease-in forwards;
}
