/* ============================================================
   Cheaply: Animations and Micro-interactions
   Subtle, purposeful, Cheaply-calibre
   ============================================================ */

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.25);
  }

  50% {
    transform: scale(1);
  }

  75% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progressFill {
  from {
    width: 0;
  }
}

@keyframes ping {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ── Reveal on scroll ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.stagger>*:nth-child(1) {
  transition-delay: 0ms;
}

.stagger>*:nth-child(2) {
  transition-delay: 60ms;
}

.stagger>*:nth-child(3) {
  transition-delay: 120ms;
}

.stagger>*:nth-child(4) {
  transition-delay: 180ms;
}

.stagger>*:nth-child(5) {
  transition-delay: 240ms;
}

.stagger>*:nth-child(6) {
  transition-delay: 300ms;
}

.stagger>*:nth-child(n+7) {
  transition-delay: 360ms;
}

/* ── Animation utilities ───────────────────────────────────── */
.animate-fade-in {
  animation: fadeIn 0.3s var(--ease-out) both;
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s var(--ease-out) both;
}

.animate-fade-in-down {
  animation: fadeInDown 0.3s var(--ease-out) both;
}

.animate-scale-in {
  animation: scaleIn 0.2s var(--ease-out) both;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
  animation: spin 0.7s linear infinite;
}

/* ── Like button animation ─────────────────────────────────── */
.liked-animate svg {
  animation: heartbeat 0.4s var(--ease-out);
}

/* ── MOQ bar animation ─────────────────────────────────────── */
.moq-animate {
  animation: progressFill 0.8s var(--ease-out) both;
}

/* ── Notification ping ─────────────────────────────────────── */
.notification-ping::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--black);
  border-radius: var(--radius-full);
  animation: ping 1.5s ease-out infinite;
}

/* ── Savings counter ───────────────────────────────────────── */
.savings-counting {
  animation: countUp 0.4s var(--ease-out);
}

/* ── Card hover lift (for non-image cards) ─────────────────── */
.card-hover {
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* ── Page transition ───────────────────────────────────────── */
.page-enter {
  animation: fadeIn 0.25s var(--ease-out);
}

/* ── Page entrance: staggered fade-in for main content sections ── */
.page-body>* {
  animation: fadeInUp 0.35s var(--ease-out) both;
}

.page-body>*:nth-child(2) {
  animation-delay: 40ms;
}

.page-body>*:nth-child(3) {
  animation-delay: 80ms;
}

.page-body>*:nth-child(4) {
  animation-delay: 120ms;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .deal-card:hover .deal-card-img {
    transform: none;
  }
}