/* ============================================================
   animations.css — MotoRideDry Child Theme
   ============================================================ */

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Scroll-triggered animation base state ───────────────── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease;
  will-change: opacity, transform;
}

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

/* ── Stagger delays for nth-child in grids ───────────────── */
.cards-grid .animate-on-scroll:nth-child(1),
.stats-grid .animate-on-scroll:nth-child(1),
.reassurance-grid .animate-on-scroll:nth-child(1) {
  transition-delay: 0ms;
}
.cards-grid .animate-on-scroll:nth-child(2),
.stats-grid .animate-on-scroll:nth-child(2),
.reassurance-grid .animate-on-scroll:nth-child(2) {
  transition-delay: 80ms;
}
.cards-grid .animate-on-scroll:nth-child(3),
.stats-grid .animate-on-scroll:nth-child(3),
.reassurance-grid .animate-on-scroll:nth-child(3) {
  transition-delay: 160ms;
}
.cards-grid .animate-on-scroll:nth-child(4),
.stats-grid .animate-on-scroll:nth-child(4) {
  transition-delay: 240ms;
}
.cards-grid .animate-on-scroll:nth-child(5) { transition-delay: 320ms; }
.cards-grid .animate-on-scroll:nth-child(6) { transition-delay: 400ms; }
.cards-grid .animate-on-scroll:nth-child(7) { transition-delay: 480ms; }
.cards-grid .animate-on-scroll:nth-child(8) { transition-delay: 560ms; }

.faq-list .animate-on-scroll:nth-child(1) { transition-delay: 0ms; }
.faq-list .animate-on-scroll:nth-child(2) { transition-delay: 60ms; }
.faq-list .animate-on-scroll:nth-child(3) { transition-delay: 120ms; }
.faq-list .animate-on-scroll:nth-child(4) { transition-delay: 180ms; }
.faq-list .animate-on-scroll:nth-child(5) { transition-delay: 240ms; }

/* ── Header scroll transition ────────────────────────────── */
.site-header {
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease,
    padding 0.3s ease;
}

.site-header.header--scrolled {
  background-color: rgba(10, 10, 10, 0.97);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

/* ── FAQ accordion ───────────────────────────────────────── */
.faq-answer {
  overflow: hidden;
  transition: none;
}

.faq-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.faq-icon::before,
.faq-icon::after {
  content: '';
  position: absolute;
  background-color: currentColor;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Horizontal bar */
.faq-icon::before {
  width: 14px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Vertical bar */
.faq-icon::after {
  width: 2px;
  height: 14px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.faq-item.is-open .faq-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
  opacity: 0;
}

.faq-item.is-open .faq-icon {
  transform: rotate(45deg);
}

/* ── Mobile nav drawer transition ────────────────────────── */
.nav-drawer {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-overlay {
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

/* ── Button hover micro-interactions ─────────────────────── */
.btn {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

/* ── Nav link underline animation ────────────────────────── */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--clr-accent);
  transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link.current-menu-item::after {
  width: 100%;
}

/* ── Feature row images slide-in ─────────────────────────── */
.feature-row:nth-child(even) .feature-row-visual.animate-on-scroll {
  transform: translateX(-30px);
}

.feature-row:nth-child(odd) .feature-row-visual.animate-on-scroll {
  transform: translateX(30px);
}

.feature-row-visual.animate-on-scroll.is-visible {
  transform: translateX(0);
  opacity: 1;
}

/* ── Stat number count-up visual hint ────────────────────── */
.stat-card.is-visible .stat-number {
  animation: scaleIn 0.4s ease forwards;
}

/* ── Step number entrance ────────────────────────────────── */
.step.is-visible .step-number {
  animation: scaleIn 0.5s ease forwards;
}

/* ── Mockup phone float ──────────────────────────────────── */
.mockup-phone {
  animation: fadeInUp 0.8s ease 0.3s both;
}

/* ── Logo accent pulse on load ───────────────────────────── */
.site-logo .logo-accent {
  display: inline-block;
  transition: color 0.2s ease;
}

/* ── Contact success entrance ────────────────────────────── */
.contact-success:not([hidden]) {
  animation: fadeInUp 0.5s ease forwards;
}

/* ── Prefers-reduced-motion: kill all animations ─────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

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

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

  .nav-drawer {
    transition: none;
  }

  .nav-overlay {
    transition: none;
  }

  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }

  .mockup-phone {
    animation: none;
  }
}
