/* ==========================================================================
   Apple Design Animations & Transitions
   ========================================================================== */

/* Keyframe Animations */
@keyframes apple-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes apple-slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes apple-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes apple-scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes apple-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes apple-shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

/* Animation Classes */
.apple-animate-fade-in {
  animation: apple-fade-in 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.apple-animate-slide-left {
  animation: apple-slide-in-left 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.apple-animate-slide-right {
  animation: apple-slide-in-right 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.apple-animate-scale {
  animation: apple-scale-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.apple-animate-pulse {
  animation: apple-pulse 2s ease-in-out infinite;
}

/* Staggered Animations */
.apple-animate-stagger > * {
  opacity: 0;
  animation: apple-fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.apple-animate-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.apple-animate-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.apple-animate-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.apple-animate-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.apple-animate-stagger > *:nth-child(5) { animation-delay: 0.5s; }

/* Hover Effects */
.apple-hover-lift {
  transition: var(--apple-transition-normal);
}

.apple-hover-lift:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--apple-shadow-lg);
}

.apple-hover-glow {
  transition: var(--apple-transition-fast);
  position: relative;
}

.apple-hover-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: var(--apple-transition-fast);
  border-radius: inherit;
}

.apple-hover-glow:hover::before {
  opacity: 1;
}

.apple-hover-3d {
  transition: var(--apple-transition-normal);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.apple-hover-3d:hover {
  transform: rotateX(5deg) rotateY(5deg) translateZ(20px);
}

/* Loading States */
.apple-loading {
  position: relative;
  overflow: hidden;
}

.apple-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.4),
    transparent
  );
  background-size: 200px 100%;
  animation: apple-shimmer 1.5s ease-in-out infinite;
}

/* Progress Indicators */
.apple-progress-bar {
  height: 4px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.apple-progress-fill {
  height: 100%;
  background: var(--wp--preset--color--accent);
  border-radius: 2px;
  width: 0;
  transition: width 0.3s ease;
}

.apple-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: var(--wp--preset--color--accent);
  border-radius: 50%;
  animation: apple-spin 0.8s linear infinite;
}

@keyframes apple-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Scroll Animations */
.apple-scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.apple-scroll-reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.apple-scroll-reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Parallax Effects */
.apple-parallax {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.apple-parallax-slow {
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Intersection Observer Animations */
.apple-animate-on-scroll {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-animate-on-scroll.is-in-viewport {
  opacity: 1;
  transform: translateY(0);
}

/* Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  .apple-animate-fade-in,
  .apple-animate-slide-left,
  .apple-animate-slide-right,
  .apple-animate-scale,
  .apple-animate-pulse,
  .apple-scroll-reveal,
  .apple-scroll-reveal-left,
  .apple-scroll-reveal-right,
  .apple-animate-on-scroll {
    animation: none;
    transition: none;
    opacity: 1;
    transform: none;
  }
  
  .apple-hover-lift:hover,
  .apple-hover-3d:hover {
    transform: none;
  }
}

/* Dark Mode Animations */
@media (prefers-color-scheme: dark) {
  .apple-hover-glow::before {
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.05), transparent);
  }
}

/* Performance Optimizations */
.apple-gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.apple-will-change {
  will-change: transform, opacity;
}