/* ==========================================================
   Woo Simple Gallery – Thumbnail Strip Style
   Loaded only when [woo_simple_gallery_thumbs] is used
   ≥ 440px : 4 thumbnails, 4th fades under the arrow
   < 440px : 3 thumbnails + arrow in its own white gutter
   ========================================================== */

.wsgt-gallery-wrapper {
	--wsgt-gap: 8px;
	--wsgt-radius: 12px;
	--wsgt-thumb-radius: 8px;
	--wsgt-border: #D9D9D9;
	--wsgt-border-active: #333;
	--wsgt-bg: #fff;
	--wsgt-fade-w: 56px;

	max-width: 100%;
	margin-bottom: 15px;
	position: relative;
}

/* ── Main image ──────────────────────────────────────────── */
.wsgt-main-image-stage {
	position: relative;
	border-radius: var(--wsgt-radius);
	overflow: hidden;
	background: var(--wsgt-bg);
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: pan-y pinch-zoom;
	user-select: none;
}
.wsgt-main-image-stage img.wsgt-active-image {
	width: 100%;
	max-width: 100%;
	height: auto;
	display: block;
	transition: opacity 0.2s ease-in-out;
}

/* ── Thumbnail strip ─────────────────────────────────────── */
.wsgt-thumb-strip {
	position: relative;
}

.wsgt-thumb-track {
	position: relative;
	display: flex;
	flex-wrap: nowrap;
	gap: var(--wsgt-gap);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.wsgt-thumb-track::-webkit-scrollbar { display: none; }

/* 4 thumbnails fill the width; the 4th sits under the fade + arrow */
.wsgt-thumb-item {
	flex: 0 0 calc((100% - 3 * var(--wsgt-gap)) / 4);
	aspect-ratio: 1 / 1;
	scroll-snap-align: start;
	padding: 0;
	margin: 0;
	background: var(--wsgt-bg);
	border: 1px solid var(--wsgt-border);
	border-radius: var(--wsgt-thumb-radius);
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}
.wsgt-thumb-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.wsgt-thumb-item:hover,
.wsgt-thumb-item.wsgt-thumb-active {
	border-color: var(--wsgt-border-active);
}
.wsgt-thumb-item:focus-visible {
	outline: 2px solid var(--wsgt-border-active);
	outline-offset: 1px;
}

/* ── Fade + arrow overlays ───────────────────────────────── */
.wsgt-fade {
	position: absolute;
	top: 0;
	bottom: 0;
	width: var(--wsgt-fade-w);
	display: flex;
	align-items: center;
	z-index: 3;
	pointer-events: none;
	transition: opacity 0.2s ease;
}
.wsgt-fade-next {
	right: 0;
	justify-content: flex-end;
	background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, var(--wsgt-bg) 70%);
}
.wsgt-fade-prev {
	left: 0;
	justify-content: flex-start;
	background: linear-gradient(to left, rgba(255, 255, 255, 0) 0%, var(--wsgt-bg) 70%);
}
.wsgt-fade.wsgt-hidden {
	opacity: 0;
}
.wsgt-fade.wsgt-hidden .wsgt-arrow {
	pointer-events: none;
}

.wsgt-arrow {
	pointer-events: auto;
	background: transparent;
	border: 0;
	padding: 6px 2px;
	margin: 0;
	cursor: pointer;
	color: #000;
	line-height: 0;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}
.wsgt-arrow svg {
	width: 9px;
	height: 15px;
	display: block;
}
/* Same chevron, mirrored for the left arrow */
.wsgt-arrow-prev svg {
	transform: scaleX(-1);
}
.wsgt-arrow:hover,
.wsgt-arrow:focus {
	background: transparent;
	color: #000;
}

/* ── < 440px: 3 thumbnails + dedicated arrow gutter ──────── */
@media (max-width: 439.98px) {
	.wsgt-gallery-wrapper {
		--wsgt-gap: 7px;
		--wsgt-fade-w: 34px;
	}
	.wsgt-thumb-item {
		flex-basis: calc((100% - 2 * var(--wsgt-gap) - var(--wsgt-fade-w)) / 3);
	}
	/* Solid white gutter so the peeking 4th thumb is fully hidden */
	.wsgt-fade-next {
		background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, var(--wsgt-bg) 25%);
	}
	.wsgt-fade-prev {
		background: linear-gradient(to left, rgba(255, 255, 255, 0) 0%, var(--wsgt-bg) 25%);
	}
}

/* ── Loading spinner ─────────────────────────────────────── */
.wsgt-gallery-wrapper.wsgt-is-loading::after {
	content: '';
	position: absolute;
	top: 35%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #3498db;
	border-radius: 50%;
	animation: wsgt-spin 1s linear infinite;
	z-index: 10;
}
.wsgt-gallery-wrapper.wsgt-is-loading .wsgt-main-image-stage,
.wsgt-gallery-wrapper.wsgt-is-loading .wsgt-thumb-strip {
	opacity: 0.4;
	pointer-events: none;
}
@keyframes wsgt-spin {
	0%   { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}