/*
 * Dish cards and category chips.
 *
 * These live in their own sheet because two very different pages need them:
 * the homepage "Categories & Items" strip and the full ordering menu. They
 * used to sit in home.css, which meant the menu page rendered its cards with
 * no card styling at all once the stylesheets were split by page type.
 */

/* -------------------------------------------------------------------------
   Category chips
   ------------------------------------------------------------------------- */

.mm-cats {
	justify-content: flex-start;
	margin-bottom: clamp(24px, 3vw, 38px);
	padding-bottom: 6px;
}

@media (min-width: 900px) {
	.mm-cats { flex-wrap: wrap; overflow: visible; justify-content: center; }
}

.mm-chip small {
	font-size: .72rem;
	opacity: .55;
	font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   Dish grid
   ------------------------------------------------------------------------- */

.mm-dishes {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
	gap: clamp(16px, 2vw, 26px);
}

@media (max-width: 560px) {
	.mm-dishes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

.mm-dish {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--mm-white);
	border: 1px solid var(--mm-line);
	border-radius: var(--mm-r-lg);
	overflow: hidden;
	box-shadow: var(--mm-shadow-xs);
	transition: transform var(--mm-t) var(--mm-ease-out), box-shadow var(--mm-t) var(--mm-ease-out), border-color var(--mm-t-fast) var(--mm-ease);
}

.mm-dish:hover {
	transform: translateY(-4px);
	box-shadow: var(--mm-shadow);
	border-color: var(--mm-red-100);
}

/* A card holding something reads as "in the order" at a glance. */
.mm-dish:has(.mm-dish__buy.is-counting) {
	border-color: var(--mm-red-200, var(--mm-red-100));
	box-shadow: 0 0 0 1px var(--mm-red-100) inset, var(--mm-shadow-xs);
}

.mm-dish.is-unavailable { opacity: .72; }

.mm-dish__media {
	position: relative;
	aspect-ratio: 4 / 3;
	border-radius: 0;
	background: var(--mm-cream-2);
}

.mm-dish__media img { width: 100%; height: 100%; object-fit: cover; }

.mm-dish__flag {
	position: absolute;
	top: 10px;
	left: 10px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border-radius: var(--mm-r-pill);
	background: rgba(255, 255, 255, .94);
	color: var(--mm-gold);
	font-size: .68rem;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	box-shadow: var(--mm-shadow-xs);
}

.mm-dish__sold {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(23, 18, 16, .5);
	color: #fff;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	font-size: .78rem;
}

.mm-dish__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 16px 16px 18px;
	gap: 8px;
}

.mm-dish__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.mm-dish__title {
	font-family: var(--mm-display);
	font-size: 1.12rem;
	line-height: 1.25;
	margin: 0;
	color: var(--mm-ink);
}

.mm-dish__price {
	font-weight: 700;
	color: var(--mm-red);
	font-size: 1.02rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.mm-dish__text {
	font-size: .875rem;
	line-height: 1.55;
	color: var(--mm-ink-60);
	margin: 0;
}

.mm-dish__meta {
	display: flex;
	align-items: center;
	gap: 7px;
	flex-wrap: wrap;
	min-height: 0;
}

.mm-spice { display: inline-flex; gap: 1px; color: #c8541f; }

.mm-dish__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 6px;
}

.mm-dish__note { font-size: .82rem; color: var(--mm-ink-40); }

/* -------------------------------------------------------------------------
   Add button ⇄ quantity stepper

   Both controls occupy the same slot: the Add button is swapped for the
   stepper the moment the dish is in the cart, so the row never changes width
   and the card never reflows underneath a finger that is mid-tap.
   ------------------------------------------------------------------------- */

.mm-dish__buy {
	flex: 1;
	min-width: 0;
}

.mm-dish__buy .mm-add {
	width: 100%;
}

.mm-stepper {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 4px;
	width: 100%;
	height: 42px;
	padding: 3px;
	border-radius: var(--mm-r-pill);
	background: var(--mm-red);
	box-shadow: 0 6px 16px -10px rgba(177, 35, 34, .9);
	animation: mm-stepper-in var(--mm-t) var(--mm-ease-out) both;
}

.mm-stepper[hidden] { display: none; }

@keyframes mm-stepper-in {
	from { transform: scale(.94); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

.mm-stepper__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(255, 255, 255, .14);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition:
		background-color var(--mm-t-fast) var(--mm-ease),
		transform var(--mm-t-fast) var(--mm-ease-out);
}

.mm-stepper__btn:hover { background: rgba(255, 255, 255, .28); }
.mm-stepper__btn:active { transform: scale(.9); }

.mm-stepper__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.mm-stepper__ico { display: flex; }

/* The bin shows only on the last one; the minus covers every other step. */
.mm-stepper__ico--bin { display: none; }
.mm-stepper.is-last .mm-stepper__ico--bin { display: flex; }
.mm-stepper.is-last .mm-stepper__ico--minus { display: none; }

.mm-stepper.is-last .mm-stepper__btn--down:hover { background: rgba(0, 0, 0, .22); }

.mm-stepper__value {
	flex: 1;
	text-align: center;
	color: #fff;
	font-weight: 700;
	font-size: .98rem;
	font-variant-numeric: tabular-nums;
	letter-spacing: .01em;
}

@media (max-width: 560px) {
	.mm-dish__body { padding: 12px 12px 14px; gap: 6px; }
	.mm-dish__title { font-size: .98rem; }
	.mm-dish__text { display: none; }
	.mm-dish__actions .mm-note-open { display: none; }

	.mm-stepper { height: 40px; }
	.mm-stepper__btn { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
	.mm-dish:hover { transform: none; }
	.mm-stepper { animation: none; }
	.mm-stepper__btn:active { transform: none; }
}
