/**
 * Case-notes gallery — stage + thumbnail strip.
 *
 * Every value is a design-system token. The reference build inlines raw hex and
 * pixel values on each element; that renders the same and cannot be re-themed.
 *
 * The block is left untouched until the script replaces it, so with JavaScript
 * off nothing here applies and WordPress's own gallery grid stands.
 */

/* Breathing room from the copy above and below (client, 31 Aug 2026).
   Asked for 30/20; taken from the spacing scale instead, on the client's word —
   26.7/20 at 1440, shrinking to 20/16 at 360, so the gap stays proportionate on
   a phone where a fixed 30px would not. Applied to the un-enhanced block too,
   so the no-JavaScript fallback is spaced the same. */
.pgs-gallery,
.brxe-post-content .wp-block-gallery,
.wp-block-post-content .wp-block-gallery {
	margin-top: var(--space-l);
	margin-bottom: var(--space-m);
}

.pgs-gallery {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
	width: 100%;
}

.pgs-gallery__stage {
	overflow: hidden;
	border-radius: var(--radius-sm);
	background-color: var(--color-white);
}

.pgs-gallery__main {
	display: block;
	width: 100%;
	height: 100%;
	/* contain, never cover: these are before/after comparisons and cropping
	   the frame removes part of what is being compared. */
	object-fit: contain;
	transition: opacity 0.2s ease;
}

.pgs-gallery__thumbs {
	display: flex;
	gap: var(--space-2xs);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	/* Keeps the strip from being clipped mid-thumbnail on a narrow screen. */
	scroll-snap-type: x proximity;
}

.pgs-gallery__thumbs > li {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.pgs-gallery__thumb {
	display: block;
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--radius-sm);
	background: none;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.pgs-gallery__thumb img {
	display: block;
	width: 80px;
	height: 60px;
	object-fit: cover;
	border-radius: var(--radius-sm);
}

.pgs-gallery__thumb:hover,
.pgs-gallery__thumb:focus-visible {
	opacity: 1;
}

.pgs-gallery__thumb:focus-visible {
	outline: 2px solid var(--color-cta);
	outline-offset: 2px;
}

.pgs-gallery__thumb.is-current {
	border-color: var(--color-primary);
	opacity: 1;
}
