/* ==========================================================================
   HELIOS EPC & SOLARIS - Animation System
   Kinetic Keyframes, Solar Ray Shimmer, Energy Flow Pulses, Bloom Dynamics
   ========================================================================== */

/* 1. Pulsing Indicators */
@keyframes pulse-dot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 8px var(--energy-green);
  }
  50% {
    transform: scale(1.35);
    opacity: 0.75;
    box-shadow: 0 0 16px var(--energy-green-glow);
  }
}

@keyframes pulse-solar {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.4));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 45px rgba(245, 158, 11, 0.8));
  }
}

/* 2. Sun Corona Rotation & Flare Breathing */
@keyframes sun-corona-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes sun-ray-stream {
  0% {
    opacity: 0.3;
    stroke-dashoffset: 100;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.3;
    stroke-dashoffset: 0;
  }
}

/* 3. Electric Particle & Pulse Current */
@keyframes electric-flow {
  0% {
    stroke-dashoffset: 200;
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0.4;
  }
}

@keyframes flow-glow {
  0%, 100% {
    filter: drop-shadow(0 0 4px var(--electric-cyan));
  }
  50% {
    filter: drop-shadow(0 0 12px var(--electric-cyan-glow)) drop-shadow(0 0 20px rgba(6, 182, 212, 0.8));
  }
}

/* 4. Photovoltaic Cell Sparkle */
@keyframes cell-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 5. Inverter Sine Wave Motion */
@keyframes wave-motion {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* 6. Smart Battery Charging Wave */
@keyframes battery-charge {
  0% {
    height: 15%;
    opacity: 0.6;
  }
  50% {
    height: 95%;
    opacity: 1;
    box-shadow: 0 0 15px var(--energy-green);
  }
  100% {
    height: 15%;
    opacity: 0.6;
  }
}

/* 7. Spinning Net Meter Dial */
@keyframes meter-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 8. Button Light Sheen Sweep */
.btn-solar-primary::after,
.btn-cyan::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 40%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.75s ease;
}

.btn-solar-primary:hover::after,
.btn-cyan:hover::after {
  transform: translateX(100%);
}

/* 9. Floating Card Hover Physics */
.float-hover {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
.float-hover:hover {
  transform: translateY(-8px);
}

/* 10. Ambient Glow Breathing */
.glow-breathe {
  animation: glow-cycle 4s infinite alternate ease-in-out;
}

@keyframes glow-cycle {
  0% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
  }
  100% {
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.5), 0 0 60px rgba(245, 158, 11, 0.2);
  }
}

/* 11. Subtle Float Animation for Badges */
.float-slow {
  animation: float-y 5s ease-in-out infinite;
}

@keyframes float-y {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* 12. Grid Net Meter Pulse */
.grid-pulsing {
  animation: grid-pulse-anim 3s infinite ease-in-out;
}

@keyframes grid-pulse-anim {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.9;
    filter: drop-shadow(0 0 10px var(--electric-cyan-glow));
  }
}

/* 13. Minimal Luxury Scroll Reveals & Micro-Interactions */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay helpers for grid items */
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }
.reveal-delay-5 { transition-delay: 0.40s; }

/* 14. Subtle Kinetic Card & Elevation Physics */
.step-card,
.project-card,
.tier-card,
.faq-item,
.calc-inputs-card,
.calc-results-card,
.stat-item {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.step-card:hover,
.tier-card:hover,
.stat-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08), 0 0 16px rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}

/* 15. Accessible Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll,
  .float-slow,
  .glow-breathe,
  .grid-pulsing,
  .pulse-dot,
  .pulse-solar,
  .float-btn.whatsapp,
  .float-btn.whatsapp::before,
  .live-stats-bar .stat-item,
  .section-tag::after {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------------------------------------------------
   16. Dedicated Mobile View Animations & Tactile Touch Physics (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* A. Mobile Floating WhatsApp Radar Ripple Pulse */
  .float-btn.whatsapp {
    position: relative;
    animation: mobile-float-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .float-btn.whatsapp::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid #25d366;
    opacity: 0;
    pointer-events: none;
    animation: mobile-pulse-radar 4.5s cubic-bezier(0.25, 1, 0.5, 1) infinite;
  }

  @keyframes mobile-pulse-radar {
    0% {
      transform: scale(0.9);
      opacity: 0.85;
    }
    35% {
      transform: scale(1.45);
      opacity: 0;
    }
    100% {
      transform: scale(1.45);
      opacity: 0;
    }
  }

  @keyframes mobile-float-enter {
    0% {
      transform: scale(0.4) translateY(30px);
      opacity: 0;
    }
    100% {
      transform: scale(1) translateY(0);
      opacity: 1;
    }
  }

  /* B. Tactile Touch Press Physics (Instant Haptic Visual Feedback on Touch) */
  .btn:active,
  .float-btn:active,
  .tab-btn:active,
  .pill-option:active,
  .sim-btn-pill:active,
  .modal-close:active {
    transform: scale(0.94) !important;
    transition: transform 0.1s ease !important;
  }

  .step-card:active,
  .project-card:active,
  .tier-card:active,
  .stat-item:active {
    transform: scale(0.98) !important;
    transition: transform 0.12s ease !important;
  }

  /* C. Mobile Navigation Drawer Slide & Cascade Stagger */
  .nav-links.open {
    animation: mobile-drawer-slide 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes mobile-drawer-slide {
    0% {
      opacity: 0;
      transform: translateY(-12px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-links.open li {
    animation: mobile-item-cascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .nav-links.open li:nth-child(1) { animation-delay: 0.03s; }
  .nav-links.open li:nth-child(2) { animation-delay: 0.06s; }
  .nav-links.open li:nth-child(3) { animation-delay: 0.09s; }
  .nav-links.open li:nth-child(4) { animation-delay: 0.12s; }
  .nav-links.open li:nth-child(5) { animation-delay: 0.15s; }
  .nav-links.open li:nth-child(6) { animation-delay: 0.18s; }
  .nav-links.open li:nth-child(7) { animation-delay: 0.21s; }

  @keyframes mobile-item-cascade {
    0% {
      opacity: 0;
      transform: translateX(-10px);
    }
    100% {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* D. Mobile 2x2 Stats Dashboard Pop-in & Subtle Accent Pulse */
  .live-stats-bar .stat-item {
    animation: mobile-stat-pop 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .live-stats-bar .stat-item:nth-child(1) { animation-delay: 0.05s; }
  .live-stats-bar .stat-item:nth-child(2) { animation-delay: 0.12s; }
  .live-stats-bar .stat-item:nth-child(3) { animation-delay: 0.19s; }
  .live-stats-bar .stat-item:nth-child(4) { animation-delay: 0.26s; }

  @keyframes mobile-stat-pop {
    0% {
      opacity: 0;
      transform: translateY(14px) scale(0.96);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  /* E. Solar Category Pill Shimmer */
  .section-tag {
    position: relative;
    overflow: hidden;
  }

  .section-tag::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.2), transparent);
    animation: mobile-tag-sheen 3.5s infinite ease-in-out;
  }

  @keyframes mobile-tag-sheen {
    0%, 60% {
      left: -100%;
    }
    100% {
      left: 200%;
    }
  }

  /* F. Mobile Modal Smooth Bottom/Center Scale Entrance */
  .modal-overlay.open .modal-box {
    animation: mobile-modal-enter 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes mobile-modal-enter {
    0% {
      opacity: 0;
      transform: translateY(24px) scale(0.96);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}
