/* TBS Device Gallery. Colors and spacing come from the theme's presets. */
.tbs-device-gallery {
	--tbs-gallery-gap: var(--wp--preset--spacing--20, 0.75rem);
	--tbs-gallery-accent: var(--wp--preset--color--contrast, currentColor);
	display: grid;
	gap: var(--tbs-gallery-gap);
	min-width: 0;
}

.tbs-device-gallery__main {
	margin: 0;
	aspect-ratio: var(--tbs-gallery-aspect, 4 / 3);
	overflow: hidden;
}

.tbs-device-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: opacity 0.2s ease;
}

.tbs-device-gallery__image.is-loading {
	opacity: 0.35;
}

.tbs-device-gallery__thumbs {
	list-style: none;
	margin: 0;
	padding: 3px; /* keeps focus/selected rings from being clipped */
	display: flex;
	gap: var(--tbs-gallery-gap);
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
}

.tbs-device-gallery__thumbs > li {
	flex: 0 0 clamp(3.5rem, 18%, 5.5rem);
	margin: 0;
	scroll-snap-align: start;
}

.tbs-device-gallery__thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

.tbs-device-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tbs-device-gallery__thumb:hover {
	opacity: 0.85;
}

.tbs-device-gallery__thumb[aria-pressed="true"] {
	opacity: 1;
	box-shadow: 0 0 0 2px var(--tbs-gallery-accent);
}

.tbs-device-gallery__thumb:focus-visible {
	outline: 2px solid var(--tbs-gallery-accent);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.tbs-device-gallery__image,
	.tbs-device-gallery__thumb {
		transition: none;
	}
}
