/* ============================================================
   Think-Win Suite — Animation Styles
   ============================================================ */

/* ---- Card Entrance (staggered scale + opacity) ---- */
@keyframes cardEnter {
  from {
    opacity: 0;
    transform: scale(0.6) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ---- Hero elements entrance ---- */
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Subtle float for CTA emphasis ---- */
@keyframes subtleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ---- Scroll Reveal Base ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stagger children within grid containers */
.grid-2 > .reveal,
.grid-3 > .reveal,
.grid-4 > .reveal {
  transition-delay: calc(var(--reveal-i, 0) * 0.08s);
}

.reveal-visible.grid-2 > .reveal,
.reveal-visible.grid-3 > .reveal,
.reveal-visible.grid-4 > .reveal {
  /* Children inside a revealed grid get their own observer triggers */;
}

/* ---- Interactive Scale Effects ---- */
.card,
.stat-card,
.step-card,
.btn,
.btn-copy,
.btn-logout,
.menu-btn,
.theme-btn,
.lang-btn,
.link-row,
.tier-cell {
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.card:active {
  transform: scale(0.97);
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

.stat-card:active {
  transform: scale(0.97);
}

.step-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

.step-card:active {
  transform: scale(0.97);
}

.btn:hover {
  transform: scale(1.05);
}

.btn:active {
  transform: scale(0.95);
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  transform: scale(1.05);
  filter: brightness(1.12);
}

.btn-primary:active {
  transform: scale(0.95);
}

.theme-btn:hover {
  transform: scale(1.1);
}

.theme-btn:active {
  transform: scale(0.9);
}

/* Nav links */
.nav-links a {
  transition:
    color 0.15s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-links a:hover {
  transform: translateY(-1px);
}

/* Page-specific buttons */
.btn-copy:hover {
  transform: scale(1.05);
}
.btn-copy:active {
  transform: scale(0.93);
}
.btn-logout:hover {
  transform: scale(1.05);
}
.btn-logout:active {
  transform: scale(0.93);
}
.menu-btn:hover {
  transform: scale(1.1);
}
.menu-btn:active {
  transform: scale(0.9);
}
.lang-btn:hover {
  transform: scale(1.08);
}
.lang-btn:active {
  transform: scale(0.92);
}
.link-row:hover {
  transform: scale(1.01);
}
.link-row:active {
  transform: scale(0.98);
}

/* ---- Hero Entrance Animation ---- */
.hero-badge {
  animation: heroFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}
.hero h1 {
  animation: heroFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}
.hero-sub {
  animation: heroFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}
.hero-actions {
  animation: heroFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

/* ---- Stat Cards Number Pop ---- */
@keyframes countPop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.stat-card .stat-num {
  animation: countPop 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.45s both;
}

/* ---- CTA Float ---- */
.cta .btn-primary {
  animation: subtleFloat 4s ease-in-out infinite;
  animation-delay: 1s;
}

/* ---- Scroll-to-Top Button ---- */
#scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border, #e8e6e0);
  background: var(--surface, #ffffff);
  color: var(--t2, #6b6b65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition:
    opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

#scroll-top-btn.scroll-top-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#scroll-top-btn:hover {
  transform: scale(1.1);
  border-color: var(--accent, #1a6b4a);
  color: var(--accent, #1a6b4a);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#scroll-top-btn:active {
  transform: scale(0.9);
}

/* ---- Focus Ring Animation ---- */
@keyframes focusPulse {
  0% { box-shadow: 0 0 0 0 var(--accent-soft, #e6f2eb); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.card:focus-visible,
.btn:focus-visible,
a:focus-visible {
  animation: focusPulse 1.5s ease-out 1;
}

/* ---- Tier Grid Row Hover ---- */
.tier-cell {
  transition:
    background 0.2s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.tier-cell:hover {
  transform: scale(1.01);
}

/* ---- State Cards Entrance Animation (initial load) ---- */
.stat-card {
  animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.25s; }
.stat-card:nth-child(4) { animation-delay: 0.35s; }

/* ---- Section Visibility ---- */
.section {
  transition: opacity 0.6s ease;
}

/* ---- Reduce motion for accessibility ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-badge,
  .hero h1,
  .hero-sub,
  .hero-actions,
  .stat-card .stat-num {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .card:hover,
  .stat-card:hover,
  .step-card:hover,
  .btn:hover,
  .theme-btn:hover {
    transform: none;
  }
  .cta .btn-primary {
    animation: none;
  }
  #scroll-top-btn {
    transition: none;
  }
}
