/* ============================================
   GUZMAN PIANO STUDIO - ANIMATIONS
   ============================================ */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(232, 93, 79, 0.4);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 0 12px rgba(232, 93, 79, 0);
  }
}

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

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-12px) rotate(3deg);
  }
  66% {
    transform: translateY(-6px) rotate(-2deg);
  }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-18px); }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

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

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(720deg);
    opacity: 0;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.08); }
  70% { transform: scale(1); }
}

@keyframes waveform {
  0%, 100% { height: 4px; }
  50% { height: 20px; }
}

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

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

@keyframes progressBar {
  from { width: 0%; }
  to { width: var(--target-width, 100%); }
}

@keyframes numberCount {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   INTERSECTION OBSERVER ANIMATION CLASSES
   ============================================ */

/* Base state — elements start invisible and offset */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}

.animate-on-scroll.animate-left {
  transform: translateX(-30px);
}

.animate-on-scroll.animate-right {
  transform: translateX(30px);
}

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

.animate-on-scroll.animate-fade {
  transform: none;
}

/* Triggered state — JS adds this class when element enters viewport */
.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* ============================================
   STAGGER DELAYS
   ============================================ */
.delay-1 { transition-delay: 0.1s !important; }
.delay-2 { transition-delay: 0.2s !important; }
.delay-3 { transition-delay: 0.3s !important; }
.delay-4 { transition-delay: 0.4s !important; }
.delay-5 { transition-delay: 0.5s !important; }
.delay-6 { transition-delay: 0.6s !important; }
.delay-7 { transition-delay: 0.7s !important; }
.delay-8 { transition-delay: 0.8s !important; }

/* ============================================
   HERO TEXT REVEAL ANIMATIONS
   ============================================ */
.hero-content .hero-eyebrow {
  opacity: 0;
  animation: fadeInDown 0.8s ease forwards;
  animation-delay: 0.2s;
}

.hero-content h1 {
  opacity: 0;
  animation: fadeInUp 0.9s ease forwards;
  animation-delay: 0.4s;
}

.hero-content .hero-subtitle {
  opacity: 0;
  animation: fadeInUp 0.9s ease forwards;
  animation-delay: 0.6s;
}

.hero-content .hero-cta-group {
  opacity: 0;
  animation: fadeInUp 0.9s ease forwards;
  animation-delay: 0.8s;
}

/* ============================================
   HERO DECORATIVE ELEMENTS
   ============================================ */
.hero-note-1 {
  position: absolute;
  top: 15%;
  left: 8%;
  font-size: 3rem;
  color: rgba(244, 180, 27, 0.25);
  animation: float 6s ease-in-out infinite;
  animation-delay: 0s;
  pointer-events: none;
  user-select: none;
}

.hero-note-2 {
  position: absolute;
  top: 25%;
  right: 10%;
  font-size: 2rem;
  color: rgba(232, 93, 79, 0.20);
  animation: float 8s ease-in-out infinite;
  animation-delay: 1s;
  pointer-events: none;
  user-select: none;
}

.hero-note-3 {
  position: absolute;
  bottom: 30%;
  left: 5%;
  font-size: 2.5rem;
  color: rgba(78, 205, 196, 0.18);
  animation: float 7s ease-in-out infinite;
  animation-delay: 2s;
  pointer-events: none;
  user-select: none;
}

.hero-note-4 {
  position: absolute;
  bottom: 25%;
  right: 6%;
  font-size: 3.5rem;
  color: rgba(255, 255, 255, 0.08);
  animation: float 9s ease-in-out infinite;
  animation-delay: 0.5s;
  pointer-events: none;
  user-select: none;
}

.hero-note-5 {
  position: absolute;
  top: 60%;
  left: 12%;
  font-size: 2rem;
  color: rgba(244, 180, 27, 0.15);
  animation: floatSlow 10s ease-in-out infinite;
  animation-delay: 3s;
  pointer-events: none;
  user-select: none;
}

/* ============================================
   HOVER MICRO-INTERACTIONS
   ============================================ */

/* Button ripple */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s, opacity 0.6s;
  opacity: 1;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
  opacity: 0;
}

/* Nav link underline animation */
.nav-link-animate {
  position: relative;
}

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

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

/* Card tilt on hover */
.card-tilt {
  transition: transform var(--transition-base);
  transform-style: preserve-3d;
}

/* Icon bounce on hover */
.icon-hover-bounce:hover {
  animation: pulseSoft 0.5s ease;
}

/* Feature card icon float */
.feature-card:hover .feature-icon {
  animation: float 1s ease-in-out infinite;
}

/* Star rating fill animation */
.star-animate {
  animation: scaleIn 0.3s ease forwards;
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text-sm {
  height: 0.8em;
  width: 60%;
}

.skeleton-card {
  height: 200px;
}

/* ============================================
   ANIMATED GRADIENT BACKGROUND
   ============================================ */
.animated-gradient {
  background: linear-gradient(-45deg, var(--navy-dark), var(--navy-primary), var(--teal-dark), var(--navy-darker));
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

/* ============================================
   WAVEFORM ANIMATION (decorative)
   ============================================ */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}

.waveform-bar {
  width: 3px;
  border-radius: 2px;
  background: var(--coral-accent);
  animation: waveform 1.2s ease-in-out infinite;
}

.waveform-bar:nth-child(1) { animation-delay: 0s; height: 8px; }
.waveform-bar:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; height: 20px; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; height: 14px; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; height: 10px; }
.waveform-bar:nth-child(6) { animation-delay: 0.5s; height: 18px; }
.waveform-bar:nth-child(7) { animation-delay: 0.6s; height: 12px; }

/* ============================================
   PAGE TRANSITION
   ============================================ */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--navy-dark);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s cubic-bezier(0.7, 0, 0.3, 1), opacity 0.4s ease;
}

.page-transition-overlay.entering {
  opacity: 1;
  transform: scaleY(1);
}

/* ============================================
   SCROLL REVEAL VARIATIONS
   ============================================ */
.reveal-group > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  /* Fallback: always become visible after 2s even if IntersectionObserver doesn't fire */
  animation: revealFallback 0.6s ease 2s forwards;
}

@keyframes revealFallback {
  to { opacity: 1; transform: translateY(0); }
}

.reveal-group.animated > * { animation: none; }
.reveal-group.animated > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0s; }
.reveal-group.animated > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
.reveal-group.animated > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.2s; }
.reveal-group.animated > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }
.reveal-group.animated > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.4s; }
.reveal-group.animated > *:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 0.5s; }

/* ============================================
   SPINNING LOADER (for reviews loading)
   ============================================ */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--navy-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--space-8) auto;
}

/* ============================================
   NOTIFICATION / TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--navy-dark);
  color: var(--white);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-toast);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: var(--success-color);
}

.toast.error {
  background: var(--error-color);
}
