/**
 * WooCommerce Safe Image Swatches — frontend
 * Namespaced .wcivsw-* selectors only.
 */

/* Hide WooCommerce's native "Clear" (reset variations) link. The swatch UI
   makes it unnecessary, and it was showing up in an unwanted position. */
body.wcivsw-enabled a.reset_variations,
body.wcivsw-enabled .reset_variations {
	display: none !important;
}

body.wcivsw-enabled form.cart table.variations,
body.wcivsw-enabled table.variations {
	table-layout: fixed;
	width: 100%;
	max-width: 100%;
}

body.wcivsw-enabled table.variations td,
body.wcivsw-enabled table.variations th {
	overflow: hidden;
	max-width: 100%;
}

.wcivsw-attr {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

body.wcivsw-hide-native .wcivsw-attr .wcivsw-native {
	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;
}

body.wcivsw-enabled .variations tr.wcivsw-row > .label {
	display: none;
}

body.wcivsw-enabled .variations tr.wcivsw-row > .value {
	width: 100%;
	display: block;
	max-width: 100%;
	overflow: hidden;
}

.wcivsw-heading {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
	line-height: 1.4;
	color: #212121;
}

.wcivsw-heading__label {
	font-weight: 700;
}

.wcivsw-heading__value {
	font-weight: 400;
}

.wcivsw-heading--button {
	margin-top: 0.85rem;
}

.wcivsw-slider {
	position: relative;
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.wcivsw-slider--swatches .wcivsw-swatches--image {
	width: 100%;
	min-width: 0;
}

.wcivsw-slider__btn {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
	color: #212121;
	font-size: 20px;
	line-height: 32px;
	text-align: center;
	cursor: pointer;
	transform: translateY(-50%);
}

.wcivsw-slider__btn--prev {
	left: 6px;
}

.wcivsw-slider__btn--next {
	right: 6px;
}

.wcivsw-slider__btn[hidden] {
	display: none !important;
}

.wcivsw-swatches {
	display: flex;
	gap: 8px;
	margin: 0 0 0.35rem;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.wcivsw-swatches--image {
	flex-wrap: nowrap;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 4px 40px 8px 2px;
}

.wcivsw-swatches--image::-webkit-scrollbar {
	display: none;
}

.wcivsw-swatches--button {
	flex-wrap: wrap;
}

.wcivsw-swatch {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 1px solid #e0e0e0;
	background: #fff;
	color: #212121;
	cursor: pointer;
	font: inherit;
	line-height: 1.2;
	appearance: none;
	-webkit-appearance: none;
}

.wcivsw-swatch:focus-visible {
	outline: 2px solid #111;
	outline-offset: 2px;
}

.wcivsw-swatch--image {
	position: relative;
	flex: 0 0 auto;
	width: 64px;
	height: 84px;
	padding: 0;
	overflow: hidden;
	border-radius: 6px;
}

.wcivsw-swatch__media {
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #f5f5f5;
}

.wcivsw-swatch__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wcivsw-swatch__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-weight: 600;
	text-transform: uppercase;
}

.wcivsw-swatch__label--sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.wcivsw-swatch--button {
	min-width: 2.75rem;
	min-height: 2.5rem;
	padding: 0.4rem 0.85rem;
	border-radius: 4px;
}

.wcivsw-swatch--button .wcivsw-swatch__label {
	font-size: 0.9rem;
	font-weight: 500;
}

.wcivsw-swatch--image.wcivsw-swatch--selected,
.wcivsw-swatch--button.wcivsw-swatch--selected {
	border: 2px solid #111;
}

.wcivsw-swatch--outofstock {
	opacity: 0.72;
	position: relative;
}

.wcivsw-swatch--outofstock::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom right,
		transparent calc(50% - 1px),
		#c00 50%,
		transparent calc(50% + 1px)
	);
	pointer-events: none;
}

.wcivsw-swatch--unavailable,
.wcivsw-swatch--disabled {
	opacity: 0.38;
	cursor: not-allowed;
}

.wcivsw-swatch--unavailable .wcivsw-swatch__label,
.wcivsw-swatch--disabled .wcivsw-swatch__label {
	text-decoration: line-through;
}

/* ---------------------------------------------------------------------
 * Self-contained image slider (main image + thumbnails), fully replacing
 * WooCommerce's/the theme's own gallery markup inside
 * ".woocommerce-product-gallery". See buildSliderWidget() in frontend.js.
 * ------------------------------------------------------------------- */

.wcivsw-slider {
	position: relative;
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.wcivsw-slider__viewport {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 4px;
	background: #f6f6f6;
}

.wcivsw-slider__track {
	display: flex;
	flex-wrap: nowrap;
	width: 100%;
	transition: transform 0.3s ease;
	will-change: transform;
}

.wcivsw-slider__slide {
	flex: 0 0 100%;
	max-width: 100%;
	line-height: 0;
}

.wcivsw-slider__img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: contain;
}

.wcivsw-slider__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.22);
	color: #212121;
	font-size: 22px;
	line-height: 36px;
	text-align: center;
	cursor: pointer;
	transform: translateY(-50%);
}

.wcivsw-slider__nav--prev {
	left: 10px;
}

.wcivsw-slider__nav--next {
	right: 10px;
}

.wcivsw-slider__counter {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 3;
	padding: 2px 8px;
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 12px;
	line-height: 1.6;
	pointer-events: none;
}

/* ---------------------------------------------------------------------
 * Mobile-only product summary reorder.
 *
 * Requested order on mobile: Images, Color, Size, Custom message,
 * Product title, Price. Desktop is completely untouched (everything below
 * is scoped inside the max-width media query).
 *
 * This uses CSS "order" (flexbox) rather than moving anything in the
 * actual HTML, so the variation <select> elements never leave
 * "form.cart" - Add to Cart keeps working exactly as before, only the
 * *visual* position of each piece changes on narrow screens. "display:
 * contents" is used on the form/table/row wrappers so their contents can
 * take part in that same ordering without changing what a screen reader
 * or the add-to-cart submission sees.
 *
 * Adjust the 768px breakpoint below if your theme's mobile breakpoint is
 * different. The custom delivery/notice message is matched by a
 * ".wcivsw-mobile-message" class that frontend.js adds automatically by
 * looking for that text - if it doesn't move, tell us its real class and
 * we'll target it directly instead of relying on that heuristic.
 * ------------------------------------------------------------------- */
@media (max-width: 768px) {
	.single-product div.summary.entry-summary {
		display: flex;
		flex-direction: column;
	}

	.single-product div.summary.entry-summary form.variations_form.cart {
		display: contents;
	}

	.single-product div.summary.entry-summary form.variations_form.cart table.variations,
	.single-product div.summary.entry-summary form.variations_form.cart table.variations tbody {
		display: contents;
	}

	.single-product div.summary.entry-summary form.variations_form.cart table.variations tr {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		width: 100%;
	}

	.single-product div.summary.entry-summary > .product_title {
		order: 5;
	}

	.single-product div.summary.entry-summary > .woocommerce-product-rating {
		order: 5;
	}

	.single-product div.summary.entry-summary > p.price,
	.single-product div.summary.entry-summary > .price {
		order: 6;
	}

	.single-product div.summary.entry-summary > .wcivsw-mobile-message {
		order: 4;
	}

	/* Color row (this plugin renders the color-type attribute with the
	   "wcivsw-attr--image" class). */
	.single-product div.summary.entry-summary form.variations_form.cart table.variations tr:has(.wcivsw-attr--image) {
		order: 2;
	}

	/* Size row (button-type attribute). */
	.single-product div.summary.entry-summary form.variations_form.cart table.variations tr:has(.wcivsw-attr--button) {
		order: 3;
	}

	/* Everything else belonging to the form (single-variation
	   description/price, quantity, Add to Cart button) stays together
	   right after Size. */
	.single-product div.summary.entry-summary form.variations_form.cart .woocommerce-variation,
	.single-product div.summary.entry-summary form.variations_form.cart .variations_button,
	.single-product div.summary.entry-summary form.variations_form.cart .reset_variations {
		order: 3;
		width: 100%;
	}
}
