/*!
 * Storzen — Variation Swatches
 * Static CSS. User-tunable values (size, spacing, color, radius) come from
 * inline custom properties printed by the PHP module.
 */

/* ── Hide the original <select> while keeping it in the DOM for WC ─────── */
.storzen-swatch-shadow-select{
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip: rect(1px,1px,1px,1px) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
	padding: 0 !important;
	margin: -1px !important;
}

/* ── Swatch group container ───────────────────────────────────────────── */
.storzen-swatches{
	display: flex;
	flex-wrap: wrap;
	gap: var(--storzen-swatch-spacing, 6px);
	align-items: center;
	margin: 2px 0;
}

/* ── Selected-value label next to swatches ────────────────────────────── */
.storzen-swatch-selected-label{
	font-size: .92em;
	color: #4b5563;
	margin-inline-start: 8px;
}
.storzen-swatch-selected-label::before{
	content: attr(data-label-prefix);
}

/* ── Individual swatch — base ─────────────────────────────────────────── */
.storzen-swatch{
	--sz-size: var(--storzen-swatch-size, 28px);
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--sz-size);
	height: var(--sz-size);
	padding: 0;
	border: 2px solid #e5e7eb;
	border-radius: var(--storzen-swatch-radius, 6px);
	background: #fff;
	cursor: pointer;
	transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
	box-sizing: border-box;
	user-select: none;
	overflow: hidden;
}
.storzen-swatch:hover{
	border-color: var(--storzen-swatch-accent, #FF3636);
	transform: translateY(-1px);
}
.storzen-swatch:focus-visible{
	outline: 2px solid var(--storzen-swatch-accent, #FF3636);
	outline-offset: 2px;
}

/* Selected state */
.storzen-swatch.is-selected{
	border-color: var(--storzen-swatch-accent, #FF3636);
	box-shadow: 0 0 0 2px rgba(124,58,237,.18);
}

/* ── Color swatch ─────────────────────────────────────────────────────── */
.storzen-swatch--color{
	padding: 3px;
}
.storzen-swatch__color{
	display: block;
	width: 100%;
	height: 100%;
	border-radius: calc( var(--storzen-swatch-radius, 6px) - 2px );
	background: currentColor;
}

/* ── Image swatch ─────────────────────────────────────────────────────── */
.storzen-swatch--image{
	padding: 0;
}
.storzen-swatch__img{
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: calc( var(--storzen-swatch-radius, 6px) - 2px );
}

/* ── Button / label swatch ────────────────────────────────────────────── */
.storzen-swatch--button{
	min-width: auto;
	padding: 0 12px;
	height: auto;
	min-height: var(--sz-size);
	font-size: 13px;
	font-weight: 500;
	color: #1f2937;
	white-space: nowrap;
}
.storzen-swatch--button.is-selected{
	background: var(--storzen-swatch-accent, #FF3636);
	color: #fff;
}
.storzen-swatch__label{
	display: inline-block;
	line-height: var(--sz-size);
}

/* ── SVG swatch (Pro) ─────────────────────────────────────────────────── */
.storzen-swatch--svg svg{
	width: 70%;
	height: 70%;
}

/* ── Out-of-stock states ──────────────────────────────────────────────── */
.storzen-swatch.is-out-of-stock{
	cursor: not-allowed;
}

/* Crossed: diagonal strike-through */
.storzen-swatch.is-oos-crossed::after{
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top right,
		transparent 0%,
		transparent calc(50% - 1.5px),
		#9ca3af calc(50% - 1px),
		#9ca3af calc(50% + 1px),
		transparent calc(50% + 1.5px),
		transparent 100%
	);
	pointer-events: none;
}

/* Faded: 40% opacity */
.storzen-swatch.is-oos-faded{
	opacity: .4;
}

/* Hide completely */
.storzen-swatch.is-oos-hide{
	display: none;
}

/* ── Tooltip ──────────────────────────────────────────────────────────── */
.storzen-swatch[data-tooltip]::before{
	content: attr(data-tooltip);
	position: absolute;
	z-index: 50;
	left: 50%;
	transform: translateX(-50%) translateY(-4px);
	padding: 4px 8px;
	background: #111827;
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	white-space: nowrap;
	border-radius: 4px;
	pointer-events: none;
	opacity: 0;
	transition: opacity .15s ease, transform .15s ease;
}
.storzen-swatch[data-tooltip][data-pos="top"]::before,
.storzen-swatch[data-tooltip]:not([data-pos])::before{
	bottom: 100%;
	margin-bottom: 4px;
}
.storzen-swatch[data-tooltip][data-pos="bottom"]::before{
	top: 100%;
	margin-top: 4px;
	transform: translateX(-50%) translateY(4px);
}
.storzen-swatch[data-tooltip]:hover::before,
.storzen-swatch[data-tooltip]:focus-visible::before{
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ── Shop-loop card swatches (compact) ───────────────────────────────── */
.storzen-swatches-shop{
	margin: 6px 0 4px;
}
.storzen-swatches-shop .storzen-swatch{
	--sz-size: 22px;
}
.storzen-swatches-shop .storzen-swatches{
	gap: 4px;
}
.storzen-swatches-shop .storzen-swatch-selected-label{
	display: none;
}

/* ── Variation-change animations (Pro) ────────────────────────────────── */
.storzen-anim-fade [data-product_variations],
.storzen-anim-fade .price{
	transition: opacity .25s ease;
}
.storzen-anim-fade.is-changing .price{
	opacity: 0;
}
.storzen-anim-slide .price{
	transition: transform .25s ease, opacity .25s ease;
}
.storzen-anim-slide.is-changing .price{
	opacity: 0;
	transform: translateY(6px);
}
.storzen-anim-zoom .price{
	transition: transform .25s ease, opacity .25s ease;
}
.storzen-anim-zoom.is-changing .price{
	opacity: 0;
	transform: scale(.95);
}
