/* ==========================================================================
   ANIMATIONS — Micro-animations, scroll effects, hover polish
   Modern B2B SaaS feel: subtle, purposeful, delightful
   ========================================================================== */

/* ---------- Scroll fade-in ---------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children for card grids, stats, steps */
.animate-on-scroll .card,
.animate-on-scroll .stat-item,
.animate-on-scroll .step-item,
.animate-on-scroll .storyboard-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.is-visible .card:nth-child(1),
.animate-on-scroll.is-visible .stat-item:nth-child(1),
.animate-on-scroll.is-visible .step-item:nth-child(1),
.animate-on-scroll.is-visible .storyboard-card:nth-child(1) {
  opacity: 1; transform: translateY(0); transition-delay: 0ms;
}

.animate-on-scroll.is-visible .card:nth-child(2),
.animate-on-scroll.is-visible .stat-item:nth-child(2),
.animate-on-scroll.is-visible .step-item:nth-child(2),
.animate-on-scroll.is-visible .storyboard-card:nth-child(2) {
  opacity: 1; transform: translateY(0); transition-delay: 120ms;
}

.animate-on-scroll.is-visible .card:nth-child(3),
.animate-on-scroll.is-visible .stat-item:nth-child(3),
.animate-on-scroll.is-visible .step-item:nth-child(3),
.animate-on-scroll.is-visible .storyboard-card:nth-child(3) {
  opacity: 1; transform: translateY(0); transition-delay: 240ms;
}

.animate-on-scroll.is-visible .card:nth-child(4),
.animate-on-scroll.is-visible .stat-item:nth-child(4),
.animate-on-scroll.is-visible .step-item:nth-child(4),
.animate-on-scroll.is-visible .storyboard-card:nth-child(4) {
  opacity: 1; transform: translateY(0); transition-delay: 360ms;
}

.animate-on-scroll.is-visible .card:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 480ms; }
.animate-on-scroll.is-visible .card:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 600ms; }

/* ---------- Button micro-animations ---------- */
.btn {
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on primary buttons */
.btn--primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.btn--primary:hover::after {
  left: 100%;
}

/* Button press effect */
.btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---------- Nav link underline slide ---------- */
.site-nav__links > li > a {
  position: relative;
}

.site-nav__links > li > a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-gold);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav__links > li > a:hover::after {
  width: 100%;
}

.site-nav--scrolled .site-nav__links > li > a::after {
  background-color: var(--color-primary);
}

/* ---------- Card hover micro-effects ---------- */
.card {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
  transform: translateY(-6px);
}

/* Card icon subtle bounce on card hover */
.card:hover .card__icon {
  animation: icon-bounce 0.4s ease;
}

@keyframes icon-bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.15); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Card link arrow slide */
.card__link::after {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover .card__link::after {
  transform: translateX(6px);
}

/* ---------- Step number pulse on scroll-in ---------- */
.animate-on-scroll.is-visible .step-item__number {
  animation: number-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes number-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Stats counter grow ---------- */
.stat-item__number {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.is-visible .stat-item__number {
  animation: stat-grow 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stat-grow {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Testimonial quote mark float ---------- */
.testimonial__quote-mark {
  animation: quote-float 3s ease-in-out infinite;
}

@keyframes quote-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ---------- Hero content entrance ---------- */
.hero__content {
  animation: hero-slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero__media {
  animation: hero-slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

@keyframes hero-slide-up {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Image hover subtle zoom ---------- */
.two-column__image {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.two-column__image img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.two-column__image:hover img {
  transform: scale(1.03);
}

/* Before/After panel hover */
.before-after__panel {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease;
}

.before-after__panel:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ---------- Storyboard card timeline dot pulse ---------- */
.storyboard-card::before {
  content: '';
  position: absolute;
  top: 20px;
  left: -8px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.animate-on-scroll.is-visible .storyboard-card::before {
  opacity: 1;
  animation: dot-pulse 0.6s ease forwards;
}

@keyframes dot-pulse {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---------- CTA Strip button entrance ---------- */
.cta-strip .btn-group {
  opacity: 0;
  transform: translateY(15px);
}

.animate-on-scroll.is-visible .cta-strip .btn-group,
.animate-on-scroll.is-visible .cta-strip__ctas {
  animation: cta-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

@keyframes cta-enter {
  0%   { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Focus ring for accessibility ---------- */
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Smooth link color transitions ---------- */
a {
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* ---------- Mega-menu entrance ---------- */
.mega-menu {
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s,
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav__links > li:hover > .mega-menu {
  transform: translateX(-50%) translateY(0);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }

  .animate-on-scroll .card,
  .animate-on-scroll .stat-item,
  .animate-on-scroll .step-item,
  .animate-on-scroll .storyboard-card {
    opacity: 1;
    transform: none;
  }

  .logo-bar__scroll {
    animation: none !important;
  }

  .hero__content,
  .hero__media {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
