/* Scroll reveals. Nothing here hides anything until html.vamora-motion is set on
   the document, which happens only when the head flag runs — so a page without
   scripts, a crawler or a printer gets the finished page, never a blank one.

   --vamora-i is the item's place in its row, set by the engine; --vamora-step
   lets a section tighten or loosen that cascade.

   A reveal travels on the transform shorthand, and the engine takes its classes
   away once it has landed so hover and tilt can own that transform. It puts
   them back when the section leaves upwards, which is what lets a reveal play
   again on the way back down. Scroll-linked depth stays on the individual
   translate, scale and rotate properties, where it never meets either. */

/* An arrival travels, and travel is width the page does not have. Clipping the
   page's own axis costs nothing — the design never scrolls sideways — and keeps
   a card that is still off to one side from widening it. */
html.vamora-motion .vamora-home,
html.vamora-motion .vamora-landing {
	overflow-x: clip;
}

html.vamora-motion .vamora-reveal {
	--vamora-delay: calc(var(--vamora-i, 0) * var(--vamora-step, var(--motion-stagger)));

	opacity: 0;
	transition:
		opacity var(--motion-reveal) var(--motion-out) var(--vamora-delay),
		transform var(--motion-reveal) var(--motion-out) var(--vamora-delay),
		filter var(--motion-reveal) var(--motion-out) var(--vamora-delay),
		clip-path var(--motion-slow) var(--motion-out) var(--vamora-delay);
}

html.vamora-motion .vamora-reveal--rise {
	transform: translate3d(0, var(--motion-rise), 0);
}

/* Sideways only where a pair actually sits side by side: stacked, the travel
   would be a phone's width of empty page to scroll through. */
html.vamora-motion .vamora-reveal--left,
html.vamora-motion .vamora-reveal--right {
	transform: translate3d(0, var(--motion-rise), 0);
}

@media (min-width: 56.25em) {
	html.vamora-motion .vamora-reveal--left {
		transform: translate3d(calc(-1 * var(--motion-shift)), 0, 0);
	}

	html.vamora-motion .vamora-reveal--right {
		transform: translate3d(var(--motion-shift), 0, 0);
	}
}

html.vamora-motion .vamora-reveal--scale {
	transform: scale(var(--motion-scale-from));
}

html.vamora-motion .vamora-reveal--pop {
	transform: scale(var(--motion-pop-from));
	transition-timing-function: var(--motion-spring);
}

html.vamora-motion .vamora-reveal--blur {
	transform: translate3d(0, calc(var(--motion-rise) / 2), 0);
	filter: blur(var(--motion-blur));
}

/* Image wipes. The element keeps its own transform free for parallax, so the
   reveal is carried by the clip alone. */
html.vamora-motion .vamora-reveal--wipe {
	clip-path: inset(0 100% 0 0);
}

/* Pen-stroke draw. The engine measures the path and sets --vamora-len. */
html.vamora-motion .vamora-reveal--draw {
	stroke-dasharray: var(--vamora-len, 1200);
	stroke-dashoffset: var(--vamora-len, 1200);
	transition: stroke-dashoffset var(--motion-draw) var(--motion-inout) var(--vamora-delay);
}

html.vamora-motion .vamora-reveal.is-inview {
	opacity: 1;
}

html.vamora-motion .vamora-reveal--rise.is-inview,
html.vamora-motion .vamora-reveal--left.is-inview,
html.vamora-motion .vamora-reveal--right.is-inview,
html.vamora-motion .vamora-reveal--scale.is-inview,
html.vamora-motion .vamora-reveal--pop.is-inview,
html.vamora-motion .vamora-reveal--blur.is-inview {
	transform: none;
}

html.vamora-motion .vamora-reveal--blur.is-inview {
	filter: none;
}

html.vamora-motion .vamora-reveal--wipe.is-inview {
	clip-path: inset(0 0 0 0);
}

html.vamora-motion .vamora-reveal--draw.is-inview {
	stroke-dashoffset: 0;
}

/* Split headings. The engine wraps each word of a heading and leaves any
   element inside it — the gradient accent line — whole, so the gradient still
   paints across unbroken text. */
html.vamora-motion .vamora-split .vamora-word,
html.vamora-motion .vamora-split .vamora-split__block {
	--vamora-delay: calc(var(--vamora-i, 0) * var(--motion-stagger-tight));

	opacity: 0;
	transform: translate3d(0, var(--motion-word-rise), 0);
	filter: blur(var(--motion-word-blur));
	transition:
		opacity var(--motion-reveal) var(--motion-out) var(--vamora-delay),
		transform var(--motion-reveal) var(--motion-out) var(--vamora-delay),
		filter var(--motion-reveal) var(--motion-out) var(--vamora-delay);
}

html.vamora-motion .vamora-split .vamora-word {
	display: inline-block;
}

html.vamora-motion .vamora-split.is-inview .vamora-word,
html.vamora-motion .vamora-split.is-inview .vamora-split__block {
	opacity: 1;
	transform: none;
	filter: none;
}

/* A paragraph the scroll fills in, word by word. The words never move — only
   their opacity does, and the scroll position moves it rather than a
   transition, so the engine hands each word its own value as the section
   passes. */
html.vamora-motion .vamora-scrub .vamora-word {
	display: inline-block;
	opacity: var(--motion-dim);
}

@media (prefers-reduced-motion: reduce) {
	html.vamora-motion .vamora-reveal,
	html.vamora-motion .vamora-split .vamora-word,
	html.vamora-motion .vamora-split .vamora-split__block {
		transition-duration: var(--motion-ui);
	}

	html.vamora-motion .vamora-reveal--wipe,
	html.vamora-motion .vamora-reveal--wipe.is-inview,
	html.vamora-motion .vamora-reveal--draw {
		clip-path: none;
		stroke-dasharray: none;
	}
}

@media print {
	html.vamora-motion .vamora-reveal,
	html.vamora-motion .vamora-split .vamora-word,
	html.vamora-motion .vamora-split .vamora-split__block,
	html.vamora-motion .vamora-scrub .vamora-word {
		opacity: 1;
		clip-path: none;
		filter: none;
		transform: none;
	}
}
