/* Apple-Style Scroll Animations */

/* Apple's signature easing curves */
:root {
  --apple-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --apple-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --apple-ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
  --apple-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Base animation states */
.apple-animate {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition: all 0.8s var(--apple-ease-out);
  will-change: transform, opacity;
}

.apple-animate.animate-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Staggered animations for grouped elements */
.apple-animate-stagger {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition: all 0.6s var(--apple-ease-out);
  will-change: transform, opacity;
}

.apple-animate-stagger.animate-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Scale animation for cards */
.apple-animate-scale {
  opacity: 0;
  transform: translate3d(0, 20px, 0) scale3d(0.95, 0.95, 1);
  transition: all 0.7s var(--apple-ease-out);
  will-change: transform, opacity;
}

.apple-animate-scale.animate-in {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
}

/* Slide from left */
.apple-animate-left {
  opacity: 0;
  transform: translate3d(-60px, 0, 0);
  transition: all 0.8s var(--apple-ease-out);
  will-change: transform, opacity;
}

.apple-animate-left.animate-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Slide from right */
.apple-animate-right {
  opacity: 0;
  transform: translate3d(60px, 0, 0);
  transition: all 0.8s var(--apple-ease-out);
  will-change: transform, opacity;
}

.apple-animate-right.animate-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Fade in animation */
.apple-animate-fade {
  opacity: 0;
  transition: opacity 0.8s var(--apple-ease-out);
  will-change: opacity;
}

.apple-animate-fade.animate-in {
  opacity: 1;
}

/* Section-specific animations */

/* Header section - no parallax to prevent overlay gaps */
.header-section {
  position: relative;
  overflow: hidden;
}

.header-content {
  position: relative;
  z-index: 2;
}

/* Gallery section animations - preserve original looping behavior */
.gallery-section .loop-container {
  /* Remove transform animations that interfere with looping text */
  opacity: 1;
  /* Let the original loop animation handle the movement */
}

/* Testimonials section - staggered card animations */
.testimonials-section .item {
  opacity: 0;
  transform: translate3d(0, 40px, 0) scale3d(0.98, 0.98, 1);
  transition: all 0.7s var(--apple-ease-out);
  will-change: transform, opacity;
}

.testimonials-section.animate-in .item:nth-child(1) {
  transition-delay: 0.1s;
}

.testimonials-section.animate-in .item:nth-child(2) {
  transition-delay: 0.2s;
}

.testimonials-section.animate-in .item:nth-child(3) {
  transition-delay: 0.3s;
}

.testimonials-section.animate-in .item {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
}

/* Social section - button animations */
.social-section .mbr-section-btn {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition: all 0.8s var(--apple-ease-out);
}

.social-section.animate-in .mbr-section-btn {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: 0.2s;
}

/* Enhanced button hover effects (Apple-style) */
.social-section .btn {
  transition: all 0.3s var(--apple-spring);
  transform: scale3d(1, 1, 1);
}

.social-section .btn:hover {
  transform: scale3d(1.05, 1.05, 1) translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.social-section .btn:active {
  transform: scale3d(0.98, 0.98, 1);
  transition-duration: 0.1s;
}

/* Title animations */
.section-title {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition: all 0.8s var(--apple-ease-out);
}

.animate-in .section-title {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Subtitle animations */
.section-subtitle {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition: all 0.8s var(--apple-ease-out);
  transition-delay: 0.1s;
}

.animate-in .section-subtitle {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Parallax effect for video backgrounds */
.parallax-bg {
  transform: translate3d(0, 0, 0);
  transition: transform 0.1s linear;
  will-change: transform;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .apple-animate,
  .apple-animate-stagger,
  .apple-animate-scale,
  .apple-animate-left,
  .apple-animate-right,
  .apple-animate-fade,
  .gallery-section .loop-container,
  .testimonials-section .item,
  .social-section .mbr-section-btn,
  .section-title,
  .section-subtitle {
    transition: none;
    opacity: 1;
    transform: none;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Performance optimizations */
.apple-animate,
.apple-animate-stagger,
.apple-animate-scale,
.apple-animate-left,
.apple-animate-right {
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Smooth scroll for anchor links */
a[href^="#"] {
  scroll-behavior: smooth;
}
