/* Vibble Foods — animations.css
   Scroll reveals, keyframes, hover effects, loading animations
   Last updated: 2026-05-09
*/

/* =============================================
   SCROLL REVEAL
   Elements start invisible, animate in when
   they enter the viewport via IntersectionObserver
   ============================================= */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for grouped elements */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Slide in from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide in from right */
.reveal-right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale up from slightly smaller */
.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* =============================================
   HERO LOGO ENTRANCE
   Logo drops in from above on page load
   ============================================= */
@keyframes logoEntrance {
  0% {
    opacity: 0;
    transform: translateY(-40px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateY(6px) scale(1.03);
  }
  80% {
    transform: translateY(-3px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero__logo {
  animation: logoEntrance 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* =============================================
   LOGO HOVER WIGGLE
   Applied via JS on mouseenter
   ============================================= */
@keyframes logoWiggle {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-4deg) scale(1.05); }
  40%  { transform: rotate(4deg) scale(1.05); }
  60%  { transform: rotate(-2deg) scale(1.02); }
  80%  { transform: rotate(2deg) scale(1.01); }
  100% { transform: rotate(0deg) scale(1); }
}

.hero__logo.wiggle {
  animation: logoWiggle 0.5s ease forwards;
}

/* =============================================
   "CRUNCH IS LOADING..." ANIMATION
   Blinking dots after the text
   ============================================= */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.loading-dots span {
  animation: blink 1.2s infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* =============================================
   HERO TEXT FADE-IN SEQUENCE
   Badge → tagline → loading text → CTA
   ============================================= */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__badge {
  animation: fadeUp 0.6s ease 0.5s both;
}

.hero__tagline {
  animation: fadeUp 0.7s ease 0.7s both;
}

.hero__loading {
  animation: fadeUp 0.6s ease 0.9s both;
}

.hero__cta {
  animation: fadeUp 0.6s ease 1.1s both;
}

/* =============================================
   BUTTON HOVER PULSE
   Subtle ring pulse on CTA hover
   ============================================= */
@keyframes btnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.btn-white:hover {
  animation: btnPulse 0.8s ease;
}

/* =============================================
   TEASE LINES STAGGER
   Each tease line fades up with increasing delay
   ============================================= */
.tease__line:nth-child(1) { transition-delay: 0s; }
.tease__line:nth-child(2) { transition-delay: 0.15s; }
.tease__line:nth-child(3) { transition-delay: 0.3s; }

/* =============================================
   MOOD CARDS HOVER
   ============================================= */
.mood__card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mood__card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* =============================================
   MYSTERY CHARACTERS FLOAT
   Subtle floating animation on illustration silhouettes
   ============================================= */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

.mystery__char:nth-child(1) {
  animation: float 4s ease-in-out infinite;
}

.mystery__char:nth-child(2) {
  animation: float 4s ease-in-out infinite 2s;
}

/* =============================================
   WHATSAPP BUTTON ENTRANCE
   Slides in from right after page loads
   ============================================= */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.whatsapp-float {
  animation: slideInRight 0.6s cubic-bezier(0.22, 1, 0.36, 1) 1.5s both;
}

/* =============================================
   FORM SUBMIT LOADING STATE
   Spinner on the button while API call is in progress
   ============================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn--loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 107, 44, 0.3);
  border-top-color: var(--color-orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
}

/* =============================================
   REDUCE MOTION — accessibility
   Respects user's system preference
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
}
