/* Attribute Swatches for WooCommerce v2.3 - product slider ([wcas_slider]) */

/* ---------- Tokens (light by default; match the swatch theme settings) ---------- */

.wcas-slider {
	--wcas-accent: #111827;
	--wcas-ink: #1f2933;
	--wcas-muted: #6b7280;
	--wcas-line: #e5e7eb;
	--wcas-surface: #ffffff;
	--wcas-stage: #f3f3f0;
	--wcas-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--wcas-focus: #3b82f6;

	position: relative;
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
	color: var(--wcas-ink);
	font-family: inherit;
	line-height: 1.3;
}

.wcas-slider.wcas-theme-dark {
	--wcas-ink: #f3f4f6;
	--wcas-muted: #9ca3af;
	--wcas-line: #374151;
	--wcas-surface: #1f2937;
	--wcas-stage: #111827;
}

.wcas-slider.wcas-theme-inherit {
	--wcas-ink: currentColor;
	--wcas-muted: color-mix(in srgb, currentColor 60%, transparent);
	--wcas-line: color-mix(in srgb, currentColor 16%, transparent);
	--wcas-surface: transparent;
	--wcas-stage: color-mix(in srgb, currentColor 5%, transparent);
}

/* ---------- Stage and slides ---------- */

.wcas-slider__stage {
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: 20px;
	background: var(--wcas-stage);
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
}

.wcas-ratio-portrait .wcas-slider__stage {
	aspect-ratio: 4 / 5;
}

.wcas-ratio-landscape .wcas-slider__stage {
	aspect-ratio: 4 / 3;
}

.wcas-radius-rounded .wcas-slider__stage {
	border-radius: 12px;
}

.wcas-slider__stage:focus-visible {
	outline: 2px solid var(--wcas-focus);
	outline-offset: 3px;
}

/* One slide sits on top of the others. The active one fades and settles into place. */
.wcas-slide {
	position: absolute;
	inset: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8%;
	opacity: 0;
	visibility: hidden;
	transform: scale(1.02);
	pointer-events: none;
	transition:
		opacity 420ms var(--wcas-ease),
		transform 560ms var(--wcas-ease),
		visibility 0s linear 420ms;
}

.wcas-slide.is-active {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
	pointer-events: auto;
	transition:
		opacity 420ms var(--wcas-ease),
		transform 560ms var(--wcas-ease),
		visibility 0s;
}

.wcas-slide__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Two images stacked, top and bottom, so each one gets half the height. */
.wcas-slide--pair {
	padding: 4%;
}

.wcas-slide__pair {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	gap: 3%;
	width: 100%;
	height: 100%;
}

.wcas-slide--pair .wcas-slide__img {
	flex: 1 1 0;
	width: 100%;
	height: auto;
	min-height: 0;
}

/* ---------- Arrows and counter ---------- */

.wcas-slider__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--wcas-line);
	border-radius: 999px;
	background: var(--wcas-surface);
	color: var(--wcas-ink);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--wcas-ease);
}

.wcas-slider__nav svg {
	width: 18px;
	height: 18px;
}

.wcas-slider__nav:hover {
	border-color: var(--wcas-accent);
	background: var(--wcas-accent);
	color: var(--wcas-surface);
}

.wcas-slider__nav:active {
	transform: translateY(-50%) scale(0.94);
}

.wcas-slider__nav:focus-visible {
	outline: 2px solid var(--wcas-focus);
	outline-offset: 3px;
}

.wcas-slider__prev {
	left: 12px;
}

.wcas-slider__next {
	right: 12px;
}

.wcas-slider__count {
	position: absolute;
	left: 12px;
	bottom: 12px;
	z-index: 2;
	padding: 4px 10px;
	border: 1px solid var(--wcas-line);
	border-radius: 999px;
	background: var(--wcas-surface);
	color: var(--wcas-muted);
	font-size: 12px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* ---------- Thumbnail strip ---------- */

.wcas-slider__thumbs {
	position: relative;
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 2px 2px 6px;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.wcas-slider__thumbs::-webkit-scrollbar {
	display: none;
}

.wcas-thumb {
	flex: 0 0 auto;
	width: 72px;
	height: 72px;
	margin: 0;
	padding: 6px;
	border: 1px solid var(--wcas-line);
	border-radius: 14px !important; /* beats the global pill-shaped button rule in cart-drawer.css */
	background: var(--wcas-stage);
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.wcas-radius-rounded .wcas-thumb {
	border-radius: 9px !important;
}

.wcas-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.wcas-thumb:hover {
	opacity: 1;
}

.wcas-thumb.is-active {
	opacity: 1;
	border-color: var(--wcas-accent);
	box-shadow: 0 0 0 1px var(--wcas-accent);
}

.wcas-thumb:focus-visible {
	opacity: 1;
	outline: 2px solid var(--wcas-focus);
	outline-offset: 2px;
}

/* A pair in the thumbnail strip: both pictures side by side. */
.wcas-thumb--pair {
	display: flex;
	gap: 2px;
	padding: 4px;
}

.wcas-thumb--pair img {
	flex: 1 1 0;
	width: 50%;
	min-width: 0;
	object-fit: cover;
}

/* A pair in the lightbox: both pictures side by side. */
.wcas-lightbox__img--2[hidden] {
	display: none !important;
}

.wcas-lightbox.is-pair .wcas-lightbox__frame {
	flex-direction: column;
	gap: 3%;
}

.wcas-lightbox.is-pair .wcas-lightbox__img {
	max-width: 100%;
	max-height: 46%;
}

/* ---------- Helpers ---------- */

/* Visually hidden, but read by screen readers (the slide live region). */
.wcas-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Set on <html> when the slider is on the page and "Hide the WooCommerce gallery" is on. */
.wcas-slider-on .woocommerce-product-gallery {
	display: none !important;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
	.wcas-slider__stage {
		border-radius: 16px;
	}

	.wcas-slider__nav {
		width: 34px;
		height: 34px;
	}

	.wcas-slider__prev {
		left: 8px;
	}

	.wcas-slider__next {
		right: 8px;
	}

	.wcas-thumb {
		width: 60px;
		height: 60px;
		border-radius: 12px !important;
	}
}

/* ---------- Reduced motion: no movement, instant changes ---------- */

@media (prefers-reduced-motion: reduce) {
	.wcas-slide,
	.wcas-slide.is-active,
	.wcas-slider__nav,
	.wcas-thumb {
		transition: none !important;
	}

	.wcas-slide,
	.wcas-slide.is-active {
		transform: none;
	}
}

/* ---------- Zoom: hover magnifier, zoom button, lightbox (v2.3) ---------- */

.wcas-slider[data-wcas-zoom] .wcas-slider__stage {
	cursor: zoom-in;
}

/* The full-size image, shown over the visible picture and moved with the mouse. */
.wcas-zoomlens {
	position: absolute;
	z-index: 1;
	pointer-events: none;
	overflow: hidden;
	background-color: var(--wcas-stage);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.wcas-zoomlens.is-on {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.15s ease, visibility 0s;
}

.wcas-slider__zoom {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--wcas-line);
	border-radius: 999px;
	background: var(--wcas-surface);
	color: var(--wcas-ink);
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wcas-slider__zoom svg {
	width: 18px;
	height: 18px;
}

.wcas-slider__zoom:hover {
	border-color: var(--wcas-accent);
	background: var(--wcas-accent);
	color: var(--wcas-surface);
}

.wcas-slider__zoom:focus-visible {
	outline: 2px solid var(--wcas-focus);
	outline-offset: 3px;
}

/* Lightbox: lives on <body>, so it uses its own colours. */
.wcas-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(17, 24, 39, 0.92);
	touch-action: pan-y;
}

.wcas-lightbox[hidden] {
	display: none;
}

.wcas-lightbox__frame {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 56px 72px;
	box-sizing: border-box;
}

.wcas-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	background: #fff;
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 0.25s ease, transform 0.3s ease;
}

.wcas-lightbox__img.is-ready {
	opacity: 1;
	transform: scale(1);
}

.wcas-lightbox__btn {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.wcas-lightbox__btn[hidden] {
	display: none;
}

.wcas-lightbox__btn svg {
	width: 20px;
	height: 20px;
}

.wcas-lightbox__btn:hover {
	background: rgba(255, 255, 255, 0.24);
}

.wcas-lightbox__btn:focus-visible {
	outline: 2px solid #93c5fd;
	outline-offset: 3px;
}

.wcas-lightbox__close {
	top: 14px;
	right: 14px;
}

.wcas-lightbox__prev {
	left: 14px;
	top: 50%;
	margin-top: -22px;
}

.wcas-lightbox__next {
	right: 14px;
	top: 50%;
	margin-top: -22px;
}

.wcas-lightbox__count {
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	padding: 4px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.wcas-lightbox__count[hidden] {
	display: none;
}

@media (max-width: 600px) {
	.wcas-slider__zoom {
		top: 8px;
		right: 8px;
		width: 34px;
		height: 34px;
	}

	.wcas-lightbox__frame {
		padding: 64px 12px 56px;
	}

	.wcas-lightbox__prev {
		left: 8px;
	}

	.wcas-lightbox__next {
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcas-zoomlens,
	.wcas-zoomlens.is-on,
	.wcas-lightbox__img,
	.wcas-lightbox__btn,
	.wcas-slider__zoom {
		transition: none !important;
	}
}

/* One image only: no arrows, counter or thumbnail strip. */
.wcas-single .wcas-slider__nav,
.wcas-single .wcas-slider__count,
.wcas-single .wcas-slider__thumbs {
	display: none;
}

/* The magnified picture inside the lens; it is moved and sized by the script. */
.wcas-zoomlens__img {
	position: absolute;
	display: block;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
}
