/* Moriveda Premium Animation Classes & Keyframes */

/* Reveal masks */
.reveal-wrapper {
  overflow: hidden;
  display: inline-block;
  vertical-align: bottom;
}

.reveal-text {
  display: inline-block;
  transform: translateY(110%);
}

.fade-up-trigger {
  opacity: 0;
  transform: translateY(30px);
}

.fade-in-trigger {
  opacity: 0;
}

.animations-fallback .reveal-text,
.animations-fallback .hero-subtitle,
.animations-fallback .hero-cta-group,
.animations-fallback #hero-product-wrapper,
.animations-fallback .fade-up-trigger,
.animations-fallback .fade-in-trigger {
  opacity: 1 !important;
  transform: none !important;
}

.animations-fallback #hero-ambient-glow,
.animations-fallback #hero-ground-halo {
  opacity: 0.65 !important;
}

/* Hero floating animation */
@keyframes floatAnimation {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(1deg);
  }
  100% {
    transform: translateY(0px) rotate(0deg);
  }
}

.floating-product {
  animation: floatAnimation 6s ease-in-out infinite;
}

/* Floating leaf particles */
@keyframes driftLeft {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    transform: translate(-100px, -600px) rotate(360deg) scale(1);
    opacity: 0;
  }
}

@keyframes driftRight {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 0;
  }
  15% {
    opacity: 0.6;
  }
  85% {
    opacity: 0.6;
  }
  100% {
    transform: translate(120px, -700px) rotate(-180deg) scale(0.7);
    opacity: 0;
  }
}

.leaf-particle {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
}

.leaf-particle-left {
  animation: driftLeft 15s linear infinite;
}

.leaf-particle-right {
  animation: driftRight 18s linear infinite;
}

/* Stripe-style background gradient shift */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.hero-bg-gradient {
  background: var(--gradient-hero);
  background-size: 300% 300%;
  animation: gradientShift 15s ease infinite;
}

/* Scrollytelling visual transitions */
.scrollytelling-container {
  position: relative;
  height: 400vh; /* Pinned for 4 sections of scroll */
  background-color: var(--bg-primary);
}

.scrollytelling-sticky {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 6rem;
  align-items: center;
  overflow: hidden;
  background-color: var(--bg-primary);
  padding: 0 8%;
}

.scrollytelling-visual {
  position: relative;
  width: 100%;
  height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.scrollytelling-content-layer {
  position: relative;
  width: 100%;
  height: 60vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  z-index: 20;
}

.scrolly-text {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.5vw, 3rem);
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(30px);
  position: absolute;
  width: 100%;
  text-align: left;
  line-height: 1.3;
}

.scrolly-text.active {
  opacity: 1;
  transform: translateY(0);
}

.visual-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.visual-image.active {
  opacity: 1;
}

/* Horizontal Scroll for Benefits */
.horizontal-scroll-section {
  position: relative;
  overflow: hidden;
}

.horizontal-scroll-container {
  display: flex;
  flex-wrap: nowrap;
  width: 300vw; /* 3 screens wide */
  height: 100vh;
  will-change: transform;
}

.horizontal-slide {
  width: 100vw;
  height: 100vh;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 100px 8% 5% 8%; /* Account for fixed header top clearance */
  background: var(--cream);
  box-sizing: border-box;
}

.horizontal-slide .container {
  width: 100%;
  flex-shrink: 0;
}

.horizontal-slide h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem) !important;
  line-height: 1.25 !important;
  margin-bottom: 1.2rem !important;
}

.slide-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.slide-visual img {
  max-height: 52vh;
  width: auto;
  object-fit: cover;
  border-radius: 24px;
}

/* 3D hover effects */
.tilt-card {
  transform-style: preserve-3d;
  transform: perspective(1000px);
}

.tilt-content {
  transform: translateZ(50px);
}

/* Magnetic button helper */
.btn-magnetic {
  display: inline-flex;
}

/* ===================================================
   HERO CINEMATIC SCROLL-STAGE SYSTEM
   =================================================== */

/* Scroll stage: 250vh gives ~150vh of scroll room after the initial 100vh view */
.hero-scroll-stage {
  position: relative;
  height: 250vh;
}

/* Sticky hero: pins to top while user scrolls through the stage */
.hero-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: calc(80px + var(--banner-h, 0px));
  box-sizing: border-box;
}

/* Two-column layout that merges container + grid */
.hero-main-grid {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
  width: 100%;
}

/* Product stage: relative container for all product visuals */
.hero-product-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 460px;
}

/* GSAP-controlled wrapper: entry animation + scroll scrub target */
.hero-product-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px; /* portrait pouch cutout */
  opacity: 0;
  will-change: transform, opacity;
  transform-origin: center bottom;
}

/* Inner float layer: CSS keyframe animation runs here,
   separate from GSAP-controlled wrapper so they don't conflict */
.hero-product-float {
  width: 100%;
  animation: heroProductFloat 4.5s ease-in-out infinite;
  animation-play-state: paused; /* Enabled by JS after landing */
}
.hero-product-float.is-floating {
  animation-play-state: running;
}

@keyframes heroProductFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50%       { transform: translateY(-18px) rotate(0.6deg); }
}

/* Product image — transparent cutout (no frame); shadow hugs the silhouette */
.hero-product-img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 26px 36px rgba(45, 90, 39, 0.26))
          drop-shadow(0 8px 16px rgba(0, 0, 0, 0.16));
  -webkit-user-drag: none;
  user-select: none;
}

/* Ambient radial glow that swells in behind the product
   — no CSS transform; GSAP sets xPercent/yPercent/scale/opacity */
.hero-ambient-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(95, 191, 119, 0.28) 0%,
    rgba(163, 207, 159, 0.14) 45%,
    transparent 70%
  );
  filter: blur(50px);
  pointer-events: none;
  z-index: 1;
}

/* Ground halo — elliptical shadow below the product
   — no CSS transform; GSAP sets xPercent/scaleX/opacity */
.hero-ground-halo {
  position: absolute;
  bottom: -24px;
  left: 50%;
  width: 440px;
  height: 60px;
  background: radial-gradient(ellipse at center, rgba(45, 90, 39, 0.26) 0%, transparent 70%);
  filter: blur(22px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

/* Mobile overrides: disable sticky pin, stack columns */
@media (max-width: 768px) {
  .hero-scroll-stage {
    height: auto;
  }
  .hero-sticky {
    position: relative;
    height: auto;
    min-height: 100vh;
  }
  .hero-main-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-product-stage {
    min-height: 320px;
    order: -1; /* Product above text on mobile */
  }
  .hero-product-wrapper {
    max-width: 260px;
    margin: 0 auto;
  }
  .hero-ambient-glow {
    width: 360px;
    height: 360px;
  }
  .hero-ground-halo {
    width: 260px;
  }
}

/* Accessibility / Reduced Motion Fallbacks */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  
  .reveal-text {
    transform: none !important;
  }
  
  .fade-up-trigger {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .floating-product {
    animation: none !important;
  }
  
  .leaf-particle {
    display: none !important;
  }
  
  .horizontal-scroll-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .horizontal-slide {
    width: 100% !important;
    height: auto !important;
    padding: 3rem 1rem !important;
  }
}
