/**
 * Contact details step of the checkout — an asymmetric split: the pizzeria's
 * own details and the order reference on the left, the form card on the right.
 *
 * Breakpoints are the theme-wide ones documented in design-tokens.css
 * (--bp-lg 1024px, --bp-md 768px); media queries cannot read custom properties,
 * so the values are repeated literally, as everywhere else in this theme.
 */

.franchesco-section--checkout {
	padding: var(--space-section) 0;
	background:
		linear-gradient(180deg, var(--color-neutral-100) 0%, var(--color-neutral-50) 100%);
}

.franchesco-checkout {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: var(--space-12);
	align-items: start;
}

.franchesco-checkout__title {
	margin: var(--space-2) 0 var(--space-4);
	font-family: var(--font-heading);
	font-size: var(--text-3xl);
	line-height: var(--leading-tight);
	letter-spacing: var(--letter-tight);
	color: var(--color-neutral-900);
}

.franchesco-checkout__lead {
	margin: 0 0 var(--space-6);
	color: var(--color-neutral-600);
	font-size: var(--text-lg);
	line-height: var(--leading-normal);
}

.franchesco-checkout__facts {
	list-style: none;
	margin: 0 0 var(--space-8);
	padding: 0;
	display: grid;
	gap: var(--space-4);
}

.franchesco-checkout__fact {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	padding: var(--space-3) var(--space-4);
	border-left: 3px solid var(--color-primary-400);
	background-color: var(--color-neutral-50);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.franchesco-checkout__fact-label {
	font-size: var(--text-xs);
	font-weight: 700;
	letter-spacing: var(--letter-wide);
	text-transform: uppercase;
	color: var(--color-neutral-500);
}

.franchesco-checkout__fact-value {
	color: var(--color-neutral-800);
	font-size: var(--text-base);
	text-decoration: none;
	transition: color var(--duration-fast) var(--ease-default);
}

a.franchesco-checkout__fact-value:hover,
a.franchesco-checkout__fact-value:focus-visible {
	color: var(--color-primary-600);
}

.franchesco-checkout__fact-value--ref {
	font-family: var(--font-heading);
	font-weight: 700;
	letter-spacing: var(--letter-wide);
	color: var(--color-primary-700);
}

.franchesco-checkout__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg);
}

/* The form card itself. */
.franchesco-checkout__panel {
	background-color: var(--color-neutral-50);
	border: 1px solid var(--color-neutral-200);
	border-radius: var(--radius-2xl);
	box-shadow: var(--shadow-xl);
	padding: var(--space-8);
}

.franchesco-contact-details-form {
	display: block;
	/* Picks up the panel's background so the sticky action bar below can
	   inherit it in turn, instead of restating the colour a second time. */
	background-color: inherit;
}

.franchesco-checkout__fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-5);
	margin-bottom: var(--space-5);
}

.franchesco-checkout__fields .franchesco-form__field {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin: 0;
}

.franchesco-checkout__fields .franchesco-form__field--wide {
	grid-column: 1 / -1;
}

.franchesco-contact-details-form .franchesco-form__hint {
	margin: 0 0 var(--space-2);
	color: var(--color-neutral-500);
	font-size: var(--text-xs);
}

.franchesco-contact-details-form .franchesco-form__actions {
	margin: var(--space-6) 0 0;
}

/* Honeypot — off screen rather than display:none, which some bots skip. */
.franchesco-contact-details-form .franchesco-form__trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.franchesco-checkout__submit {
	width: 100%;
	cursor: pointer;
}

.franchesco-checkout__submit[disabled],
.franchesco-checkout__submit[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
	pointer-events: none;
}

.franchesco-checkout__submit:focus-visible {
	outline: 3px solid var(--color-primary-700);
	outline-offset: 3px;
}

/* Field level errors, matching the theme's other forms. */
.franchesco-contact-details-form .franchesco-form__error {
	display: none;
	color: var(--color-primary-700);
	font-size: var(--text-xs);
	font-weight: 600;
}

.franchesco-contact-details-form .franchesco-form__error.is-visible {
	display: block;
}

.franchesco-contact-details-form .franchesco-form__input.is-invalid {
	border-color: var(--color-primary-600);
	background-color: var(--color-primary-50);
}

/* .franchesco-form-notice--kept lives in pages.css — one definition sitewide. */

@media (max-width: 1024px) {
	.franchesco-checkout {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--space-8);
	}

	.franchesco-checkout__image {
		aspect-ratio: 21 / 9;
	}
}

@media (max-width: 768px) {
	.franchesco-checkout__panel {
		padding: var(--space-5);
	}

	/* Name, phone and e-mail each take the full width, one under the other. */
	.franchesco-checkout__fields {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--space-4);
	}

	.franchesco-checkout__title {
		font-size: var(--text-2xl);
	}
	.franchesco-checkout__fields .franchesco-form__field,
	.franchesco-checkout__fields .franchesco-form__field--wide {
		grid-column: 1 / -1;
	}

	.franchesco-checkout__title {
		font-size: var(--text-2xl);
	}

	/*
	 * "Place order" stays with the visitor instead of waiting under the last
	 * hint — the sticky mechanics live in pages.css
	 * (.franchesco-form__actions--sticky); the bar only inherits the panel's
	 * own background here so nothing shows through behind it.
	 */
	.franchesco-contact-details-form .franchesco-form__actions--sticky {
		margin-top: var(--space-5);
		background-color: inherit;
	}

	/* A refused field keeps its message right underneath it, on its own line,
	   wrapping rather than being cut off at the edge of the card. */
	.franchesco-contact-details-form .franchesco-form__error.is-visible {
		display: block;
		max-width: 100%;
		overflow-wrap: anywhere;
	}
}
