/* ============================================================
   animations.css — Keyframes & Transition Animations
   Digital Ceremony Launcher
   ============================================================ */

/* ── Idle Screen ─────────────────────────────────────────────── */

@keyframes floatLogo {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

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

.idle-event-title {
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}

@keyframes twinkle {
  0%   { opacity: 0.5; }
  50%  { opacity: 1; }
  100% { opacity: 0.6; }
}

@keyframes pulseHands {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); filter: drop-shadow(0 0 20px rgba(0,255,220,0.8)); }
}

/* ── Waiting Prompt ──────────────────────────────────────────── */

@keyframes waitDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%       { opacity: 1;   transform: scale(1.2); }
}

/* ── Countdown ───────────────────────────────────────────────── */

.pulse {
  animation: pulseGlow 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes pulseGlow {
  0%   {
    transform: scale(0.4);
    opacity: 0;
    filter: blur(20px) drop-shadow(0 0 0 transparent);
  }
  30%  {
    transform: scale(1.25);
    opacity: 1;
    filter: blur(0) drop-shadow(0 0 60px rgba(0,255,220,0.8));
  }
  60%  {
    transform: scale(0.95);
    filter: drop-shadow(0 0 30px rgba(0,255,220,0.4));
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: drop-shadow(0 0 20px rgba(0,255,220,0.3));
  }
}

/* Glitch effect overlay for countdown */
@keyframes glitch {
  0%  { clip-path: inset(80% 0 0 0); transform: translate(-3px,  2px); }
  10% { clip-path: inset(10% 0 70% 0); transform: translate( 3px, -2px); }
  20% { clip-path: inset(50% 0 20% 0); transform: translate(-2px,  3px); }
  30% { clip-path: inset(30% 0 60% 0); transform: translate( 2px,  1px); }
  40% { clip-path: inset(60% 0 15% 0); transform: translate(-1px, -3px); }
  50% { clip-path: inset(15% 0 75% 0); transform: translate( 3px,  2px); }
  60% { clip-path: inset(40% 0 40% 0); transform: translate(-2px,  1px); }
  70% { clip-path: inset(75% 0 10% 0); transform: translate( 1px, -1px); }
  80% { clip-path: inset(5%  0 85% 0); transform: translate(-3px,  2px); }
  90% { clip-path: inset(25% 0 50% 0); transform: translate( 2px, -2px); }
  100%{ clip-path: inset(65% 0 25% 0); transform: translate(-1px,  1px); }
}

#countdown-number::before,
#countdown-number::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#screen-countdown {
  position: absolute;
}

#countdown-number {
  position: relative;
}

#countdown-number::before {
  color: var(--theme-color);
  text-shadow: -2px 0 var(--theme-color);
  animation: glitch 0.4s linear infinite;
  opacity: 0.6;
}

#countdown-number::after {
  color: var(--accent-color);
  text-shadow: 2px 0 var(--accent-color);
  animation: glitch 0.4s linear infinite reverse;
  opacity: 0.4;
}

/* ── Screen Flash (Climax) ───────────────────────────────────── */

@keyframes screenFlash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Screen Shake (Climax) ───────────────────────────────────── */

@keyframes shake {
  0%  { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-8px, 4px) rotate(-0.5deg); }
  20% { transform: translate(8px, -4px) rotate(0.5deg); }
  30% { transform: translate(-6px, 6px) rotate(-0.3deg); }
  40% { transform: translate(6px, -6px) rotate(0.3deg); }
  50% { transform: translate(-4px, 2px) rotate(-0.2deg); }
  60% { transform: translate(4px, -2px) rotate(0.2deg); }
  70% { transform: translate(-2px, 4px) rotate(-0.1deg); }
  80% { transform: translate(2px, -2px) rotate(0.1deg); }
  90% { transform: translate(-1px, 1px); }
  100%{ transform: translate(0, 0) rotate(0deg); }
}

/* ── Announcement Text Reveal ────────────────────────────────── */

@keyframes revealText {
  0%   {
    opacity: 0;
    transform: scale(0.2);
    filter: blur(30px) brightness(3);
  }
  40%  {
    opacity: 1;
    transform: scale(1.15);
    filter: blur(0) brightness(1.5);
  }
  70%  {
    transform: scale(0.95);
    filter: brightness(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

/* ── FadeIn Animations ───────────────────────────────────────── */

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

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

/* ── Celebration Card Entrance ───────────────────────────────── */

@keyframes cardEntrance {
  0%   {
    opacity: 0;
    transform: scale(0.5) translateY(60px);
    filter: blur(10px);
  }
  60%  {
    opacity: 1;
    transform: scale(1.05) translateY(-10px);
    filter: blur(0);
  }
  80%  {
    transform: scale(0.98) translateY(4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

/* ── Scan Canvas Fade ────────────────────────────────────────── */

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

/* ── Celebration Logo Pulse ──────────────────────────────────── */

.celebration-logo {
  animation: floatLogo 3s ease-in-out infinite,
             celebrationGlow 2s ease-in-out infinite alternate;
}

@keyframes celebrationGlow {
  0%   { filter: drop-shadow(0 0 15px var(--theme-color)); }
  100% { filter: drop-shadow(0 0 40px var(--accent-color)) brightness(1.2); }
}

/* ── Border Pulse (Celebration Card) ─────────────────────────── */

#celebration-card.entered {
  animation: cardEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             borderPulse 3s ease-in-out 1s infinite;
}

@keyframes borderPulse {
  0%, 100% { box-shadow: 0 0 40px rgba(0,255,220,0.15), 0 0 80px rgba(123,47,255,0.1); }
  50%       { box-shadow: 0 0 60px rgba(0,255,220,0.3),  0 0 120px rgba(123,47,255,0.2); }
}

/* ── Screen transition pulse (idle ↔ states) ─────────────────── */

.app-screen {
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-screen.active {
  animation: fadeIn 0.5s ease forwards;
}
