/* ============================================================
   CallD.AI — Animations
   Scroll-reveal, diagram animations, hover effects
   ============================================================ */

/* ── Scroll Reveal ── */
/* Elements start hidden, revealed by IntersectionObserver adding .is-visible */

.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children: add delay via data attribute or nth-child */
.fade-up[data-delay="1"] { transition-delay: 0.1s; }
.fade-up[data-delay="2"] { transition-delay: 0.2s; }
.fade-up[data-delay="3"] { transition-delay: 0.3s; }
.fade-up[data-delay="4"] { transition-delay: 0.4s; }
.fade-up[data-delay="5"] { transition-delay: 0.5s; }

.fade-in {
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}

.fade-in.is-visible {
  opacity: 1;
}

.scale-in {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.scale-in.is-visible {
  opacity: 1;
  transform: scale(1);
}

.slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.slide-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.slide-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ── Keyframe Animations (for always-running elements) ── */

/* Floating pills in architecture diagrams */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-8px); }
}

.anim-float {
  animation: float 4s ease-in-out infinite;
}

.anim-float-slow {
  animation: float 6s ease-in-out infinite;
}

/* Pulsing glow */
@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.95; transform: scale(1.03); }
}

.anim-pulse {
  animation: pulse 3s ease-in-out infinite;
}

/* Dashed flow lines */
@keyframes dash {
  to { stroke-dashoffset: -360; }
}

.anim-dash {
  animation: dash 20s linear infinite;
}

/* Moving dot along connectors (straight — legacy) */
@keyframes dot-flow {
  0%   { left: -6px; opacity: 0; }
  8%   { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: calc(100% + 6px); opacity: 0; }
}

/* Moving dot along wave connectors — one full cycle per crossing */
@keyframes dot-flow-wave {
  0%   { left: -6px;             opacity: 0; transform: translateY(0);    }
  5%   {                         opacity: 1;                              }
  25%  {                                     transform: translateY(-4px); }
  50%  {                                     transform: translateY(0);    }
  75%  {                                     transform: translateY(4px);  }
  92%  {                         opacity: 1;                              }
  100% { left: calc(100% + 6px); opacity: 0; transform: translateY(0);   }
}

/* Voice waveform bars */
@keyframes bar {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.3); }
}

.voice-bar {
  animation: bar 1.2s ease-in-out infinite;
}

.voice-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bar:nth-child(4) { animation-delay: 0.3s; }
.voice-bar:nth-child(5) { animation-delay: 0.15s; }
.voice-bar:nth-child(6) { animation-delay: 0.25s; }
.voice-bar:nth-child(7) { animation-delay: 0.35s; }

/* Gentle rotation (for loading or decorative) */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Marquee / auto-scroll */
@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.marquee-track {
  display: flex;
  animation: marquee 40s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* ── Card hover effects ── */
.card-hover {
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ── Button press ── */
.btn-press:active {
  transform: scale(0.97);
}

/* ── 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;
  }

  .fade-up,
  .fade-in,
  .scale-in,
  .slide-left,
  .slide-right {
    opacity: 1;
    transform: none;
  }
}
