/* ==========================================================================
   Shree Krishna Fashion — Framer Motion animations converted to CSS.
   Mirrors the transition values used in the React source (motion/react).
   ========================================================================== */

/* ---- View enter: opacity 0 + y:10 → opacity 1 + y:0, 0.25s easeOut ----
   Used for every AnimatePresence-wrapped motion.div in App.tsx */
@keyframes skf-view-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.skf-view-enter { animation: skf-view-enter 0.25s ease-out both; }

/* ---- Fade-up (whileInView: opacity 0 y:20 → opacity 1 y:0) ---- */
@keyframes skf-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.skf-fade-up { animation: skf-fade-up 0.6s ease-out both; }

/* ---- Fade in (initial opacity 0 → opacity 1, 0.6s) ---- */
@keyframes skf-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.skf-fade-in { animation: skf-fade-in 0.6s ease-out both; }

/* ---- Scale in (initial opacity 0 scale 0.95 → 1) — success view ---- */
@keyframes skf-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.skf-scale-in { animation: skf-scale-in 0.3s ease-out both; }

/* ---- Slide in from right (x:100% → 0) — cart drawer ---- */
@keyframes skf-slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.skf-slide-in-right { animation: skf-slide-in-right 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ---- Slide out to right (0 → 100%) — cart drawer exit ---- */
@keyframes skf-slide-out-right {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}
.skf-slide-out-right { animation: skf-slide-out-right 0.3s ease-in both; }

/* ---- Slide in from left (-100% → 0) — sidebar drawer ---- */
@keyframes skf-slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
.skf-slide-in-left { animation: skf-slide-in-left 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ---- Scale-into-place (initial scale 0.95 y:-20 → 1) — search overlay ---- */
@keyframes skf-pop-in {
  from { opacity: 0; transform: scale(0.95) translateY(-20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.skf-pop-in { animation: skf-pop-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ---- Hero crossfade (opacity 0 → 1) ---- */
@keyframes skf-hero-crossfade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.skf-hero-slide-active { animation: skf-hero-crossfade 0.6s ease-in-out both; }

/* ---- Staggered children (motion variants staggerChildren 0.08) ---- */
.skf-stagger > * { opacity: 0; animation: skf-fade-up 0.6s ease-out forwards; }
.skf-stagger > *:nth-child(1) { animation-delay: 0s; }
.skf-stagger > *:nth-child(2) { animation-delay: 0.08s; }
.skf-stagger > *:nth-child(3) { animation-delay: 0.16s; }
.skf-stagger > *:nth-child(4) { animation-delay: 0.24s; }
.skf-stagger > *:nth-child(5) { animation-delay: 0.32s; }
.skf-stagger > *:nth-child(6) { animation-delay: 0.40s; }
.skf-stagger > *:nth-child(7) { animation-delay: 0.48s; }
.skf-stagger > *:nth-child(8) { animation-delay: 0.56s; }

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

/* ---- Toast slide up (motion y:50 → 0) ---- */
@keyframes skf-toast-in {
  from { opacity: 0; transform: translate(-50%, 50px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.skf-toast-in { animation: skf-toast-in 0.3s ease-out both; }
