/* =============================================
   Freo Now — Why Freo Now (Sticky Scroll Cards)
   Desktop: 3 cards at a time (2 pages)
   Mobile:  1 card at a time (6 scroll stops)
   ============================================= */

.why-section {
  height: 300vh; /* 2 pages on desktop */
  position: relative;
  background: var(--grad-deep);
}

.why-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow: hidden;
  z-index: 1;
}

.why-title {
  margin-bottom: 2.5rem;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.why-cards-wrapper {
  position: relative;
  width: 100%;
  max-width: 960px;
  height: 300px;
}

/* ── Page (group of 3 cards) ── */
.why-page {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  opacity: 0;
  transform: translateY(70px) scale(0.93);
  transition:
    opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  will-change: transform, opacity;
}

.why-page.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.why-page.above {
  opacity: 0;
  transform: translateY(-70px) scale(0.93);
}

/* ── Individual card styling ── */
.why-card {
  background: var(--white);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  box-shadow: 0 25px 60px rgba(12, 45, 72, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.why-card-icon {
  font-size: 3rem;
  line-height: 1;
  display: inline-block; /* needed for transforms */
}

/* ── Emoji animations (play once on page activation) ── */

/* 1. 🔄 Counter-clockwise spin */
.why-page.active .why-card[data-why="1"] .why-card-icon {
  animation: whySpin 0.8s ease-out 0.3s 1 both;
}
@keyframes whySpin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(-200deg) scale(1.15); }
  100% { transform: rotate(-360deg) scale(1); }
}

/* 2. 💰 Bounce + glow */
.why-page.active .why-card[data-why="2"] .why-card-icon {
  animation: whyBounce 0.7s ease-out 0.3s 1 both;
}
@keyframes whyBounce {
  0%   { transform: translateY(0) scale(1); filter: none; }
  30%  { transform: translateY(-18px) scale(1.2); filter: drop-shadow(0 0 12px #ffd700); }
  50%  { transform: translateY(-4px) scale(1.05); filter: drop-shadow(0 0 6px #ffd700); }
  70%  { transform: translateY(-10px) scale(1.1); filter: drop-shadow(0 0 8px #ffd700); }
  100% { transform: translateY(0) scale(1); filter: none; }
}

/* 3. 📱 Shake */
.why-page.active .why-card[data-why="3"] .why-card-icon {
  animation: whyShake 0.6s ease-out 0.3s 1 both;
}
@keyframes whyShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  15%      { transform: translateX(-6px) rotate(-5deg); }
  30%      { transform: translateX(5px) rotate(4deg); }
  45%      { transform: translateX(-4px) rotate(-3deg); }
  60%      { transform: translateX(3px) rotate(2deg); }
  75%      { transform: translateX(-2px) rotate(-1deg); }
  90%      { transform: translateX(1px) rotate(0); }
}

/* 4. 🎯 Zoom into center */
.why-page.active .why-card[data-why="4"] .why-card-icon {
  animation: whyTarget 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s 1 both;
}
@keyframes whyTarget {
  0%   { transform: scale(2.5); opacity: 0; }
  60%  { transform: scale(0.9); opacity: 1; }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* 5. ❤️ Heartbeat + glow */
.why-page.active .why-card[data-why="5"] .why-card-icon {
  animation: whyHeart 0.9s ease-out 0.3s 1 both;
}
@keyframes whyHeart {
  0%        { transform: scale(1); filter: none; }
  14%       { transform: scale(1.3); filter: drop-shadow(0 0 10px #e53935); }
  28%       { transform: scale(1); filter: none; }
  42%       { transform: scale(1.2); filter: drop-shadow(0 0 8px #e53935); }
  56%       { transform: scale(1); filter: none; }
  70%       { transform: scale(1.1); filter: drop-shadow(0 0 4px #e53935); }
  100%      { transform: scale(1); filter: none; }
}

/* 6. 📈 Grow upward */
.why-page.active .why-card[data-why="6"] .why-card-icon {
  animation: whyGrow 0.7s ease-out 0.3s 1 both;
}
@keyframes whyGrow {
  0%   { transform: scaleY(0.3) translateY(10px); opacity: 0.3; }
  60%  { transform: scaleY(1.15) translateY(-4px); opacity: 1; }
  100% { transform: scaleY(1) translateY(0); opacity: 1; }
}

/* ── Card text ── */
.why-card h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--primary);
  font-weight: 700;
  margin: 0;
}

.why-card p {
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  color: #444;
  line-height: 1.6;
  margin: 0;
}

/* ── Dot progress indicators (Vertical) ── */
.why-dots {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.why-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(12, 45, 72, 0.2);
  transition: width 0.35s ease, background 0.35s ease, border-radius 0.35s ease;
  flex-shrink: 0;
}

.why-dot.active {
  width: 28px;
  border-radius: 4px;
  background: var(--primary);
}

/* Hide mobile-only dots on desktop */
.why-dot-mobile {
  display: none;
}

/* =============================================
   Mobile: 1 card at a time, 6 scroll stops
   ============================================= */
@media (max-width: 600px) {
  .why-section {
    height: 600vh; /* 6 individual cards */
  }

  .why-cards-wrapper {
    max-width: 500px; /* Standard mobile width */
    height: 300px; 
    margin: 0 auto; /* Center it */
    padding: 0;
  }

  /* Hide dots completely on mobile */
  .why-dots {
    display: none !important;
  }

  /* Flatten pages — cards position individually */
  .why-page {
    display: contents;
  }

  .why-card {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(70px) scale(0.93);
    transition:
      opacity 0.65s cubic-bezier(0.4, 0, 0.2, 1),
      transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    will-change: transform, opacity;
  }

  .why-card.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .why-card.above {
    opacity: 0;
    transform: translateY(-70px) scale(0.93);
  }

  /* Mobile emoji animations — target .why-card.active directly */
  .why-card[data-why="1"].active .why-card-icon { animation: whySpin 0.8s ease-out 0.3s 1 both; }
  .why-card[data-why="2"].active .why-card-icon { animation: whyBounce 0.7s ease-out 0.3s 1 both; }
  .why-card[data-why="3"].active .why-card-icon { animation: whyShake 0.6s ease-out 0.3s 1 both; }
  .why-card[data-why="4"].active .why-card-icon { animation: whyTarget 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s 1 both; }
  .why-card[data-why="5"].active .why-card-icon { animation: whyHeart 0.9s ease-out 0.3s 1 both; }
  .why-card[data-why="6"].active .why-card-icon { animation: whyGrow 0.7s ease-out 0.3s 1 both; }

  /* Increase text size for readability on mobile */
  .why-card p {
    font-size: 1.1rem;
    padding: 0 0.5rem; /* Slight padding prevent edge collisions */
  }
}
