/* ==========================================================================
   animations.css — keyframes and scroll-reveal initial state
   (.reveal-up is animated to identity by GSAP ScrollTrigger in js/effects.js)
   ========================================================================== */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes float-particle {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-100vh) scale(0); opacity: 0; }
}

/* Initial state for scroll-triggered reveals. */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
}

/* --- Voice AI demo modal ------------------------------------------------------ */

/* Modal entrance (scale + opacity rise) and exit (reverse). The `.open`
   class drives both directions from js/voice-demo.js. */
.voice-modal {
  opacity: 0;
  transition: opacity 0.3s var(--ease-smooth), visibility 0.3s var(--ease-smooth);
}

.voice-modal.open {
  opacity: 1;
}

.voice-modal__card {
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.35s var(--ease-smooth), opacity 0.35s var(--ease-smooth);
}

.voice-modal.open .voice-modal__card {
  opacity: 1;
  transform: none;
}

/* Agent speaking pulse: js/voice-demo.js toggles `.is-speaking` on the ring
   from the WebAudio RMS amplitude gate measured on the agent analyser. */
@keyframes agent-speaking-glow {
  0%   { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.5), 0 0 24px rgba(168, 85, 247, 0.3); }
  70%  { box-shadow: 0 0 0 18px rgba(168, 85, 247, 0), 0 0 40px rgba(168, 85, 247, 0.5); }
  100% { box-shadow: 0 0 0 18px rgba(168, 85, 247, 0), 0 0 24px rgba(168, 85, 247, 0.3); }
}

.voice-modal__ring.is-speaking {
  animation: agent-speaking-glow 1.6s var(--ease-smooth) infinite;
  border-color: rgba(168, 85, 247, 0.8);
}

/* Reduced motion: no continuous pulses, no scale — plain fades. */
@media (prefers-reduced-motion: reduce) {
  .voice-modal__ring.is-speaking {
    animation: none;
    border-color: rgba(168, 85, 247, 0.8);
  }

  .voice-modal,
  .voice-modal.open {
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .voice-modal__card,
  .voice-modal.open .voice-modal__card {
    transform: none;
    transition: opacity 0.2s ease;
  }
}

/* --- Contact FAB ------------------------------------------------------------ */

/* Idle "breathing" ring: expands from the neon-blue trigger core, then rests. */
@keyframes fab-idle-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.35); }
  70%  { box-shadow: 0 0 0 18px rgba(0, 212, 255, 0); }
  100% { box-shadow: 0 0 0 18px rgba(0, 212, 255, 0); }
}

.contact-fab__trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  animation: fab-idle-pulse 2.6s var(--ease-smooth) infinite;
  pointer-events: none;
}

/* An open dial is signal enough — stop the idle pulse while expanded. */
.contact-fab.open .contact-fab__trigger::before {
  animation: none;
}

/* Staggered spring slide-up for the speed-dial items: the item nearest the
   trigger (4th child) pops first, the topmost last. Delays apply only to the
   opening transition, so collapsing is instant and un-staggered. */
.contact-fab__item {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.85);
  transform-origin: 100% 100%;
  transition:
    opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0.35s;
}

.contact-fab.open .contact-fab__item {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.contact-fab.open .contact-fab__item:nth-child(4) { transition-delay: 0s; }
.contact-fab.open .contact-fab__item:nth-child(3) { transition-delay: 0.05s; }
.contact-fab.open .contact-fab__item:nth-child(2) { transition-delay: 0.1s; }
.contact-fab.open .contact-fab__item:nth-child(1) { transition-delay: 0.15s; }

/* Reduced motion: no continuous pulses, no slide/spring — plain fades. */
@media (prefers-reduced-motion: reduce) {
  .contact-fab__trigger::before,
  .contact-fab.open .contact-fab__trigger::before {
    animation: none;
  }

  .contact-fab__item,
  .contact-fab.open .contact-fab__item {
    transition: opacity 0.2s ease, visibility 0.2s ease;
    transform: none;
  }
}
