/* Dirigible Variation Swatches — frontend styles.
   Theme per site by overriding the custom properties below in the theme
   stylesheet or Customizer → Additional CSS. */

:root {
	--dvs-size: 36px;        /* swatch size */
	--dvs-radius: 50%;       /* 50% = circle, 6px = rounded square */
	--dvs-gap: 8px;
	--dvs-border: #d5d5d5;
	--dvs-selected: #1a1a1a; /* selected ring color */
	--dvs-label-bg: #fff;
	--dvs-label-color: #1a1a1a;
	--dvs-disabled-line: #b3b3b3; /* the cross-out slash */
}

/* Settings-driven modifiers (overridable per site via the custom props). */
.dvs-wrap.dvs-size-28 { --dvs-size: 28px; }
.dvs-wrap.dvs-size-36 { --dvs-size: 36px; }
.dvs-wrap.dvs-size-44 { --dvs-size: 44px; }
.dvs-wrap.dvs-shape-circle { --dvs-radius: 50%; }
.dvs-wrap.dvs-shape-rounded { --dvs-radius: 6px; }

/* The native select stays in the DOM as the source of truth; hide it visually
   only (screen-reader accessible, no-JS browsers get the plain dropdown). */
.dvs-wrap select {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0 !important;
}

.dvs-swatches {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--dvs-gap);
	padding: 2px 0;
}

.dvs-swatch {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: var(--dvs-size);
	height: var(--dvs-size);
	border: 1px solid var(--dvs-border);
	border-radius: var(--dvs-radius);
	background: var(--dvs-label-bg);
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-user-select: none;
	user-select: none;
}

.dvs-swatch:hover,
.dvs-swatch:focus-visible {
	border-color: var(--dvs-selected);
}

.dvs-swatch.dvs-selected {
	border-color: var(--dvs-selected);
	box-shadow: 0 0 0 1px var(--dvs-selected);
}

/* Color / image swatches */
.dvs-type-color,
.dvs-type-image {
	width: var(--dvs-size);
	padding: 2px;
}

.dvs-chip {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	overflow: hidden;
}

.dvs-chip img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Text pills (button type, or color/image terms with no swatch value set) */
.dvs-type-label {
	padding: 0 0.75em;
}

.dvs-label {
	font-size: 0.85em;
	line-height: 1;
	color: var(--dvs-label-color);
	white-space: nowrap;
}

/* Out-of-stock / unavailable options stay visible, crossed out. */
.dvs-swatch.dvs-disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.dvs-swatch.dvs-disabled::after {
	content: "";
	position: absolute;
	left: -12%;
	right: -12%;
	top: 50%;
	height: 1px;
	background: var(--dvs-disabled-line);
	transform: rotate(-45deg);
	pointer-events: none;
}
