/* ============================================
   ANIMATIONS.CSS - Ultra-Smooth Modern Animations
   Raidho Coaching Website
   
   Using modern spring-like easing for natural motion
   GPU-accelerated transforms for 60fps smoothness
   ============================================ */

/* Modern Easing Functions - Slow & Magical */
:root {
  /* Primary ease - smooth in and out, buttery feel */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  /* Gentle ease out - soft deceleration like feather landing */
  --ease-out: cubic-bezier(0.0, 0, 0.2, 1);
  /* Gentle ease in - soft acceleration */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  /* Extra smooth - very gentle, magical feel */
  --ease-magical: cubic-bezier(0.25, 0.1, 0.25, 1);
  /* Slow in-out - for long, elegant animations */
  --ease-slow: cubic-bezier(0.45, 0, 0.55, 1);
  /* Silky smooth - Apple-style transitions */
  --ease-silk: cubic-bezier(0.19, 1, 0.22, 1);
  /* Dreamy - very slow start and end */
  --ease-dreamy: cubic-bezier(0.23, 1, 0.32, 1);
  /* Magical spring - natural bounce feel */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Elegant out - luxurious deceleration */
  --ease-elegant: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   KEYFRAMES
   ============================================ */

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 50px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translate3d(-40px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translate3d(40px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Slide Animations */
@keyframes slideInLeft {
  from {
    transform: translate3d(-100%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInRight {
  from {
    transform: translate3d(100%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideInUp {
  from {
    transform: translate3d(0, 100%, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

/* Hero entrance - dramatic slow reveal */
@keyframes heroReveal {
  0% {
    opacity: 0;
    transform: translate3d(0, 80px, 0) scale(0.95);
    filter: blur(8px);
  }
  40% {
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

/* Scale Animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale3d(0.9, 0.9, 1);
  }
  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes scaleReveal {
  from {
    opacity: 0;
    transform: scale3d(0.92, 0.92, 1);
  }
  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

/* Gentle pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
  50% {
    opacity: 0.85;
    transform: scale3d(1.02, 1.02, 1);
  }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(43, 138, 143, 0.2); }
  50% { box-shadow: 0 0 40px rgba(43, 138, 143, 0.35); }
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -15px, 0); }
}

@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -8px, 0); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Button Wave Animation - Flowing gradient between brand colors */
@keyframes buttonWave {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Button Border Wave Animation */
@keyframes buttonBorderWave {
  0% { 
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(168, 83, 47, 0.25);
  }
  50% { 
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(43, 138, 143, 0.25);
  }
  100% { 
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(168, 83, 47, 0.25);
  }
}

@keyframes pageLoad {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================================
   UTILITY CLASSES (Animation-based)
   ============================================ */

.animate-fade-in {
  opacity: 0;
  animation: fadeIn 1.8s var(--ease-elegant) forwards;
  will-change: opacity;
}

.animate-fade-in-up {
  opacity: 0;
  transform: translate3d(0, 50px, 0);
  animation: heroReveal 2.2s var(--ease-elegant) forwards;
  will-change: transform, opacity, filter;
}

.animate-fade-in-down {
  opacity: 0;
  transform: translate3d(0, -40px, 0);
  animation: fadeInDown 2s var(--ease-silk) forwards;
  will-change: transform, opacity;
}

.animate-fade-in-left {
  opacity: 0;
  transform: translate3d(-60px, 0, 0);
  animation: fadeInLeft 2s var(--ease-silk) forwards;
  will-change: transform, opacity;
}

.animate-fade-in-right {
  opacity: 0;
  transform: translate3d(60px, 0, 0);
  animation: fadeInRight 2s var(--ease-silk) forwards;
  will-change: transform, opacity;
}

.animate-slide-in-left {
  transform: translate3d(-100%, 0, 0);
  animation: slideInLeft 1.8s var(--ease-silk) forwards;
  will-change: transform;
}

.animate-slide-in-right {
  transform: translate3d(100%, 0, 0);
  animation: slideInRight 1.8s var(--ease-silk) forwards;
  will-change: transform;
}

.animate-scale-in {
  opacity: 0;
  transform: scale3d(0.85, 0.85, 1);
  animation: scaleIn 2s var(--ease-silk) forwards;
  will-change: transform, opacity;
}

.animate-scale-reveal {
  opacity: 0;
  transform: scale3d(0.9, 0.9, 1);
  animation: scaleReveal 2.2s var(--ease-silk) forwards;
  will-change: transform, opacity;
}

.animate-pulse { animation: pulse 5s var(--ease-slow) infinite; }
.animate-glow { animation: glowPulse 5s var(--ease-slow) infinite; }
.animate-float { animation: float 8s var(--ease-slow) infinite; will-change: transform; }
.animate-bob { animation: bob 6s var(--ease-slow) infinite; will-change: transform; }

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent), var(--primary));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s var(--ease-slow) infinite;
}

/* Page Load */
body {
  animation: pageLoad 0.8s var(--ease-smooth) forwards;
}

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   Consolidated & Enhanced for "Slow & Magical"
   ============================================ */

/* Base states - Hidden */
html body .scroll-fade-in,
html body .scroll-fade-in-up,
html body .scroll-fade-in-left,
html body .scroll-fade-in-right,
html body .scroll-scale-in,
html body .scroll-blur-in {
  opacity: 0;
  visibility: hidden; /* Double ensure hidden state */
  will-change: transform, opacity, filter;
}

/* Specific initial transforms to match keyframes 0% state */
html body .scroll-fade-in-up { 
  transform: translate3d(0, 80px, 0) scale(0.95); 
  filter: blur(8px);
}
html body .scroll-fade-in-left { transform: translate3d(-40px, 0, 0); }
html body .scroll-fade-in-right { transform: translate3d(40px, 0, 0); }
html body .scroll-fade-in-down { transform: translate3d(0, -30px, 0); }
html body .scroll-scale-in { transform: scale3d(0.9, 0.9, 1); }
html body .scroll-blur-in { 
  transform: translate3d(0, 80px, 0) scale(0.95); 
  filter: blur(8px); 
}

/* Active states - Visible (Magic happens here via Keyframes) */
html body .scroll-fade-in.in-view {
  visibility: visible;
  animation: fadeIn 1.8s var(--ease-elegant) forwards;
}

html body .scroll-fade-in-up.in-view {
  visibility: visible;
  animation: heroReveal 2.2s var(--ease-elegant) forwards;
}


html body .scroll-fade-in-left.in-view {
  visibility: visible;
  animation: fadeInLeft 2s var(--ease-silk) forwards;
}

html body .scroll-fade-in-right.in-view {
  visibility: visible;
  animation: fadeInRight 2s var(--ease-silk) forwards;
}

html body .scroll-scale-in.in-view {
  visibility: visible;
  animation: scaleIn 2s var(--ease-silk) forwards;
}

html body .scroll-blur-in.in-view {
  visibility: visible;
  animation: heroReveal 2.2s var(--ease-elegant) forwards;
}

/* Staggered Delays - Helper Classes */
.delay-100 { transition-delay: 0.1s; animation-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; animation-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; animation-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; animation-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; animation-delay: 0.5s; }
.delay-600 { transition-delay: 0.6s; animation-delay: 0.6s; }
.delay-700 { transition-delay: 0.7s; animation-delay: 0.7s; }
.delay-800 { transition-delay: 0.8s; animation-delay: 0.8s; }
.delay-1000 { transition-delay: 1.0s; animation-delay: 1.0s; }
.delay-1200 { transition-delay: 1.2s; animation-delay: 1.2s; }

/* Grid Staggering Defaults */
.grid-3 > .scroll-fade-in-up:nth-child(1) { transition-delay: 0s; }
.grid-3 > .scroll-fade-in-up:nth-child(2) { transition-delay: 0.2s; }
.grid-3 > .scroll-fade-in-up:nth-child(3) { transition-delay: 0.4s; }
.grid-3 > .scroll-fade-in-up:nth-child(4) { transition-delay: 0.2s; }
.grid-3 > .scroll-fade-in-up:nth-child(5) { transition-delay: 0.4s; }
.grid-3 > .scroll-fade-in-up:nth-child(6) { transition-delay: 0.6s; }

.grid-4 > .scroll-fade-in-up:nth-child(1) { transition-delay: 0s; }
.grid-4 > .scroll-fade-in-up:nth-child(2) { transition-delay: 0.15s; }
.grid-4 > .scroll-fade-in-up:nth-child(3) { transition-delay: 0.3s; }
.grid-4 > .scroll-fade-in-up:nth-child(4) { transition-delay: 0.45s; }

.two-column > *:first-child.scroll-fade-in-up { transition-delay: 0s; }
.two-column > *:last-child.scroll-fade-in-up { transition-delay: 0.3s; }

/* ============================================
   HOVER EFFECTS - Slow & Magical
   ============================================ */

/* Generic Transitions for Interactions - Slow & Magical */
html body a:not(.btn) {
  -webkit-transition: color 0.8s var(--ease-silk),
                      opacity 0.8s var(--ease-silk),
                      transform 0.8s var(--ease-silk),
                      text-decoration-color 0.8s var(--ease-silk);
  transition: color 0.8s var(--ease-silk),
              opacity 0.8s var(--ease-silk),
              transform 0.8s var(--ease-silk),
              text-decoration-color 0.8s var(--ease-silk);
}

/* NOTE: .btn and .card transitions now defined in main.css to avoid conflicts */

/* Hover Lift - Uses scale (zoom) */
html body .hover-lift {
  -webkit-transition: transform 1.2s var(--ease-silk), box-shadow 1.2s var(--ease-silk);
  transition: transform 1.2s var(--ease-silk), box-shadow 1.2s var(--ease-silk);
  will-change: transform, box-shadow;
}

html body .hover-lift:hover {
  -webkit-transform: scale3d(1.03, 1.03, 1);
  transform: scale3d(1.03, 1.03, 1);
  box-shadow: 
    0 25px 50px rgba(43, 138, 143, 0.15),
    0 10px 20px rgba(0, 0, 0, 0.08);
}

/* Hover Scale */
html body .hover-scale {
  -webkit-transition: transform 1.2s var(--ease-silk);
  transition: transform 1.2s var(--ease-silk);
  will-change: transform;
}

html body .hover-scale:hover {
  -webkit-transform: scale3d(1.04, 1.04, 1);
  transform: scale3d(1.04, 1.04, 1);
}

/* Hover Glow - Uses scale (zoom) */
html body .glow-hover {
  -webkit-transition: transform 1.2s var(--ease-silk), box-shadow 1.2s var(--ease-silk);
  transition: transform 1.2s var(--ease-silk), box-shadow 1.2s var(--ease-silk);
}

html body .glow-hover:hover {
  -webkit-transform: scale3d(1.02, 1.02, 1);
  transform: scale3d(1.02, 1.02, 1);
  box-shadow: 
    0 20px 45px rgba(43, 138, 143, 0.2),
    0 8px 20px rgba(0, 0, 0, 0.05);
}

/* Image Reveal */
.image-reveal {
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.image-reveal img {
  transition: transform 1.2s var(--ease-smooth);
  will-change: transform;
}

.image-reveal:hover img {
  -webkit-transform: scale3d(1.06, 1.06, 1);
  transform: scale3d(1.06, 1.06, 1);
}

/* Link Underline Animation */
.link-animated {
  position: relative;
  display: inline-block;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  -webkit-transform: scaleX(0);
  transform: scaleX(0);
  transform-origin: right;
  -webkit-transition: transform 1s var(--ease-silk);
  transition: transform 1s var(--ease-silk);
}

.link-animated:hover::after {
  -webkit-transform: scaleX(1);
  transform: scaleX(1);
  transform-origin: left;
}

/* Button Press */
.btn-press {
  -webkit-transition: transform 0.8s var(--ease-silk), box-shadow 0.8s var(--ease-silk);
  transition: transform 0.8s var(--ease-silk), box-shadow 0.8s var(--ease-silk);
}

.btn-press:active {
  -webkit-transform: scale3d(0.98, 0.98, 1);
  transform: scale3d(0.98, 0.98, 1);
  -webkit-transition: transform 0.3s var(--ease-smooth);
  transition: transform 0.3s var(--ease-smooth);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
/* Temporarily disabled for debugging "Nothing Changed" issue */
/*
@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-fade-in,
  .scroll-fade-in-up,
  .scroll-fade-in-left,
  .scroll-fade-in-right,
  .scroll-scale-in,
  .scroll-blur-in {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
}
*/
