/* giii-motion 1.0.0 — at-rest and animated states. MIT, (c) GIII.
 * Everything is visible at rest. Motion only applies under `.js` (added by the
 * site's head script or by init()), and never under prefers-reduced-motion.
 * Set the tokens below from the design tokens; they are on :where(:root) so any
 * site rule overrides them. */

:where(:root) {
  --motion-duration-fast: 150ms;
  --motion-duration-base: 600ms;
  --motion-duration-slow: 1000ms;
  --motion-ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --motion-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --motion-distance: 18px;
  --motion-stagger: 70ms;
}

/* (1) Reveal — individual translate/scale properties, so a block's own
 * `transform` is left alone. */
.js [data-reveal] {
  transition-property: opacity, translate, scale;
  transition-duration: var(--motion-duration-base);
  transition-timing-function: var(--motion-ease-out);
  transition-delay: var(--reveal-delay, calc(var(--reveal-i, 0) * var(--motion-stagger)));
}
.js [data-reveal]:not([data-visible]) { opacity: 0; translate: 0 var(--motion-distance); }
.js [data-reveal='down']:not([data-visible]) { translate: 0 calc(-1 * var(--motion-distance)); }
.js [data-reveal='left']:not([data-visible]) { translate: calc(-1 * var(--motion-distance)) 0; }
.js [data-reveal='right']:not([data-visible]) { translate: var(--motion-distance) 0; }
.js [data-reveal='fade']:not([data-visible]) { translate: none; }
.js [data-reveal='scale']:not([data-visible]) { translate: none; scale: 0.94; }
/* Failsafe with no JS at all: if the head script added `js` but giii-motion never
 * ran (blocked, failed to load), hidden blocks appear after 3 s by CSS alone. */
.js:not(.gm-ready) [data-reveal]:not([data-visible]) { animation: gm-failsafe 0s 3s forwards; }
@keyframes gm-failsafe { to { opacity: 1; translate: none; scale: none; } }

/* (3) Counters: reserve the width so ticking digits never reflow the line. */
[data-count-to] { display: inline-block; font-variant-numeric: tabular-nums; }

/* (4) Pin: plain CSS sticky. Needs a taller parent and no overflow:hidden/auto
 * ancestor between it and the scroller. */
[data-pin] { position: sticky; top: var(--pin-top, 0px); z-index: 1; }

/* (5) Reading progress (decorative unless you give it role="progressbar"). */
[data-progress] { transform: scaleX(0); transform-origin: 0 50%; }

/* (6) Before/after compare. At rest: the two photos side by side. */
[data-compare] { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
[data-compare] > img { width: 100%; height: auto; display: block; }
[data-compare].gm-compare-on {
  grid-template-columns: 1fr; gap: 0; container-type: inline-size;
  position: relative; touch-action: pan-y; user-select: none; cursor: ew-resize;
}
.gm-compare-on > img { grid-area: 1 / 1; }
.gm-compare-on > img:nth-of-type(2) { clip-path: inset(0 0 0 calc(var(--pos, 50) * 1%)); }
.gm-compare-handle {
  grid-area: 1 / 1; justify-self: start; align-self: stretch; position: relative;
  width: 44px; margin-left: -22px; translate: calc(var(--pos, 50) * 1cqi) 0;
  outline: none; cursor: ew-resize;
}
.gm-compare-handle::before {
  content: ''; position: absolute; inset: 0 auto 0 50%; width: 2px; margin-left: -1px;
  background: var(--compare-line, #fff); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25);
}
.gm-compare-handle::after {
  content: '\2039\00a0\203A'; position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--compare-knob, #fff); color: var(--compare-knob-ink, #111); font: 700 18px/1 system-ui, sans-serif;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
}
.gm-compare-handle:focus-visible::after { outline: 3px solid var(--focus-ring, #1a5fd0); outline-offset: 2px; }

/* (7) Marquee. At rest the row simply wraps; with JS it loops. */
.gm-marquee-on { overflow: hidden; }
.gm-marquee-track { display: flex; width: max-content; animation: gm-marquee var(--marquee-duration, 30s) linear infinite; }
.gm-marquee-set {
  display: flex; flex: none; align-items: center;
  gap: var(--marquee-gap, 2.5rem); padding-inline-end: var(--marquee-gap, 2.5rem);
}
.gm-marquee-on:hover .gm-marquee-track,
.gm-marquee-on:focus-within .gm-marquee-track,
.gm-marquee-on.gm-offscreen .gm-marquee-track { animation-play-state: paused; }
@keyframes gm-marquee { to { transform: translate3d(-50%, 0, 0); } }

/* (8) Tilt (pointer devices only; JS adds .gm-tilt-on). */
.gm-tilt-on {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform var(--motion-duration-fast) var(--motion-ease-out);
}

/* Reduced motion: final state, nothing moves. (JS also skips these features.) */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js [data-reveal]:not([data-visible]) {
    opacity: 1; translate: none; scale: none; transition: none; animation: none;
  }
  [data-parallax] { translate: none !important; }
  .gm-marquee-track { animation: none; }
  .gm-tilt-on { transform: none; transition: none; }
}
