/* Petition signing modal animations */

@keyframes signing-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-signing-float {
  animation: signing-float 3s ease-in-out infinite;
}

/* Sign Petition button animations */

.sign-petition-btn .sign-pulse {
  animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
  0%, 60%, 100% {
    opacity: 0;
    transform: scale(1);
  }
  70% {
    opacity: 0.25;
    transform: scale(1.03);
  }
}

.sign-petition-btn .sign-icon {
  animation: penAttention 2s ease-in-out infinite;
  animation-delay: 0.3s;
}

@keyframes penAttention {
  0%, 50%, 100% { transform: translateX(0) rotate(0deg); }
  60% { transform: translateX(2px) rotate(-8deg); }
  70% { transform: translateX(-2px) rotate(8deg); }
  80% { transform: translateX(2px) rotate(-8deg); }
  90% { transform: translateX(0) rotate(0deg); }
}

.sign-petition-btn:hover .sign-icon {
  animation: penWrite 0.6s ease-in-out;
}

@keyframes penWrite {
  0% { transform: translateX(0) rotate(0deg) scale(1); }
  25% { transform: translateX(3px) rotate(-10deg) scale(1.1); }
  50% { transform: translateX(-2px) rotate(10deg) scale(1.1); }
  75% { transform: translateX(1px) rotate(-5deg) scale(1.05); }
  100% { transform: translateX(0) rotate(0deg) scale(1); }
}

.petition-signature-modal-trigger {
  position: relative;
  overflow: hidden;
}

.sign-petition-btn:active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    width: 200%;
    height: 200%;
    opacity: 0;
  }
}

.sign-petition-btn {
  border-radius: 0 0 0.25rem 0.25rem;
  margin-top: -1px;
}

.petition-signature-modal-trigger.signed .signed-shimmer {
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.08; }
}

.petition-signature-modal-trigger.signed .check-icon {
  animation: checkPulse 2.5s ease-in-out infinite;
}

@keyframes checkPulse {
  0%, 70%, 100% { transform: scale(1); }
  80% { transform: scale(1.2); }
  85% { transform: scale(1.1); }
}

.petition-signature-modal-trigger.signed:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.1), 0 2px 4px -1px rgba(34, 197, 94, 0.06);
}

.petition-signature-modal-trigger.signed:hover .check-icon {
  animation: checkSpin 0.5s ease-in-out;
}

@keyframes checkSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

/* PIN OTP shake — used on the signing modal's 6-box OTP group after a wrong code. */

.animate-shake {
  animation: pin-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Verified celebration confetti — 6 dots scattered around the eagle.
   Each dot gets inline --x / --y CSS variables so a single keyframe drives
   them in different directions. One-shot on mount of Phase C. */

.animate-confetti {
  animation: petition-confetti 1.2s cubic-bezier(0.15, 0.8, 0.4, 1) forwards;
}

@keyframes petition-confetti {
  0%   { transform: translate(0, 0) scale(0); opacity: 0; }
  25%  { transform: translate(calc(var(--x) * 0.3), calc(var(--y) * 0.3)) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}

/* Eagle lands with a spring bounce + slight rotation wobble — played once
   when the verified celebration phase mounts. The final frame holds at
   scale(1) / opacity(1) so the eagle stays visible after the animation. */

.animate-eagle-land {
  animation: eagle-land 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes eagle-land {
  0%   { transform: scale(0) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(4deg); opacity: 1; }
  80%  { transform: scale(0.96) rotate(-2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Gentle ongoing flutter after the eagle has landed — adds subtle life
   without being distracting. Loops indefinitely. */

.animate-eagle-flutter {
  animation: eagle-flutter 3.2s ease-in-out infinite;
}

@keyframes eagle-flutter {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  50%      { transform: translateY(-3px) rotate(1.5deg) scale(1); }
}
