/* ============================================
   CUSTOM ANIMATIONS — Bi Innovate
   Page Transitions | Preloader | Glow Orb | Keyframes
   ============================================ */

/* === Page Transitions (Nuxt built-in) === */
.page-enter-active {
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.page-leave-active {
  transition: opacity 0.2s cubic-bezier(0.4, 0, 1, 1), transform 0.2s cubic-bezier(0.4, 0, 1, 1);
}
.page-enter-from {
  opacity: 0;
  transform: translateX(18px) scale(0.99);
}
.page-leave-to {
  opacity: 0;
  transform: translateX(-12px) scale(0.99);
}

/* === Preloader Keyframes (used in app.vue) === */
@keyframes preloaderPulse {
  from { opacity: 0.6; transform: scale(0.95); }
  to   { opacity: 1;   transform: scale(1.05); }
}

@keyframes techSpin {
  0%   { transform: rotate(0deg)   scale(0.8); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.8); }
}

/* === Form Glow Orb === */
@keyframes floatLight {
  0%   { transform: translate(0, 0)     scale(1);   opacity: 0.6; }
  100% { transform: translate(20px, -20px) scale(1.2); opacity: 1; }
}

/* === Subtle shimmer for section dividers === */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* === Gentle float for decorative elements === */
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* === GPU Acceleration Hints === */
.wow,
.preloader-spinner,
.preloader-logo,
.form-glow-orb {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes to free GPU memory */
.wow.animated {
  will-change: auto;
}

/* === Hover micro-animations — reusable utilities === */

/* Lift on hover (cards, buttons) */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}
.hover-lift:hover {
  transform: translateY(-4px);
}

/* Neon glow on hover — attach alongside .hover-lift */
.hover-neon:hover {
  box-shadow: 0 0 15px rgba(255, 0, 217, 0.5), 0 0 30px rgba(255, 0, 217, 0.3) !important;
}

/* === Smooth section entrance — staggered children === */
.wow.fadeInUp .service-six-item,
.wow.fadeInUp .why-choose-item,
.wow.fadeInUp .work-step-item {
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Enhanced card hover — unified across site === */
.service-six-item,
.why-choose-item,
.service-item-four,
.client-logo-item,
.bi-team-card,
.policy-section,
.terms-section {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

/* === Smooth icon rotation on hover === */
.service-six-item .icon i,
.why-choose-item .icon i,
.work-step-item .icon i {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.service-six-item:hover .icon i {
  transform: scale(1.1);
  color: var(--ygency-primary-color, var(--c-accent));
}

/* === Divider line shimmer effect === */
.divider-line {
  background: linear-gradient(90deg, var(--c-accent), #ff6ef0, var(--c-accent));
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
}

/* === Sub-title accent line pulse === */
.sub-title::before {
  transition: transform 0.3s ease;
}

/* === Smooth link underline animation === */
.footer-widget a,
.list-style-two a {
  position: relative;
  transition: color 0.3s ease;
}

.footer-widget a::after,
.list-style-two a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--ygency-primary-color, var(--c-accent));
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html[dir="rtl"] .footer-widget a::after,
html[dir="rtl"] .list-style-two a::after {
  left: auto;
  right: 0;
}

.footer-widget a:hover::after,
.list-style-two a:hover::after {
  width: 100%;
}

/* === Step number glow on hover === */
.work-step-item .step-number {
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.work-step-item:hover .step-number {
  color: var(--ygency-primary-color, var(--c-accent));
  text-shadow: 0 0 20px rgba(255, 0, 217, 0.4);
}

/* === Counter number glow === */
.count-text .count {
  transition: text-shadow 0.3s ease;
}

.counter-item:hover .count-text .count {
  text-shadow: 0 0 15px rgba(255, 0, 217, 0.3);
}

/* === Headline marquee smooth === */
.headline-text.marquee,
.marquee-inner {
  transition: none;
}

/* === Section accent line animation === */
.bi-section-accent::after {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.bi-section-accent:hover::after {
  width: 120px;
}

/* === Mouse-follow 3D Tilt (JS sets --tilt-x, --tilt-y) === */
.bi-tilt {
  transform: perspective(800px)
             rotateX(calc(var(--tilt-y, 0) * 1deg))
             rotateY(calc(var(--tilt-x, 0) * 1deg));
  transition: transform 0.15s ease-out;
}

/* === Staggered grid entrance (skill badges) === */
.bi-stagger > * {
  opacity: 0;
  transform: translateY(15px) scale(0.96);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.bi-stagger.bi-visible > * {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bi-stagger.bi-visible > *:nth-child(1)  { transition-delay: 0s; }
.bi-stagger.bi-visible > *:nth-child(2)  { transition-delay: 0.04s; }
.bi-stagger.bi-visible > *:nth-child(3)  { transition-delay: 0.08s; }
.bi-stagger.bi-visible > *:nth-child(4)  { transition-delay: 0.12s; }
.bi-stagger.bi-visible > *:nth-child(5)  { transition-delay: 0.16s; }
.bi-stagger.bi-visible > *:nth-child(6)  { transition-delay: 0.20s; }
.bi-stagger.bi-visible > *:nth-child(7)  { transition-delay: 0.24s; }
.bi-stagger.bi-visible > *:nth-child(8)  { transition-delay: 0.28s; }
.bi-stagger.bi-visible > *:nth-child(9)  { transition-delay: 0.32s; }
.bi-stagger.bi-visible > *:nth-child(10) { transition-delay: 0.36s; }
.bi-stagger.bi-visible > *:nth-child(11) { transition-delay: 0.40s; }
.bi-stagger.bi-visible > *:nth-child(12) { transition-delay: 0.44s; }
.bi-stagger.bi-visible > *:nth-child(13) { transition-delay: 0.48s; }
.bi-stagger.bi-visible > *:nth-child(14) { transition-delay: 0.52s; }
.bi-stagger.bi-visible > *:nth-child(15) { transition-delay: 0.56s; }
.bi-stagger.bi-visible > *:nth-child(16) { transition-delay: 0.60s; }
.bi-stagger.bi-visible > *:nth-child(17) { transition-delay: 0.64s; }
.bi-stagger.bi-visible > *:nth-child(18) { transition-delay: 0.68s; }

/* === Accessibility: Respect user's motion preferences === */
@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;
  }

  .wow {
    visibility: visible !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .preloader-spinner::before,
  .preloader-spinner::after {
    animation: none !important;
  }

  .preloader-logo {
    animation: none !important;
  }

  .form-glow-orb {
    animation: none !important;
  }

  .hover-lift:hover {
    transform: none;
  }

  .page-enter-active,
  .page-leave-active {
    transition: none;
  }

  .page-enter-from,
  .page-leave-to {
    opacity: 1;
    transform: none;
  }

  .divider-line {
    animation: none !important;
  }

  .bi-section-accent::after {
    width: 120px;
  }

  .bi-tilt {
    transform: none !important;
  }

  .bi-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition-delay: 0s !important;
  }

  .bi-text-reveal,
  .bi-text-reveal span {
    clip-path: none !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ============================================
   HERO TEXT REVEAL — clip-path slide-up
   Apply .bi-text-reveal to any heading wrapper.
   Children get staggered automatically.
   ============================================ */
@keyframes biTextReveal {
  from {
    clip-path: inset(100% 0 0 0);
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    clip-path: inset(0% 0 0 0);
    transform: translateY(0);
    opacity: 1;
  }
}

.bi-text-reveal {
  overflow: hidden;
}

.bi-text-reveal > *,
.bi-text-reveal span,
.bi-text-reveal i {
  display: inline-block;
  animation: biTextReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bi-text-reveal > *:nth-child(1) { animation-delay: 0.1s; }
.bi-text-reveal > *:nth-child(2) { animation-delay: 0.22s; }
.bi-text-reveal > *:nth-child(3) { animation-delay: 0.34s; }

/* Auto-apply on hero heading */
.hero-content h1 {
  overflow: hidden;
}

.hero-content h1 > span,
.hero-content h1 > i {
  display: inline-block;
  animation: biTextReveal 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-content h1 > span { animation-delay: 0.35s; }
.hero-content h1 > i    { animation-delay: 0.5s; }
