/*
 * Bafha Engage — front-end components (menus, campaigns) inside any theme.
 * Inherits the theme's fonts and colours. Override with CSS variables, e.g.
 *   .bfe-menu { --bfe-menu-accent: #b5651d; --bfe-menu-radius: 0; }
 *
 * Cards (menu grid, campaigns, lunch days) have their own background so they
 * stay readable on any section colour. Dark cards, for example:
 *   .bfe-menu, .bfe-campaigns, .bfe-daily { --bfe-card-bg: #1f1f24; --bfe-card-text: #f4f4f6; }
 */

/* Same size in every theme: the components do not take over the page's
 * text size (a 19.2px theme body would make everything 20 % bigger) nor the
 * html size behind "rem". A theme may choose another size:
 *   .bfe-menu { --bfe-font-size: 17px; }
 * Category headings keep the theme's heading style on purpose. */
.bfe-menu, .bfe-campaigns, .bfe-daily, .bfe-hours {
	--bfe-rem: var(--bfe-font-size, 16px);
	font-size: var(--bfe-font-size, 16px);
	line-height: 1.5;
}
/* [bafha_info field="status|today"]: a detail inside text, sized like the text around it. */
.bfe-hours.bfe-info { --bfe-rem: 1em; font-size: inherit; line-height: inherit; }

.bfe-menu, .bfe-campaigns, .bfe-daily {
	--bfe-card-bg: #fff;
	--bfe-card-text: #1d1d22;
	--bfe-card-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .07);
}
.bfe-menu [hidden], .bfe-campaigns [hidden] { display: none !important; }

.bfe-menu {
	--bfe-menu-accent: currentColor;
	--bfe-menu-muted: color-mix(in srgb, currentColor 62%, transparent);
	--bfe-menu-line: color-mix(in srgb, currentColor 14%, transparent);
	--bfe-menu-surface: color-mix(in srgb, currentColor 4%, transparent);
	--bfe-menu-radius: 12px;
	--bfe-menu-gap: calc(1.25 * var(--bfe-rem));
	container-type: inline-size;
}

/* Full width even inside flex containers (Bricks, Greenlight, Gutenberg rows). */
.bfe-menu,

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

.bfe-menu--empty { padding: calc(1 * var(--bfe-rem)); border: 1px dashed var(--bfe-menu-line); border-radius: var(--bfe-menu-radius); }

/* Category jump links: horizontally scrollable on phones */
.bfe-menu__nav {
	display: flex;
	gap: calc(0.5 * var(--bfe-rem));
	overflow-x: auto;
	padding: 0 0 calc(0.75 * var(--bfe-rem));
	margin: 0 0 calc(1 * var(--bfe-rem));
	scrollbar-width: thin;
}
.bfe-menu__nav-link {
	flex: none;
	padding: .4em .9em;
	border: 1px solid var(--bfe-menu-line);
	border-radius: 999px;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}
.bfe-menu__nav-link:hover,
.bfe-menu__nav-link:focus-visible { border-color: var(--bfe-menu-accent); }

.bfe-menu__section { scroll-margin-top: calc(5 * var(--bfe-rem)); }
.bfe-menu__section + .bfe-menu__section { margin-top: calc(var(--bfe-menu-gap) * 1.6); }
.bfe-menu__heading { margin: 0 0 calc(0.75 * var(--bfe-rem)); }

.bfe-menu__items { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--bfe-menu-gap); }

.bfe-menu__item { display: flex; gap: calc(1 * var(--bfe-rem)); align-items: flex-start; }
.bfe-menu__media { flex: none; width: 88px; }
.bfe-menu__img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--bfe-menu-radius); }
.bfe-menu__body { flex: 1; min-width: 0; }

.bfe-menu__line { display: flex; align-items: baseline; gap: calc(0.75 * var(--bfe-rem)); }
.bfe-menu__name { margin: 0; font-size: 1.05em; line-height: 1.3; }
.bfe-menu__price { margin-left: auto; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--bfe-menu-accent); }
.bfe-menu__price-label { font-weight: 400; color: var(--bfe-menu-muted); margin-right: .25em; }

.bfe-menu__desc { margin: calc(0.25 * var(--bfe-rem)) 0 0; color: var(--bfe-menu-muted); font-size: .95em; line-height: 1.5; }
.bfe-menu__meta { margin: .9em 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: calc(0.35 * var(--bfe-rem)); font-size: .8em; }
.bfe-menu__badge { padding: .1em .6em; border-radius: 999px; background: var(--bfe-menu-surface); border: 1px solid var(--bfe-menu-line); }
.bfe-menu__allergens { color: var(--bfe-menu-muted); }

/* Compact: no images, tight rows */
.bfe-menu--compact .bfe-menu__items { gap: calc(0.5 * var(--bfe-rem)); }
.bfe-menu--compact .bfe-menu__item { padding-bottom: calc(0.5 * var(--bfe-rem)); border-bottom: 1px solid var(--bfe-menu-line); }
.bfe-menu--compact .bfe-menu__media { display: none; }

/* Grid: cards */
/* At most 3 cards per row (2 on tablets, 1 on phones). Change with .bfe-menu { --bfe-menu-columns: 4; } */
.bfe-menu--grid .bfe-menu__items { grid-template-columns: repeat(var(--bfe-menu-columns, 3), minmax(0, 1fr)); }
@container (max-width: 820px) { .bfe-menu--grid .bfe-menu__items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 520px) { .bfe-menu--grid .bfe-menu__items { grid-template-columns: minmax(0, 1fr); } }
.bfe-menu--grid .bfe-menu__item { flex-direction: column; gap: 0; border: 0; border-radius: var(--bfe-menu-radius); overflow: hidden; background: var(--bfe-card-bg); color: var(--bfe-card-text); box-shadow: var(--bfe-card-shadow); }
.bfe-menu--grid .bfe-menu__media { width: 100%; }
.bfe-menu--grid .bfe-menu__img { aspect-ratio: 16 / 10; border-radius: 0; }
.bfe-menu--grid .bfe-menu__body { width: 100%; padding: calc(0.9 * var(--bfe-rem)) calc(1 * var(--bfe-rem)) calc(1 * var(--bfe-rem)); }

@container (max-width: 420px) {
	.bfe-menu--list .bfe-menu__media { width: 64px; }
	.bfe-menu__line { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
	.bfe-menu { scroll-behavior: smooth; }
}

/* Offer prices (menus and campaigns) */
.bfe-price-offer { display: inline-flex; gap: .4em; align-items: baseline; white-space: nowrap; }
.bfe-price-offer del { opacity: .55; font-weight: 400; }
.bfe-price-offer ins { text-decoration: none; font-weight: 700; }
.bfe-menu__offer-label { display: inline-block; margin-right: .4em; padding: .05em .5em; border-radius: 999px; font-size: .75em; font-weight: 700; background: var(--bfe-menu-surface); border: 1px solid var(--bfe-menu-line); }

/* Campaigns */
.bfe-campaigns {
	--bfe-menu-accent: currentColor;
	--bfe-campaign-line: color-mix(in srgb, currentColor 14%, transparent);
	--bfe-campaign-surface: color-mix(in srgb, currentColor 4%, transparent);
	--bfe-campaign-radius: 12px;
	width: 100%;
	max-width: 100%;
	align-self: stretch;
	container-type: inline-size;
}
.bfe-campaigns *, .bfe-campaigns *::before, .bfe-campaigns *::after { box-sizing: border-box; }
.bfe-campaigns--empty { padding: calc(1 * var(--bfe-rem)); border: 1px dashed var(--bfe-campaign-line); border-radius: var(--bfe-campaign-radius); }

.bfe-campaigns__items { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(1.25 * var(--bfe-rem)); }
.bfe-campaign { display: flex; flex-direction: column; overflow: hidden; border: 0; border-radius: var(--bfe-campaign-radius); background: var(--bfe-card-bg); color: var(--bfe-card-text); box-shadow: var(--bfe-card-shadow); }
.bfe-campaign__img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.bfe-campaign__body { padding: calc(1 * var(--bfe-rem)) calc(1.1 * var(--bfe-rem)) calc(1.1 * var(--bfe-rem)); display: grid; gap: calc(0.5 * var(--bfe-rem)); align-content: start; }
.bfe-campaign__badge { justify-self: start; padding: .15em .7em; border-radius: 999px; font-size: .8em; font-weight: 700; background: color-mix(in srgb, currentColor 12%, transparent); }
.bfe-campaign__title { margin: 0; font-size: 1.15em; line-height: 1.3; }
.bfe-campaign__desc { margin: 0; opacity: .8; line-height: 1.5; }
.bfe-campaign__products { list-style: none; margin: calc(0.25 * var(--bfe-rem)) 0 0; padding: calc(0.5 * var(--bfe-rem)) 0 0; border-top: 1px solid var(--bfe-campaign-line); display: grid; gap: calc(0.3 * var(--bfe-rem)); }
.bfe-campaign__products li { display: flex; justify-content: space-between; gap: calc(1 * var(--bfe-rem)); }
.bfe-campaign__until { margin: 0; font-size: .85em; opacity: .7; }
.bfe-campaign__schedule { margin: 0; font-size: .9em; font-weight: 600; font-variant-numeric: tabular-nums; }
.bfe-campaign__now { display: inline-block; margin-left: .4em; padding: .05em .55em; border-radius: 999px; font-size: .8em; color: #fff; background: #1f8a4c; }

.bfe-campaigns--cards .bfe-campaigns__items { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }

.bfe-campaigns--list .bfe-campaign { flex-direction: row; align-items: flex-start; }
.bfe-campaigns--list .bfe-campaign__media { flex: none; width: 120px; }
.bfe-campaigns--list .bfe-campaign__img { aspect-ratio: 1; }

.bfe-campaigns--banner .bfe-campaign { flex-direction: row; align-items: stretch; }
.bfe-campaigns--banner .bfe-campaign__media { flex: 0 0 42%; }
.bfe-campaigns--banner .bfe-campaign__img { height: 100%; aspect-ratio: auto; min-height: 200px; }
.bfe-campaigns--banner .bfe-campaign__body { padding: calc(1.5 * var(--bfe-rem)); align-content: center; }
.bfe-campaigns--banner .bfe-campaign__title { font-size: 1.5em; }

@container (max-width: 560px) {
	.bfe-campaigns--banner .bfe-campaign,
	.bfe-campaigns--list .bfe-campaign { flex-direction: column; }
	.bfe-campaigns--banner .bfe-campaign__media,
	.bfe-campaigns--list .bfe-campaign__media { flex-basis: auto; width: 100%; }
	.bfe-campaigns--list .bfe-campaign__img { aspect-ratio: 16 / 9; }
}

/* Opening hours ([bafha_hours], block). Override e.g.
 *   .bfe-hours { --bfe-hours-open: #1f7a5a; --bfe-hours-today: #fff4e0; } */
.bfe-hours {
	--bfe-hours-line: color-mix(in srgb, currentColor 14%, transparent);
	--bfe-hours-muted: color-mix(in srgb, currentColor 62%, transparent);
	--bfe-hours-today: color-mix(in srgb, currentColor 6%, transparent);
	--bfe-hours-open: #1f8a4c;
	--bfe-hours-closed: #b42318;
	--bfe-hours-radius: 12px;
	width: 100%;
	max-width: calc(32 * var(--bfe-rem));
}
.bfe-hours *, .bfe-hours *::before, .bfe-hours *::after { box-sizing: border-box; }
.bfe-hours--empty { padding: calc(1 * var(--bfe-rem)); border: 1px dashed var(--bfe-hours-line); border-radius: var(--bfe-hours-radius); }
.bfe-hours p { margin: 0; }
.bfe-hours > * + * { margin-top: calc(0.9 * var(--bfe-rem)); }

.bfe-hours__status { display: inline-flex; align-items: center; gap: .5em; font-weight: 600; }
.bfe-hours__dot { width: .6em; height: .6em; border-radius: 50%; background: var(--bfe-hours-closed); flex: none; }
.bfe-hours__status.is-open .bfe-hours__dot { background: var(--bfe-hours-open); box-shadow: 0 0 0 .2em color-mix(in srgb, var(--bfe-hours-open) 25%, transparent); }

.bfe-hours__table { width: 100%; border-collapse: collapse; margin: 0; font-variant-numeric: tabular-nums; }
.bfe-hours__table th, .bfe-hours__table td { padding: .5em .75em; border: 0; border-bottom: 1px solid var(--bfe-hours-line); text-align: left; font-weight: 400; vertical-align: top; background: none; }
.bfe-hours__table td { text-align: right; }
.bfe-hours__row:last-child th, .bfe-hours__row:last-child td { border-bottom: 0; }
.bfe-hours__row.is-today th, .bfe-hours__row.is-today td { font-weight: 700; background: var(--bfe-hours-today); }
.bfe-hours__row.is-today th { border-radius: var(--bfe-hours-radius) 0 0 var(--bfe-hours-radius); }
.bfe-hours__row.is-today td { border-radius: 0 var(--bfe-hours-radius) var(--bfe-hours-radius) 0; }
.bfe-hours__row.is-closed td { color: var(--bfe-hours-muted); }

.bfe-hours__today { display: flex; gap: .75em; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.bfe-hours__label { font-weight: 700; }

.bfe-hours__special-title { font-weight: 700; margin-bottom: calc(0.4 * var(--bfe-rem)) !important; }
.bfe-hours__special ul { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(0.4 * var(--bfe-rem)); }
.bfe-hours__special li { display: flex; flex-wrap: wrap; gap: .25em .75em; font-variant-numeric: tabular-nums; }
.bfe-hours__date { font-weight: 600; }
.bfe-hours__special-note { color: var(--bfe-hours-muted); }
.bfe-hours__special .bfe-hours__time { margin-left: auto; }
.bfe-hours__special li.is-closed .bfe-hours__time { color: var(--bfe-hours-closed); }
.bfe-hours__note { color: var(--bfe-hours-muted); font-size: .95em; }

/* Lunch menu ([bafha_daily], block). Override e.g. .bfe-daily { --bfe-daily-today: #fff4e0; } */
.bfe-daily {
	--bfe-daily-line: color-mix(in srgb, currentColor 14%, transparent);
	--bfe-daily-muted: color-mix(in srgb, currentColor 62%, transparent);
	--bfe-daily-today: color-mix(in srgb, currentColor 5%, transparent);
	--bfe-daily-radius: 12px;
	--bfe-menu-line: var(--bfe-daily-line);
	--bfe-menu-muted: var(--bfe-daily-muted);
	--bfe-menu-surface: var(--bfe-daily-today);
	width: 100%;
	display: grid;
	gap: calc(1 * var(--bfe-rem));
}
.bfe-daily *, .bfe-daily *::before, .bfe-daily *::after { box-sizing: border-box; }
.bfe-daily [hidden] { display: none !important; }
.bfe-daily p { margin: 0; }
.bfe-daily--empty { padding: calc(1 * var(--bfe-rem)); border: 1px dashed var(--bfe-daily-line); border-radius: var(--bfe-daily-radius); }
.bfe-daily__time { display: flex; flex-wrap: wrap; gap: .25em .75em; }
.bfe-daily__time span, .bfe-daily__msg { color: var(--bfe-daily-muted); }
.bfe-daily__day { padding: calc(1 * var(--bfe-rem)); border: 0; border-radius: var(--bfe-daily-radius); background: var(--bfe-card-bg); color: var(--bfe-card-text); box-shadow: var(--bfe-card-shadow); }
.bfe-daily--week .bfe-daily__day.is-today { box-shadow: 0 0 0 2px currentColor, var(--bfe-card-shadow); }
.bfe-daily--week .bfe-daily__day.is-past { opacity: .55; }
.bfe-daily__date { margin: 0 0 calc(0.6 * var(--bfe-rem)); font-size: 1.05em; }
.bfe-daily__dishes { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(0.75 * var(--bfe-rem)); }
.bfe-daily__head { display: flex; gap: calc(1 * var(--bfe-rem)); align-items: baseline; }
.bfe-daily__name { font-weight: 600; }
.bfe-daily__price { margin-left: auto; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.bfe-daily__desc { margin-top: calc(0.2 * var(--bfe-rem)) !important; color: var(--bfe-daily-muted); font-size: .95em; }
.bfe-daily__meta { display: flex; flex-wrap: wrap; gap: calc(0.35 * var(--bfe-rem)); margin-top: calc(0.35 * var(--bfe-rem)) !important; font-size: .8em; }

/* Sold out (menu, lunch menu) */
.bfe-sold-out { display: inline-block; flex: none; padding: .1em .6em; border-radius: 999px; font-size: .75em; font-weight: 700; letter-spacing: .02em; color: #fff; background: #b42318; white-space: nowrap; }
.is-sold-out .bfe-menu__name, .is-sold-out .bfe-daily__name, .is-sold-out .bfe-menu__desc, .is-sold-out .bfe-daily__desc { opacity: .55; }
.is-sold-out .bfe-menu__media { opacity: .5; }
/* "Sold out" sits where the price is, so long names keep their line. */
.bfe-menu__line .bfe-sold-out, .bfe-daily__head .bfe-sold-out { margin-left: auto; }

/* Website menu: search and category list */
/* Floating bar that stays at the top while scrolling. With a sticky theme header:
 *   .bfe-menu { --bfe-menu-sticky-top: 80px; } */
.bfe-menu__tools {
	position: sticky;
	top: var(--bfe-menu-sticky-top, 12px);
	z-index: 20;
	display: flex;
	flex-wrap: wrap;
	gap: calc(0.5 * var(--bfe-rem));
	margin: 0 0 calc(1.25 * var(--bfe-rem));
	padding: calc(0.4 * var(--bfe-rem));
	border-radius: 28px;
	background: var(--bfe-card-bg);
	color: var(--bfe-card-text);
	box-shadow: var(--bfe-card-shadow);
}
.bfe-menu__search, .bfe-menu__select {
	min-height: 44px;
	padding: .55em 1em;
	border: 1px solid color-mix(in srgb, var(--bfe-card-text) 14%, transparent);
	border-radius: 999px;
	background-color: var(--bfe-card-bg);
	color: var(--bfe-card-text);
	font: inherit;
	box-shadow: none;
}
.bfe-menu__section { scroll-margin-top: calc(var(--bfe-menu-sticky-top, 12px) + calc(7 * var(--bfe-rem))); }
.bfe-menu__field { position: relative; display: flex; flex: 1 1 240px; min-width: 0; }
.bfe-menu__search {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	padding-left: 2.6em;
	padding-right: 2.8em;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364646f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4.2-4.2'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 1em center;
	background-size: 18px 18px;
}
.bfe-menu__select {
	flex: 0 1 240px;
	min-width: 0;
	padding-right: 2.6em;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364646f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1.1em center;
	background-size: 16px 16px; /* Themes sometimes shrink select arrows. */
	cursor: pointer;
}
.bfe-menu__search:focus-visible, .bfe-menu__select:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.bfe-menu__search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; } /* Our own "×" instead. */
.bfe-menu__clear {
	position: absolute;
	top: 50%;
	right: .45em;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: color-mix(in srgb, var(--bfe-card-text) 55%, transparent);
	transform: translateY(-50%);
	cursor: pointer;
}
.bfe-menu__clear[hidden] { display: none; }
.bfe-menu__clear:hover { background: none; color: var(--bfe-card-text); }
.bfe-menu__clear:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.bfe-menu__clear svg { display: block; width: 16px; height: 16px; }
.bfe-menu__empty { flex-basis: 100%; margin: calc(0.25 * var(--bfe-rem)) calc(0.75 * var(--bfe-rem)) calc(0.35 * var(--bfe-rem)); }
.bfe-menu__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Phones: search and category list in one row, so the sticky bar stays low. */
@container (max-width: 600px) {
	.bfe-menu__tools { flex-wrap: nowrap; gap: 6px; padding: 6px; }
	.bfe-menu__tools .bfe-menu__field { flex: 1 1 0; min-width: 0; }
	.bfe-menu__tools .bfe-menu__select { flex: 0 0 44%; min-width: 0; padding-left: .8em; padding-right: 2.2em; background-position: right .8em center; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
	.bfe-menu__tools .bfe-menu__search { font-size: 16px; /* 16px: phones do not zoom in on focus. */ padding-left: 2.3em; background-position: .8em center; }
	.bfe-menu__tools:has(.bfe-menu__empty:not([hidden])) { flex-wrap: wrap; } /* Room for "Nothing found". */
}

/* Note below the menu (allergens, additives, a greeting) */
.bfe-menu__note { margin-top: calc(var(--bfe-menu-gap) * 1.6); padding-top: calc(1 * var(--bfe-rem)); border-top: 1px solid var(--bfe-menu-line); color: var(--bfe-menu-muted); font-size: .9em; line-height: 1.6; }

/* Dark section behind a component (detected by assets/js/tone.js, or the
 * class "bfe-dark" on a parent): light text outside the cards. Cards keep
 * their own colours. */
.bfe-on-dark { color: #f2f2f5; }
.bfe-on-dark :is(h1, h2, h3, h4, h5, h6), .bfe-hours.bfe-on-dark :is(td, th, p) { color: inherit; } /* Themes often colour headings themselves. */
.bfe-on-dark .bfe-menu__note, .bfe-on-dark .bfe-hours__note { color: color-mix(in srgb, #f2f2f5 72%, transparent); }

/* Own colours of a menu (panel › Menus › "Own colours"): win over the theme and the dark-section switch. */
.bfe-menu.has-heading-color .bfe-menu__heading { color: var(--bfe-menu-heading); }
.bfe-menu.has-note-color .bfe-menu__note { color: var(--bfe-menu-info); border-top-color: color-mix(in srgb, var(--bfe-menu-info) 30%, transparent); }
