/*
 * CardFlow — animations.css
 * Requires: styles.css (for CSS custom properties)
 * All animations respect prefers-reduced-motion.
 */

/* =============================================
   1. PAGE LOAD — cards fade + slide in
   ============================================= */

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  animation: card-enter 0.45s ease both;
}

/* Stagger each card in a row so they cascade in */
.cards-row .card:nth-child(1) { animation-delay: 0.05s; }
.cards-row .card:nth-child(2) { animation-delay: 0.12s; }
.cards-row .card:nth-child(3) { animation-delay: 0.19s; }
.cards-row .card:nth-child(4) { animation-delay: 0.26s; }
.cards-row .card:nth-child(5) { animation-delay: 0.33s; }

/* Binder cards get the same stagger */
.binder-card:nth-child(1),
.binder-item:nth-child(1) { animation-delay: 0.05s; }
.binder-card:nth-child(2),
.binder-item:nth-child(2) { animation-delay: 0.12s; }
.binder-card:nth-child(3),
.binder-item:nth-child(3) { animation-delay: 0.19s; }
.binder-card:nth-child(4),
.binder-item:nth-child(4) { animation-delay: 0.26s; }
.binder-card:nth-child(5),
.binder-item:nth-child(5) { animation-delay: 0.33s; }
.binder-card:nth-child(6),
.binder-item:nth-child(6) { animation-delay: 0.40s; }

.binder-card,
.binder-item {
  animation: card-enter 0.45s ease both;
}


/* =============================================
   2. SKELETON SHIMMER — while cards load
   ============================================= */

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

.card-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(0, 229, 255, 0.07)   50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 12px;
  border: 2px solid rgba(0, 229, 255, 0.04);
}


/* =============================================
   3. MODAL — fade + scale in/out
   ============================================= */

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-box-in {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modal-box-out {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
}

/* Applies when the modal becomes visible */
.modal:not([aria-hidden="true"]),
.modal-overlay {
  animation: modal-backdrop-in 0.22s ease both;
}

.modal:not([aria-hidden="true"]) .modal__box,
.modal-overlay .modal {
  animation: modal-box-in 0.28s cubic-bezier(0.34, 1.38, 0.64, 1) both;
}

/* Dismiss animation — add class "is-closing" via JS before hiding */
.modal.is-closing .modal__box,
.modal-overlay.is-closing .modal {
  animation: modal-box-out 0.2s ease both;
}


/* =============================================
   4. MOBILE NAV — slide down when opened
   ============================================= */

@keyframes nav-slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav.show,
.nav.active {
  animation: nav-slide-down 0.22s ease both;
}


/* =============================================
   5. PRIMARY BUTTON — neon pulse on hover
   ============================================= */

@keyframes btn-glow-pulse {
  0%   { box-shadow: 0 0 10px rgba(0, 229, 255, 0.18); }
  50%  { box-shadow: 0 0 26px rgba(0, 229, 255, 0.42), 0 0 6px rgba(0, 229, 255, 0.22) inset; }
  100% { box-shadow: 0 0 10px rgba(0, 229, 255, 0.18); }
}

.btn.primary:hover,
.btn--primary:hover {
  animation: btn-glow-pulse 1.4s ease-in-out infinite;
}


/* =============================================
   6. TOAST NOTIFICATION — already uses CSS
      transitions in styles.css; add a bounce
      on entry for extra polish
   ============================================= */

@keyframes toast-bounce-in {
  0%   { transform: translateY(20px); opacity: 0; }
  60%  { transform: translateY(-5px); opacity: 1; }
  100% { transform: translateY(0);    opacity: 1; }
}

.toast.is-visible {
  animation: toast-bounce-in 0.35s cubic-bezier(0.34, 1.38, 0.64, 1) both;
}


/* =============================================
   7. PAGE TITLE — subtle fade-in on load
   ============================================= */

@keyframes hero-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
    letter-spacing: 0.06em;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: normal;
  }
}

.hero,
.page-title,
h1 {
  animation: hero-fade-in 0.55s ease both;
}


/* =============================================
   8. PREFERS-REDUCED-MOTION
      Strips all decorative animations for
      users who have this OS setting enabled.
   ============================================= */

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