/**
 * Bundle & Save — storefront styles.
 *
 * Colours are declared once here as custom properties, matching the values the
 * product page already renders (they are hardcoded across ~2300 lines of
 * mu-plugins/levendar-single-product-hero.php, which has no tokens of its own).
 * Restyling the bundle block means editing this block and nothing else; if that
 * mu-plugin is ever migrated to tokens, it can point at these.
 */
:root {
	--lcvs-green: #194f2b;
	--lcvs-green-mid: #204b2f;
	--lcvs-gold: #b47a1d;
	--lcvs-gold-border: #c79335;
	--lcvs-gold-deep: #8f651f;
	--lcvs-surface: #fffdfa;
	--lcvs-ink: #273228;
	--lcvs-muted: rgba(32, 39, 31, 0.46);
	--lcvs-hairline: rgba(32, 75, 47, 0.16);
	--lcvs-tint: rgba(32, 75, 47, 0.06);
	--lcvs-gold-tint: rgba(199, 147, 53, 0.16);
	--lcvs-radius: 10px;
}

/*
 * The theme's mu-plugin lays the form out as `156px minmax(0, 1fr)` — a
 * quantity box beside the button — with !important throughout. The bundle
 * replaces that column, so the grid collapses to one track. Both the theme's
 * body class and ours are in the selector purely to out-specify it rather than
 * rely on stylesheet order.
 */
body.lcvs-bundle-active.woocommerce div.product form.cart,
body.lcvs-bundle-active.levendar-single-product-layout.woocommerce div.product form.cart {
	grid-template-columns: minmax(0, 1fr) !important;
	display: block !important;
}

body.lcvs-bundle-active form.cart > div.quantity,
body.lcvs-bundle-active.woocommerce div.product form.cart > div.quantity {
	display: none !important;
}

body.lcvs-bundle-active.woocommerce div.product form.cart > .single_add_to_cart_button {
	width: 100% !important;
}

.lcvs-bundle {
	margin: 0 0 18px;
}

.lcvs-bundle__heading {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 18px;
}

.lcvs-bundle__rule {
	flex: 1;
	height: 1px;
	background: var(--lcvs-hairline);
}

.lcvs-bundle__title {
	font-size: 12px;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--lcvs-green-mid);
}

.lcvs-bundle__set {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.lcvs-bundle__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

.lcvs-tier {
	position: relative;
}

/*
 * Hidden in place, deliberately not with WordPress's .screen-reader-text.
 * Elementor redefines that class as `position:absolute; top:-10000em`, which on
 * a 16px root puts the radio ~160,000px above its own card. Clicking a label
 * focuses the radio, browsers scroll a newly focused element into view, and the
 * page therefore jumped to the top on every tier selection. Anchoring the input
 * inside the card keeps focus where the customer already is.
 */
.lcvs-tier__input {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.lcvs-tier__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	cursor: pointer;
	overflow: hidden;
	border: 1px solid var(--lcvs-hairline);
	border-radius: var(--lcvs-radius);
	background: var(--lcvs-surface);
	text-align: center;
	/* Border width is part of the selected state, so it is compensated with
	   padding rather than an outline — an outline would sit outside the radius
	   and clip against the neighbouring card. */
	padding: 0 0 12px;
	transition: border-color 0.15s linear, background-color 0.15s linear;
}

.lcvs-tier__label {
	display: block;
	width: 100%;
	padding: 7px 6px;
	background: var(--lcvs-tint);
	color: var(--lcvs-green-mid);
	font-size: 11px;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.lcvs-tier__input:checked + .lcvs-tier__card {
	border-color: var(--lcvs-green);
	box-shadow: inset 0 0 0 1px var(--lcvs-green);
}

.lcvs-tier__input:checked + .lcvs-tier__card .lcvs-tier__label {
	background: var(--lcvs-green);
	color: #fff;
	font-weight: 700;
}

.lcvs-tier__input:focus-visible + .lcvs-tier__card {
	outline: 2px solid var(--lcvs-gold-border);
	outline-offset: 2px;
}

/*
 * One square image per tier, supplied already composed with the right number of
 * units. `contain` on a 1:1 box preserves that composition exactly — `cover`
 * would crop whatever sits nearest the edges, which on a three-pack is a bottle.
 */
.lcvs-tier__media {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	margin: 10px 0 0;
	padding: 0 10px;
}

.lcvs-tier__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.lcvs-tier__badge {
	display: inline-block;
	margin: 8px 0 0;
	padding: 3px 9px;
	border-radius: 20px;
	background: var(--lcvs-gold-tint);
	color: var(--lcvs-gold-deep);
	font-size: 10px;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	line-height: 1.6;
}

.lcvs-tier__unit {
	display: block;
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--lcvs-ink);
}

.lcvs-tier__total {
	display: block;
	margin: 5px 0 0;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 19px;
	line-height: 1.2;
	color: var(--lcvs-gold);
}

.lcvs-tier__compare {
	display: block;
	min-height: 18px;
	font-size: 12px;
	color: var(--lcvs-muted);
}

.lcvs-tier__compare del {
	color: inherit;
	text-decoration: line-through;
}

/* wc_price() wraps amounts in its own span; keep them inheriting the card's
   type rather than the theme's global price styling. */
.lcvs-tier__unit .woocommerce-Price-amount,
.lcvs-tier__total .woocommerce-Price-amount,
.lcvs-tier__compare .woocommerce-Price-amount {
	font-size: inherit;
	font-family: inherit;
	color: inherit;
}

.lcvs-bundle__captions {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
}

.lcvs-bundle__captions li {
	margin: 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--lcvs-ink);
	text-align: center;
}

.lcvs-bundle__stock-note {
	margin: 0 0 12px;
	font-size: 12px;
	color: var(--lcvs-gold-deep);
}

@media (max-width: 480px) {
	.lcvs-bundle__grid,
	.lcvs-bundle__captions {
		gap: 6px;
	}

	.lcvs-tier__label {
		font-size: 10px;
		letter-spacing: 0.5px;
	}

	/* The image keeps its 1:1 box and simply scales with the card; only the
	   breathing room around it tightens. */
	.lcvs-tier__media {
		padding: 0 5px;
	}

	.lcvs-tier__total {
		font-size: 16px;
	}

	.lcvs-tier__unit {
		font-size: 11px;
	}
}
