/*
  NUVÈN — motion.css
  The movement layer ported from the Shopify build: a short opening curtain, page-to-page
  transitions, headings that arrive a word at a time, staged hero text, a hero that sinks back
  as you scroll, buttons that fill with colour, photos that settle and zoom, the bag that jumps,
  and panels whose contents follow them in.

  Only transform, opacity, translate and clip-path move, so phones stay smooth. With motion.js
  missing or a device set to reduce motion, everything sits in its final place.
*/

:root {
	--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
	--ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
	--ease-curtain: cubic-bezier(0.76, 0, 0.24, 1);
}

/* 1. Opening curtain (first page of a visit) ------------------------------------------------ */

html.nv-intro body::before,
html.nv-intro body::after {
	position: fixed;
	z-index: 1000;
	pointer-events: none;
}

html.nv-intro body::before {
	content: '';
	inset: 0;
	background: rgb(var(--ink));
	animation: nv-curtain 1.1s var(--ease-curtain) 0.95s both;
}

html.nv-intro body::after {
	content: 'NUVÈN';
	top: 50%;
	left: 50%;
	color: rgb(var(--bone));
	font-family: var(--font-display);
	font-size: clamp(2.5rem, 1.5rem + 5vw, 5rem);
	font-weight: 600;
	letter-spacing: 0.28em;
	text-indent: 0.28em;
	animation: nv-word 1.3s var(--ease-out) both;
}

@keyframes nv-curtain {
	to {
		clip-path: inset(0 0 100% 0);
	}
}

@keyframes nv-word {
	0% {
		opacity: 0;
		transform: translate(-50%, -20%);
		letter-spacing: 0.6em;
	}
	45% {
		opacity: 1;
		transform: translate(-50%, -50%);
		letter-spacing: 0.28em;
	}
	75% {
		opacity: 1;
		transform: translate(-50%, -50%);
	}
	100% {
		opacity: 0;
		transform: translate(-50%, -90%);
	}
}

@media (prefers-reduced-motion: no-preference) {
	/* 2. Page-to-page transitions --------------------------------------------------------- */

	@view-transition {
		navigation: auto;
	}

	::view-transition-old(root) {
		animation: nv-page-out 0.5s var(--ease-out) both;
	}

	::view-transition-new(root) {
		animation: nv-page-in 0.6s var(--ease-out) both;
	}

	.site-header {
		view-transition-name: nv-header;
	}

	::view-transition-group(nv-header) {
		z-index: 10;
		animation-duration: 0s;
	}

	@keyframes nv-page-out {
		to {
			opacity: 0;
			transform: translateY(-1.5rem) scale(0.985);
		}
	}

	@keyframes nv-page-in {
		from {
			opacity: 0;
			transform: translateY(2.5rem);
		}
	}

	html {
		scroll-behavior: smooth;
	}

	/* 3. Arriving on scroll --------------------------------------------------------------- */

	.nv-motion [data-reveal] {
		transition-delay: calc(var(--i, 0) * 90ms);
	}

	/* Headings: a word at a time from behind an edge. The block itself no longer fades. */
	.split-word {
		display: inline-block;
		overflow: hidden;
		padding-block-end: 0.14em;
		margin-block-end: -0.14em;
		vertical-align: top;
	}

	.split-word > span {
		display: inline-block;
		transition: transform 1s var(--ease-out);
		transition-delay: calc(var(--w, 0) * 60ms + var(--i, 0) * 90ms);
	}

	.nv-motion .is-split[data-reveal]:not(.is-in),
	.nv-motion [data-reveal]:not(.is-in) .is-split {
		opacity: 1 !important;
		filter: none !important;
		transform: none !important;
	}

	.nv-motion [data-reveal]:not(.is-in) .split-word > span,
	.nv-motion .is-split[data-reveal]:not(.is-in) .split-word > span,
	.nv-motion .hero:not(.is-staged) .split-word > span,
	.nv-motion .hero__slide:not(.is-active) .split-word > span {
		transform: translateY(110%);
	}

	/* Product rows, pages and the footer rise in, one after another. */
	.nv-motion li.product[data-reveal]:not(.is-in),
	.nv-motion .summary > [data-reveal]:not(.is-in),
	.nv-motion .site-footer__inner > [data-reveal]:not(.is-in) {
		opacity: 0;
		transform: translateY(2rem);
	}

	/* 4. Hero ---------------------------------------------------------------------------- */

	.nv-motion .hero__track {
		transform: translate3d(0, var(--hero-y, 0), 0);
		opacity: var(--hero-fade, 1);
		will-change: transform;
	}

	.nv-motion .hero {
		overflow: clip;
	}

	.nv-motion .hero__content {
		translate: 0 var(--hero-text, 0);
	}

	.nv-motion .hero__eyebrow,
	.nv-motion .hero__content .button {
		opacity: 0;
		transform: translateY(1.5rem);
		transition: opacity 0.8s var(--ease-out), transform 0.9s var(--ease-out);
	}

	.nv-motion .hero.is-staged .hero__slide.is-active .hero__eyebrow,
	.nv-motion .hero.is-staged .hero__slide.is-active .hero__content .button {
		opacity: 1;
		transform: none;
	}

	.nv-motion .hero.is-staged .hero__slide.is-active .hero__eyebrow {
		transition-delay: 0.1s;
	}

	.nv-motion .hero.is-staged .hero__slide.is-active .split-word > span {
		transition-delay: calc(0.25s + var(--w, 0) * 70ms);
	}

	.nv-motion .hero.is-staged .hero__slide.is-active .hero__content .button {
		transition-delay: 0.75s;
	}

	/* The first photo settles from a deeper zoom as the curtain lifts. */
	.nv-motion .hero:not(.is-staged) .hero__slide.is-active .hero__img {
		transform: scale(1.18);
		transition: none;
	}

	.nv-motion .hero.is-staged .hero__img {
		transition: transform 7s cubic-bezier(0.22, 0.61, 0.36, 1);
	}

	/* Hero doodles wait for the text. */
	.nv-motion .hero:not(.is-staged) .doodle-sticker {
		opacity: 0;
		transform: scale(0.6) rotate(-20deg);
	}

	.nv-motion .hero .doodle-sticker {
		transition: opacity 0.8s var(--ease-out) 1.1s, transform 1s var(--ease-spring) 1.1s;
	}

	/* 5. Pictures that drift, and the band that leans ----------------------------------- */

	.nv-motion .nv-drift {
		animation: none !important;
		scale: 1.14;
		will-change: translate;
	}

	.nv-motion .cats__word.nv-drift {
		scale: 1;
	}

	.band__track {
		transform: skewX(var(--lean, 0deg));
	}

	/* 6. Buttons, cards and small touches ----------------------------------------------- */

	/* A second colour sweeps across a button from the left. */
	.button {
		position: relative;
		isolation: isolate;
		overflow: hidden;
	}

	.button::before {
		content: '';
		position: absolute;
		z-index: -1;
		inset: 0;
		border-radius: inherit;
		background: rgb(var(--cognac));
		transform: scaleX(0);
		transform-origin: right center;
		transition: transform 0.55s var(--ease-out);
	}

	.button--light::before {
		background: rgb(var(--ink));
	}

	.button > span:first-child {
		transition: color 0.4s var(--ease-out);
	}

	@keyframes nv-roll {
		0% {
			transform: none;
		}
		45% {
			transform: translateX(170%);
		}
		45.01% {
			transform: translateX(-170%);
		}
		100% {
			transform: none;
		}
	}

	.button__disc {
		overflow: hidden;
	}

	@media (hover: hover) {
		.button:hover::before {
			transform: scaleX(1);
			transform-origin: left center;
		}

		.button--light:hover > span:first-child {
			color: rgb(var(--bone));
		}

		.button:hover .button__disc .icon {
			animation: nv-roll 0.62s var(--ease-out);
		}

		.card-media img,
		.cats__media img,
		.social__item img,
		.look__media img {
			transition: opacity 0.6s var(--ease), transform 1.4s var(--ease-out);
		}

		.card:hover .card-media img,
		.cats__tile:hover .cats__media img,
		.social__item:hover img,
		.look:hover .look__media img {
			transform: scale(1.07);
		}

		/* Pointing at one link in a group quiets the others. */
		.site-nav li,
		.site-footer__nav li {
			transition: opacity 0.3s var(--ease);
		}

		.site-nav .menu:hover > li:not(:hover),
		.site-footer__nav ul:hover li:not(:hover) {
			opacity: 0.4;
		}
	}

	/* On phones there is no pointer, so the arrow rolls once as its slide arrives. */
	.nv-motion .hero.is-staged .hero__slide.is-active .button__disc .icon {
		animation: nv-roll 0.62s var(--ease-out) 1.6s;
	}

	.button:active,
	.icon-button:active,
	.card__add:active,
	.chip:active,
	.hero__dot:active {
		transform: scale(0.94);
	}

	/* The bag jumps when something lands in it. */
	.is-bumped .icon {
		animation: nv-bump 0.62s var(--ease-spring);
	}

	.is-bumped .cart-count {
		animation: nv-pop 0.62s var(--ease-spring);
	}

	@keyframes nv-bump {
		30% {
			transform: translateY(-0.375rem) rotate(-8deg);
		}
		60% {
			transform: translateY(0) rotate(6deg);
		}
	}

	@keyframes nv-pop {
		40% {
			transform: scale(1.5);
		}
	}

	.nv-fly {
		position: fixed;
		z-index: 300;
		object-fit: cover;
		border-radius: 50%;
		box-shadow: 0 0 0 3px rgb(var(--lime));
		pointer-events: none;
		transition: transform 0.72s var(--ease-curtain), opacity 0.72s var(--ease);
	}

	/* Photos fade in as they load. */
	.nv-motion img.nv-fade {
		opacity: 0;
		transition: opacity 0.7s var(--ease);
	}

	.nv-motion img.nv-fade.is-loaded {
		opacity: 1;
	}

	/* 7. Panels: what is inside follows them in ----------------------------------------- */

	.drawer:not([hidden]) .drawer__nav li,
	.drawer:not([hidden]) .drawer__foot,
	.search-sheet:not([hidden]) .search-sheet__panel > * {
		animation: nv-item 0.62s var(--ease-out) both;
	}

	.drawer:not([hidden]) .drawer__nav li:nth-child(1) { animation-delay: 0.12s; }
	.drawer:not([hidden]) .drawer__nav li:nth-child(2) { animation-delay: 0.17s; }
	.drawer:not([hidden]) .drawer__nav li:nth-child(3) { animation-delay: 0.22s; }
	.drawer:not([hidden]) .drawer__nav li:nth-child(4) { animation-delay: 0.27s; }
	.drawer:not([hidden]) .drawer__nav li:nth-child(5) { animation-delay: 0.32s; }
	.drawer:not([hidden]) .drawer__nav li:nth-child(n + 6) { animation-delay: 0.37s; }
	.drawer:not([hidden]) .drawer__foot { animation-delay: 0.42s; }
	.search-sheet:not([hidden]) .search-sheet__panel > :nth-child(2) { animation-delay: 0.08s; }

	.drawer__scrim {
		backdrop-filter: blur(6px);
		-webkit-backdrop-filter: blur(6px);
	}

	@keyframes nv-item {
		from {
			opacity: 0;
			transform: translateY(1.25rem);
		}
	}

	/* 8. Reading line: a hairline of neon that fills as you scroll ------------------------ */

	.nv-progress {
		position: fixed;
		z-index: 120;
		inset: 0 0 auto;
		height: 2px;
		background: rgb(var(--lime));
		transform: scaleX(0);
		transform-origin: left center;
		pointer-events: none;
	}
}

.nv-progress {
	display: none;
}

.nv-motion .nv-progress {
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	html.nv-intro body::before,
	html.nv-intro body::after {
		display: none;
	}

	.nv-progress {
		display: none !important;
	}
}
