/**
 * Sterling Product Gallery.
 *
 * A stacked set of product shots cross-faded in one frame, with edge arrows,
 * a "View Full Image" link and a scrolling thumbnail strip.
 */

.sterling-gallery {
	--sterling-gallery-ratio: 4 / 3;
	--sterling-gallery-arrow: #b6b6b6;
	--sterling-gallery-arrow-hover: var(--sterling-gold, #bd9b51);

	max-width: 100%;
}

/* Stage: the frame with an arrow on either side
   ------------------------------------------------------------------------ */

.sterling-gallery__stage {
	position: relative;
}

.sterling-gallery__frame {
	position: relative;
	aspect-ratio: var(--sterling-gallery-ratio);
	overflow: hidden;
	background-color: #fff;
}

.sterling-gallery__slide {
	position: absolute;
	inset: 0;
	display: block;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
}

.sterling-gallery__slide.is-active {
	opacity: 1;
	visibility: visible;
}

/* Elementor's own `.elementor img { height: auto }` outranks a single class,
   so the fitting rules are scoped one level deeper to win on specificity. */
.sterling-gallery .sterling-gallery__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Arrows
   ------------------------------------------------------------------------ */

.sterling-gallery__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem 0.5rem;
	border: 0;
	background: none;
	color: var(--sterling-gallery-arrow);
	cursor: pointer;
	transform: translateY(-50%);
	transition: color 0.2s ease;
}

.sterling-gallery__arrow svg {
	width: 18px;
	height: 30px;
	fill: currentColor;
}

.sterling-gallery__arrow--prev {
	left: 0.25rem;
}

.sterling-gallery__arrow--next {
	right: 0.25rem;
}

.sterling-gallery__arrow:hover,
.sterling-gallery__arrow:focus-visible {
	color: var(--sterling-gallery-arrow-hover);
}

/* "View Full Image"
   ------------------------------------------------------------------------ */

.sterling-gallery__full {
	margin: 1rem 0 0;
	text-align: center;
}

.sterling-gallery__full-link {
	font-family: var(--sterling-display, sans-serif);
	font-size: clamp(1.125rem, 1.6vw, 1.5rem);
	font-weight: 700;
	line-height: 1.2;
	color: var(--sterling-ink, #231f20);
	text-transform: uppercase;
	letter-spacing: 0.02em;
	text-decoration: none;
	border-bottom: 2px solid transparent;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.sterling-gallery__full-link:hover,
.sterling-gallery__full-link:focus-visible {
	color: var(--sterling-gold, #bd9b51);
	border-bottom-color: var(--sterling-gold, #bd9b51);
}

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

.sterling-gallery__thumbs {
	display: flex;
	gap: 0.75rem;
	margin-top: 1.25rem;
	padding-bottom: 0.75rem;
	overflow-x: auto;
	scrollbar-width: thin;
	scroll-behavior: smooth;
}

.sterling-gallery__thumb {
	position: relative;
	flex: 0 0 auto;
	width: 140px;
	max-width: 30vw;
	padding: 0;
	border: 2px solid transparent;
	background-color: #fff;
	cursor: pointer;
	transition: border-color 0.2s ease, opacity 0.2s ease;
}

.sterling-gallery .sterling-gallery__thumb-image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--sterling-gallery-ratio);
	object-fit: contain;
}

.sterling-gallery__thumb:hover,
.sterling-gallery__thumb:focus-visible {
	border-color: var(--sterling-gray, #7f7f7f);
}

.sterling-gallery__thumb.is-active {
	border-color: var(--sterling-gold, #bd9b51);
}

/* Editor hint when no photos have been picked yet. */
.sterling-gallery__empty {
	margin: 0;
	padding: 2rem;
	border: 1px dashed var(--sterling-gray, #7f7f7f);
	color: var(--sterling-gray, #7f7f7f);
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.sterling-gallery__slide {
		transition: none;
	}

	.sterling-gallery__thumbs {
		scroll-behavior: auto;
	}
}

@media (max-width: 767px) {
	.sterling-gallery__thumb {
		width: 100px;
	}
}
