/* ============================================================
   PARFINO — Animations
   Philosophy: purposeful, never gratuitous. 60fps. Breathable.
   ============================================================ */

/* ── Keyframes ──────────────────────────────────────────────── */
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10%       { transform: translate(-2%, -3%); }
  20%       { transform: translate(2%, 1%); }
  30%       { transform: translate(-1%, 4%); }
  40%       { transform: translate(3%, -2%); }
  50%       { transform: translate(-3%, 1%); }
  60%       { transform: translate(1%, -4%); }
  70%       { transform: translate(-2%, 3%); }
  80%       { transform: translate(3%, 2%); }
  90%       { transform: translate(-1%, -1%); }
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(3%, -4%) scale(1.06); }
  66%       { transform: translate(-3%, 3%) scale(.96); }
}

@keyframes bottle-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

@keyframes scroll-line {
  0%        { transform: scaleY(0); transform-origin: top; opacity: 1; }
  50%       { transform: scaleY(1); transform-origin: top; opacity: 1; }
  51%       { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100%      { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes scale-in {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  from { background-position: -600px 0; }
  to   { background-position: 600px 0; }
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(100,34,44,.4); }
  70%  { box-shadow: 0 0 0 12px rgba(100,34,44,0); }
  100% { box-shadow: 0 0 0 0 rgba(100,34,44,0); }
}

@keyframes cart-bounce {
  0%, 100% { transform: scale(1); }
  30%       { transform: scale(1.4); }
  60%       { transform: scale(.9); }
}

/* ── Reveal on Scroll ───────────────────────────────────────── */
.reveal,
.reveal-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--ease-out) var(--delay, 0s),
              transform .7s var(--ease-out) var(--delay, 0s);
  will-change: opacity, transform;
}

.reveal {
  transform: translateY(18px) scale(.98);
  transition: opacity .6s var(--ease-out) var(--delay, 0s),
              transform .6s var(--ease-out) var(--delay, 0s);
}

.reveal.is-visible,
.reveal-up.is-visible {
  opacity: 1;
  transform: none;
}

/* ── Hero entrance (always plays) ───────────────────────────── */
.hero__eyebrow { animation: fade-in .8s var(--ease-out) .2s both; }
.hero__title   { animation: fade-in-up 1s var(--ease-out) .35s both; }
.hero__sub     { animation: fade-in-up .9s var(--ease-out) .55s both; }
.hero__actions { animation: fade-in-up .8s var(--ease-out) .7s both; }
.hero__volumes { animation: fade-in .8s var(--ease-out) .9s both; }
.hero__scroll  { animation: fade-in .8s var(--ease-out) 1.2s both; }

/* ── Cart bounce on item added ──────────────────────────────── */
.cart-count.is-bouncing {
  animation: cart-bounce .45s var(--ease-spring) both;
}

/* ── Add to cart button state ───────────────────────────────── */
.add-to-cart-btn.is-adding {
  pointer-events: none;
  animation: pulse-ring .6s ease-out;
}

/* ── Page loading skeleton ──────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bone) 25%,
    var(--cream-dark) 37%,
    var(--bone) 63%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

/* ── Stagger children ───────────────────────────────────────── */
.products-grid .product-card:nth-child(1) { --delay: 0s; }
.products-grid .product-card:nth-child(2) { --delay: .06s; }
.products-grid .product-card:nth-child(3) { --delay: .12s; }
.products-grid .product-card:nth-child(4) { --delay: .18s; }
.products-grid .product-card:nth-child(5) { --delay: .08s; }
.products-grid .product-card:nth-child(6) { --delay: .14s; }
.products-grid .product-card:nth-child(7) { --delay: .20s; }
.products-grid .product-card:nth-child(8) { --delay: .1s; }

.promise-grid .promise-card { transition-delay: var(--delay, 0s); }
.brands-grid  .brand-chip   { transition-delay: var(--delay, 0s); }

/* ── Magnetic button (applied via JS) ──────────────────────── */
.btn--magnetic {
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              background var(--dur-base),
              color var(--dur-base);
}

/* ── Hover glow on wine buttons ─────────────────────────────── */
.btn--primary {
  box-shadow: 0 0 0 rgba(100,34,44,0);
  transition: background var(--dur-base), transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.btn--primary:hover {
  box-shadow: 0 8px 30px rgba(100,34,44,.35), 0 2px 8px rgba(100,34,44,.2);
}

/* ── Volume option transition ───────────────────────────────── */
.volume-option {
  transition: border-color var(--dur-fast), background var(--dur-fast),
              transform var(--dur-fast) var(--ease-spring);
}

.volume-option:active { transform: scale(.95); }

/* ── Image reveal on load ───────────────────────────────────── */
img {
  transition: opacity .4s ease;
}

img[data-loading] { opacity: 0; }
img.is-loaded     { opacity: 1; }

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

  .reveal, .reveal-up {
    opacity: 1;
    transform: none;
  }
}
