/**
 * ARDOIZA public styles: menu and reservation form.
 *
 * Colours follow the ARDOIZA palette (terracotta, ink, cream, sand) but every value is a
 * CSS custom property that a theme can override on .ardoiza-menu / .ardoiza-form-wrap. They are set on these
 * containers, so a value given on :root does not reach them. This sheet may be printed after the theme's (in
 * the footer when a shortcode enqueues it): the override needs one more selector, for example
 * "body .ardoiza-form-wrap { --ardoiza-accent: #1f4e8c; }".
 * Only the plugin's own classes are styled; nothing global.
 *
 * Every rule below the custom properties is scoped by the plugin container (.ardoiza-menu .x,
 * .ardoiza-form-wrap .x): two classes outweigh the "class + element" rules of themes
 * (.entry-content li, .entry-content div, .entry-content h2...) that otherwise reset our layout.
 * Margins, paddings, display and float are set explicitly for the same reason.
 * Text sizes of the menu are in em: they follow the text size of the site, so that a dish name is never
 * smaller than its description.
 */

.ardoiza-menu,
.ardoiza-form-wrap,
.ardoiza-form__closed {
	--ardoiza-accent: #c45122;
	--ardoiza-accent-dark: #a94520;
	--ardoiza-on-accent: #ffffff;
	--ardoiza-ink: #172a30;
	--ardoiza-ink-soft: #4c5b5f;
	--ardoiza-cream: #faf7f3;
	--ardoiza-sand: #f1e4d1;
	--ardoiza-line: #e3dccc;
	--ardoiza-field-line: #cfc6b2;
	--ardoiza-surface: #ffffff;
	--ardoiza-error: #a32a1f;
	--ardoiza-error-bg: #f7ded9;
	--ardoiza-radius: 10px;
	/* Derived from --ardoiza-radius: changing it rounds the form card and its fields in proportion. */
	--ardoiza-radius-card: calc(var(--ardoiza-radius) * 1.8);
	--ardoiza-radius-field: calc(var(--ardoiza-radius) * 1.2);
	--ardoiza-card-shadow: 0 10px 30px rgba(23, 42, 48, 0.06);
	/* Shadow of the button, tinted from --ardoiza-accent. A browser without color-mix() shows no shadow. */
	--ardoiza-accent-shadow: color-mix(in srgb, var(--ardoiza-accent) 22%, transparent);
	--ardoiza-font: inherit;
	--ardoiza-price-font: inherit;

	font-family: var(--ardoiza-font);
	color: var(--ardoiza-ink);
	line-height: 1.5;
	box-sizing: border-box;
}

.ardoiza-menu *,
.ardoiza-form-wrap * {
	box-sizing: inherit;
}

/*
 * Shortcode pasted with its <code> formatting (copied from a settings screen into a visual editor). The HTML
 * parser then wraps every piece of text of the menu and of the form in a <code> element. Seen on a site with
 * Enfold (1.0.5, same sheet as 1.0.6): the monospace font of <code> everywhere instead of the font of the
 * theme and, in each dish, the name and the price held together in one <code>, so that the price stuck to
 * the name. These wrappers are made transparent: no box of their own
 * (display: contents, the second !important of this sheet, for the same reason as the dish line) and the
 * font of the text around them.
 */
.ardoiza-menu code,
.ardoiza-form-wrap code {
	display: contents !important;
	font: inherit;
	color: inherit;
	letter-spacing: inherit;
	white-space: inherit;
}

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

.ardoiza-menu .ardoiza-menu__section {
	display: block;
	margin: 0 0 2.5rem;
	padding: 0;
}

/* Some themes float their headings or set them inline: the section title stays a full line. */
.ardoiza-menu .ardoiza-menu__title {
	display: block;
	float: none;
	margin: 0 0 0.35rem;
	padding: 0 0 0.35rem;
	border: 0;
	border-bottom: 2px solid var(--ardoiza-accent);
	color: var(--ardoiza-accent);
	font-size: 1.5em;
	letter-spacing: 0.02em;
}

/* Title of the dishes without a section: read by screen readers only, even if the theme has no such class. */
.ardoiza-menu .ardoiza-menu__title.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.ardoiza-menu .ardoiza-menu__section-desc {
	margin: 0 0 1rem;
	padding: 0;
	color: var(--ardoiza-ink-soft);
	font-style: italic;
}

.ardoiza-menu .ardoiza-menu__dishes {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ardoiza-menu .ardoiza-dish {
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 0.9rem 0;
	border: 0;
	border-bottom: 1px solid var(--ardoiza-line);
	list-style: none;
	background: none;
}

/* A theme bullet or clearfix drawn with ::before / ::after would become an extra column of the dish. */
.ardoiza-menu .ardoiza-dish::before,
.ardoiza-menu .ardoiza-dish::after {
	content: none;
	display: none;
}

.ardoiza-menu .ardoiza-dish:last-child {
	border-bottom: 0;
}

.ardoiza-menu .ardoiza-dish__media {
	flex: 0 0 96px;
	margin: 0;
	padding: 0;
}

.ardoiza-menu .ardoiza-dish__image {
	display: block;
	width: 96px;
	max-width: 100%;
	height: 96px;
	margin: 0;
	object-fit: cover;
	border-radius: var(--ardoiza-radius);
}

.ardoiza-menu .ardoiza-dish__body {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
}

/*
 * Name on the left, price on the right of the same line. In 1.0.6 the price could stick to the name: when the
 * two spans are not the items of this flex box (both held in one <code> wrapper, see above, as on the site
 * that reported it; or a theme rule heavier than ".ardoiza-dish__head"), the line falls back to plain text. The display of this line is one of the two
 * !important of the sheet, because nothing else keeps the price apart from the name. The float of the price
 * only acts if the line is still not a flex box (a float is ignored inside one); the space between the two
 * spans in the markup is the last resort.
 */
.ardoiza-menu .ardoiza-dish__head {
	display: flex !important;
	flex-wrap: nowrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
}

.ardoiza-menu .ardoiza-dish__name {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	overflow-wrap: break-word;
	font-weight: 700;
	font-size: 1.05em;
}

.ardoiza-menu .ardoiza-dish__price {
	flex: 0 0 auto;
	float: right;
	float: inline-end;
	margin: 0;
	margin-inline-start: auto;
	padding: 0;
	font-family: var(--ardoiza-price-font);
	font-weight: 700;
	white-space: nowrap;
	text-align: end;
	color: var(--ardoiza-accent-dark);
}

.ardoiza-menu .ardoiza-dish__desc {
	margin: 0.2rem 0 0;
	padding: 0;
	color: var(--ardoiza-ink-soft);
	font-size: 0.95em;
}

.ardoiza-menu .ardoiza-dish__desc p {
	margin: 0 0 0.3rem;
	padding: 0;
	font-size: inherit;
}

.ardoiza-menu .ardoiza-dish__desc p:last-child {
	margin-bottom: 0;
}

.ardoiza-menu .ardoiza-dish__tags {
	margin: 0.35rem 0 0;
	padding: 0;
}

.ardoiza-menu .ardoiza-tag {
	display: inline-block;
	padding: 0.1rem 0.55rem;
	border: 1px solid var(--ardoiza-accent);
	border-radius: 999px;
	font-size: 0.8em;
	font-weight: 600;
	color: var(--ardoiza-accent-dark);
	background: var(--ardoiza-cream);
}

.ardoiza-menu .ardoiza-dish__allergens {
	margin: 0.35rem 0 0;
	padding: 0;
	font-size: 0.88em;
	color: var(--ardoiza-ink-soft);
}

.ardoiza-menu .ardoiza-dish__allergens-label {
	font-weight: 600;
	color: var(--ardoiza-ink);
}

.ardoiza-menu .ardoiza-dish__status {
	margin: 0.2rem 0 0;
	padding: 0;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--ardoiza-accent-dark);
}

.ardoiza-menu .ardoiza-dish.is-unavailable .ardoiza-dish__name,
.ardoiza-menu .ardoiza-dish.is-unavailable .ardoiza-dish__price {
	opacity: 0.6;
}

.ardoiza-menu .ardoiza-menu__legend {
	display: block;
	margin: 1rem 0 0;
	padding: 0.9rem 1.1rem;
	border-radius: var(--ardoiza-radius);
	background: var(--ardoiza-sand);
	font-size: 0.9em;
}

.ardoiza-menu .ardoiza-menu__legend p {
	margin: 0 0 0.4rem;
	padding: 0;
}

.ardoiza-menu .ardoiza-menu__legend p:last-child {
	margin-bottom: 0;
}

.ardoiza-menu .ardoiza-menu__empty {
	margin: 0;
	padding: 1rem;
	border-radius: var(--ardoiza-radius);
	background: var(--ardoiza-cream);
	text-align: center;
}

/* ------------------------------------------------------------------ */
/* Reservation form                                                    */
/* ------------------------------------------------------------------ */

/*
 * The form is a white card with its title inside, two columns of fields, one on a phone. The font is the
 * text font of the site (inherited); colours come from the custom properties above.
 */
.ardoiza-form-wrap {
	max-width: 44rem;
	padding: 1.75rem 1.75rem 1.6rem;
	border: 1px solid var(--ardoiza-line);
	border-radius: var(--ardoiza-radius-card);
	background: var(--ardoiza-surface);
	box-shadow: var(--ardoiza-card-shadow);
}

.ardoiza-form-wrap .ardoiza-form__title {
	display: block;
	float: none;
	margin: 0 0 1.25rem;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ardoiza-accent);
	font-size: 1.4rem;
	line-height: 1.25;
	letter-spacing: 0.02em;
}

/* Short accent line under the title, on the side where the text starts. */
.ardoiza-form-wrap .ardoiza-form__title::after {
	content: "";
	display: block;
	width: 2.75rem;
	height: 3px;
	margin-top: 0.6rem;
	border-radius: 3px;
	background: var(--ardoiza-accent);
}

.ardoiza-form-wrap .ardoiza-form {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
}

.ardoiza-form-wrap .ardoiza-form__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 1rem 1.1rem;
	margin: 0;
	padding: 0;
}

.ardoiza-form-wrap .ardoiza-form__field {
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.ardoiza-form-wrap .ardoiza-form__field--full {
	grid-column: 1 / -1;
}

.ardoiza-form-wrap .ardoiza-form__field label {
	display: block;
	margin: 0;
	padding: 0;
	color: var(--ardoiza-ink-soft);
	font-weight: 600;
	font-size: 0.85rem;
}

/* Fields take the text font of the site, never the one a theme gives to form controls or to code. */
.ardoiza-form-wrap .ardoiza-form__field input:not([type="checkbox"]),
.ardoiza-form-wrap .ardoiza-form__field select,
.ardoiza-form-wrap .ardoiza-form__field textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	height: auto;
	min-height: 2.9rem;
	margin: 0;
	padding: 0.65rem 0.9rem;
	border: 1px solid var(--ardoiza-field-line);
	border-radius: var(--ardoiza-radius-field);
	background: var(--ardoiza-cream);
	box-shadow: none;
	color: var(--ardoiza-ink);
	font: inherit;
	font-size: 1rem;
	line-height: 1.4;
	text-transform: none;
	letter-spacing: normal;
}

.ardoiza-form-wrap .ardoiza-form__field textarea {
	min-height: 6rem;
	resize: vertical;
}

/* Field in cause after a refused request, or time no longer offered: red border and a message below. */
.ardoiza-form-wrap .ardoiza-form__field input[aria-invalid="true"]:not([type="checkbox"]),
.ardoiza-form-wrap .ardoiza-form__field select[aria-invalid="true"] {
	border: 2px solid var(--ardoiza-error);
}

.ardoiza-form-wrap .ardoiza-form__field input[type="checkbox"][aria-invalid="true"] {
	outline: 2px solid var(--ardoiza-error);
	outline-offset: 1px;
}

/* Note under a field (the comment field asks for no health information). */
.ardoiza-form-wrap .ardoiza-form__help {
	display: block;
	color: var(--ardoiza-ink-soft);
	font-size: 0.82rem;
}

.ardoiza-form-wrap .ardoiza-form__field-error {
	display: block;
	margin-top: 0.3rem;
	color: var(--ardoiza-error);
	font-size: 0.9rem;
	font-weight: 600;
}

.ardoiza-form-wrap .ardoiza-form__field input:focus-visible,
.ardoiza-form-wrap .ardoiza-form__field select:focus-visible,
.ardoiza-form-wrap .ardoiza-form__field textarea:focus-visible,
.ardoiza-form-wrap .ardoiza-button:focus-visible {
	outline: 3px solid var(--ardoiza-accent);
	outline-offset: 2px;
}

/* Consent in a light frame, box on the side where the text starts. */
.ardoiza-form-wrap .ardoiza-form__consent label {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--ardoiza-line);
	border-radius: var(--ardoiza-radius-field);
	background: var(--ardoiza-cream);
	color: var(--ardoiza-ink);
	font-weight: 400;
	font-size: 0.92rem;
}

.ardoiza-form-wrap .ardoiza-form__consent input {
	flex: 0 0 auto;
	width: auto;
	margin: 0.2rem 0 0;
}

/* Sentence and privacy link in one column next to the box: the link follows the sentence, never a column of its own. */
.ardoiza-form-wrap .ardoiza-form__consent-text {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
}

/*
 * Anti-spam field, invisible to people and kept in place: clipped rather than pushed 10 000 px to the left,
 * which on a right-to-left site widened the page by as much (horizontal scrolling, seen in 1.0.6).
 */
.ardoiza-form-wrap .ardoiza-form__hp {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.ardoiza-form-wrap .ardoiza-form__submit {
	margin: 1.4rem 0 0;
	padding: 0;
}

.ardoiza-form-wrap .ardoiza-button {
	display: inline-block;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0.85rem 1.75rem;
	border: 0;
	border-radius: 999px;
	background: var(--ardoiza-accent);
	box-shadow: 0 6px 16px var(--ardoiza-accent-shadow);
	color: var(--ardoiza-on-accent);
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}

.ardoiza-form-wrap .ardoiza-button:hover {
	background: var(--ardoiza-accent-dark);
}

.ardoiza-form-wrap .ardoiza-button[disabled] {
	opacity: 0.55;
	box-shadow: none;
	cursor: not-allowed;
}

.ardoiza-form-wrap .ardoiza-form__notice {
	margin: 0 0 1.1rem;
	padding: 0.8rem 1rem;
	border-radius: var(--ardoiza-radius-field);
	border: 1px solid var(--ardoiza-line);
	background: var(--ardoiza-sand);
	font-weight: 600;
}

.ardoiza-form-wrap .ardoiza-form__notice.is-error {
	border-color: var(--ardoiza-error);
	background: var(--ardoiza-error-bg);
	color: var(--ardoiza-error);
}

/* Printed on its own, outside .ardoiza-form-wrap, when online reservations are closed. */
.ardoiza-form__closed {
	padding: 0.8rem 1rem;
	border-radius: var(--ardoiza-radius);
	background: var(--ardoiza-sand);
}

/* Phone: a narrower frame around the form. */
@media (max-width: 480px) {
	.ardoiza-form-wrap {
		padding: 1.25rem 1rem 1.1rem;
		border-radius: calc(var(--ardoiza-radius) * 1.4);
	}
}

/* Phone: the photo goes above the text; name and price stay on one line, price on the right. */
@media (max-width: 480px) {
	.ardoiza-menu .ardoiza-dish {
		flex-direction: column;
	}

	.ardoiza-menu .ardoiza-dish__media,
	.ardoiza-menu .ardoiza-dish__image {
		width: 100%;
		flex-basis: auto;
		height: auto;
		max-height: 200px;
	}
}
