/* ============================================
   ALTERAA - Animations & Transitions
   ============================================ */

/* ============================================
   1. Scroll-triggered animations
   ============================================ */

/* Base state for animated elements */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Staggered children animation */
.animate-on-scroll.stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.animate-on-scroll.stagger.is-visible > *:nth-child(1) { transition-delay: 0.1s; }
.animate-on-scroll.stagger.is-visible > *:nth-child(2) { transition-delay: 0.2s; }
.animate-on-scroll.stagger.is-visible > *:nth-child(3) { transition-delay: 0.3s; }
.animate-on-scroll.stagger.is-visible > *:nth-child(4) { transition-delay: 0.4s; }
.animate-on-scroll.stagger.is-visible > *:nth-child(5) { transition-delay: 0.5s; }

.animate-on-scroll.stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   2. Hero Animations (CSS only, immediate)
   ============================================ */

/* Fade in */
.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

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

/* Fade in and slide up */
.animate-fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

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

/* Fade in from left */
.animate-fade-in-left {
  animation: fadeInLeft 0.8s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

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

/* Fade in from right */
.animate-fade-in-right {
  animation: fadeInRight 0.8s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

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

/* Scale up */
.animate-scale-up {
  animation: scaleUp 0.6s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

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

/* ============================================
   3. Floating / Continuous animations
   ============================================ */

/* Subtle float animation for book cover */
.animate-float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotateY(-5deg);
  }
  50% {
    transform: translateY(-10px) rotateY(-5deg);
  }
}

/* Pulse glow for CTA */
.animate-pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(201, 162, 39, 0.2);
  }
}

/* Shimmer effect for badges */
.animate-shimmer {
  position: relative;
  overflow: hidden;
}

.animate-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  50%, 100% {
    left: 100%;
  }
}

/* ============================================
   4. Interactive animations
   ============================================ */

/* Button hover ripple effect */
.btn::before {
  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 ease, height 0.6s ease;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

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

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

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

/* Gallery item hover */
.univers__item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.5) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.univers__item:hover::after {
  opacity: 1;
}

/* ============================================
   5. Page transitions
   ============================================ */

/* Fade transition for page load */
body {
  animation: pageLoad 0.5s ease-out;
}

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

/* ============================================
   6. Parallax effect (subtle)
   ============================================ */

.parallax-container {
  overflow: hidden;
  position: relative;
}

.parallax-bg {
  position: absolute;
  inset: -10%;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* ============================================
   7. Lightbox animations
   ============================================ */

.lightbox__image {
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.lightbox--open .lightbox__image {
  transform: scale(1);
  opacity: 1;
}

/* ============================================
   8. Form animations
   ============================================ */

/* Input focus animation */
.form__input {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.form__input:focus {
  transform: scale(1.01);
}

/* Success/error message animation */
.form__message {
  animation: slideDown 0.3s ease-out;
}

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

/* Checkbox animation */
.form__checkbox {
  transition: transform 0.2s ease;
}

.form__checkbox:checked {
  animation: checkPop 0.3s ease;
}

@keyframes checkPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ============================================
   9. FAQ accordion animations
   ============================================ */

.faq__answer {
  animation: accordionOpen 0.3s ease-out;
}

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

/* ============================================
   10. Countdown number flip (optional)
   ============================================ */

.countdown__number {
  transition: transform 0.3s ease;
}

.countdown__number--changed {
  animation: numberFlip 0.3s ease;
}

@keyframes numberFlip {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-20px);
    opacity: 0;
  }
  51% {
    transform: translateY(20px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   11. Music player animations
   ============================================ */

.music-player--playing .music-player__toggle {
  animation: musicPulse 1s ease-in-out infinite;
}

@keyframes musicPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4);
  }
  50% {
    box-shadow: 0 0 15px 5px rgba(201, 162, 39, 0.2);
  }
}

/* ============================================
   12. Reduced motion support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }

  .animate-float,
  .animate-pulse-glow,
  .animate-shimmer {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}
