/*
 * Cart page: centred heading (same look as the shop heading) and the add-on sections.
 * Owner-approved 2026-11-15 (mockup A on tablets and desktops, B on phones). Markup: inc/cart-addons.php,
 * behaviour: assets/js/mw-cart-addons.js. Presentation and added UI only; the Cart block is untouched.
 */

/* ---------- Heading ---------- */
.woocommerce-cart main h1.wp-block-post-title {
	margin-block: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	font-size: clamp(1.5rem, 0.9rem + 1.8vw, 2rem);
	font-weight: 500;
	letter-spacing: 0.04em;
	line-height: 1.2;
	text-align: center;
}

/* ---------- Shared ---------- */
.mw-addons__title {
	margin: 0;
	color: var(--wp--preset--color--contrast);
	font-weight: 300;
	line-height: 1.25;
}

/* ---------- Cards (768px and up) ---------- */
.mw-addons--cards {
	margin-top: clamp(2.25rem, 5vw, 3rem);
}

.mw-addons--cards .mw-addons__title {
	margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
	font-size: clamp(1.25rem, 1rem + 1.1vw, 1.75rem);
	text-align: center;
}

/* From 768px to 1023px the grid is three wide, so the fourth card is left out rather than sitting alone. */
@media (min-width: 768px) and (max-width: 1023px) {
	.mw-addons__grid > li:nth-child(n + 4) {
		display: none;
	}
}

@media (max-width: 767px) {
	.mw-addons--cards {
		display: none;
	}
}

/* ---------- List: the Cart page on phones (placed between the cart items and the totals by script) and the
   mini-cart drawer. The Cart page list is hidden from 768px; the drawer list shows at every width. ---------- */
.mw-addons--list {
	display: none;
}

@media (max-width: 767px) {
	.mw-addons--list:not([hidden]) {
		display: block;
		margin-block: 20px 8px;
	}
}

.mw-addons--drawer:not([hidden]) {
	display: block;
	margin-block: 20px 8px;
}

:is(.mw-addons--list, .mw-addons--drawer):not([hidden]) {
	padding: 16px 16px 6px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	background: var(--wp--preset--color--surface);
}

:is(.mw-addons--list, .mw-addons--drawer) .mw-addons__title {
	font-size: 1.0625rem;
	font-weight: 500;
}

.mw-addons__hint {
	margin: 2px 0 6px;
	color: var(--wp--preset--color--text-muted);
	font-size: 0.875rem;
}

.mw-addons__rows {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The lists show three products, the cards show up to four. */
.mw-addons__row:nth-child(n + 4) {
	display: none;
}

.mw-addons__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 12px 0;
	border-top: 1px solid var(--wp--preset--color--border);
}

.mw-addons__thumb {
	flex: none;
	width: 48px;
	height: 60px;
	overflow: hidden;
	border-radius: 6px;
	background: var(--wp--preset--color--border);
}

.mw-addons__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mw-addons__info {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	min-width: 0;
	gap: 2px;
}

.mw-addons__name {
	overflow: hidden;
	color: var(--wp--preset--color--contrast);
	font-size: 0.875rem;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mw-addons__price {
	color: var(--wp--preset--color--text-muted);
	font-size: 0.875rem;
}

.mw-addons__price del {
	margin-right: 4px;
}

.mw-addons__price ins {
	text-decoration: none;
}

.mw-addons__add {
	display: inline-flex;
	flex: none;
	align-items: center;
	min-height: 36px;
	margin: 0;
	padding: 0 14px;
	border: 1.5px solid var(--wp--preset--color--contrast);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.mw-addons__add[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

.mw-addons__add.mw-added {
	border-color: var(--wp--preset--color--success);
	color: var(--wp--preset--color--success);
}

.mw-addons__row .mw-save__error {
	flex-basis: 100%;
	margin: 0;
	color: var(--wp--preset--color--error);
	font-size: 0.8125rem;
}
