/*
 * Product gallery: thumbnails under the hero shot, plus the enlarged preview.
 *
 * main.css / pages.css stay byte-identical to the static build. main.css
 * already styles .product-gallery__thumbs and .gallery-thumb; this file adds the
 * zoom affordance and the lightbox that the static build does not ship.
 */

/* The hero image becomes a button, so neutralise the button chrome. */
.product-gallery__zoom {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
	line-height: 0;
}

.product-gallery__zoom img {
	width: 100%;
	height: auto;
}

/* A hint that the image can be opened, without a permanent overlay. */
.product-gallery__zoom::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: rgba(0, 0, 0, 0);
	transition: background 0.2s ease;
}

.product-gallery__main {
	position: relative;
}

.product-gallery__zoom:hover::after {
	background: rgba(0, 0, 0, 0.12);
}

.product-gallery__zoom:focus-visible {
	outline: 2px solid var(--c-gold);
	outline-offset: 2px;
}

/* Thumbnail strip. */
.product-gallery__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}

.gallery-thumb {
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: #fff;
	cursor: pointer;
	line-height: 0;
	transition: border-color 0.15s ease;
}

.gallery-thumb img {
	display: block;
	width: 120px;
	height: 80px;
	object-fit: contain;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
	border-color: var(--c-ink);
}

.gallery-thumb.is-active {
	border-color: var(--c-ink);
	box-shadow: 0 0 0 1px var(--c-ink);
}

/* --- enlarged preview ---------------------------------------------------- */

.gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	background: rgba(12, 14, 15, 0.92);
	overflow: auto;
}

.gallery-lightbox[hidden] {
	display: none;
}

.gallery-lightbox__figure {
	margin: 0;
	max-width: 1100px;
	width: 100%;
	text-align: center;
}

.gallery-lightbox__figure img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 82vh;
	object-fit: contain;
	background: #fff;
}

.gallery-lightbox__caption {
	margin-top: 14px;
	font-size: var(--fs-micro, 12px);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.72);
}

.gallery-lightbox__close {
	position: absolute;
	top: 18px;
	right: 24px;
	width: 44px;
	height: 44px;
	padding: 0;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	background: none;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	cursor: pointer;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible {
	color: var(--c-gold);
	border-color: var(--c-gold);
}

@media (max-width: 640px) {
	.gallery-lightbox {
		padding: 16px;
	}

	.gallery-thumb img {
		width: 88px;
		height: 60px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.product-gallery__zoom::after,
	.gallery-thumb {
		transition: none;
	}
}
/*
 * Finish swatch chips on the product detail page.
 *
 * The chip shows the finish photo instead of a flat colour. pages.css sizes the
 * chip at 30px, which is too small to recognise a handle, and it leaves the
 * swatch looking like an identical grey square when no colour is stored.
 * Sized to 40px so the finish photo is recognisable without crowding the list.
 */
.swatch-finishes .swatch-chip {
	width: 40px;
	height: 40px;
	border: 1px solid rgba(0, 0, 0, .12);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	grid-row: auto;
}

.swatch-finishes .swatch-btn.is-active .swatch-chip {
	border-color: var(--c-ink);
	box-shadow: 0 0 0 1px var(--c-ink);
}

@media (max-width: 640px) {
	.swatch-finishes .swatch-chip {
		width: 34px;
		height: 34px;
	}
}
