/* ==========================================================================
   animations.css – keyframes, scroll reveals and micro-interactions
   Elements with [data-reveal] fade up when they enter the viewport
   (see initReveal() in main.js). Everything is disabled for users who
   prefer reduced motion.
   ========================================================================== */

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

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

@keyframes dotFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* Hero copy entrance – the one orchestrated page-load moment */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.slide.is-active .slide-kicker,
.slide.is-active h1,
.slide.is-active h2,
.slide.is-active p,
.slide.is-active .slide-actions {
  animation: riseIn 0.8s var(--ease) both;
}
.slide.is-active h1, .slide.is-active h2 { animation-delay: 0.08s; }
.slide.is-active p { animation-delay: 0.16s; }
.slide.is-active .slide-actions { animation-delay: 0.24s; }
.slide.is-active .glass-chip { animation: riseIn 0.8s var(--ease) 0.4s both; }

/* Stitch line "sewing" itself in when revealed */
@keyframes sew {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
.stitch.is-visible, [data-reveal].is-visible .stitch { animation: sew 1.1s var(--ease) both; }

/* Scroll reveal */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* Process line draws downward as the section is revealed */
.js .process[data-reveal]::before { transform: scaleY(0); transform-origin: top; transition: transform 1.6s var(--ease) 0.2s; }
.js .process[data-reveal].is-visible::before { transform: scaleY(1); }

/* Shake for invalid form submissions */
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.field.has-error input,
.field.has-error select,
.field.has-error textarea { animation: nudge 0.3s ease-in-out; }

/* Stepper value bump */
@keyframes bump {
  50% { transform: scale(1.12); }
}
.stepper input.bump { animation: bump 0.2s ease; }

/* Product card stagger when the grid re-renders */
.product-grid .product-card { animation: riseIn 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .slide-media img { transform: none !important; }
}
