/* Mix & Match · Grid — product pool as a 3-column card grid. */

/* Rows size independently — deliberately not `grid-auto-rows: 1fr`, which makes
   every card as tall as the tallest anywhere in the pool, not just in its row. */
/* Three columns, but only while three still fit: the `max()` inside `minmax()` is
   a 120px column cap. `auto-fill`, not `auto-fit`, so a two-product pool stays two cards. */
.wffn-bundles-mm-pool--grid.wffn-bundles-mm-pool--grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(120px, (100% - 24px) / 3), 1fr));
	gap: 12px;
}

/* The axes stay stacked, one per line: pairing them shrinks each to about half the
   card, below the ~122px "Choose an option" needs, and only when its text is short. */

/* Pool cards are grid items, and a grid item's default `min-width: auto` refuses
   to shrink below min-content, so a wide card pushes itself past the column. */
.wffn-bundles-mm-pool--grid.wffn-bundles-mm-pool--grid > .wffn-bundles-mm-item {
	min-width: 0;
}

/* An item image wider than its card shrinks to the card and stays square. */
.wffn-bundles-mm-pool--grid.wffn-bundles-mm-pool--grid .wffn-bundles-mm-thumb {
	max-width: 100%;
	height: auto;
	aspect-ratio: 1;
}

.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
	padding: var(--wffn-bundles-pad-t) var(--wffn-bundles-pad-r) var(--wffn-bundles-pad-b) var(--wffn-bundles-pad-l);
	border: var(--wffn-bundles-border-width) var(--wffn-bundles-border-style) var(--wffn-bundles-border);
	border-radius: var(--wffn-bundles-corner);
	background: var(--wffn-bundles-bg);
}

/* Centre the picker's wrapped lines: the card centres the `.wffn-bundles-variant` wrapper,
   but the wrapper is wider than the control, so its wrapped axes park on one edge. */
.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card .wffn-bundles-variant {
	justify-content: center;
}

.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card .wffn-bundles-mm-item-name {
	font-size: calc(var(--wffn-bundles-title-size) - 2px);
	/* No reserved second line: the price's `margin-top: auto` already absorbs the
	   difference out of the card's own slack, and a floor removes that slack. */
}

/* Cards stretch to the tallest in the grid, and where the free space goes is what
   reads as alignment. On the price, it lands where the missing picker would have been. */
.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card .wffn-bundles-mm-item-price {
	margin-top: auto;
}

/* A struck and a final price may share this one element. A variable member's two ranges side by side outgrow the
   card, so they may wrap onto two lines — between the prices, never inside one. */
.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card .wffn-bundles-mm-item-price:has(> .wffn-bundles-mm-item-price-original) {
	white-space: normal;
}

.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card .wffn-bundles-mm-item-price > .wffn-bundles-mm-item-price-original,
.wffn-bundles-mm-item--card.wffn-bundles-mm-item--card .wffn-bundles-mm-item-price > .wffn-bundles-mm-item-price-final {
	white-space: nowrap;
}
