/* Jero swatches: matches the Iconic swatches they replace (14px squares, 4px padding,
   0.5px #666 border on hover/selected, name tooltip). */

.jero-swatches-field { position: relative; }
.jero-swatches-field select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

.jero-swatches {
	display: flex;
	flex-wrap: wrap;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}
.jero-swatches li { margin: 0 3px; padding: 0; list-style: none; }
.jero-swatches li::before { display: none; } /* Divi list bullets */

/* Product page: label above the swatches, as Iconic laid it out (its row and cell were blocks),
   with a colon after the label. !important: WooCommerce/Divi table styles. */
table.variations tr:has(.jero-swatches-field),
table.variations tr:has(.jero-swatches-field) > td { display: block !important; }
table.variations tr:has(.jero-swatches-field) label { display: block; } /* so its 16px margin applies */
table.variations tr:has(.jero-swatches-field) label::after { content: ':'; }

/* Swatches left-aligned (-4px cancels the first swatch's padding) */
.jero-swatches-field .jero-swatches { justify-content: flex-start; transform: translateX(-4px); }
@media (max-width: 980px) {
	.jero-swatches-field .jero-swatches { margin-top: 10px !important; }
}

/* Lists: centred under the SKU */
.jero-swatches--loop { justify-content: center; }

.jero-swatch {
	position: relative;
	display: block;
	margin: 0;
	padding: 4px;
	border: 0;
	background: none;
	line-height: 0;
	cursor: pointer;
}
.jero-swatch::before {
	content: '';
	position: absolute;
	inset: 2px;
	border: 0.5px solid transparent;
	transition: border-color 0.2s;
}
.jero-swatch:hover::before,
.jero-swatch:focus-visible::before,
.jero-swatch.is-selected::before { border-color: #666; }
.jero-swatch:focus-visible { outline: none; }

.jero-swatch__colour {
	display: block;
	width: 14px;
	height: 14px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); /* keeps white swatches visible */
}

/* Name tooltip, above the swatch */
.jero-swatch__label {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	z-index: 10;
	padding: 5px 8px;
	border-radius: 3px;
	background: #333;
	color: #fff;
	font-size: 12px;
	line-height: 1;
	white-space: nowrap;
	pointer-events: none;
	visibility: hidden;
	opacity: 0;
	transform: translateX(-50%);
	transition: opacity 0.15s, visibility 0.15s;
}
.jero-swatch__label::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	border: 4px solid transparent;
	border-top-color: #333;
	transform: translateX(-50%);
}
.jero-swatch:hover .jero-swatch__label,
.jero-swatch:focus-visible .jero-swatch__label { visibility: visible; opacity: 1; }
