/**
 * Mini-cart: .mk-mini-cart (drawer, templates/components/mini-cart.php) and
 * its REST body (mini-cart-content.php, mini-cart-footer.php).
 *
 * Drawer on the right, 400 wide (600 from 64rem, full screen below 48rem), flush content:
 * every part brings its own padding. Promotions padding 12 / 16 + bottom
 * divider; items (cart-item); accordion with leading icons, coupon form and
 * the summary panel (subtle background, padding 12 / 16). Footer padding
 * 16 / 24: "To pay:" title-large primary (space-between), checkout button
 * full width with 12 above and below, logos. Empty cart: big centred text,
 * recommendations, catalog button.
 */

.mk-mini-cart__body[aria-busy="true"] {
	cursor: progress;
}

.mk-mini-cart__body[aria-busy="true"] .mk-mini-cart__content {
	opacity: 0.6;
	pointer-events: none;
}

.mk-mini-cart__content:focus {
	outline: none;
}

.mk-mini-cart__error {
	margin: 0;
	padding-block: var(--wp--custom--mini-cart--promotions-padding-block);
	padding-inline: var(--wp--custom--mini-cart--promotions-padding-inline);
	background-color: var(--wp--custom--color--status--error--background);
	color: var(--wp--custom--color--status--error--foreground);
	font-family: var(--wp--custom--text--body-medium--font-family);
	font-size: var(--wp--custom--text--body-medium--font-size);
	font-weight: var(--wp--custom--text--body-medium--font-weight);
	line-height: var(--wp--custom--text--body-medium--line-height);
	letter-spacing: var(--wp--custom--text--body-medium--letter-spacing);
}

.mk-mini-cart__promotions {
	display: grid;
	gap: var(--wp--custom--mini-cart--promotions-gap);
	padding-block: var(--wp--custom--mini-cart--promotions-padding-block);
	padding-inline: var(--wp--custom--mini-cart--promotions-padding-inline);
	border-block-end: var(--wp--custom--border-width--thin) solid
		var(--wp--custom--color--mini-cart--divider);
}

/* Accordion: the summary panel and coupon form bring their own padding. */
.mk-mini-cart__panel {
	display: grid;
	gap: var(--wp--custom--mini-cart--summary-padding-block);
	padding-block-end: var(--wp--custom--mini-cart--summary-padding-block);
	padding-inline: var(--wp--custom--mini-cart--summary-padding-inline);
}

.mk-mini-cart__coupon {
	display: flex;
	gap: var(--wp--custom--mini-cart--promotions-gap);
}

.mk-mini-cart__code {
	flex: 1;
	box-sizing: border-box;
	min-inline-size: 0;
	padding-block: var(--wp--custom--button--small--padding-block);
	padding-inline: var(--wp--custom--button--small--padding-inline);
	border: var(--wp--custom--border-width--thin) solid
		var(--wp--custom--color--control--border);
	border-radius: var(--wp--custom--quantity-input--radius);
	background-color: var(--wp--custom--color--control--background);
	color: var(--wp--custom--color--text--primary);
	font-family: var(--wp--custom--text--body-medium--font-family);
	font-size: var(--wp--custom--text--body-medium--font-size);
	font-weight: var(--wp--custom--text--body-medium--font-weight);
	line-height: var(--wp--custom--text--body-medium--line-height);
	letter-spacing: var(--wp--custom--text--body-medium--letter-spacing);
	text-transform: uppercase;
}

.mk-mini-cart__code::placeholder {
	color: var(--wp--custom--color--text--placeholder);
	text-transform: none;
}

.mk-mini-cart__code:focus-visible {
	outline-width: var(--wp--custom--focus--ring-width);
	outline-style: solid;
	outline-color: var(--wp--custom--color--focus--ring);
	outline-offset: calc(-1 * var(--wp--custom--focus--ring-width));
}

.mk-mini-cart__applied {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0;
	color: var(--wp--custom--color--text--primary);
	font-family: var(--wp--custom--text--label-medium--font-family);
	font-size: var(--wp--custom--text--label-medium--font-size);
	font-weight: var(--wp--custom--text--label-medium--font-weight);
	line-height: var(--wp--custom--text--label-medium--line-height);
	letter-spacing: var(--wp--custom--text--label-medium--letter-spacing);
}

.mk-mini-cart__summary {
	padding-block: var(--wp--custom--mini-cart--summary-padding-block);
	padding-inline: var(--wp--custom--mini-cart--summary-padding-inline);
	background-color: var(--wp--custom--color--mini-cart--summary-background);
}

/* Footer: hidden while there is nothing in it (empty cart). */
.mk-mini-cart .mk-drawer__footer:has([data-mk-mini-cart-footer]:empty) {
	display: none;
}

.mk-mini-cart__footer {
	padding-block: var(--wp--custom--mini-cart--footer-padding-block);
	padding-inline: var(--wp--custom--mini-cart--footer-padding-inline);
}

.mk-mini-cart__total {
	display: flex;
	justify-content: space-between;
	gap: var(--wp--custom--mini-cart--promotions-gap);
	margin: 0;
	color: var(--wp--custom--color--text--primary);
	font-family: var(--wp--custom--text--title-large--font-family);
	font-size: var(--wp--custom--text--title-large--font-size);
	font-weight: var(--wp--custom--text--title-large--font-weight);
	line-height: var(--wp--custom--text--title-large--line-height);
	letter-spacing: var(--wp--custom--text--title-large--letter-spacing);
}

/* Scoped to the drawer so the button's own `margin: 0` (same weight, may load
   later) does not win. */
.mk-mini-cart .mk-mini-cart__checkout,
.mk-mini-cart .mk-mini-cart__browse-button {
	display: flex;
	inline-size: 100%;
}

.mk-mini-cart .mk-mini-cart__checkout {
	margin-block: var(--wp--custom--mini-cart--button-margin);
}

/* Empty cart. */
.mk-mini-cart__empty {
	margin: 0;
	padding-block: var(--wp--custom--mini-cart--empty-padding-block);
	padding-inline: var(--wp--custom--mini-cart--empty-padding-inline);
	color: var(--wp--custom--color--text--primary);
	font-family: var(--wp--custom--text--body-medium--font-family);
	font-size: var(--wp--custom--text--body-medium--font-size);
	font-weight: var(--wp--custom--text--body-medium--font-weight);
	line-height: var(--wp--custom--text--body-medium--line-height);
	letter-spacing: var(--wp--custom--text--body-medium--letter-spacing);
	text-align: center;
}

.mk-mini-cart__recommended {
	padding-inline: var(
		--wp--custom--mini-cart--recommendations-padding-inline
	);
}

.mk-mini-cart__browse {
	padding-block: var(--wp--custom--mini-cart--recommendations-padding-bottom);
	padding-inline: var(
		--wp--custom--mini-cart--recommendations-padding-inline
	);
}

/* Quick add from a product card (D-92): the cart icon bumps once. */
.mk-mini-cart-button.is-bumped .mk-icon {
	animation: mk-mini-cart-bump var(--wp--custom--motion--duration--slow)
		var(--wp--custom--motion--easing--emphasized);
}

@keyframes mk-mini-cart-bump {
	50% {
		transform: scale(var(--wp--custom--mini-cart--bump-scale));
	}
}

@media (prefers-reduced-motion: reduce) {
	.mk-mini-cart-button.is-bumped .mk-icon {
		animation: none;
	}
}
