/* ==========================================================================
   Animations & Micro-interactions V3 — Subtilité, Vivacité & Confort
   ========================================================================== */

/* 1. Le Bouton impatient qui vibre périodiquement */
@keyframes wiggle-pulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.28);
  }
  15% {
    transform: scale(1.03) rotate(-1.5deg);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.42);
  }
  25% {
    transform: scale(1.03) rotate(1.5deg);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.42);
  }
  35% {
    transform: scale(1.02) rotate(-1deg);
  }
  45% {
    transform: scale(1.01) rotate(1deg);
  }
  55% {
    transform: scale(1) rotate(0deg);
  }
}

.btn-impatient {
  animation: wiggle-pulse 4s ease-in-out infinite;
  animation-delay: 2.5s;
}

.btn-impatient:hover {
  animation: none;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(234, 88, 12, 0.45);
}

/* 2. Pulse Status Dot */
@keyframes pulse-soft {
  0% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.5);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(5, 150, 105, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
  }
}

/* 3. Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.15s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.2s; }

/* 4. 3D Tilt Card Base */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

/* 5. Smooth Fade In for Dynamic Panels */
@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: panelFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 6. Memoji Lifelike Micro-Float */
@keyframes memoji-lifelike-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  28% {
    transform: translateY(-8px) rotate(1deg);
  }
  60% {
    transform: translateY(-3px) rotate(-0.8deg);
  }
  82% {
    transform: translateY(-1px) rotate(0.4deg);
  }
}

.memoji-lifelike {
  animation: memoji-lifelike-float 5.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  will-change: transform;
}

/* 7. Status Pill Alive Micro-Hop (Dynamic Island style) */
@keyframes pill-alive-hop {
  0%, 80%, 100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.16);
  }
  85% {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.28);
  }
  89% {
    transform: translateY(0) scale(0.99);
  }
  93% {
    transform: translateY(-1px) scale(1.01);
  }
}

.status-pill-alive {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(236, 253, 245, 0.88);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.16);
  animation: pill-alive-hop 6.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.status-pill-alive .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulse-soft 2.2s infinite;
}

/* 8. Organic Ambient Mesh Drift (Depth without cyberpunk) */
@keyframes ambient-drift-warm {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-35px, 25px) scale(1.08);
  }
}

@keyframes ambient-drift-cool {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30px, -30px) scale(1.12);
  }
}

.hero-ambient-glow {
  position: absolute;
  inset: -15% -10%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.36;
}

.glow-blob-warm {
  top: 10%;
  right: 5%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.28) 0%, rgba(245, 158, 11, 0.12) 60%, transparent 80%);
  animation: ambient-drift-warm 14s ease-in-out infinite alternate;
}

.glow-blob-cool {
  bottom: 5%;
  left: 5%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(29, 78, 216, 0.24) 0%, rgba(59, 130, 246, 0.08) 60%, transparent 80%);
  animation: ambient-drift-cool 16s ease-in-out infinite alternate;
}

/* 9. Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .btn-impatient,
  .memoji-lifelike,
  .status-pill-alive,
  .glow-blob-warm,
  .glow-blob-cool {
    animation: none !important;
  }
}
