/* ==========================================================================
   ELAWADY Marine Supplies - Animations, Transitions & Motion System
   ========================================================================== */


/* ==========================================================================
   1. SCROLL-TRIGGERED REVEAL SYSTEM
   ========================================================================== */

.reveal {
  opacity: 0;
  transition-property: opacity, transform;
  transition-duration: var(--transition-slow);
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: none !important;
}

.reveal-fade-up    { transform: translateY(30px); }
.reveal-fade-in    { transform: scale(0.95); }

.reveal-slide-start { transform: translateX(-40px); }
.reveal-slide-end   { transform: translateX(40px); }

html[dir="rtl"] .reveal-slide-start { transform: translateX(40px); }
html[dir="rtl"] .reveal-slide-end   { transform: translateX(-40px); }


/* ==========================================================================
   2. HERO ENTRY STAGGER SEQUENCE
   ========================================================================== */

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-title-enter {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes hero-divider-expand {
  from {
    opacity: 0;
    width: 0;
  }
  to {
    opacity: 1;
    width: 80px;
  }
}

@keyframes hero-indicator-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Stagger class applied to hero children */
.hero-stagger {
  opacity: 0;
}

/* Eyebrow — appears first */
.hero-frame > .hero-stagger:nth-child(1) {
  animation: hero-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

/* Title group — core impact */
.hero-frame > .hero-stagger:nth-child(2) {
  animation: hero-fade-up 1s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards;
}

/* Title within group — enhanced entrance */
.hero-frame > .hero-stagger:nth-child(2) .hero-title {
  animation: hero-title-enter 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

/* Divider — reveal from center */
.hero-frame > .hero-stagger:nth-child(3) {
  animation: hero-divider-expand 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.95s forwards;
}

/* Description — slides up */
.hero-frame > .hero-stagger:nth-child(4) {
  animation: hero-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1.15s forwards;
}

/* CTA group — final reveal */
.hero-frame > .hero-stagger:nth-child(5) {
  animation: hero-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1.4s forwards;
}

/* Scroll indicator — delayed entrance */
.scroll-indicator.hero-stagger {
  animation: hero-indicator-enter 0.8s cubic-bezier(0.16, 1, 0.3, 1) 2.2s forwards;
}


/* ==========================================================================
   3. ATMOSPHERIC EFFECTS
   ========================================================================== */

/* Glow Breathing — the deep-sea bioluminescence pulse */
@keyframes glow-breathe {
  0%, 100% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

/* Particle Drift — suspended matter floating in deep water */
@keyframes particle-drift {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  8% {
    opacity: 0.7;
  }
  50% {
    opacity: 0.4;
  }
  92% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-120px) translateX(40px);
    opacity: 0;
  }
}

/* Scroll Indicator Pulse — draws the eye downward */
@keyframes scroll-pulse {
  0% {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: top;
  }
  50% {
    opacity: 0.3;
    transform: scaleY(0.4);
    transform-origin: top;
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: top;
  }
}


/* ==========================================================================
   4. MICRO-INTERACTIONS & UTILITY ANIMATIONS
   ========================================================================== */

@keyframes pulse-cyan {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--clr-primary-rgb), 0.35);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(var(--clr-primary-rgb), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--clr-primary-rgb), 0);
  }
}

.pulse-cyan-btn {
  animation: pulse-cyan 2.5s infinite;
}

@keyframes abyssal-glow {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 5px rgba(var(--clr-primary-rgb), 0.2));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 15px rgba(var(--clr-primary-rgb), 0.5));
  }
}

.marine-glow {
  animation: abyssal-glow 4s infinite ease-in-out;
}


/* ==========================================================================
   5. ACCESSIBILITY: REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  /* Kill all transitions and animations for sensitive users */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero-stagger {
    opacity: 1 !important;
    animation: none !important;
  }

  .hero-frame > .hero-stagger .hero-title {
    animation: none !important;
    opacity: 1 !important;
  }

  .scroll-indicator.hero-stagger {
    opacity: 1 !important;
    animation: none !important;
    transform: translateX(-50%) !important;
  }

  .scroll-line {
    animation: none !important;
  }

  .hero-glow {
    animation: none !important;
  }

  .hero-particles span {
    animation: none !important;
    opacity: 0.4 !important;
  }

  .pulse-cyan-btn,
  .marine-glow {
    animation: none !important;
  }
}
