/* =========================================================
   NOVA WEAR — editorial motion layer
   Loaded after styles.css. Scroll-linked values come from js/motion.js
   as CSS variables. Product images in the shop grid are never hidden
   or delayed: motion here is editorial (hero, split, campaign, type).
   ========================================================= */

/* ---------- Page transitions between routes ---------- */
#app.is-entering { animation: pageIn 520ms var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero { --hp: 0; }
.hero__media::before {
  content: ""; position: absolute; inset: 0; z-index: 1; background: var(--paper);
  transform-origin: right center; animation: curtain 1.15s var(--ease) 0.08s both; pointer-events: none;
}
@keyframes curtain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.hero__media img { translate: 0 calc(var(--hp) * 10%); scale: calc(1 + var(--hp) * 0.14); will-change: transform; }
.hero__cap { z-index: 2; translate: 0 calc(var(--hp) * -40px); }
.hero__copy > div { translate: 0 calc(var(--hp) * -50px); opacity: calc(1 - var(--hp) * 0.9); }

/* ---------- Ticker band reacts to scroll ---------- */
.band { --bv: 0; }
.band__track { translate: calc(var(--bv) * -1px) 0; }

/* ---------- Headings: words rise out of a mask ---------- */
[data-split] .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
[data-split] .w > span { display: inline-block; transform: translate3d(0, 110%, 0); transition: transform 900ms var(--ease); transition-delay: calc(var(--wi, 0) * 60ms + 80ms); }
.is-in [data-split] .w > span, [data-split].is-in .w > span { transform: none; }
.js .reveal:has([data-split]) { transform: none; }

/* ---------- Category tiles: staggered entrance + touch flip ---------- */
.m .cats .cat { opacity: 0; transform: translate3d(0, 34px, 0); transition: opacity 700ms var(--ease), transform 900ms var(--ease); transition-delay: calc(var(--ci, 0) * 70ms); }
.m .cats .cat.m-in { opacity: 1; transform: none; }
@media (hover: none), (pointer: coarse) {
  .cat.is-flip .cat__media .is-back { opacity: 1; }
  .cat.is-flip .cat__media .is-front { opacity: 0; }
  .cat.is-flip .cat__media { background: var(--beige); }
}

/* ---------- Editorial split: curtain + parallax ---------- */
.split__media { --sp: 0.5; }
.m .split__media { clip-path: inset(0 0 100% 0); transition: clip-path 1.3s var(--ease); }
.m .split__media.m-in { clip-path: inset(0 0 0 0); }
.split__media img { scale: 1.14; translate: 0 calc((var(--sp) - 0.5) * -9%); }
.m .split__media img { transition: transform 1.4s var(--ease); }
.m .split__copy .specs li { position: relative; border-bottom-color: transparent; }
.m .split__copy .specs li::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--line-2); transform: scaleX(0); transform-origin: left; transition: transform 900ms var(--ease); }
.m .split__copy.is-in .specs li::after { transform: scaleX(1); }
.m .split__copy.is-in .specs li:nth-child(2)::after { transition-delay: 120ms; }
.m .split__copy.is-in .specs li:nth-child(3)::after { transition-delay: 240ms; }

/* ---------- Campaign: zoom-out + counter-moving type ---------- */
.campaign { --cp: 0.5; }
/* Zoom is anchored to the top edge and the crop keeps the top of the photo,
   so the model's head is never cut (it sits ~4% below the photo's top edge). */
.campaign img { object-position: 50% 0%; transform-origin: 50% 0%; scale: calc(1.15 - var(--cp) * 0.15); will-change: transform; }
.camp__l1, .camp__l2 { display: inline-block; will-change: transform; }
.camp__l1 { translate: calc((0.5 - var(--cp)) * 14vw) 0; }
.camp__l2 { translate: calc((var(--cp) - 0.5) * 14vw) 0; }

/* ---------- Values: rules draw in ---------- */
.m .values { border-top-color: transparent; position: relative; }
.m .values::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--line-2); transform: scaleX(var(--vl, 0)); transform-origin: left; }

/* ---------- Product page: color change wipes in the new photos ---------- */
.gallery.is-swapped .gallery__item { animation: wipeIn 700ms var(--ease) both; }
.gallery.is-swapped .gallery__item:nth-child(2) { animation-delay: 70ms; }
.gallery.is-swapped .gallery__item:nth-child(3) { animation-delay: 140ms; }
@keyframes wipeIn { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
.sw[aria-pressed="true"] i { animation: swPop 420ms var(--ease); }
@keyframes swPop { 0% { transform: scale(1.18); } 100% { transform: scale(0.82); } }

/* ---------- Bag: items settle in when the drawer opens ---------- */
.drawer.is-open .drawer__body > * { animation: bagIn 560ms var(--ease) both; }
.drawer.is-open .drawer__body > *:nth-child(2) { animation-delay: 60ms; }
.drawer.is-open .drawer__body > *:nth-child(3) { animation-delay: 120ms; }
.drawer.is-open .drawer__body > *:nth-child(n + 4) { animation-delay: 180ms; }
@keyframes bagIn { from { opacity: 0; transform: translate3d(24px, 0, 0); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .camp__l1 { translate: calc((0.5 - var(--cp)) * 20vw) 0; }
  .camp__l2 { translate: calc((var(--cp) - 0.5) * 20vw) 0; }
}

@media (prefers-reduced-motion: reduce) {
  #app.is-entering, .hero__media::before { animation: none; }
  .hero__media::before { display: none; }
  .hero__media img, .hero__cap, .hero__copy > div, .band__track, .split__media img, .campaign img, .camp__l1, .camp__l2 { translate: none !important; scale: none !important; opacity: 1 !important; }
  [data-split] .w > span { transform: none !important; }
  .m .cats .cat { opacity: 1; transform: none; }
  .m .split__media { clip-path: none; }
  .gallery.is-swapped .gallery__item, .drawer.is-open .drawer__body > *, .sw[aria-pressed="true"] i { animation: none; }
}
