/**
 * Icon-mode option swatches (Phase 04).
 *
 * Dedicated stylesheet, enqueued only on product pages carrying an attached
 * set with display==='icon' (Product_Options_Frontend::enqueue_option_icon_assets)
 * — NOT bundled into frontend.css, which loads only for variable/tiered
 * products and would leave a simple product's swatches unstyled.
 */

.ppr-product-option--icon {
	border: 0;
	margin: 0;
	padding: 0;
}

.ppr-swatch-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;
}

.ppr-swatch {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	box-sizing: border-box;
	overflow: hidden;
	background: #fff;
	border: 2px solid #ccc;
	border-radius: 4px;
	cursor: pointer;
}

.ppr-swatch__visual {
	display: block;
	width: 100%;
	height: 100%;
}

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

/* Visually hidden but keyboard-focusable and still part of form submission —
   NEVER display:none (that would drop it from the tab order and the POST). */
.ppr-swatch__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.ppr-swatch__input:checked + .ppr-swatch__visual {
	outline: 3px solid #2271b1;
	outline-offset: -3px;
}

.ppr-swatch__input:focus-visible + .ppr-swatch__visual {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

/* Same visually-hidden treatment as the input — screen-reader-only text. */
.ppr-swatch__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.ppr-swatch-selected-label {
	margin-left: 6px;
	font-weight: 600;
}
