/* ==========================================================================
   animations.css — scroll reveals, keyframes, motion preferences
   Only `transform` and `opacity` are animated so this stays smooth on
   low-end phones. Everything is disabled under prefers-reduced-motion.
   ========================================================================== */

/* ---------- Scroll reveal ----------
   js/animations.js adds .in via IntersectionObserver.
   Stagger with an inline style="--i:2" on each child.            */
.reveal {
  opacity: 0;
  transition:
    opacity   .85s var(--ease-out),
    transform .85s var(--ease-out),
    clip-path .95s var(--ease-out);
  transition-delay: calc(var(--i, 0) * .09s);
  will-change: transform, opacity;
}
.reveal[data-anim="up"]    { transform: translateY(38px); }
.reveal[data-anim="left"]  { transform: translateX(-38px); }
.reveal[data-anim="right"] { transform: translateX(38px); }
.reveal[data-anim="scale"] { transform: scale(.93); }
.reveal[data-anim="clip"]  { clip-path: inset(0 0 100% 0); opacity: 1; }
.reveal[data-anim="fade"]  { transform: none; }

.reveal.in {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 0 0);
}
.reveal.in { will-change: auto; }

/* ---------- Hero headline: word-by-word mask reveal ---------- */
.word-mask { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; }
.word-mask > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1s var(--ease-out);
  transition-delay: calc(.15s + var(--i, 0) * .075s);
}
.is-ready .word-mask > span { transform: translateY(0); }

/* ---------- Logo stroke draw-on ----------
   Each path carries pathLength="1" so one dasharray value works for all. */
.logo__mark path,
.logo__mark circle {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.5s var(--ease-out) forwards;
}
.logo__mark circle       { animation-duration: 1.9s; }
.logo__mark path:nth-of-type(1) { animation-delay: .18s; }
.logo__mark path:nth-of-type(2) { animation-delay: .34s; }
.logo__mark path:nth-of-type(3) { animation-delay: .46s; }
.logo__mark path:nth-of-type(4) { animation-delay: .58s; }
.logo__mark g path       { animation-delay: .8s; animation-duration: .9s; }

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

/* ---------- Marquee ticker ---------- */
.marquee {
  --speed: 34s;
  display: flex;
  overflow: hidden;
  user-select: none;
  padding-block: 1.1rem;
  background: var(--nisarga);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee__track {
  display: flex;
  flex: none;
  gap: 2.5rem;
  padding-right: 2.5rem;
  min-width: 100%;
  animation: marquee var(--speed) linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  font-family: var(--font-display);
  font-size: clamp(1rem, .85rem + .6vw, 1.4rem);
  font-style: italic;
  letter-spacing: .04em;
  white-space: nowrap;
  color: var(--cream);
}
.marquee__item::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--kavi-soft);
}
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- Add-to-cart fly ---------- */
.fly-clone {
  position: fixed;
  z-index: 250;
  border-radius: 10px;
  object-fit: cover;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  transition: transform .85s cubic-bezier(.5, -0.3, .55, 1), opacity .85s ease-in;
}

@keyframes badge-bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ---------- Toasts ---------- */
@keyframes toast-in  { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Loading skeletons ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--sand);
  border-radius: var(--radius);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Scroll cue ---------- */
.scroll-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue__line {
  width: 1px;
  height: 52px;
  background: linear-gradient(var(--sage), transparent);
  position: relative;
  overflow: hidden;
}
.scroll-cue__line::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 40%;
  background: var(--kavi);
  animation: cue 2.1s var(--ease) infinite;
}
@keyframes cue {
  0%   { transform: translateY(-100%); }
  60%, 100% { transform: translateY(260%); }
}

/* ---------- Spinner ---------- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Respect the user's motion preference — everything above becomes instant.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .word-mask > span { transform: none !important; }
  .logo__mark path, .logo__mark circle { stroke-dashoffset: 0 !important; }
  .marquee__track { animation: none !important; }
}
