/* ============================================
   Keyframe Animations & Scroll-Triggered Classes
   ============================================ */

/* --- Keyframes --- */

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInSlideUpLarge {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInSlideRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInSlideRightLarge {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInSlideLeft {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInSlideLeftLarge {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideUpBar {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDownBar {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@keyframes scaleXLine {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalContentIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes checkmarkScale {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- Scroll-Triggered Animation Classes --- */

[data-animate] {
  opacity: 0;
}

[data-animate].animate-in {
  opacity: 1;
}

[data-animate="fade-slide-up"].animate-in {
  animation: fadeInSlideUp var(--duration-slow) var(--ease-standard) forwards;
}

[data-animate="fade-slide-up-large"].animate-in {
  animation: fadeInSlideUpLarge var(--duration-slow) var(--ease-standard) forwards;
}

[data-animate="fade-slide-right"].animate-in {
  animation: fadeInSlideRight var(--duration-slow) var(--ease-standard) forwards;
}

[data-animate="fade-slide-right-large"].animate-in {
  animation: fadeInSlideRightLarge var(--duration-slower) var(--ease-standard) forwards;
}

[data-animate="fade-slide-left"].animate-in {
  animation: fadeInSlideLeft var(--duration-slow) var(--ease-standard) forwards;
}

[data-animate="fade-slide-left-large"].animate-in {
  animation: fadeInSlideLeftLarge var(--duration-slower) var(--ease-standard) forwards;
}

[data-animate="fade-slide-down"].animate-in {
  animation: fadeInSlideDown var(--duration-slow) var(--ease-standard) forwards;
}

[data-animate="fade-scale"].animate-in {
  animation: fadeInScale var(--duration-slower) var(--ease-standard) forwards;
}

[data-animate="fade"].animate-in {
  animation: fadeIn var(--duration-normal) ease-out forwards;
}

/* Stagger delays for children */
.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.16s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.32s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.40s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.48s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.56s; }

/* --- Loading Spinner --- */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

.spinner-circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-dasharray: 60;
  stroke-linecap: round;
}

/* --- Hero Entrance Sequence (page load) --- */

.hero-badge {
  opacity: 0;
  animation: fadeInSlideDown 0.5s var(--ease-standard) 0.1s forwards;
}

.hero-heading {
  opacity: 0;
  animation: fadeInSlideRightLarge 0.6s var(--ease-standard) 0.2s forwards;
}

.hero-subheading {
  opacity: 0;
  animation: fadeInSlideRight 0.6s var(--ease-standard) 0.35s forwards;
}

.hero-cta {
  opacity: 0;
  animation: fadeInSlideUp 0.5s var(--ease-standard) 0.5s forwards;
}

.hero-trust {
  opacity: 0;
  animation: fadeIn 0.4s ease-out 0.7s forwards;
}

.hero-image {
  opacity: 0;
  animation: fadeInSlideLeftLarge 0.7s var(--ease-standard) 0.3s forwards;
}

/* Download hero entrance */
.download-hero-breadcrumb {
  opacity: 0;
  animation: fadeIn 0.3s ease-out 0s forwards;
}

.download-hero-heading {
  opacity: 0;
  animation: fadeInSlideRight 0.6s var(--ease-standard) 0.1s forwards;
}

.download-hero-subheading {
  opacity: 0;
  animation: fadeInSlideRight 0.5s var(--ease-standard) 0.2s forwards;
}

.download-hero-box {
  opacity: 0;
  animation: fadeInSlideUp 0.6s var(--ease-standard) 0.3s forwards;
}

.download-hero-tabs-bar {
  opacity: 0;
  animation: fadeIn 0.4s ease-out 0.5s forwards;
}

.download-hero-visual {
  opacity: 0;
  animation: fadeInSlideLeft 0.6s var(--ease-standard) 0.2s forwards;
}

/* --- FAQ Accordion Transitions --- */

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-standard), padding 0.2s ease;
}

.faq-item.expanded .faq-answer {
  max-height: 500px;
}

.faq-chevron {
  transition: transform 0.3s var(--ease-standard);
}

.faq-item.expanded .faq-chevron {
  transform: rotate(180deg);
}

.faq-item.expanded .faq-question {
  border-left: 3px solid var(--brand-orange);
  padding-left: 21px;
}

.faq-item .faq-question {
  border-left: 3px solid transparent;
  padding-left: 21px;
  transition: border-color 0.2s ease;
}

/* --- Tab Content Transitions --- */

.tab-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.15s ease-out, transform 0.25s ease-out;
}

.tab-content.switching {
  opacity: 0;
  transform: translateY(10px);
}

/* --- Sticky Bar Animation --- */

.sticky-bar {
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-standard);
}

.sticky-bar.visible {
  transform: translateY(0);
}

.sticky-bar.hiding {
  transform: translateY(100%);
  transition-duration: 0.3s;
}

/* --- Mobile Menu --- */

.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-standard);
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.mobile-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* --- Modal --- */

.modal-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s var(--ease-standard);
}

.modal-backdrop.open .modal-content {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- Connecting Line for Steps --- */

.step-line {
  transform: scaleX(0);
  transform-origin: left center;
}

.step-line.animate-in {
  animation: scaleXLine 0.8s var(--ease-standard) 0.3s forwards;
}

/* --- Nav Scroll Effect --- */

.site-nav {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.site-nav.scrolled {
  box-shadow: var(--shadow-nav-scroll);
}

@media (min-width: 1024px) {
  .site-nav.scrolled {
    background-color: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* --- Reduced Motion --- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  [data-animate] {
    opacity: 1;
  }
}
