/* ============================================================
   ANIMATIONS.CSS – Fahrschule Lange
   Alle Animationen mit transform/opacity (GPU-beschleunigt)
   Niemals width/height/left/top/margin animieren!
   ============================================================ */

/* ------------------------------------------------------------
   1. HERO FADE-IN & SLIDE-UP (index.html)
   ------------------------------------------------------------ */
.hero__content {
  animation: fadeInUp 0.8s ease-out both;
}

.hero__badge {
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero__title {
  animation: fadeInUp 0.7s ease-out 0.2s both;
}

.hero__subtitle {
  animation: fadeInUp 0.7s ease-out 0.35s both;
}

.hero__ctas {
  animation: fadeInUp 0.7s ease-out 0.5s both;
}

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

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

/* ------------------------------------------------------------
   2. SCROLL REVEAL – Elemente erscheinen beim Scrollen
   ------------------------------------------------------------ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Gestaffelt (stagger) für Karten-Gruppen */
.animate-stagger .animate-on-scroll:nth-child(1) { transition-delay: 0s;    }
.animate-stagger .animate-on-scroll:nth-child(2) { transition-delay: 0.1s;  }
.animate-stagger .animate-on-scroll:nth-child(3) { transition-delay: 0.2s;  }
.animate-stagger .animate-on-scroll:nth-child(4) { transition-delay: 0.3s;  }
.animate-stagger .animate-on-scroll:nth-child(5) { transition-delay: 0.4s;  }
.animate-stagger .animate-on-scroll:nth-child(6) { transition-delay: 0.5s;  }
.animate-stagger .animate-on-scroll:nth-child(7) { transition-delay: 0.6s;  }
.animate-stagger .animate-on-scroll:nth-child(8) { transition-delay: 0.7s;  }
.animate-stagger .animate-on-scroll:nth-child(9) { transition-delay: 0.8s;  }

/* Slide von links */
.animate-slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide von rechts */
.animate-slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ------------------------------------------------------------
   3. SMOOTH HOVER-EFFEKTE (Buttons, Karten, Links)
   ------------------------------------------------------------ */
.btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease !important;
}

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

.card {
  transition: transform 0.25s ease, box-shadow 0.25s ease !important;
}

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

/* Bild-Zoom beim Hover */
.img-zoom-wrap {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.img-zoom-wrap img {
  transition: transform 0.4s ease;
}

.img-zoom-wrap:hover img {
  transform: scale(1.05);
}

/* ------------------------------------------------------------
   4. NUMBER COUNTER (Vertrauensleiste)
   ------------------------------------------------------------ */
.counter-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   5. LOADING SPINNER (Formulare)
   ------------------------------------------------------------ */
.loading-spinner {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--light-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ------------------------------------------------------------
   6. MOBILE MENU SLIDE-IN
   ------------------------------------------------------------ */
.nav__mobile {
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex !important; /* override display:none – wir nutzen transform */
  position: fixed !important;
  top: 70px;
  right: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--white);
  z-index: 999;
  flex-direction: column;
  padding: var(--space-md) 0;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.nav__mobile.open {
  transform: translateX(0);
}

/* Overlay beim offenen Menü */
.nav__overlay {
  position: fixed;
  inset: 0;
  top: 70px;
  background: rgba(0,0,0,0.4);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nav__overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------------------------------------
   7. SUCCESS ANIMATION (nach Formular-Absenden)
   ------------------------------------------------------------ */
.success-icon {
  animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Checkmark-Zeichnen-Animation */
.checkmark-circle {
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: drawCircle 0.6s ease-out forwards;
}

.checkmark-check {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: drawCheck 0.4s ease-out 0.5s forwards;
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

/* ------------------------------------------------------------
   8. PULSE ANIMATION (CTA-Buttons)
   ------------------------------------------------------------ */
.btn--pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 160, 32, 0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(232, 160, 32, 0); }
}

/* ------------------------------------------------------------
   9. SKELETON SCREEN (während Bilder laden)
   ------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(90deg, var(--light) 25%, var(--light-mid) 50%, var(--light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ------------------------------------------------------------
   10. PARALLAX WRAPPER
   ------------------------------------------------------------ */
.hero--parallax {
  will-change: transform;
}

/* Schritt-Verbindungslinie Animation */
.schritte__linie {
  width: 0;
  transition: width 0.8s ease;
}

.schritte__linie.visible {
  width: 100%;
}

/* ------------------------------------------------------------
   PREFERS REDUCED MOTION – Animationen für Nutzer deaktivieren
   die das wünschen (Barrierefreiheit)
   ------------------------------------------------------------ */
@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,
  .animate-slide-left,
  .animate-slide-right {
    opacity: 1 !important;
    transform: none !important;
  }
}
