/* ============================================================================
   Dhilli Ads - Premium Modern Animation Layer
   css/animations.css
   ============================================================================ */

/* -------------------------------------------------------------------------- */
/* 0. Design Tokens                                                           */
/* -------------------------------------------------------------------------- */
:root {
  --motion-fast: 160ms;
  --motion-standard: 280ms;
  --motion-slow: 520ms;
  --ease-standard: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 200ms;
  --dur-base: 600ms;
  --dur-slow: 1000ms;
  --reveal-distance: 28px;
}

/* -------------------------------------------------------------------------- */
/* 1. Accessibility: prefers-reduced-motion (MANDATORY)                       */
/* -------------------------------------------------------------------------- */
@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;
  }
  .scroll-progress-bar {
    display: none !important;
  }
  .anim-word {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* -------------------------------------------------------------------------- */
/* 2. Top Scroll Progress Bar                                                 */
/* -------------------------------------------------------------------------- */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 99999;
  pointer-events: none;
}

.scroll-progress-bar .progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent-gradient, linear-gradient(135deg, #ff5722 0%, #ff3b00 50%, #e11d48 100%));
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

/* -------------------------------------------------------------------------- */
/* 3. Header & Navigation Micro-Interactions                                  */
/* -------------------------------------------------------------------------- */

/* Nav Link Underline Growth */
.nav-link {
  position: relative;
  transition: color 0.25s var(--ease-out);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-orange, #ff5722);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease-out);
  border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* Logo Gentle Scale */
.logo {
  transition: transform 0.25s var(--ease-out);
}
.logo:hover {
  transform: scale(1.04);
}

/* CTA Pulse Glow */
@keyframes ctaPulseGlow {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
  }
  50% {
    box-shadow: 0 4px 25px rgba(255, 87, 34, 0.55), 0 0 35px rgba(255, 87, 34, 0.2);
  }
}

.nav-actions-desktop .btn-primary,
.mobile-cta-item .btn-primary {
  animation: ctaPulseGlow 4s ease-in-out infinite;
}

.nav-actions-desktop .btn-primary:hover,
.mobile-cta-item .btn-primary:hover {
  animation-play-state: paused;
}

/* -------------------------------------------------------------------------- */
/* 4. Hero Section Animations                                                 */
/* -------------------------------------------------------------------------- */

/* Hero Title Word Split Mask */
.anim-word-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  line-height: 1.15;
}

.anim-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(115%);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.anim-word.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Ensure text-gradient on words renders background-clip correctly */
.anim-word.text-gradient {
  background: var(--accent-gradient, linear-gradient(135deg, #ff5722 0%, #ff3b00 50%, #e11d48 100%));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Button Shine Sweep Effect */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  pointer-events: none;
  transform: skewX(-20deg);
}

.btn-primary:hover::after {
  left: 140%;
  transition: left 0.65s ease;
}

/* WhatsApp Icon Wiggle on Button Hover */
@keyframes waIconWiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(5deg); }
}

.btn-whatsapp:hover .btn-whatsapp-img {
  animation: waIconWiggle 0.5s ease-in-out;
}

/* Ambient Hero Blobs */
.hero-ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

.hero-blob-orange {
  width: 380px;
  height: 380px;
  background: #ff5722;
  top: -60px;
  right: -60px;
  animation: ambientFloat1 24s ease-in-out infinite alternate;
}

.hero-blob-blue {
  width: 320px;
  height: 320px;
  background: #0284c7;
  bottom: -40px;
  left: -40px;
  animation: ambientFloat2 28s ease-in-out infinite alternate;
}

@keyframes ambientFloat1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-35px, 30px) scale(1.08); }
}

@keyframes ambientFloat2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -25px) scale(1.06); }
}

/* Dashboard Tracker Card Idle Float */
@keyframes trackerIdleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.hero-dashboard-preview {
  animation: trackerIdleFloat 5s ease-in-out infinite;
}

/* Metric Growth Badge Pop-in */
@keyframes growthBadgePop {
  0% { opacity: 0; transform: scale(0.65); }
  70% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

.dash-metric-growth.pop-in {
  animation: growthBadgePop 0.45s var(--ease-out-back) forwards;
}

/* -------------------------------------------------------------------------- */
/* 5. Card Hover & Micro-Interactions                                         */
/* -------------------------------------------------------------------------- */

/* Cursor Spotlight (Desktop Only) */
.glass-card:not(.pricing-card) {
  position: relative;
  overflow: hidden;
}

.glass-card .card-spotlight {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 87, 34, 0.08) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  z-index: 0;
}

.glass-card:hover .card-spotlight {
  opacity: 1;
}

/* Service Card Icon Rotate & Scale */
.service-card .service-icon {
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
}

.service-card:hover .service-icon {
  transform: rotate(6deg) scale(1.08);
}

/* Service Checklist Nudge on Hover */
.service-card .service-feature-item {
  transition: transform 0.2s var(--ease-out);
}

.service-card:hover .service-feature-item:nth-child(1) { transform: translateX(4px); transition-delay: 0ms; }
.service-card:hover .service-feature-item:nth-child(2) { transform: translateX(4px); transition-delay: 40ms; }
.service-card:hover .service-feature-item:nth-child(3) { transform: translateX(4px); transition-delay: 80ms; }

.service-card .feature-check {
  transition: transform 0.25s var(--ease-out-back);
}

.service-card:hover .feature-check {
  transform: scale(1.2);
}

/* -------------------------------------------------------------------------- */
/* 6. Why Choose Us Section                                                   */
/* -------------------------------------------------------------------------- */

/* Animated Gradient Underline Draw */
#why-us .text-gradient {
  position: relative;
  display: inline-block;
}

#why-us .text-gradient::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-gradient, linear-gradient(135deg, #ff5722, #e11d48));
  transform: scaleX(0);
  transform-origin: left;
  border-radius: 2px;
  transition: transform 0.8s var(--ease-out);
}

#why-us .text-gradient.draw-active::after {
  transform: scaleX(1);
}

/* Why Choose Us Emoji Bounce */
@keyframes emojiBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-3px); }
}

.why-us-grid .glass-card:hover .service-icon {
  animation: emojiBounce 0.5s var(--ease-out);
}

/* -------------------------------------------------------------------------- */
/* 7. Pricing & Estimator Animations                                          */
/* -------------------------------------------------------------------------- */

/* Popular Badge Shimmer Loop */
@keyframes badgeShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.popular-badge {
  background-size: 200% 100% !important;
  background-image: linear-gradient(
    90deg,
    #ff5722 0%,
    #ff8a65 35%,
    #ffffff 50%,
    #ff8a65 65%,
    #ff5722 100%
  ) !important;
  animation: badgeShimmer 3.5s linear infinite !important;
}

/* Estimator Checkbox Pop */
.checkbox-option .custom-chk {
  transition: transform 0.25s var(--ease-out-back), background 0.2s ease;
}

.checkbox-option.selected .custom-chk {
  transform: scale(1.15);
}

/* Estimator Total Pulse on Change */
@keyframes totalAmountPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); color: var(--primary-orange); }
  100% { transform: scale(1); }
}

.total-amount.pulse {
  animation: totalAmountPulse 0.35s var(--ease-out);
}

/* -------------------------------------------------------------------------- */
/* 8. Process Timeline Step Animations                                        */
/* -------------------------------------------------------------------------- */
.process-step {
  transition: transform 0.25s var(--ease-out);
}

.process-step .process-num {
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}

.process-step:hover .process-num {
  transform: scale(1.12) rotate(4deg);
  box-shadow: 0 0 18px rgba(255, 87, 34, 0.3);
}

/* -------------------------------------------------------------------------- */
/* 9. Software Tools Infinite Marquee                                         */
/* -------------------------------------------------------------------------- */
.marquee-container {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.tool-chip {
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease;
}

.tool-chip:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* -------------------------------------------------------------------------- */
/* 10. Industries Grid Hover Interaction                                      */
/* -------------------------------------------------------------------------- */
.industry-card {
  transition: transform 0.2s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
}

.industry-card:hover {
  transform: translateY(-4px);
}

.industry-card:hover .industry-icon {
  animation: emojiBounce 0.45s ease;
}

/* -------------------------------------------------------------------------- */
/* 11. Footer Link & Social Interactions                                      */
/* -------------------------------------------------------------------------- */
.footer-link {
  transition: transform 0.2s var(--ease-out), color 0.2s ease;
}

.footer-link:hover {
  transform: translateX(4px);
}

.footer .btn-secondary {
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease;
}

.footer .btn-secondary:hover {
  transform: scale(1.1) translateY(-2px);
}

/* -------------------------------------------------------------------------- */
/* 12. Modal Popup Animations                                                 */
/* -------------------------------------------------------------------------- */
.modal-close {
  transition: transform 0.25s var(--ease-out), background 0.2s ease;
}

.modal-close:hover {
  transform: rotate(90deg);
}

/* -------------------------------------------------------------------------- */
/* 13. Floating WhatsApp Pulse Ring & Wiggle                                  */
/* -------------------------------------------------------------------------- */
@keyframes waRadiateRing {
  0% { transform: scale(1); opacity: 0.65; }
  100% { transform: scale(1.75); opacity: 0; }
}

.floating-whatsapp::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.35);
  animation: waRadiateRing 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes waHoverWiggle {
  0%, 100% { transform: rotate(0deg) scale(1.12); }
  25% { transform: rotate(-8deg) scale(1.12); }
  75% { transform: rotate(8deg) scale(1.12); }
}

.floating-whatsapp:hover {
  animation: waHoverWiggle 0.4s ease-in-out;
}

/* -------------------------------------------------------------------------- */
/* 14. Global Button Interactions                                             */
/* -------------------------------------------------------------------------- */
.btn {
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) ease,
              background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: scale(0.97);
}

/* -------------------------------------------------------------------------- */
/* 15. Mobile & Touch Screen Optimizations (< 768px / hover: none)            */
/* -------------------------------------------------------------------------- */
@media (max-width: 768px), (hover: none) {
  .hero-ambient-blob {
    display: none !important;
  }
  .hero-dashboard-preview {
    animation: none !important;
  }
  .card-spotlight {
    display: none !important;
  }
}

/* Keep ambient motion restrained; hover feedback remains available on demand. */
.nav-actions-desktop .btn-primary,
.mobile-cta-item .btn-primary,
.popular-badge {
  animation: none !important;
}

.floating-whatsapp::before {
  animation: none;
  opacity: 0.18;
}

@media (hover: hover) and (pointer: fine) {
  .glass-card:hover { transform: translateY(-3px); }
  .pricing-card:hover { transform: translateY(-4px); }
  .pricing-card.popular:hover { transform: scale(1.03) translateY(-4px); }
  .industry-card:hover { transform: translateY(-3px); }
  .tool-chip:hover { transform: translateY(-2px); }
  .footer .btn-secondary:hover { transform: translateY(-2px); }
  .service-card:hover .service-icon { transform: rotate(3deg) scale(1.04); }
  .service-card:hover .feature-check { transform: scale(1.08); }
}
