/*
 * The menu's layout, and its five looks.
 *
 * Kept in step with resources/js/wix-menu.css in the MenuGPS repository: the same menu on two of a
 * restaurant's channels should not look like two different menus. Edit both.
 *
 * The default look ("classic") is layout only. No fonts, no colours, no backgrounds: the menu
 * should look like the site it is on, and a plugin that imposes a typeface is one people end up
 * fighting. `currentColor` and `em` throughout mean a theme's own type scale and palette carry
 * straight through, and every class is prefixed so any of this can be overridden without a
 * specificity war. The other looks add what they must and no more — a card needs a border, a
 * board needs a background — and still take the site's typeface.
 */
.menugps-menu {
	display: grid;
	gap: 2.5em;
}

@media (min-width: 700px) {
	.menugps-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.menugps-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Above the sections: the occasion line and the section tabs ---- */

/* "Tonight: Christmas Eve menu, until 23:00". Spans every column, like the picker. */
.menugps-occasion {
	grid-column: 1 / -1;
	margin: 0;
	padding: .55em .9em;
	font-size: .92em;
	border-left: 3px solid var(--menugps-accent, currentColor);
	opacity: .85;
}

.menugps-occasion strong { font-weight: 600; }

/*
 * Section tabs for a long menu. A scrolling row of pills, stuck to the top while the menu is
 * on screen. The background has to be stated for the sticky row to cover the dishes under it;
 * it follows the page's colour scheme, and a site with its own background can set
 * --menugps-bg on the wrapper.
 */
.menugps-sections {
	grid-column: 1 / -1;
	display: flex;
	gap: .4em;
	list-style: none;
	margin: 0;
	padding: .5em 0;
	overflow-x: auto;
	scrollbar-width: none;
	position: sticky;
	top: var(--menugps-sticky-top, 0);
	z-index: 2;
	background: var(--menugps-bg, Canvas);
}

.menugps-sections::-webkit-scrollbar { display: none; }
.menugps-sections li { flex: none; margin: 0; }

.menugps-section-link {
	display: inline-block;
	padding: .35em .95em;
	border: 1px solid currentColor;
	border-radius: 999px;
	font: inherit;
	font-size: .85em;
	line-height: 1.3;
	color: inherit;
	background: none;
	text-decoration: none;
	white-space: nowrap;
	opacity: .7;
	cursor: pointer;
}

.menugps-section-link:hover,
.menugps-section-link:focus,
.menugps-section-link.is-current {
	opacity: 1;
	text-decoration: none;
}

/* ---- Sections ---- */

/* Room under the sticky tabs when an anchor lands here. */
.menugps-section { scroll-margin-top: 3.4em; }

.menugps-section-title {
	margin: 0 0 .25em;
}

.menugps-section-note {
	margin: 0 0 1em;
	opacity: .75;
	font-size: .9em;
}

/* "Mon–Fri 08:00–11:00" under a section that keeps hours. */
.menugps-hours {
	display: block;
	margin: 0 0 .9em;
	font-size: .8em;
	letter-spacing: .03em;
	opacity: .6;
}

.menugps-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 1.1em;
}

/* ---- One dish ---- */

.menugps-item {
	display: flex;
	gap: .9em;
	align-items: flex-start;
	margin: 0;
}

.menugps-item-body {
	flex: 1 1 auto;
	min-width: 0;
}

.menugps-item-photo {
	flex: none;
	width: 4.2em;
	height: 4.2em;
	border-radius: .5em;
	object-fit: cover;
	display: block;
}

.menugps-item-head {
	display: flex;
	align-items: baseline;
	gap: .75em;
}

/* The dotted leader between dish and price, the way a printed menu does it. */
.menugps-item-head::after {
	content: "";
	flex: 1 1 auto;
	order: 1;
	border-bottom: 1px dotted currentColor;
	opacity: .28;
	transform: translateY(-.2em);
}

.menugps-item-name { font-weight: 600; }
.menugps-item-price { order: 2; white-space: nowrap; font-variant-numeric: tabular-nums; }

.menugps-item-desc {
	margin: .35em 0 0;
	font-size: .92em;
	opacity: .8;
}

/* Several prices — Starter €9.00, Main €17.00 — each on its own, under the name. */
.menugps-variants {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: .2em 1.2em;
	margin: .3em 0 0;
	padding: 0;
	font-size: .92em;
}

.menugps-variant { margin: 0; }
.menugps-variant-price { font-weight: 600; margin-left: .4em; font-variant-numeric: tabular-nums; }

/* The row of small things under a dish: diet tags, allergen codes, hours, sold out. */
.menugps-item-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .35em .6em;
	margin-top: .4em;
}

.menugps-tags,
.menugps-allergens {
	display: inline-flex;
	flex-wrap: wrap;
	gap: .35em;
}

.menugps-tag {
	font-size: .7em;
	letter-spacing: .06em;
	text-transform: uppercase;
	border: 1px solid currentColor;
	border-radius: 2px;
	padding: .1em .35em;
	opacity: .65;
}

/* Allergen codes: an <abbr> each, the full name on hover and for a screen reader. */
.menugps-allergen {
	font-size: .7em;
	letter-spacing: .06em;
	padding: .1em .2em;
	opacity: .6;
	text-decoration: none;
	border-bottom: 1px dotted currentColor;
	cursor: help;
}

.menugps-item-meta .menugps-hours { margin: 0; }

.menugps-sold-out {
	font-size: .7em;
	letter-spacing: .06em;
	text-transform: uppercase;
	border-radius: 2px;
	padding: .15em .45em;
	background: currentColor;
}

/* The label's text in the page's background colour, on the page's text colour. */
.menugps-sold-out > span { color: var(--menugps-bg, Canvas); }

.menugps-item.is-sold-out { opacity: .55; }
.menugps-item.is-sold-out .menugps-item-name { text-decoration: line-through; text-decoration-thickness: 1px; }
.menugps-item.is-sold-out .menugps-item-photo { filter: grayscale(1); }

/* Only applied when the merchant picked a colour; otherwise everything inherits the theme. */
.menugps-menu[style*="--menugps-accent"] .menugps-section-title,
.menugps-menu[style*="--menugps-accent"] .menugps-item-price,
.menugps-menu[style*="--menugps-accent"] .menugps-variant-price {
	color: var(--menugps-accent);
}

/* ---- Modifiers the settings screens switch on and off ---- */

.menugps-plain .menugps-item-head::after { display: none; }
.menugps-plain .menugps-item-head { justify-content: space-between; }

.menugps-centred .menugps-section-title,
.menugps-centred .menugps-section-note,
.menugps-centred > .menugps-section > .menugps-hours { text-align: center; }

.menugps-compact { gap: 1.6em; }
.menugps-compact .menugps-items { gap: .65em; }
.menugps-compact .menugps-item-desc { margin-top: .2em; }

.menugps-no-tags .menugps-tags,
.menugps-no-tags .menugps-allergens { display: none; }
.menugps-no-photos .menugps-item-photo { display: none; }

/* ---- Looks ----
 *
 * Each is one class on the wrapper. Classic is the default above and needs no class. The
 * others change as little as they can: a theme that overrides the site's typeface would be
 * exactly the plugin this one set out not to be.
 */

/* Modern: clean rows, a bold price on the right, soft pills, a short accent rule under titles. */
.menugps-theme-modern .menugps-item-head::after { display: none; }
.menugps-theme-modern .menugps-item-head { justify-content: space-between; }
.menugps-theme-modern .menugps-item-price { font-weight: 700; }
.menugps-theme-modern .menugps-items { gap: 0; }

.menugps-theme-modern .menugps-item {
	padding: .9em 0;
	border-top: 1px solid rgba(127, 127, 127, .28);
	border-top-color: color-mix(in srgb, currentColor 14%, transparent);
}

.menugps-theme-modern .menugps-item:last-child { border-bottom: 1px solid rgba(127, 127, 127, .28); border-bottom-color: color-mix(in srgb, currentColor 14%, transparent); }

.menugps-theme-modern .menugps-section-title { margin-bottom: .7em; }

.menugps-theme-modern .menugps-section-title::after {
	content: "";
	display: block;
	width: 2.5em;
	height: 3px;
	margin-top: .45em;
	border-radius: 2px;
	background: var(--menugps-accent, currentColor);
}

.menugps-theme-modern.menugps-centred .menugps-section-title::after { margin-left: auto; margin-right: auto; }

.menugps-theme-modern .menugps-tag {
	border: 0;
	border-radius: 999px;
	padding: .25em .7em;
	text-transform: none;
	letter-spacing: 0;
	font-size: .75em;
	opacity: .9;
	background: rgba(127, 127, 127, .16);
	background: color-mix(in srgb, currentColor 10%, transparent);
}

.menugps-theme-modern .menugps-item-photo { width: 4.8em; height: 4.8em; border-radius: .7em; }

/* Cards: a grid of cards with the photograph on top. Section columns do not apply. */
.menugps-menu.menugps-theme-cards { grid-template-columns: none; }

.menugps-theme-cards .menugps-items {
	grid-template-columns: repeat(auto-fill, minmax(14em, 1fr));
	gap: 1.2em;
	align-items: stretch;
}

.menugps-theme-cards .menugps-item {
	flex-direction: column;
	gap: 0;
	border: 1px solid rgba(127, 127, 127, .28);
	border-color: color-mix(in srgb, currentColor 16%, transparent);
	border-radius: .9em;
	overflow: hidden;
}

.menugps-theme-cards .menugps-item-photo {
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	border-radius: 0;
}

.menugps-theme-cards .menugps-item-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: .9em 1em 1em;
}

.menugps-theme-cards .menugps-item-head::after { display: none; }
.menugps-theme-cards .menugps-item-head { justify-content: space-between; align-items: flex-start; gap: .6em; }
.menugps-theme-cards .menugps-item-price { font-weight: 700; }

.menugps-theme-cards .menugps-item-desc {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.menugps-theme-cards .menugps-item-meta { margin-top: auto; padding-top: .6em; }
.menugps-theme-cards .menugps-tag { border: 0; border-radius: 999px; padding: .25em .7em; text-transform: none; letter-spacing: 0; font-size: .75em; background: rgba(127, 127, 127, .16); background: color-mix(in srgb, currentColor 10%, transparent); opacity: .9; }
.menugps-theme-cards .menugps-section-title { margin-bottom: .8em; }

/* On a phone, two small cards across rather than one tall one per dish. */
@media (max-width: 600px) {
	.menugps-theme-cards .menugps-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8em; }
	.menugps-theme-cards .menugps-item-body { padding: .7em .75em .8em; }
	.menugps-theme-cards .menugps-item-head { flex-direction: column; gap: .1em; }
}

/* Elegant: everything centred, small-cap titles between thin rules, the price under the name. */
.menugps-theme-elegant { text-align: center; }

.menugps-theme-elegant .menugps-section-title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1em;
	margin-bottom: .6em;
	font-weight: 400;
	font-size: .95em;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.menugps-theme-elegant .menugps-section-title::before,
.menugps-theme-elegant .menugps-section-title::after {
	content: "";
	flex: 1 1 2em;
	max-width: 6em;
	border-top: 1px solid currentColor;
	opacity: .35;
}

.menugps-theme-elegant .menugps-items { gap: 1.5em; }
.menugps-theme-elegant .menugps-item { flex-direction: column; align-items: center; gap: .6em; }
.menugps-theme-elegant .menugps-item-photo { width: 5.5em; height: 5.5em; border-radius: 50%; }
.menugps-theme-elegant .menugps-item-head { flex-direction: column; align-items: center; gap: .15em; }
.menugps-theme-elegant .menugps-item-head::after { display: none; }
.menugps-theme-elegant .menugps-item-name { letter-spacing: .03em; }
.menugps-theme-elegant .menugps-item-price { font-style: italic; opacity: .85; }
.menugps-theme-elegant .menugps-item-desc { font-style: italic; max-width: 34em; margin-left: auto; margin-right: auto; }
.menugps-theme-elegant .menugps-variants,
.menugps-theme-elegant .menugps-item-meta { justify-content: center; }
.menugps-theme-elegant .menugps-occasion { border-left: 0; border-top: 1px solid var(--menugps-accent, currentColor); border-bottom: 1px solid var(--menugps-accent, currentColor); }

/* Board: a dark board with light type and gold titles — a bar, a café, a chalkboard wall. */
.menugps-theme-board {
	--menugps-bg: #1c1b19;
	--menugps-board-accent: var(--menugps-accent, #d8b46a);
	background: var(--menugps-bg);
	color: #f4ecdd;
	padding: 2em 1.6em;
	border-radius: .6em;
}

.menugps-theme-board .menugps-section-title {
	color: var(--menugps-board-accent);
	font-size: 1em;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	margin-bottom: .6em;
}

.menugps-theme-board .menugps-item-head::after { opacity: .4; }
.menugps-theme-board .menugps-item-price,
.menugps-theme-board .menugps-variant-price { font-weight: 700; color: var(--menugps-board-accent); }
.menugps-theme-board .menugps-item-desc { opacity: .72; }
.menugps-theme-board .menugps-item-photo { display: none; }
.menugps-theme-board .menugps-section-link { border-color: rgba(244, 236, 221, .5); }
.menugps-theme-board .menugps-occasion { border-left-color: var(--menugps-board-accent); }
.menugps-theme-board .menugps-sold-out > span { color: var(--menugps-bg); }

/*
 * Language picker.
 *
 * Sits above the menu and stays out of the way: no colours of its own, no box, everything
 * inherited from the theme like the rest of the plugin. It is a line of small text, not a widget.
 */
.menugps-langs {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .35em .9em;
	margin: 0 0 1.2em;
	font-size: .85em;
}

.menugps-langs-quick {
	display: inline-flex;
	flex-wrap: wrap;
	gap: .2em .7em;
}

/* Empty until the script fills it, so no gap is reserved for a row that may never appear. */
.menugps-langs-quick:empty {
	display: none;
}

.menugps-lang {
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	opacity: .75;
}

.menugps-lang:hover,
.menugps-lang:focus {
	opacity: 1;
}

/* The language you are reading: stated, not offered. */
.menugps-langs-quick .menugps-lang.is-current {
	pointer-events: none;
	border-bottom: 0;
	opacity: 1;
	font-weight: 600;
}

.menugps-langs-all summary {
	cursor: pointer;
	opacity: .6;
}

.menugps-langs-all summary:hover {
	opacity: 1;
}

/*
 * The full list. Columns rather than one long scroll, because fifty-three names in a single
 * column is a page of its own on a phone.
 */
.menugps-langs-list {
	list-style: none;
	margin: .7em 0 0;
	padding: 0;
	columns: 2;
	column-gap: 1.5em;
	max-height: 60vh;
	overflow-y: auto;
}

.menugps-langs-list li {
	break-inside: avoid;
	margin: 0 0 .35em;
}

@media (min-width: 40em) {
	.menugps-langs-list {
		columns: 4;
	}
}
