/* ============================================================
   NACHAT — ANIMATION STYLESHEET
   All keyframes + scroll-reveal + reduced-motion handling
============================================================= */

/* ============================================================
   SCROLL REVEAL (JS toggles .in-view)
============================================================= */
.reveal-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 640ms var(--ease-settle), transform 640ms var(--ease-settle);
}
.reveal-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Staggering handled inline via JS-assigned transition-delay,
   but provide graceful default stagger for direct siblings */
.grid-3 .tile.in-view:nth-child(1),
.grid-4 .card-h.in-view:nth-child(1) { transition-delay: 0ms; }
.grid-3 .tile.in-view:nth-child(2),
.grid-4 .card-h.in-view:nth-child(2) { transition-delay: 100ms; }
.grid-3 .tile.in-view:nth-child(3),
.grid-4 .card-h.in-view:nth-child(3) { transition-delay: 200ms; }
.grid-4 .card-h.in-view:nth-child(4) { transition-delay: 300ms; }

/* ============================================================
   HERO PHONE FLOAT
============================================================= */
@keyframes phoneFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.phone-float {
  animation: phoneFloat 6s ease-in-out infinite;
}

/* Floating satellite cards bob independently, slightly out of phase */
@keyframes bobA {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(-1deg); }
}
@keyframes bobB {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(12px) rotate(1deg); }
}
.bob-a { animation: bobA 5s ease-in-out infinite; }
.bob-b { animation: bobB 5.6s ease-in-out infinite 0.4s; }

/* ============================================================
   TYPING INDICATOR
============================================================= */
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.mock-typing span { animation: typingBounce 1.2s ease-in-out infinite; }
.mock-typing span:nth-child(2) { animation-delay: 0.15s; }
.mock-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Sequenced chat bubbles reveal one at a time when in view */
.mock-bubble.seq {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 420ms var(--ease-settle), transform 420ms var(--ease-settle);
}
.mock-chat-body.in-view .mock-bubble.seq {
  opacity: 1;
  transform: translateY(0);
}
.mock-chat-body.in-view .mock-bubble.seq[data-delay="0"] { transition-delay: 100ms; }
.mock-chat-body.in-view .mock-bubble.seq[data-delay="1"] { transition-delay: 500ms; }
.mock-chat-body.in-view .mock-bubble.seq[data-delay="2"] { transition-delay: 900ms; }

@keyframes reactionPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.mock-chat-body.in-view .reaction-target .mock-reaction {
  animation: reactionPop 420ms var(--ease-settle) 1.3s backwards;
}

/* ============================================================
   CALL RIPPLE
============================================================= */
@keyframes ripple {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(1.9); opacity: 0; }
}
.ripple { animation: ripple 2.2s ease-out infinite; }
.ripple.r2 { animation-delay: 0.9s; }

/* ============================================================
   WALLET BALANCE COUNT-UP (value set via JS, transition provides easing) */
#walletBalance { display: inline-block; }

/* ============================================================
   PAYMENTS SUCCESS CHECKMARK
============================================================= */
#checkPath {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 600ms var(--ease-settle);
}
.pay-flow.success #checkPath { stroke-dashoffset: 0; }
.pay-flow.success .pay-success {
  opacity: 1;
  transition: opacity 400ms var(--ease-settle);
}
.pay-success { transition: opacity 400ms var(--ease-settle); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.cursor-blink { animation: blink 1s step-start infinite; }

/* ============================================================
   SECURITY ICON DRAW-IN
============================================================= */
.tile-dark svg path,
.tile-dark svg rect,
.tile-dark svg circle {
  transition: opacity 800ms var(--ease-settle);
}

/* ============================================================
   DOWNLOAD CTA — ONE-TIME GLOW
============================================================= */
@keyframes glowPulse {
  0% { box-shadow: 0 0 0 0 rgba(155, 211, 90, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(155, 211, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(155, 211, 90, 0); }
}
.glow-once.in-view { animation: glowPulse 1.4s var(--ease-settle) 1; }

/* ============================================================
   BEAUTIFUL EVERYWHERE — SUBTLE SCROLL PARALLAX
   (JS sets --parallax-y custom property per phone)
============================================================= */
.fan-left, .fan-right, .fan-center {
  transform: translateY(var(--parallax-y, 0px));
}
.fan-left { transform: rotate(-8deg) translateY(var(--parallax-y, 0px)); }
.fan-right { transform: rotate(8deg) translateY(var(--parallax-y, 0px)); }

/* ============================================================
   REDUCED MOTION — CALM MODE FALLBACK
============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .phone-float,
  .bob-a,
  .bob-b,
  .ripple,
  .mock-typing span,
  .glow-once.in-view {
    animation: none !important;
  }

  .reveal-up {
    transition: opacity 300ms linear !important;
    transform: none !important;
  }

  .mock-bubble.seq {
    transition: opacity 300ms linear !important;
    transform: none !important;
  }

  .fan-left, .fan-right, .fan-center {
    transform: none !important;
  }

  #checkPath { transition: none; }
  .pay-flow.success #checkPath { stroke-dashoffset: 0; }
}
