/* ============ SCROLL-TRIGGERED ANIMATIONS ============ */

.anim-fade-up {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stagger children within grids */
.benefits-grid .anim-fade-up:nth-child(1) { transition-delay: 0ms; }
.benefits-grid .anim-fade-up:nth-child(2) { transition-delay: 80ms; }
.benefits-grid .anim-fade-up:nth-child(3) { transition-delay: 160ms; }
.benefits-grid .anim-fade-up:nth-child(4) { transition-delay: 240ms; }
.benefits-grid .anim-fade-up:nth-child(5) { transition-delay: 320ms; }
.benefits-grid .anim-fade-up:nth-child(6) { transition-delay: 400ms; }

/* ============ HERO ENTRANCE ============ */
.hero .hero-eyebrow,
.hero .hero-title,
.hero .hero-subtitle,
.hero .hero-cta-group {
  opacity: 0;
  transform: translateY(24px);
  animation: hero-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero .hero-eyebrow   { animation-delay: 0.1s; }
.hero .hero-title      { animation-delay: 0.25s; }
.hero .hero-subtitle   { animation-delay: 0.4s; }
.hero .hero-cta-group  { animation-delay: 0.55s; }

@keyframes hero-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ BAR CHART ANIMATION ============ */
/* Bar growth handled in styles.css */

@keyframes insight-pulse {
  0%, 100% {
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    filter: brightness(1.15);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4), 0 0 50px rgba(249, 115, 22, 0.2);
  }
}

/* ============ METRIC TILES ANIMATION ============ */
.metric-tile {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.feature-block.visible .metric-tile {
  opacity: 1;
  transform: scale(1);
}

.feature-block.visible .metric-tile:nth-child(1) { transition-delay: 0ms; }
.feature-block.visible .metric-tile:nth-child(2) { transition-delay: 100ms; }
.feature-block.visible .metric-tile:nth-child(3) { transition-delay: 200ms; }
.feature-block.visible .metric-tile:nth-child(4) { transition-delay: 300ms; }

/* ============ CHAT MESSAGES ANIMATION ============ */
.chat-msg {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}

.feature-block.visible .chat-msg {
  opacity: 1;
  transform: translateY(0);
}

.feature-block.visible .chat-msg:nth-child(1) { transition-delay: 200ms; }
.feature-block.visible .chat-msg:nth-child(2) { transition-delay: 600ms; }
.feature-block.visible .chat-msg:nth-child(3) { transition-delay: 1000ms; }

/* ============ UNIFIED SOURCES ANIMATION ============ */
.unified-source {
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.35s ease-out, transform 0.35s ease-out,
              border-color 0.3s ease-out, color 0.3s ease-out, box-shadow 0.3s ease-out;
}

.feature-block.visible .unified-source {
  opacity: 1;
  transform: scale(1);
}

/* Stagger: top row children 1-3, center is child 4, bottom row children 5-7 */
.feature-block.visible .unified-source:nth-child(1) { transition-delay: 0ms; }
.feature-block.visible .unified-source:nth-child(2) { transition-delay: 80ms; }
.feature-block.visible .unified-source:nth-child(3) { transition-delay: 160ms; }
.feature-block.visible .unified-source:nth-child(5) { transition-delay: 240ms; }
.feature-block.visible .unified-source:nth-child(6) { transition-delay: 320ms; }
.feature-block.visible .unified-source:nth-child(7) { transition-delay: 400ms; }

.unified-center {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  transition-delay: 200ms;
}

.feature-block.visible .unified-center {
  opacity: 1;
  transform: scale(1);
}

/* Center pulsing glow — continuous */
@keyframes unified-center-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); }
  50% { box-shadow: 0 4px 30px rgba(0, 136, 168, 0.4), 0 0 20px rgba(0, 136, 168, 0.2); }
}

.feature-block.visible .unified-center {
  animation: unified-center-pulse 5s ease-in-out infinite;
  animation-delay: 0.8s;
}

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

  .anim-fade-up,
  .hero .hero-eyebrow,
  .hero .hero-title,
  .hero .hero-subtitle,
  .hero .hero-cta-group,
  .insight-bar,
  .metric-tile,
  .chat-msg,
  .unified-source,
  .unified-center,
  .agent-node {
    opacity: 1 !important;
    transform: none !important;
  }

  .agent-node-1 {
    transform: translateX(-50%) !important;
  }

}
