/**
 * Pizza Scroll — scene.css
 * The scroll-driven layout. Everything here is scoped to `.ps-enhanced`,
 * a class set on <html> only when the animated experience can run
 * (see inc/setup.php → pizza_scroll_head_bootstrap and assets/js/app.js).
 *
 * How it is put together
 *   .ps-stage          tall section: its height is the scroll distance
 *   .ps-stage__panel   position: sticky, one viewport tall — the "screen"
 *   .ps-anchor         invisible squares placed with CSS; the 3D camera
 *                      frames the box so that it matches the active anchor.
 *                      Moving the scene for a breakpoint = editing --x/--y/--s.
 */

.ps-stage {
	/* Scroll distance, in viewport heights. */
	--ps-scroll-length: 5.6;
	/* Circular path radius / hover point, in box widths. */
	--ps-orbit-radius: 0.66;
	--ps-hover-up: 0.56;
	--ps-hover-toward: 0.34;

	--ps-vh: 1vh;

	--hero-s: clamp(13rem, min(29vw, calc(46 * var(--ps-vh))), 31rem);
	--hero-x: 69%;
	--hero-y: 57%;
}

@supports (height: 1svh) {
	.ps-stage {
		--ps-vh: 1svh;
	}
}

/* ---------------------------------------------------------- stage + panel */

.ps-enhanced .ps-header {
	position: fixed;
}

.ps-enhanced .ps-stage {
	position: relative;
	height: calc(var(--ps-scroll-length) * 100 * var(--ps-vh));
}

/* After the confirmation the scene is one screen tall: nothing left to scrub. */
.ps-enhanced .ps-stage.is-complete {
	height: auto;
}

.ps-enhanced .ps-stage__panel {
	position: sticky;
	top: 0;
	display: block;
	width: 100%;
	max-width: none;
	height: calc(100 * var(--ps-vh));
	margin: 0;
	padding: 0;
	overflow: hidden;
	transition: opacity 0.18s linear;
}

/* Short dip while the shortcut jumps straight to the form. */
.ps-enhanced .ps-stage__panel.is-jumping {
	opacity: 0;
}

/* ------------------------------------------------------------------ scene */

.ps-enhanced .ps-scene {
	position: absolute;
	inset: 0;
	display: block;
}

.ps-enhanced .ps-canvas {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.45s ease;
}

.ps-enhanced .ps-anchor {
	position: absolute;
	left: var(--x);
	top: var(--y);
	display: block;
	width: var(--s);
	height: var(--s);
	transform: translate(-50%, -50%);
	visibility: hidden;
	pointer-events: none;
}

.ps-anchor[data-ps-anchor="hero"] {
	--s: var(--hero-s);
	--x: var(--hero-x);
	--y: var(--hero-y);
}

.ps-anchor[data-ps-anchor="orbit"] {
	--s: min(21vw, calc(28 * var(--ps-vh)));
	--x: 50%;
	--y: 81%;
}

.ps-anchor[data-ps-anchor="ready"] {
	--s: min(21vw, calc(31 * var(--ps-vh)));
	--x: 28%;
	--y: 72%;
}

.ps-anchor[data-ps-anchor="thanks"] {
	--s: min(25vw, calc(36 * var(--ps-vh)));
	--x: 50%;
	--y: 68%;
}

/* The still of the closed box sits exactly where the 3D box will be drawn
   (the still is rendered with the box occupying half of its width), so the
   hand-over to WebGL is a cross-fade with no jump. */
.ps-enhanced .ps-still--closed {
	position: absolute;
	left: var(--hero-x);
	top: var(--hero-y);
	width: calc(var(--hero-s) * 2);
	max-width: none;
	transform: translate(-50%, -50%);
	transition: opacity 0.45s ease;
}

.ps-enhanced .ps-still--open {
	display: none;
}

.ps-enhanced .ps-stage.has-scene .ps-canvas {
	opacity: 1;
}

.ps-enhanced .ps-stage.has-scene .ps-still--closed {
	opacity: 0;
}

/* ------------------------------------------------------------------- hero */

.ps-enhanced .ps-hero {
	position: absolute;
	left: max(var(--ps-gutter), env(safe-area-inset-left));
	top: 50%;
	width: min(46vw, 44rem);
	transform: translateY(calc(-50% + var(--ps-shift, 0px)));
	will-change: opacity, transform;
}

/* ------------------------------------------------------------------ order */

/* Hidden until the choreography brings it in. If the scripts never start,
   the bootstrap in <head> removes .ps-enhanced and the form is simply part
   of the page again. */
.ps-enhanced .ps-order {
	position: absolute;
	right: max(var(--ps-gutter), 7vw);
	top: 50%;
	display: block;
	width: min(27rem, 40vw);
	transform: translateY(calc(-50% + var(--ps-shift, 0px)));
	opacity: 0;
	visibility: hidden;
	will-change: opacity, transform;
}

/* ----------------------------------------------------------------- thanks */

.ps-enhanced .ps-thanks,
.ps-enhanced .ps-stage.is-success .ps-thanks {
	position: absolute;
	left: 0;
	right: 0;
	top: clamp(5.5rem, calc(13 * var(--ps-vh)), 9.5rem);
	display: block;
	padding: 0 var(--ps-gutter);
	text-align: center;
	transform: translateY(var(--ps-shift, 0px));
	opacity: 0;
	visibility: hidden;
}

.ps-enhanced .ps-thanks__title {
	margin-inline: auto;
	max-width: 12em;
}

/* In the animated layout the choreography decides what is visible. */
.ps-enhanced .ps-stage.is-success .ps-hero,
.ps-enhanced .ps-stage.is-success .ps-order {
	display: block;
}
