/* =========================================================================
 * Quick add — the «+» on a product card and the size panel it opens.
 *
 * Two halves:
 *   1. the card's add-to-cart link is restyled into a bare «+»;
 *   2. the panel that slides up inside the card, frosted so the photograph
 *      stays faintly visible behind it.
 *
 * Specificity is deliberate. The visual rules carry !important because the
 * parent theme paints loop buttons with a long class chain; the `display` rule
 * deliberately does NOT, so the «Mark Gallery Selects» cards — which hide
 * their add-to-cart link on purpose (child.css:1065) — stay hidden instead of
 * having a «+» forced back into them.
 *
 * Applies at every width: the same control is used on phones, tablets and
 * desktop, only its padding changes.
 * ========================================================================= */

/* --- 1. the card control ------------------------------------------------ */

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	position: relative;
	overflow: hidden;         /* keeps the sliding panel inside the card */
}

.woocommerce ul.products li.product a.button.add_to_cart_button,
.woocommerce-page ul.products li.product a.button.add_to_cart_button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	margin: 2px 0 6px;
	padding: 4px 0 !important;
	background: none !important;
	border: 0 !important;
	box-shadow: none !important;
	color: var(--ink, #0a0a0a) !important;
	/* The label stays in the accessibility tree — only its pixels go. */
	font-size: 0 !important;
	line-height: 1;
	text-decoration: none;
}

.woocommerce ul.products li.product a.button.add_to_cart_button::before,
.woocommerce-page ul.products li.product a.button.add_to_cart_button::before {
	content: "+";
	font-size: 24px;
	font-weight: 300;
	line-height: 1;
	transition: transform 160ms ease;
}

.woocommerce ul.products li.product a.button.add_to_cart_button:hover::before {
	transform: scale(1.15);
}

.woocommerce ul.products li.product a.button.add_to_cart_button:focus-visible,
.woocommerce-page ul.products li.product a.button.add_to_cart_button:focus-visible {
	outline: 2px solid var(--ink, #0a0a0a);
	outline-offset: 2px;
	border-radius: 4px;
}

.woocommerce ul.products li.product.mg-qa-open,
.woocommerce-page ul.products li.product.mg-qa-open {
	z-index: 4;
}

/* The «Mark Gallery Selects» cards hide this link on purpose (child.css:1065)
 * because they carry their own quick-view control. The «+» rule above has the
 * same specificity as that hide rule and loads later, so without this the «+»
 * would be forced back into those cards — measured, and it was. */
.picks .woocommerce ul.products li.product > a.button,
.picks .woocommerce ul.products li.product > a.added_to_cart,
.picks .woocommerce ul.products li.product a.button.add_to_cart_button {
	display: none !important;
}

/* --- 2. the panel ------------------------------------------------------- */

.mg-qa {
	position: absolute;
	inset: 0;
	z-index: 6;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 8px;
	padding: 10px;
	/* Frosted, not opaque: the photograph has to stay recognisable so the
	 * shopper keeps their place in the grid while choosing a size. The white
	 * veil is deliberately light (58%) and the blur small — enough to settle
	 * the image behind the text without hiding it, and cheap enough to animate
	 * on a phone. The text carries a white halo (below) to stay legible over a
	 * dark garment. */
	background: rgba(255, 255, 255, 0.58);
	-webkit-backdrop-filter: blur(7px) saturate(120%);
	backdrop-filter: blur(7px) saturate(120%);
	text-align: center;
	opacity: 0;
	transform: translateY(100%);
	transition: transform 280ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 200ms ease;
}

.mg-qa[hidden] {
	display: none;
}

.mg-qa.is-open {
	opacity: 1;
	transform: none;
}

.mg-qa__head {
	display: flex;
	justify-content: flex-end;   /* RTL: the close sits at the inline-end */
}

.mg-qa__close {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 32px;
	padding: 2px 4px;
	background: none;
	border: 0;
	color: var(--ink, #0a0a0a);
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}

.mg-qa__close:focus-visible {
	outline: 2px solid var(--ink, #0a0a0a);
	outline-offset: 2px;
}

.mg-qa__body {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	/* Absorbs the leftover height so the label, the select and the stock line
	 * stay together in the middle of the card instead of drifting apart on a
	 * tall desktop card. */
	flex: 1 1 auto;
	min-height: 0;
}

.mg-qa__label {
	margin: 0;
	font-size: 13px;
	line-height: 1.7;
	/* No halo. Instead the text is near-black, which clears contrast against
	 * the frosted photo behind it without the glow that read as a shadow. */
	color: #1f1f1f;
}

.mg-qa__select {
	width: 100%;
	max-width: 210px;
	min-height: 40px;
	padding: 6px 10px;
	border: 1px solid #d8d8d8;
	border-radius: 2px;
	background: #fff;
	color: var(--ink, #0a0a0a);
	font: inherit;
	font-size: 14px;
	text-align: center;
	text-align-last: center;
}

.mg-qa__select:focus-visible {
	outline: 2px solid var(--ink, #0a0a0a);
	outline-offset: 1px;
}

.mg-qa__stock {
	margin: 0;
	min-height: 20px;
	font-size: 13px;
	line-height: 1.7;
	color: #1f1f1f;
}

.mg-qa__stock.is-out {
	color: #b81f1f;
}

.mg-qa__add {
	width: 100%;
	min-height: 44px;
	padding: 8px 6px;
	border: 1px solid var(--ink, #0a0a0a);
	background: var(--ink, #0a0a0a);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease;
}

.mg-qa__add:hover:not(:disabled) {
	background: #fff;
	color: var(--ink, #0a0a0a);
}

.mg-qa__add:focus-visible {
	outline: 2px solid var(--ink, #0a0a0a);
	outline-offset: 3px;
}

.mg-qa__add:disabled {
	background: #ededed;
	border-color: #ededed;
	color: #8c8c8c;
	cursor: not-allowed;
}

/* --- 3. narrow cards ----------------------------------------------------
 * In the two-column phone grid a card is about 175px wide and ~290px tall, so
 * the panel has to give back some padding to keep the whole control visible.
 * ---------------------------------------------------------------------- */
@media (max-width: 480px) {
	.mg-qa {
		padding: 8px;
		gap: 6px;
	}

	.mg-qa__label {
		font-size: 12px;
	}

	.mg-qa__select {
		min-height: 36px;
		font-size: 13px;
	}

	.mg-qa__stock {
		font-size: 12px;
	}

	.mg-qa__add {
		min-height: 40px;
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mg-qa {
		transition: none;
	}

	.woocommerce ul.products li.product a.button.add_to_cart_button::before {
		transition: none;
	}

	.woocommerce ul.products li.product a.button.add_to_cart_button:hover::before {
		transform: none;
	}
}
