/* ==========================================
   ANIMATIONS & KEYFRAMES
   ========================================== */

/* Gradient Shift */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Hero Background */
@keyframes heroGradient {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-5%, 3%) rotate(1deg); }
  50% { transform: translate(3%, -5%) rotate(-1deg); }
  75% { transform: translate(-3%, 5%) rotate(0.5deg); }
}

/* Pulse */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

/* Glow Pulse */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.05); }
}

/* Rotate Glow (photo border) */
@keyframes rotateGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Use a conic gradient for rotating border */
.hero-photo-wrapper::before {
  background: conic-gradient(
    from 0deg,
    #6c63ff,
    #00d4ff,
    #6c63ff,
    #ff6b35,
    #6c63ff
  );
}

/* Blink Cursor */
@keyframes blink {
  0%, 100% { border-color: var(--accent-secondary); }
  50% { border-color: transparent; }
}

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade In Up */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade In Down */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Fade In Right */
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Scale In */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Slide Up */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Spin */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================
   SCROLL ANIMATION CLASSES
   ========================================== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.fade-in-left {
  transform: translateX(-40px);
}

.animate-on-scroll.fade-in-right {
  transform: translateX(40px);
}

.animate-on-scroll.scale-in {
  transform: scale(0.85);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays for children */
.stagger-children .animate-on-scroll:nth-child(1) { transition-delay: 0.05s; }
.stagger-children .animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.stagger-children .animate-on-scroll:nth-child(3) { transition-delay: 0.15s; }
.stagger-children .animate-on-scroll:nth-child(4) { transition-delay: 0.2s; }
.stagger-children .animate-on-scroll:nth-child(5) { transition-delay: 0.25s; }
.stagger-children .animate-on-scroll:nth-child(6) { transition-delay: 0.3s; }
.stagger-children .animate-on-scroll:nth-child(7) { transition-delay: 0.35s; }
.stagger-children .animate-on-scroll:nth-child(8) { transition-delay: 0.4s; }
.stagger-children .animate-on-scroll:nth-child(9) { transition-delay: 0.45s; }
.stagger-children .animate-on-scroll:nth-child(10) { transition-delay: 0.5s; }

/* ==========================================
   ANIMATION UTILITY CLASSES
   ========================================== */
.anim-fade-in { animation: fadeIn 0.6s ease forwards; }
.anim-fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.anim-fade-in-down { animation: fadeInDown 0.6s ease forwards; }
.anim-fade-in-left { animation: fadeInLeft 0.6s ease forwards; }
.anim-fade-in-right { animation: fadeInRight 0.6s ease forwards; }
.anim-scale-in { animation: scaleIn 0.5s ease forwards; }
.anim-float { animation: float 6s ease-in-out infinite; }

/* Animation Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }

/* ==========================================
   LOADING SCREEN
   ========================================== */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================
   HOVER MICRO-ANIMATIONS
   ========================================== */

/* Magnetic hover effect for buttons */
.btn:active {
  transform: translateY(0) scale(0.98);
}

/* Card tilt on hover (subtle) */
@media (hover: hover) {
  .glass-card:hover,
  .service-card:hover {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

/* Link underline animation */
.animated-link {
  position: relative;
}

.animated-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  transition: width var(--transition-base);
}

.animated-link:hover::after {
  width: 100%;
}

/* Number counter animation placeholder */
.counter-number {
  display: inline-block;
  min-width: 2ch;
}

/* ==========================================
   PAGE TRANSITION
   ========================================== */
.page-transition-enter {
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

/* ==========================================
   ENHANCED PORTFOLIO ANIMATIONS
   ========================================== */

/* Portfolio card entrance — staggered reveal with scale + opacity */
@keyframes portfolioReveal {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.9) rotateX(8deg);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0deg);
    filter: blur(0);
  }
}

.portfolio-card.animate-on-scroll.is-visible {
  animation: portfolioReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Portfolio image parallax on hover */
.portfolio-card:hover .portfolio-image {
  overflow: hidden;
}

.portfolio-card .portfolio-image > div,
.portfolio-card .portfolio-image img {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portfolio-card:hover .portfolio-image > div,
.portfolio-card:hover .portfolio-image img {
  transform: scale(1.1);
}

/* Magnetic hover effect — subtle glow follows cursor */
@keyframes magneticGlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Portfolio content slide-up on hover */
.portfolio-content {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Portfolio card shimmer border effect on hover */
@keyframes borderShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ==========================================
   PRODUCT CARD ANIMATIONS
   ========================================== */

/* Product card entrance animation */
@keyframes productSlideIn {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.92);
    filter: blur(3px);
  }
  60% {
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.product-card.animate-on-scroll.is-visible {
  animation: productSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Product image hover ripple effect */
@keyframes productImageRipple {
  0% {
    box-shadow: inset 0 0 0 0 rgba(46, 75, 242, 0);
  }
  100% {
    box-shadow: inset 0 0 60px 10px rgba(46, 75, 242, 0.08);
  }
}

.product-card:hover .product-image-wrapper {
  animation: productImageRipple 0.4s ease forwards;
}

/* Product badge floating animation */
@keyframes badgeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.product-badge {
  animation: badgeFloat 3s ease-in-out infinite, badgePulse 3s ease infinite;
}

/* Product price reveal animation */
@keyframes priceReveal {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.product-card:hover .product-price-current {
  animation: priceReveal 0.4s ease forwards;
}

/* Floating particles for product cards */
@keyframes floatParticle {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  50% {
    transform: translate(20px, -30px) rotate(180deg);
  }
}

/* Service card enhanced hover */
.service-card {
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hero stats counter glow */
@keyframes counterGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(46, 75, 242, 0.3);
  }
  50% {
    text-shadow: 0 0 25px rgba(46, 75, 242, 0.6);
  }
}

.stat-number {
  animation: counterGlow 3s ease infinite;
}

/* CTA box breathing animation */
@keyframes ctaBreathing {
  0%, 100% {
    box-shadow: 0 0 40px rgba(46, 75, 242, 0.08);
  }
  50% {
    box-shadow: 0 0 80px rgba(46, 75, 242, 0.15);
  }
}

.cta-box {
  animation: ctaBreathing 5s ease infinite;
}

/* Timeline dot pulse */
@keyframes dotPulse {
  0%, 100% {
    box-shadow: 0 0 15px var(--glow-primary);
    transform: translateX(-50%) scale(1);
  }
  50% {
    box-shadow: 0 0 25px var(--glow-primary), 0 0 45px var(--glow-secondary);
    transform: translateX(-50%) scale(1.2);
  }
}

.timeline-dot {
  animation: dotPulse 3s ease infinite;
}

/* Section tag hover wiggle */
@keyframes tagWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

.section-tag:hover {
  animation: tagWiggle 0.4s ease;
}

/* Staggered reveal for "why" cards */
.products-why-grid .product-why-card.animate-on-scroll:nth-child(1).is-visible { animation-delay: 0s; }
.products-why-grid .product-why-card.animate-on-scroll:nth-child(2).is-visible { animation-delay: 0.1s; }
.products-why-grid .product-why-card.animate-on-scroll:nth-child(3).is-visible { animation-delay: 0.2s; }
.products-why-grid .product-why-card.animate-on-scroll:nth-child(4).is-visible { animation-delay: 0.3s; }

/* Smooth hover transitions for all interactive elements */
@media (hover: hover) {
  .portfolio-card,
  .product-card,
  .service-card,
  .blog-card,
  .pricing-card {
    will-change: transform, box-shadow;
  }
}

