/**
 * DeeToo editorial motion.
 *
 * One vocabulary for the whole site, ported from the fashion-editorial spec:
 * slow, heavy, scroll-triggered reveals on a single easing curve, revealed once
 * and never re-played on scroll-back.
 *
 * Nothing here applies until the loader script puts `dt-motion` on <html>. That
 * script bails out on prefers-reduced-motion and on browsers without
 * IntersectionObserver, so a visitor who never gets the JS sees an ordinary,
 * fully visible page instead of a blank one.
 */

:root {
	/* The one ease. Deliberately not mixed with anything else. */
	--dt-ease:     cubic-bezier(.22, 1, .36, 1);
	--dt-rv-dur:   .9s;    /* standard reveal            */
	--dt-rv-slow:  1.15s;  /* full-bleed poster reveal   */
	--dt-rv-y:     28px;   /* how far things travel up   */
	--dt-stagger:  .1s;    /* gap between group children */
}

/* -------------------------------------------------------------------------
 * Reveal targets.
 *
 * This list is duplicated as DT.fade / DT.rise / DT.groups in motion.js. CSS
 * owns the hidden state so it lands on the first paint (no flash of content
 * that then disappears); JS only adds `.dt-in` and the stagger index. Keep the
 * two lists in step.
 * ---------------------------------------------------------------------- */

/* Fade only — section headers, whose words do the moving instead (below). */
html.dt-motion :is(
	.dth-head,
	.dt-brands__head,
	.dth-why__t
):not(.dt-in) { opacity: 0; }

/* Fade and rise. */
html.dt-motion :is(
	.dth-fbanner,
	.dth-brands,
	.dth-trust,
	.dtp__strip,
	.dth-news,
	.dth-ig,
	.dth-empty,
	.dt-hero,
	.dt-showing,
	.dt-finder,
	.dth-hero__usps,
	.dt-archive__help,
	.dt-promo,
	.dt-stats
):not(.dt-in) {
	opacity: 0;
	transform: translateY(var(--dt-rv-y));
}

html.dt-motion :is(
	.dth-head, .dt-brands__head, .dth-why__t,
	.dth-fbanner, .dth-brands, .dth-trust, .dtp__strip, .dth-news, .dth-ig, .dth-empty, .dt-hero, .dt-showing,
	.dt-finder, .dth-hero__usps, .dt-archive__help, .dt-promo, .dt-stats
) {
	transition: opacity var(--dt-rv-dur) var(--dt-ease),
	            transform var(--dt-rv-dur) var(--dt-ease);
}

/* -------------------------------------------------------------------------
 * Stagger groups.
 *
 * Anything that repeats — cards, category circles, brand logos, trust items —
 * comes in one after another rather than all at once. JS numbers the children
 * through --dt-i.
 * ---------------------------------------------------------------------- */

html.dt-motion :is(
	.dth-rail__track,
	.dth-why,
	.dth-revs,
	.dth-ig__row,
	.dt-grid,
	.dt-tabs,
	.dt-brands__row,
	.dth-needs
) > * {
	transition: opacity var(--dt-rv-dur) var(--dt-ease),
	            transform var(--dt-rv-dur) var(--dt-ease);
	transition-delay: calc(var(--dt-i, 0) * var(--dt-stagger));
}

html.dt-motion :is(
	.dth-rail__track,
	.dth-why,
	.dth-revs,
	.dth-ig__row,
	.dt-grid,
	.dt-tabs,
	.dt-brands__row,
	.dth-needs
) > *:not(.dt-in) {
	opacity: 0;
	transform: translateY(24px);
}

/* -------------------------------------------------------------------------
 * Elementor images: the client's own banner artwork.
 *
 * Opened by scroll position, not by a one-off timer. Several side by side
 * become an editorial strip, and the stagger index makes them open left to
 * right like a curtain. An earlier `:not(.dt-in)` rule forced them shut until
 * the reveal observer fired, which held a banner closed while the scrub said
 * it was already opening and then snapped it — it is gone on purpose.
 * ---------------------------------------------------------------------- */

/* Scroll-scrubbed wipe. motion.js writes --dt-wipe (0 = closed, 1 = open) on
   each banner widget from where it sits in the viewport, every frame, so the
   frame opens as you scroll down and closes again as you scroll back up. No
   transition: the scroll position is the timeline.

   The clip sits on the inner element, not the widget the observer watches —
   a widget clipped to zero area reports zero intersection to
   IntersectionObserver and would never be picked up again. The fallback of 1
   means a page without the script shows every banner fully open. */
html.dt-motion .elementor-widget-image > * {
	clip-path: inset(0 calc((1 - var(--dt-wipe, 1)) * 100%) 0 0);
}
/* The picture travels with the opening edge, so it reads as sliding in rather
   than a still image being uncovered. */
html.dt-motion .elementor-widget-image img:not(.dt-par) {
	transform: translate3d(calc((1 - var(--dt-wipe, 1)) * -70px), 0, 0);
	will-change: transform;
}

/* -------------------------------------------------------------------------
 * Hero: the banner carousel settles rather than snapping.
 *
 * Scale only, never opacity — the hero is the largest paint on the page and
 * fading it in would push LCP back by the length of the animation.
 * ---------------------------------------------------------------------- */

html.dt-motion .elementor-widget-image-carousel .swiper-slide,
html.dt-motion .elementor-widget-image-carousel .elementor-image-carousel-wrapper {
	overflow: hidden;
}
/* The slide images rest slightly oversized. That crop is deliberate: it is the
   headroom the parallax drifts within, so the image can move against the page
   without ever exposing an edge.

   motion.js owns this transform outright — it composes the load settle and the
   scroll parallax into a single write per frame. Two systems writing `transform`
   on one element would simply overwrite each other. The value below is the
   resting state, so a visitor who never gets the JS sees the hero correctly
   rather than frozen mid-settle. */
html.dt-motion .elementor-widget-image-carousel :is(.swiper-slide img, .elementor-carousel-image) {
	/* Rest is 1 — no permanent zoom. A banner is the client's own artwork with
	   text and CTAs placed right up to the edge; an 8% crop that never lifts
	   was cutting that content off, not just easing in over it. The load
	   settle still starts oversized (motion.js), it just finishes at 1 instead
	   of stopping at the old load-in zoom. */
	transform: translate3d(0, var(--dt-par-y, 0px), 0) scale(var(--dt-hero-s, 1));
	will-change: transform;
}

/* -------------------------------------------------------------------------
 * Masked word reveal on section headings.
 *
 * Each word sits in its own clipped box and slides up from underneath, which
 * is the wordmark treatment from the brief applied to every section title.
 * The wrappers are added by JS, so headings without it just fade.
 * ---------------------------------------------------------------------- */

.dt-w  { display: inline-block; overflow: hidden; vertical-align: bottom; }
.dt-w__i {
	display: inline-block;
	transform: translateY(110%);
	transition: transform var(--dt-rv-dur) var(--dt-ease);
	transition-delay: calc(var(--dt-wi, 0) * .07s);
}
.dt-in .dt-w__i { transform: none; }
html:not(.dt-motion) .dt-w__i { transform: none; }

/* The subtitle under a heading is a printed watermark, not a moving part:
   opacity only, and a beat behind the words. */
html.dt-motion .dth-head__s {
	transition: opacity .9s var(--dt-ease) .25s;
}
html.dt-motion .dth-head:not(.dt-in) .dth-head__s { opacity: 0; }

/* Header ornaments (the flame, the crown, the little SVG chips) fade without
   moving, so they never compete with the copy. */
html.dt-motion :is(.dth-fire, .dth-crown, .dth-news__i, .dth-ig__i) {
	transition: opacity 1.1s var(--dt-ease) .2s;
}
html.dt-motion :is(.dth-head, .dth-news, .dth-ig):not(.dt-in)
	:is(.dth-fire, .dth-crown, .dth-news__i, .dth-ig__i) { opacity: 0; }

/* -------------------------------------------------------------------------
 * Slow hover on product imagery.
 *
 * Half a second, not the 150ms an app would use — the unhurried scale is the
 * whole luxury signal. The card lift is slowed to match so the two do not read
 * as two different interactions.
 * ---------------------------------------------------------------------- */

.dt-card__img { overflow: hidden; border-radius: 10px; }
.dt-card__img img { transition: transform .55s var(--dt-ease); }
.dt-card:hover .dt-card__img img,
.dt-card:active .dt-card__img img { transform: scale(1.05); }

.dt-card {
	transition: box-shadow .55s var(--dt-ease),
	            border-color .55s var(--dt-ease),
	            transform .55s var(--dt-ease);
}

.dth-cat__img img { transition: transform .55s var(--dt-ease); }
.dth-cat:hover .dth-cat__img img { transform: scale(1.06); }

/* Shop by Need tiles hold the client's own banner artwork; the same unhurried
   scale, and the dimming lifts on hover. */
.dth-need img { transition: transform .55s var(--dt-ease), opacity .55s var(--dt-ease); }
.dth-need:hover img { transform: scale(1.06); opacity: 1; }

/* -------------------------------------------------------------------------
 * Opt-outs
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html.dt-motion :not(.dt-in),
	html.dt-motion :is(.dt-w__i, .elementor-carousel-image) {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
}

/* =========================================================================
 * Scroll-linked and gesture-specific motion
 *
 * Everything above reveals on "did it enter the viewport". The rules below are
 * the other kinds: tied to scroll position, to a shape, or to a state change.
 * ====================================================================== */

/* The one ease stays the one ease for reveals. This second curve exists only
   for things that should land with a little weight — a circle arriving reads
   better with a slight overshoot than with a linear settle. It is deliberately
   not used anywhere a rectangle or a block of text moves. */
:root { --dt-pop: cubic-bezier(.34, 1.46, .64, 1); }

/* ---------- Category circles: pop, don't rise ---------- */

html.dt-motion .dth-rail--cats .dth-rail__track > .dth-cat {
	transition: opacity .5s var(--dt-ease),
	            transform .62s var(--dt-pop);
	transition-delay: calc(var(--dt-i, 0) * var(--dt-stagger));
}
html.dt-motion .dth-rail--cats .dth-rail__track > .dth-cat:not(.dt-in) {
	opacity: 0;
	/* Scale only — a circle sliding up from below reads as a paragraph. */
	transform: scale(.82);
}

/* ---------- Line icons draw themselves ----------
   Lengths are measured per shape in JS and written to --dt-len, because a
   guessed dasharray that is shorter than the real path makes the stroke repeat
   instead of draw. */

html.dt-motion .dt-draw {
	stroke-dasharray: var(--dt-len, 0);
	stroke-dashoffset: var(--dt-len, 0);
	transition: stroke-dashoffset 1s var(--dt-ease);
	transition-delay: calc(var(--dt-di, 0) * .09s);
}
html.dt-motion .dt-drawn .dt-draw { stroke-dashoffset: 0; }

/* ---------- Parallax ----------
   The moving layer is always oversized by its container, which clips. */

html.dt-motion .dt-par-clip { overflow: hidden; }
html.dt-motion .dt-par {
	/* The variable is set on the clipping parent and inherited, so a layer that
	   gets re-created by its own script still picks up the current value.
	   1.015 is headroom for the drift, not a zoom — see the note on the hero
	   rule above for why this used to be 1.08 and cropped the banner text.

	   the wipe slide is folded in here rather than given its own rule, because a
	   second rule setting `transform` on this element would simply replace this
	   one — the reveal slide and the scroll parallax have to be one value. */
	transform: translate3d(
		calc((1 - var(--dt-wipe, 1)) * -70px),
		var(--dt-par-y, 0px),
		0
	) scale(1.015);
	will-change: transform;
}

/* ---------- Scroll progress ----------
   Fixed to the viewport rather than sitting under the header, because this
   header is static and scrolls away — a bar attached to it would be gone
   exactly when it starts being useful. */

.dt-progress {
	position: fixed; inset: 0 auto auto 0;
	height: 3px; width: 100%;
	transform: scaleX(var(--dt-progress, 0));
	transform-origin: 0 50%;
	background: linear-gradient(90deg, var(--dt-orange, #f4511e), #ff8a4c);
	z-index: 99999;
	pointer-events: none;
}

/* ---------- Pinned "Why Choose" ----------
   Desktop only. On a phone the viewport is short enough that pinning eats the
   whole screen, and a touch scroll that stops responding reads as a bug. */

@media (min-width: 1000px) {
	/* The theme wraps the page in .template-container with overflow:hidden,
	   which silently makes position:sticky inert for everything inside it —
	   a scroll container is what sticky sticks to, and that one is not the
	   viewport. `clip` does the same visual job without establishing a scroll
	   container, so sticky keeps working and the horizontal overflow this was
	   guarding against is still clipped. */
	html.dt-can-pin .template-container { overflow: clip; }

	html.dt-motion .dth-whypin { position: relative; }
	html.dt-motion .dth-whypin__stick {
		position: sticky;
		top: 18vh;
	}
	/* Each reason is dimmed until the scrub reaches it. */
	html.dt-motion .dth-whypin .dth-why > li {
		opacity: .28;
		transform: translateY(8px);
		transition: opacity .45s var(--dt-ease), transform .45s var(--dt-ease);
	}
	html.dt-motion .dth-whypin .dth-why > li.is-lit {
		opacity: 1;
		transform: none;
	}
	html.dt-motion .dth-whypin .dth-why > li.is-lit .dth-why__i {
		background: var(--dt-orange);
		border-color: var(--dt-orange);
		color: #fff;
	}
	html.dt-motion .dth-whypin .dth-why__i {
		transition: background .45s var(--dt-ease), border-color .45s var(--dt-ease),
		            color .45s var(--dt-ease);
	}
}

/* ---------- Cart feedback ---------- */

@keyframes dt-cart-pulse {
	0%   { transform: scale(1); }
	30%  { transform: scale(1.28); }
	55%  { transform: scale(.94); }
	100% { transform: scale(1); }
}
.dtx-cart.is-bumped { animation: dt-cart-pulse .6s cubic-bezier(.34, 1.46, .64, 1); }
.dtx-cart.is-bumped .dtx-cart__n {
	animation: dt-cart-pulse .6s cubic-bezier(.34, 1.46, .64, 1) .06s;
}

@media (prefers-reduced-motion: reduce) {
	.dtx-cart.is-bumped,
	.dtx-cart.is-bumped .dtx-cart__n { animation: none; }
	.dt-progress { transition: none; }
}
