/*
 * Product tours (docs/MOTION.md). Markup: template-parts/product-tour.php.
 *
 * Without JavaScript or with reduced motion: the still screen, exactly as
 * .screen draws it, and the steps as a short numbered list under it.
 * With tour.js (.is-live): a camera (transform on .tour__stage), a spotlight
 * (.tour__dim, a dark layer with a rounded hole cut by clip-path) and one
 * caption at a time.
 */
.tour {
	display: flex;
	flex-direction: column;
	gap: 18px;
	min-width: 0;
}
.tour__frame {
	position: relative;
}

/* The stage is the image's box: the camera moves it, the spotlight lives in it. */
.tour__stage {
	position: relative;
	width: 1000px;
	margin-left: calc(var(--screen-off, 0.161) * -1000px);
	transform-origin: 0 0;
}
.tour__stage .screen__img {
	width: 100%;
	margin-left: 0;
}
.tour__dim {
	position: absolute;
	inset: 0;
	background: rgb(11 15 23 / 44%);
	opacity: 0;
	pointer-events: none;
}

/* The steps as a plain list (no JavaScript, reduced motion). */
.tour__list {
	display: grid;
	gap: 6px;
	max-width: 620px;
	margin: 0;
	padding-left: 1.4em;
	list-style: decimal;
	font-size: 15px;
	line-height: 1.45;
	color: var(--muted);
}
.tour__list li::marker {
	color: var(--ink);
	font-weight: 600;
}

/* --------------------------------- Live --------------------------------- */
.is-live .tour__stage {
	transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) scale(var(--sc, 1));
	transition: transform 1.4s var(--ease-in-out);
}
/* While the camera moves, the stage and the spotlight are layers of their own,
   so the spotlight's repaint never re-draws the screenshot. */
.is-live.is-moving .tour__stage,
.is-live.is-moving .tour__dim {
	will-change: transform;
}
.is-live .tour__dim {
	clip-path: var(--hole, none);
	transition:
		clip-path 1.4s var(--ease-in-out),
		opacity 0.9s var(--ease-in-out);
}
.is-live .tour__dim.is-on {
	opacity: 1;
}
.is-instant .tour__stage,
.is-instant .tour__dim {
	transition: none;
}

/* One caption at a time, all in one cell, so the height never changes. */
.is-live .tour__list {
	grid-template-areas: "c";
	gap: 0;
	padding-left: 0;
	list-style: none;
	font-size: 16px;
	color: var(--ink);
}
.is-live .tour__list li {
	grid-area: c;
	opacity: 0;
	visibility: hidden;
	transform: translate3d(0, 6px, 0);
	transition:
		opacity 0.35s var(--ease-out),
		transform 0.35s var(--ease-out),
		visibility 0s linear 0.35s;
}
.is-live .tour__list li.is-current {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition:
		opacity 0.6s var(--ease-out) 0.5s,
		transform 0.6s var(--ease-out) 0.5s,
		visibility 0s linear 0s;
}

/* Controls. */
.tour__bar {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 2px;
	margin-top: -6px;
}
.tour__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 6px;
	color: var(--ink);
	font: 600 15px/1 var(--font-body);
	cursor: pointer;
	transition: background-color var(--dur-fast) var(--ease-out);
}
.tour__btn:hover {
	background: var(--soft);
}
.tour__btn svg {
	flex: none;
}
.tour__play {
	min-width: 98px;
	justify-content: flex-start;
	padding: 0 14px 0 12px;
	margin-right: 6px;
	border: 1.5px solid var(--line);
}
.tour__dots {
	display: flex;
}
.tour__dots {
	flex-wrap: nowrap;
}
.tour__dot {
	position: relative;
	min-width: 44px;
}
.tour__dot::before,
.tour__dot::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	margin: -5px 0 0 -5px;
}
.tour__dot::before {
	border: 1.5px solid var(--field);
}
/* The brand's orange square marks the step on screen. */
.tour__dot::after {
	background: var(--accent);
	transform: scale(0);
	transition: transform var(--dur) var(--ease-out);
}
.tour__dot[aria-current]::after {
	transform: none;
}
.tour__dot[aria-current]::before {
	border-color: var(--accent);
}
.tour__live {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (max-width: 479px) {
	.tour__prev,
	.tour__next {
		display: none;
	}
}

@media (min-width: 1000px) {
	.tour__stage {
		width: 100%;
		margin-left: 0;
	}
	.is-live .tour__list {
		font-size: 17px;
	}
	/* Keep caption and controls clear of the phone frame beside the screen. */
	.feature__visual--phone .tour__list,
	.feature__visual--phone .tour__bar {
		max-width: 440px;
	}
	.feature .tour {
		gap: 22px;
	}
	/* The phone frame's place moves to its wrapper, so the wrapper has a size
	   for its arrival (and its clip) to work on. Same place as main.css. */
	.feature__visual--phone .tour-phone {
		position: absolute;
		left: 480px;
		top: 110px;
		width: 214px;
	}
	.feature__visual--phone .tour-phone .phone {
		position: static;
		width: 100%;
	}
}
