:root {
	--wcvis-size: 64px;
	--wcvis-radius: 50%;
}

.wcvis-swatches {
	margin: 4px 0 10px;
}

/* Keep the real <select> in the DOM (WooCommerce's own JS drives variation
   matching off it) but hide it visually while staying screen-reader friendly. */
.wcvis-select.screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.wcvis-swatch-list {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wcvis-swatch {
	width: var(--wcvis-size);
	cursor: pointer;
	outline: none;
}

.wcvis-swatch-img {
	position: relative;
	display: block;
	width: var(--wcvis-size);
	height: var(--wcvis-size);
	border-radius: var(--wcvis-radius);
	background-color: #f2f2f2;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
	transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.wcvis-swatch:hover .wcvis-swatch-img {
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
	transform: translateY(-1px);
}

.wcvis-swatch.wcvis-selected .wcvis-swatch-img,
.wcvis-swatch:focus-visible .wcvis-swatch-img {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #222;
}

/* Out of stock: cross the swatch out but keep it fully clickable/selectable. */
.wcvis-swatch.wcvis-out-of-stock .wcvis-swatch-img {
	opacity: 0.55;
}

.wcvis-swatch.wcvis-out-of-stock .wcvis-swatch-img::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--wcvis-radius);
	background: linear-gradient(
		to top right,
		transparent 0%,
		transparent 46%,
		#e33 47%,
		#e33 53%,
		transparent 54%,
		transparent 100%
	);
	pointer-events: none;
}

.wcvis-swatch.wcvis-out-of-stock:hover .wcvis-swatch-img {
	transform: none;
}
