/**
 * Pizza Scroll — main.css
 * Tokens, type, base layout, order form.
 *
 * This file alone gives a complete, static page (title, still image, form,
 * thank-you message). scene.css adds the scroll-driven layout on top of it.
 */

/* ------------------------------------------------------------------ fonts */

@font-face {
	font-family: "Fraunces Display";
	src: url("../fonts/fraunces-display.woff2") format("woff2");
	font-weight: 800;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Instrument Sans";
	src: url("../fonts/instrument-sans.woff2") format("woff2");
	font-weight: 400 600;
	font-style: normal;
	font-display: swap;
}

/* ----------------------------------------------------------------- tokens */

:root {
	--ps-cream: #F5F0E7;
	--ps-tomato: #D94732;
	--ps-kraft: #B88A5A;
	--ps-ink: #24211E;
	--ps-dough: #FFF9EF;

	/* Derived: small red text needs more contrast than the brand tomato gives. */
	--ps-tomato-deep: #A8301D;
	--ps-ink-soft: #5F564D;
	--ps-line: rgba(36, 33, 30, 0.22);

	--ps-font-display: "Fraunces Display", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
	--ps-font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	--ps-gutter: clamp(1.25rem, 4vw, 3.5rem);
	--ps-header-h: 4.75rem;
}

/* ------------------------------------------------------------------- base */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--ps-cream);
	color: var(--ps-ink);
	font-family: var(--ps-font-ui);
	font-size: 1.0625rem;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
	overflow-x: clip;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
	text-underline-offset: 0.18em;
	text-decoration-thickness: 0.08em;
}

a:hover {
	color: var(--ps-tomato-deep);
}

:focus-visible {
	outline: 3px solid var(--ps-ink);
	outline-offset: 3px;
	border-radius: 2px;
}

.ps-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.ps-skip {
	position: absolute;
	left: var(--ps-gutter);
	top: 0.75rem;
	z-index: 100;
	padding: 0.7rem 1.1rem;
	background: var(--ps-ink);
	color: var(--ps-dough);
	border-radius: 999px;
	font-weight: 600;
	text-decoration: none;
	transform: translateY(-300%);
}

.ps-skip:focus {
	transform: none;
	color: var(--ps-dough);
	outline-color: var(--ps-tomato);
}

/* ----------------------------------------------------------------- header */

.ps-header {
	position: absolute;
	inset: 0 0 auto;
	z-index: 30;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	height: var(--ps-header-h);
	padding: 0 var(--ps-gutter);
	padding-left: max(var(--ps-gutter), env(safe-area-inset-left));
	padding-right: max(var(--ps-gutter), env(safe-area-inset-right));
	pointer-events: none;
}

.ps-header a {
	pointer-events: auto;
}

.ps-brand {
	font-family: var(--ps-font-display);
	font-weight: 800;
	font-size: 1.375rem;
	letter-spacing: -0.015em;
	text-decoration: none;
}

.ps-header__order {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding: 0 1.15rem;
	border: 1.5px solid var(--ps-ink);
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.9375rem;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s, opacity 0.3s, visibility 0.3s;
}

.ps-header__order:hover {
	background: var(--ps-ink);
	color: var(--ps-dough);
}

/* Animated layout with the form on screen, or order confirmed: the shortcut
   would only be noise. (In the static layout it stays: the form is further
   down the page.) */
html.ps-enhanced[data-ps-state="ready"] .ps-header__order,
html.ps-enhanced[data-ps-state="submitting"] .ps-header__order,
html.ps-enhanced[data-ps-state="error"] .ps-header__order,
html[data-ps-state="success"] .ps-header__order {
	opacity: 0;
	visibility: hidden;
}

/* Logged-in users: leave room for the WordPress toolbar. */
.admin-bar .ps-header,
.admin-bar .ps-skip {
	margin-top: var(--wp-admin--admin-bar--height, 32px);
}

/* ------------------------------------------------------------------ title */

.ps-title,
.ps-ticket__title,
.ps-thanks__title,
.ps-entry__title {
	margin: 0;
	font-family: var(--ps-font-display);
	font-weight: 800;
	letter-spacing: -0.028em;
	text-wrap: balance;
}

.ps-title {
	font-size: clamp(2.75rem, 7.4vw, 7.25rem);
	line-height: 0.92;
	max-width: 8.6em;
}

.ps-cue {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	margin: clamp(1.5rem, 4vh, 2.75rem) 0 0;
	font-weight: 500;
	font-size: 1rem;
}

.ps-cue__ring {
	flex: none;
	overflow: visible;
}

.ps-cue__ring circle,
.ps-cue__ring path {
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ps-cue__track {
	stroke: var(--ps-line);
	stroke-width: 1.5;
}

.ps-cue__progress {
	stroke: var(--ps-tomato);
	stroke-width: 2.5;
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
	transform: rotate(-90deg);
	transform-origin: 22px 22px;
}

.ps-cue__arrow {
	stroke: var(--ps-tomato);
	stroke-width: 2;
}

/* ------------------------------------------------- stage (static layout) */

.ps-stage__panel {
	display: grid;
	gap: clamp(2rem, 6vw, 4.5rem);
	max-width: 76rem;
	margin: 0 auto;
	padding: calc(var(--ps-header-h) + clamp(1.5rem, 5vw, 4rem)) var(--ps-gutter) clamp(3rem, 8vw, 6rem);
}

.ps-hero {
	order: 1;
}

.ps-scene {
	order: 2;
	display: grid;
	justify-items: center;
}

.ps-order {
	order: 3;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 27rem);
	align-items: center;
	gap: clamp(1.5rem, 5vw, 4rem);
	scroll-margin-top: 1.5rem;
}

.ps-thanks {
	order: 1;
	display: none;
}

.ps-canvas,
.ps-anchor {
	display: none;
}

.ps-still {
	width: min(100%, 38rem);
	aspect-ratio: 1;
	object-fit: contain;
	user-select: none;
	pointer-events: none;
}

.ps-still--open {
	justify-self: center;
}

/* Confirmed order, static layout: the message replaces title and form. */
.ps-stage.is-success .ps-hero,
.ps-stage.is-success .ps-order {
	display: none;
}

.ps-stage.is-success .ps-thanks {
	display: block;
}

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

.ps-thanks__title {
	font-size: clamp(2.4rem, 5.6vw, 5rem);
	line-height: 0.96;
}

.ps-thanks__title:focus {
	outline: none;
}

.ps-thanks__detail {
	margin: 1rem 0 0;
	font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
	color: var(--ps-ink-soft);
}

/* ---------------------------------------------------------------- ticket */

/* The form is an order slip — a "comanda": one sheet of paper with a
   perforated edge, ruled fields, a single stamp-red action. */
.ps-ticket {
	position: relative;
	isolation: isolate;
	padding: clamp(1.5rem, 2.6vw, 2.25rem);
	padding-top: calc(clamp(1.5rem, 2.6vw, 2.25rem) + 6px);
	filter: drop-shadow(0 1px 0 rgba(120, 84, 48, 0.1)) drop-shadow(0 18px 20px rgba(86, 56, 28, 0.2));
}

/* The paper itself, with a perforated top edge. It is a separate layer so
   the mask does not clip the shadow or the focus outlines of the fields. */
.ps-ticket::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--ps-dough);
	border-radius: 0 0 10px 10px;
	-webkit-mask: radial-gradient(circle at 9px 0, transparent 5px, #000 5.5px) -9px 0 / 18px 100% repeat-x;
	mask: radial-gradient(circle at 9px 0, transparent 5px, #000 5.5px) -9px 0 / 18px 100% repeat-x;
}

.ps-ticket__title {
	font-size: clamp(1.75rem, 2.7vw, 2.5rem);
	line-height: 1;
	margin-bottom: clamp(1.1rem, 2vw, 1.6rem);
}

.ps-form {
	display: grid;
	gap: 0.9rem;
}

.ps-field {
	display: grid;
	gap: 0.35rem;
}

.ps-field label {
	font-weight: 600;
	font-size: 0.9375rem;
}

.ps-field__optional {
	font-weight: 400;
	color: var(--ps-ink-soft);
}

.ps-field input,
.ps-field textarea {
	width: 100%;
	margin: 0;
	padding: 0.72rem 0.85rem;
	border: 0;
	border-bottom: 1.5px solid var(--ps-ink);
	border-radius: 4px 4px 0 0;
	background: rgba(36, 33, 30, 0.045);
	color: var(--ps-ink);
	font: inherit;
	font-size: 1.0625rem; /* ≥ 16px: no zoom-on-focus on iOS */
	line-height: 1.35;
	transition: background-color 0.15s, border-color 0.15s;
}

.ps-field textarea {
	display: block;
	min-height: 5.2rem;
	resize: vertical;
}

.ps-field input::placeholder,
.ps-field textarea::placeholder {
	color: #6E655C;
	opacity: 1;
}

.ps-field input:hover,
.ps-field textarea:hover {
	background: rgba(36, 33, 30, 0.07);
}

.ps-field input:focus-visible,
.ps-field textarea:focus-visible {
	outline: 3px solid var(--ps-ink);
	outline-offset: 2px;
	background: #fff;
}

.ps-field.has-error input,
.ps-field.has-error textarea {
	border-bottom-color: var(--ps-tomato-deep);
	border-bottom-width: 2.5px;
	background: rgba(217, 71, 50, 0.07);
}

.ps-field__error {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--ps-tomato-deep);
}

.ps-field__error:empty,
.ps-form__status:empty {
	display: none;
}

.ps-field--trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.ps-form__status {
	margin: 0;
	padding: 0.7rem 0.85rem;
	border-left: 3px solid var(--ps-tomato-deep);
	background: rgba(217, 71, 50, 0.08);
	color: var(--ps-ink);
	font-size: 0.95rem;
	font-weight: 500;
}

.ps-form__privacy {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--ps-ink-soft);
}

/* ---------------------------------------------------------------- button */

.ps-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.7rem;
	width: 100%;
	min-height: 3.5rem;
	margin: 0.2rem 0 0;
	padding: 0.6rem 1.5rem;
	border: 0;
	border-radius: 999px;
	background: var(--ps-tomato);
	color: var(--ps-dough);
	font: inherit;
	font-weight: 600;
	font-size: 1.1875rem; /* large bold text: 3:1 contrast requirement met (4.1:1) */
	line-height: 1.1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.18s, transform 0.12s;
	-webkit-tap-highlight-color: transparent;
}

.ps-button:hover {
	background: #C63D29;
	color: var(--ps-dough);
}

.ps-button:active {
	transform: translateY(1px);
}

.ps-button--inline {
	width: auto;
}

.ps-button[aria-disabled="true"] {
	cursor: progress;
	background: #B9442F;
}

.ps-button__spinner {
	display: none;
	width: 1.15rem;
	height: 1.15rem;
	border: 2.5px solid rgba(255, 249, 239, 0.4);
	border-top-color: var(--ps-dough);
	border-radius: 50%;
}

.ps-button[aria-disabled="true"] .ps-button__spinner {
	display: block;
	animation: ps-spin 0.8s linear infinite;
}

@keyframes ps-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---------------------------------------------------------------- footer */

.ps-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 2rem;
	padding: 1.75rem var(--ps-gutter);
	padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
	border-top: 1px solid var(--ps-line);
	font-size: 0.875rem;
	color: var(--ps-ink-soft);
}

.ps-footer p {
	margin: 0;
}

/* ------------------------------------------------- other pages (index.php) */

.ps-page {
	max-width: 44rem;
	margin: 0 auto;
	padding: calc(var(--ps-header-h) + clamp(2rem, 6vw, 4rem)) var(--ps-gutter) clamp(3rem, 8vw, 6rem);
}

.ps-entry + .ps-entry {
	margin-top: 3rem;
}

.ps-entry__title {
	font-size: clamp(2.2rem, 5vw, 3.75rem);
	line-height: 1;
}

.ps-entry__title a {
	text-decoration: none;
}

.ps-entry__content {
	margin-top: 1.5rem;
	font-size: 1.125rem;
	line-height: 1.6;
}

.ps-entry__content > * {
	margin-block: 0 1.25em;
}
