/**
 * Pizza Scroll — responsive.css
 * Tablet, smartphone, short landscape screens, reduced motion.
 *
 * The compositions are re-drawn per format, not scaled down:
 *   wide      title left, box right; at the end the scene moves left and the
 *             order slip takes the right half
 *   portrait  title on top, box below; at the end the scene shrinks to the
 *             top of the screen and the slip rises from the bottom
 *   short     (phones held sideways) two compact columns
 */

/* ------------------------------------------------- static layout, narrow */

@media (max-width: 760px) {
	.ps-order {
		grid-template-columns: minmax(0, 1fr);
	}

	.ps-still--open {
		width: min(100%, 24rem);
	}

	.ps-header__order {
		padding: 0 0.95rem;
	}
}

/* ------------------------------------------- portrait: tablet + smartphone */

@media (max-width: 900px), (orientation: portrait) {
	.ps-stage {
		--ps-scroll-length: 5;
		--ps-orbit-radius: 0.62;
		--ps-hover-up: 0.56;
		--ps-hover-toward: 0.3;

		--hero-s: min(56vw, calc(31 * var(--ps-vh)));
		--hero-x: 50%;
		--hero-y: 67%;
	}

	.ps-title {
		font-size: clamp(2.5rem, 11.5vw, 5.25rem);
	}

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

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

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

	.ps-enhanced .ps-hero {
		left: 0;
		right: 0;
		top: calc(var(--ps-header-h) + 2.5 * var(--ps-vh));
		width: auto;
		padding: 0 max(var(--ps-gutter), env(safe-area-inset-right)) 0 max(var(--ps-gutter), env(safe-area-inset-left));
		transform: translateY(var(--ps-shift, 0px));
	}

	.ps-enhanced .ps-cue {
		position: absolute;
		left: max(var(--ps-gutter), env(safe-area-inset-left));
		/* Pinned to the bottom of the screen, whatever the title height. */
		top: calc(100 * var(--ps-vh) - var(--ps-header-h) - 2.5 * var(--ps-vh) - 4.25rem - env(safe-area-inset-bottom));
		margin: 0;
	}

	.ps-enhanced .ps-order {
		left: 50%;
		right: auto;
		top: auto;
		bottom: max(0.75rem, env(safe-area-inset-bottom));
		width: min(34rem, calc(100vw - 1.5rem));
		max-height: calc(100 * var(--ps-vh) - 34 * var(--ps-vh));
		transform: translate(-50%, var(--ps-shift, 0px));
	}

	.ps-enhanced .ps-ticket {
		max-height: inherit;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 1.15rem 1.15rem 1rem;
		padding-top: calc(1.15rem + 6px);
	}

	.ps-enhanced .ps-ticket__title {
		font-size: clamp(1.5rem, 6.4vw, 2.1rem);
		margin-bottom: 0.8rem;
	}

	.ps-enhanced .ps-form {
		gap: 0.6rem;
	}

	.ps-enhanced .ps-field {
		gap: 0.25rem;
	}

	.ps-enhanced .ps-field input,
	.ps-enhanced .ps-field textarea {
		padding: 0.56rem 0.75rem;
	}

	.ps-enhanced .ps-field textarea {
		min-height: 3.6rem;
		height: 3.6rem;
	}

	.ps-enhanced .ps-button {
		min-height: 3.25rem;
	}

	.ps-enhanced .ps-thanks,
	.ps-enhanced .ps-stage.is-success .ps-thanks {
		top: calc(var(--ps-header-h) + 4 * var(--ps-vh));
	}

	.ps-thanks__title {
		font-size: clamp(2.2rem, 10vw, 4.25rem);
	}
}

/* Small phones: every pixel of height counts. */
@media (max-height: 640px) and (orientation: portrait) {
	.ps-anchor[data-ps-anchor="ready"] {
		--s: min(26vw, calc(13 * var(--ps-vh)));
		--y: 21%;
	}

	.ps-enhanced .ps-order {
		bottom: max(0.5rem, env(safe-area-inset-bottom));
		max-height: calc(100 * var(--ps-vh) - 28 * var(--ps-vh));
	}

	.ps-enhanced .ps-ticket {
		padding: 0.85rem 0.95rem 0.8rem;
		padding-top: calc(0.85rem + 6px);
	}

	.ps-enhanced .ps-ticket__title {
		font-size: 1.4rem;
		margin-bottom: 0.5rem;
	}

	.ps-enhanced .ps-form {
		gap: 0.45rem;
	}

	.ps-enhanced .ps-field input,
	.ps-enhanced .ps-field textarea {
		padding: 0.46rem 0.7rem;
	}

	.ps-enhanced .ps-field textarea {
		min-height: 3.2rem;
		height: 3.2rem;
	}

	.ps-enhanced .ps-button {
		min-height: 3rem;
	}
}

/* Tablet in portrait: more air around the slip. */
@media (min-width: 600px) and (orientation: portrait) {
	.ps-stage {
		--ps-orbit-radius: 0.66;
	}

	.ps-anchor[data-ps-anchor="ready"] {
		--s: min(26vw, calc(17 * var(--ps-vh)));
		--y: 27%;
	}

	.ps-enhanced .ps-order {
		bottom: calc(5 * var(--ps-vh));
		max-height: calc(100 * var(--ps-vh) - 42 * var(--ps-vh));
	}

	.ps-enhanced .ps-ticket {
		padding: 1.75rem;
		padding-top: calc(1.75rem + 6px);
	}
}

/* ---------------------------------------------- short landscape (phones) */

@media (orientation: landscape) and (max-height: 540px) {
	.ps-stage {
		--ps-scroll-length: 6;
		--ps-orbit-radius: 0.6;
		--ps-hover-up: 0.5;
		--hero-s: min(26vw, calc(52 * var(--ps-vh)));
		--hero-x: 72%;
		--hero-y: 60%;
	}

	:root {
		--ps-header-h: 3.5rem;
	}

	.ps-title {
		font-size: clamp(2rem, 6vw, 3.25rem);
	}

	.ps-cue {
		margin-top: 1.25rem;
	}

	.ps-enhanced .ps-hero {
		left: max(var(--ps-gutter), env(safe-area-inset-left));
		right: auto;
		top: 54%;
		width: 44vw;
		padding: 0;
		transform: translateY(calc(-50% + var(--ps-shift, 0px)));
	}

	.ps-enhanced .ps-cue {
		position: static;
	}

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

	.ps-anchor[data-ps-anchor="ready"] {
		--s: min(20vw, calc(34 * var(--ps-vh)));
		--x: 24%;
		--y: 76%;
	}

	.ps-anchor[data-ps-anchor="thanks"] {
		--s: min(22vw, calc(38 * var(--ps-vh)));
		--x: 72%;
		--y: 60%;
	}

	.ps-enhanced .ps-order {
		left: auto;
		right: max(var(--ps-gutter), env(safe-area-inset-right));
		top: 50%;
		bottom: auto;
		width: min(26rem, 50vw);
		max-height: calc(100 * var(--ps-vh) - 1.5rem);
		transform: translateY(calc(-50% + var(--ps-shift, 0px)));
	}

	.ps-enhanced .ps-ticket {
		max-height: inherit;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 1rem 1.1rem;
		padding-top: calc(1rem + 6px);
	}

	.ps-enhanced .ps-ticket__title {
		font-size: 1.5rem;
		margin-bottom: 0.6rem;
	}

	.ps-enhanced .ps-form {
		gap: 0.5rem;
	}

	.ps-enhanced .ps-field input,
	.ps-enhanced .ps-field textarea {
		padding: 0.45rem 0.7rem;
	}

	.ps-enhanced .ps-field textarea {
		min-height: 2.9rem;
		height: 2.9rem;
	}

	.ps-enhanced .ps-button {
		min-height: 3rem;
	}

	.ps-enhanced .ps-thanks,
	.ps-enhanced .ps-stage.is-success .ps-thanks {
		left: max(var(--ps-gutter), env(safe-area-inset-left));
		right: auto;
		top: 50%;
		width: 46vw;
		padding: 0;
		text-align: left;
		transform: translateY(calc(-50% + var(--ps-shift, 0px)));
	}

	.ps-enhanced .ps-thanks__title {
		margin-inline: 0;
		font-size: clamp(1.9rem, 5.4vw, 3rem);
	}
}

/* --------------------------------------------------------- reduced motion */

/* The animated layout is never activated with this preference (the class
   .ps-enhanced is not set), so the page is the static one from main.css:
   no pinning, form immediately reachable. What is left to do here is to
   switch off the few CSS transitions. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}

	/* A spinner that does not spin: show a steady "in progress" mark instead. */
	.ps-button[aria-disabled="true"] .ps-button__spinner {
		animation: none;
		border-color: var(--ps-dough);
		border-style: dotted;
	}
}

/* --------------------------------------------------------------- printing */

@media print {
	.ps-header__order,
	.ps-cue,
	.ps-canvas {
		display: none !important;
	}
}
