/*
 * Lunch table frontend.
 *
 * Colours, fonts and spacing come from the provider theme's custom properties, so the
 * plugins pick up the site's branding automatically. Every var() carries a fallback so
 * the extension still looks intentional on a site that does not ship those properties.
 *
 * The target group is largely elderly visitors, hence the deliberately oversized type,
 * touch targets of at least 3rem and strong focus outlines.
 *
 * Two theme rules have to be fought off explicitly, both scoped to `.cont`:
 *   .cont ul li          adds padding to every list item
 *   .cont ul li::before  paints a bullet next to it
 * Plain `list-style: none` does not touch a generated bullet, and the theme's selector
 * carries one class, so the counter-rules below need two to win.
 */

.lunchmenu {
	--lm-color: var(--mainColor, #0069b4);
	--lm-color-dark: var(--mainColorDark, #004f91);
	--lm-text: var(--fontColor, #1f1f1e);
	--lm-border: var(--formBorderColor, #b6b6b6);
	--lm-surface: var(--contrastColorInverted, #fff);
	--lm-muted: var(--backgroundColor, #f1f1f1);
	--lm-warning: var(--warningColor, #b10000);
	--lm-success: #1a7a35;
	--lm-radius: 6px;
	--lm-gap: 1.5rem;

	font-family: var(--mainFont, inherit);
	font-size: 1.125rem;
	line-height: 1.6;
	color: var(--lm-text);
}

/* ---------------------------------------------------------------- Messages */

.lunchmenu .lunchmenu-messages {
	margin: var(--lm-gap) 0 var(--lm-gap);
	padding: 1rem 1.25rem;
	border-left: 6px solid var(--lm-color);
	border-radius: var(--lm-radius);
	background: var(--lm-muted);
}

.lunchmenu .lunchmenu-messages--error {
	border-left-color: var(--lm-warning);
}

.lunchmenu .lunchmenu-messages--success {
	border-left-color: var(--lm-success);
}

.lunchmenu .lunchmenu-messages__title {
	margin: 0 0 .5rem;
	font-size: 1.25rem;
	font-weight: 700;
}

.lunchmenu .lunchmenu-messages--error .lunchmenu-messages__title {
	color: var(--lm-warning);
}

.lunchmenu .lunchmenu-messages__list {
	margin: 0;
	padding-left: 1.25rem;
}

.lunchmenu .lunchmenu-messages__list li {
	padding: 0 0 0 .25rem;
	list-style: disc;
}

.lunchmenu .lunchmenu-messages__list li::before {
	display: none;
}

.lunchmenu .lunchmenu-messages p:last-child,
.lunchmenu .lunchmenu-messages ul:last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------- Form */

.lunchmenu-form {
	max-width: 40rem;
}

.lunchmenu .lunchmenu-field {
	margin-bottom: var(--lm-gap);
}

.lunchmenu .lunchmenu-field > label {
	display: block;
	margin-bottom: .4rem;
	font-weight: 700;
}

/*
 * The text fields carry no styling of their own on purpose. The theme already dresses
 * `input, select, textarea` — square corners, 10px/15px padding, its own focus border —
 * and the order form has to sit next to the contact form without looking like a stranger.
 * Only the composite controls below (stepper, plan cards) bring their own rules.
 */
.lunchmenu-form .lunchmenu-stepper__button:focus-visible {
	outline: 3px solid var(--lm-color);
	outline-offset: -3px;
}

.lunchmenu .lunchmenu-field.error > label {
	color: var(--lm-warning);
}

.lunchmenu-form .lunchmenu-field.error input,
.lunchmenu .lunchmenu-menus.error {
	border-color: var(--lm-warning);
}

.lunchmenu .lunchmenu-required {
	color: var(--lm-warning);
}

.lunchmenu .lunchmenu-hint {
	margin: .4rem 0 0;
	font-size: .95rem;
	line-height: 1.45;
	opacity: .85;
}

.lunchmenu .lunchmenu-error {
	margin: .4rem 0 0;
	font-size: 1rem;
	font-weight: 700;
	color: var(--lm-warning);
}

.lunchmenu .lunchmenu-privacy {
	margin: var(--lm-gap) 0 .5rem;
	font-size: 1rem;
}

.lunchmenu .lunchmenu-hint--required {
	margin: 0 0 var(--lm-gap);
}

/* --------------------------------------------------------- Menus + stepper */

.lunchmenu .lunchmenu-menus {
	margin: 0 0 var(--lm-gap);
	padding: .5rem 1.25rem 1.25rem;
	border: 1px solid var(--lm-border);
	border-radius: var(--lm-radius);
	background: var(--lm-surface);
}

.lunchmenu .lunchmenu-menus__legend {
	padding: 0 .5rem;
	font-size: 1.125rem;
	font-weight: 700;
}

.lunchmenu .lunchmenu-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .75rem 1.5rem;
	padding: .85rem 0;
	border-bottom: 1px solid var(--lm-border);
}

.lunchmenu .lunchmenu-menu:last-of-type {
	border-bottom: 0;
	padding-bottom: 0;
}

.lunchmenu .lunchmenu-menu__label {
	flex: 1 1 12rem;
	margin: 0;
	font-size: 1.125rem;
	font-weight: 700;
}

.lunchmenu .lunchmenu-menu__price {
	display: block;
	font-size: .95rem;
	font-weight: 400;
	opacity: .85;
}

/*
 * One bordered group with two dividers instead of three separate boxes. `overflow: hidden`
 * on the group clips the children, so no child needs its own corner radius — which also
 * keeps the generic input rules above from rounding the middle field.
 */
.lunchmenu .lunchmenu-stepper {
	display: inline-flex;
	align-items: stretch;
	flex: 0 0 auto;
	overflow: hidden;
	border: 1px solid var(--lm-border);
	border-radius: var(--lm-radius);
	background: var(--lm-surface);
}

/*
 * Flexbox centring rather than text alignment: the symbol is an SVG box, so it lands dead
 * centre regardless of font metrics or what the theme does to button text.
 */
.lunchmenu .lunchmenu-stepper__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3.25rem;
	min-height: 3.25rem;
	padding: 0;
	color: var(--lm-color);
	background: transparent;
	border: 0;
	cursor: pointer;
	transition: var(--baseTransition, all .2s ease-in-out);
}

.lunchmenu .lunchmenu-stepper__icon {
	display: block;
	width: 1.5rem;
	height: 1.5rem;
}

.lunchmenu .lunchmenu-stepper__button:first-child {
	border-right: 1px solid var(--lm-border);
}

.lunchmenu .lunchmenu-stepper__button:last-child {
	border-left: 1px solid var(--lm-border);
}

.lunchmenu .lunchmenu-stepper__button:hover {
	color: var(--lm-surface);
	background: var(--lm-color);
}

.lunchmenu .lunchmenu-stepper__button:active {
	background: var(--lm-color-dark);
}

.lunchmenu-form .lunchmenu-stepper__input {
	width: 4.5rem;
	min-height: 3.25rem;
	margin: 0;
	padding: 0 .25rem;
	text-align: center;
	font-size: 1.375rem;
	font-weight: 700;
	color: var(--lm-text);
	background: transparent;
	border: 0;
	border-radius: 0;
	-moz-appearance: textfield;
	appearance: textfield;
}

.lunchmenu .lunchmenu-stepper__input::-webkit-outer-spin-button,
.lunchmenu .lunchmenu-stepper__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/*
 * The take-away row inherits only a bottom margin from .lunchmenu-field, so it ends up
 * pressed against the divider of the menu above while the total block below leaves plenty
 * of air. Its own padding restores the rhythm of the menu rows; the bottom margin goes,
 * because the total already brings its own spacing.
 *
 * Both classes are named on purpose: .lunchmenu-field--check further down sets `padding: 0`
 * to neutralise the theme's `.checkbox { padding: 10px }`, and that shorthand would reset
 * the padding-top again — it carries the same specificity but comes later.
 */
.lunchmenu .lunchmenu-field--check.lunchmenu-menus__takeaway {
	margin-bottom: 0;
	padding-top: 1rem;
}

.lunchmenu .lunchmenu-total {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: .5rem 1rem;
	margin: 1rem 0 0;
	padding-top: 1rem;
	border-top: 2px solid var(--lm-border);
	font-size: 1.125rem;
	font-weight: 700;
}

.lunchmenu .lunchmenu-total__value {
	font-size: 1.5rem;
	color: var(--lm-color-dark);
	white-space: nowrap;
}

/* --------------------------------------------------------------- Checkbox */

.lunchmenu .lunchmenu-field--check {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: 0;
}

.lunchmenu-form .lunchmenu-field--check input[type="checkbox"] {
	flex: 0 0 auto;
	margin: 0;
}

.lunchmenu .lunchmenu-field--check > label {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 400;
	cursor: pointer;
}

/* ---------------------------------------------------------------- Captcha */

.lunchmenu .lunchmenu-captcha {
	max-width: 22rem;
}

.lunchmenu .lunchmenu-captcha.error .altcha {
	border-color: var(--lm-warning);
}

/*
 * Visually hidden, but still read out. Neither theme ships such a utility, so the plugin
 * brings its own — scoped to .lunchmenu so it cannot collide with one added later.
 */
.lunchmenu .lunchmenu-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;
}

/* --------------------------------------------------------------- Honeypot */

.lunchmenu .lunchmenu-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------------------------------------------------------------- Actions */

.lunchmenu .lunchmenu-actions {
	margin: var(--lm-gap) 0 0;
}

/* ----------------------------------------------------------- Confirmation */

.lunchmenu .lunchmenu-summary {
	max-width: 40rem;
	margin: 0 0 var(--lm-gap);
	padding: .5rem 1.25rem;
	border: 1px solid var(--lm-border);
	border-radius: var(--lm-radius);
	background: var(--lm-surface);
}

.lunchmenu .lunchmenu-summary__row {
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1rem;
	padding: .75rem 0;
	border-bottom: 1px solid var(--lm-border);
}

.lunchmenu .lunchmenu-summary__row:last-child {
	border-bottom: 0;
}

.lunchmenu .lunchmenu-summary dt {
	flex: 1 1 12rem;
	font-weight: 700;
}

.lunchmenu .lunchmenu-summary dd {
	flex: 0 1 auto;
	margin: 0;
}

/* ------------------------------------------------------------- Menu plans */

/*
 * The cards borrow the look of the theme's accordion triggers (.px-accordion-inner .item
 * .trigger): same surface, same 6px radius, same 20px/30px padding and the same slim gap
 * between items — so the plans sit in the page like a familiar element rather than a
 * white box nobody else uses.
 *
 * What is deliberately not borrowed is the chevron. It promises "expands in place", while
 * these open a PDF in a new tab; the download symbol takes its position and colour instead.
 */

.lunchmenu .lunchmenu-plans__list {
	display: flex;
	flex-direction: column;
	gap: var(--spaceBetweenSlim, .625rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Two classes, so the theme's `.cont ul li` rules lose on specificity. */
.lunchmenu .lunchmenu-plans__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lunchmenu .lunchmenu-plans__item::before {
	content: none;
	display: none;
}

.lunchmenu .lunchmenu-plans__link {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.25rem;
	padding: 20px 30px;
	border-radius: var(--lm-radius);
	background: var(--backgroundColor, #f1f1f1);
	color: var(--lm-text);
	text-decoration: none;
	transition: var(--baseTransition, all .2s ease-in-out);
}

/*
 * A basis of 0 keeps label and icon on one line now that the link wraps: with `auto`, a long
 * title would push the icon onto a line of its own before the text started to shrink.
 */
.lunchmenu .lunchmenu-plans__text {
	flex: 1 1 0;
	min-width: 0;
}

.lunchmenu .lunchmenu-plans__title {
	display: block;
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--headlineColor, var(--lm-text));
}

.lunchmenu .lunchmenu-plans__range {
	display: block;
	font-size: .95rem;
	opacity: .8;
}

.lunchmenu .lunchmenu-plans__icon {
	flex: 0 0 auto;
	width: 1.5rem;
	height: 1.5rem;
	color: var(--lm-color);
	transition: var(--baseTransition, all .2s ease-in-out);
}

/* The rendered first page of the PDF, on a line of its own below label and icon. */
.lunchmenu .lunchmenu-plans__preview {
	display: block;
	flex: 1 0 100%;
	width: 100%;
	max-width: 100%;
	height: auto;
	border-radius: calc(var(--lm-radius) / 2);
	background: #fff;
}

.lunchmenu a.lunchmenu-plans__link:hover,
.lunchmenu a.lunchmenu-plans__link:focus-visible {
	background: color-mix(in srgb, var(--backgroundColor, #f1f1f1), var(--lm-color) 12%);
}

/* The accordion turns its chevron on hover; a download arrow nudges towards its line. */
.lunchmenu a.lunchmenu-plans__link:hover .lunchmenu-plans__icon,
.lunchmenu a.lunchmenu-plans__link:focus-visible .lunchmenu-plans__icon {
	transform: translateY(2px);
}

.lunchmenu a.lunchmenu-plans__link:focus-visible {
	outline: 3px solid var(--lm-color);
	outline-offset: 2px;
}

.lunchmenu .lunchmenu-plans__empty {
	margin: 0;
	opacity: .85;
}

/* ------------------------------------------------------------ Small screens */

@media (max-width: 30rem) {
	.lunchmenu .lunchmenu-menu {
		align-items: stretch;
		flex-direction: column;
	}

	.lunchmenu .lunchmenu-stepper {
		align-self: flex-start;
	}
}
