/* ==========================================================================
   Tapitt Talks Companion — animations.css
   Keyframes and transition utility classes.
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 91, 214, 0.35); transform: scale(1); }
  50% { box-shadow: 0 0 0 16px rgba(91, 91, 214, 0); transform: scale(1.03); }
}

@keyframes progressFill {
  from { width: 0%; }
  to { width: var(--fill-to, 100%); }
}

@keyframes unlockBounce {
  0% { transform: scale(0.85) rotate(-4deg); opacity: 0; }
  55% { transform: scale(1.06) rotate(2deg); opacity: 1; }
  80% { transform: scale(0.98) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes shakeX {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

@keyframes checkmarkDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes confettiFall {
  from { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  to { transform: translateY(110vh) rotate(360deg); opacity: 0.9; }
}

@keyframes screenFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes screenFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes splashProgress {
  from { width: 0%; }
  to { width: 100%; }
}

/* ---------------------------------------------------------------------- */
/* Utility classes                                                          */
/* ---------------------------------------------------------------------- */

.animate-fade-in {
  animation: fadeIn var(--transition-base) ease both;
}

.animate-fade-in-up {
  animation: fadeInUp var(--transition-slow) ease both;
}

.animate-slide-in-right {
  animation: slideInRight var(--transition-base) ease both;
}

.animate-pulse-glow {
  animation: pulseGlow 2.2s ease-in-out infinite;
}

.animate-shake {
  animation: shakeX 420ms ease-in-out;
}

.animate-unlock {
  animation: unlockBounce 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Stagger helper for lists of .animate-fade-in-up children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

/* ---------------------------------------------------------------------- */
/* Splash-specific                                                          */
/* ---------------------------------------------------------------------- */

.splash-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-surface);
}

.splash-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
}

.splash-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: 0 var(--spacing-lg);
}

.splash-logo {
  margin-bottom: var(--spacing-sm);
  border-radius: var(--radius-lg);
}

.splash-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  animation: fadeInUp var(--transition-slow) ease 200ms both;
}

.splash-tagline {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-accent);
  animation: fadeInUp var(--transition-slow) ease 320ms both;
}

/* ---------------------------------------------------------------------- */
/* Confetti piece (created dynamically by completion.js)                   */
/* ---------------------------------------------------------------------- */

.confetti-piece {
  position: absolute;
  top: -10px;
  will-change: transform, opacity;
}

/* ---------------------------------------------------------------------- */
/* Reduced motion overrides                                                 */
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .animate-pulse-glow {
    animation: none;
    box-shadow: none;
  }

  .checkmark-path {
    stroke-dashoffset: 0;
    animation: none;
  }
}
