/*
 * Price table — [express_mobile_laundry_prices]
 *
 * A standalone stylesheet: the booking form's bundle is not loaded on a page
 * that only lists prices.
 *
 * Three things shape the way this is written:
 *
 *  - It answers to the same CSS variables as the booking form, so setting a
 *    colour under Express Laundry → Appearance themes both. Each variable has
 *    a fallback here, so the table still looks right on a page where the
 *    booking form never loads.
 *  - Every rule is scoped under `.eml-prices` and every value is set
 *    explicitly, because a theme's own `ul`, `li` and heading styles would
 *    otherwise reach in — list bullets and inherited margins are what make an
 *    embedded price list look broken.
 *  - It is laid out with container queries where they are supported, so the
 *    table reflows to the width of the column it is placed in rather than to
 *    the width of the window. Dropping a price list into a narrow sidebar is a
 *    normal thing to do, and viewport media queries get that wrong.
 */

.eml-prices {
	/* Local copies of the booking form's tokens. Admin settings override
	   these; these keep the table correct when nothing has been set. */
	--eml-brand: #00a3e0;
	--eml-ink: #0b2447;
	--eml-ink-2: #5b6b8c;
	--eml-line: #e4eaf3;
	--eml-surface: #ffffff;
	--eml-surface-2: #f6fafd;
	--eml-radius: 0px;
	--eml-radius-lg: 0px;

	box-sizing: border-box;
	container-type: inline-size;
	margin: 0 0 1.5rem;
	color: var(--eml-ink);
	font-family: inherit;
	line-height: 1.5;
	text-align: left;
}

.eml-prices *,
.eml-prices *::before,
.eml-prices *::after {
	box-sizing: border-box;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.eml-prices__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

/* Two columns once there is genuinely room for them. 560px is where two
   columns stop squeezing the price away from its item name. */
@container (min-width: 560px) {
	.eml-prices--cols-auto .eml-prices__grid,
	.eml-prices--cols-2 .eml-prices__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Browsers without container query support: fall back to the viewport, which
   is right far more often than it is wrong. */
@supports not (container-type: inline-size) {
	@media (min-width: 720px) {
		.eml-prices--cols-auto .eml-prices__grid,
		.eml-prices--cols-2 .eml-prices__grid {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}
	}
}

.eml-prices--cols-1 .eml-prices__grid {
	grid-template-columns: 1fr;
}

/* ── Category card ───────────────────────────────────────────────────────── */

.eml-prices__group {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	border: 1px solid var(--eml-line);
	border-radius: var(--eml-radius-lg);
	background: var(--eml-surface);
	overflow: hidden;
}

.eml-prices__header {
	padding: 14px 18px;
	border-bottom: 1px solid var(--eml-line);
	background: var(--eml-surface-2);
}

.eml-prices__heading {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	color: var(--eml-ink);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	line-height: 1.3;
	text-transform: none;
}

/* A short brand rule rather than an icon — it needs no asset and cannot fail
   to load. */
.eml-prices__heading::before {
	content: "";
	flex: none;
	width: 3px;
	height: 1em;
	border-radius: var(--eml-radius);
	background: var(--eml-brand);
}

.eml-prices__intro {
	margin: 4px 0 0;
	padding: 0;
	color: var(--eml-ink-2);
	font-size: 0.8125rem;
	line-height: 1.45;
}

/* ── Rows ────────────────────────────────────────────────────────────────── */

.eml-prices__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.eml-prices__list > li::before,
.eml-prices__list > li::marker {
	content: none;
}

.eml-prices__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px 16px;
	margin: 0;
	padding: 11px 18px;
	border-top: 1px solid var(--eml-line);
	list-style: none;
}

.eml-prices__row:first-child {
	border-top: 0;
}

.eml-prices__item {
	display: flex;
	min-width: 0;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
}

.eml-prices__name {
	color: var(--eml-ink);
	font-size: 0.9375rem;
	font-weight: 600;
}

.eml-prices__note {
	color: var(--eml-ink-2);
	font-size: 0.8125rem;
}

/* The second half of a tiered price. Set in the brand colour because it is a
   saving, and people should see it. */
.eml-prices__tier {
	margin-top: 2px;
	color: var(--eml-brand);
	font-size: 0.8125rem;
	font-weight: 600;
}

.eml-prices__amount {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: flex-end;
	gap: 1px;
	text-align: right;
	/* Digits line up column-wise even at different widths. */
	font-variant-numeric: tabular-nums;
}

.eml-prices__price {
	color: var(--eml-ink);
	font-size: 1rem;
	font-weight: 700;
	white-space: nowrap;
}

.eml-prices__unit {
	color: var(--eml-ink-2);
	font-size: 0.75rem;
	font-weight: 500;
	white-space: nowrap;
}

/* ── Footnotes ───────────────────────────────────────────────────────────── */

.eml-prices__minimum {
	margin: 16px 0 0;
	padding: 10px 14px;
	border: 1px solid var(--eml-line);
	border-left: 3px solid var(--eml-brand);
	border-radius: var(--eml-radius);
	background: var(--eml-surface-2);
	color: var(--eml-ink);
	font-size: 0.875rem;
	font-weight: 600;
}

.eml-prices__fine {
	margin: 8px 0 0;
	color: var(--eml-ink-2);
	font-size: 0.8125rem;
}

/* ── Narrow columns ──────────────────────────────────────────────────────── */

/* Below this the price cannot sit beside a long item name without one of them
   wrapping awkwardly, so it moves under it. */
@container (max-width: 340px) {
	.eml-prices__row {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}

	.eml-prices__amount {
		flex-direction: row;
		align-items: baseline;
		gap: 6px;
		text-align: left;
	}
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
	.eml-prices__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.eml-prices__group {
		border: 1px solid #999;
		break-inside: avoid;
	}

	.eml-prices__header {
		background: transparent;
	}
}
