.llq-gallery-viewer {
	--llq-gallery-rail-size: clamp(48px, 5.8vw, 76px);
	min-width: 0;
}

.llq-gallery-viewer [hidden] {
	display: none !important;
}

.llq-gallery-viewer .llq-gallery-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: start;
	gap: 12px;
}

.llq-gallery-viewer .llq-gallery-layout--rail {
	grid-template-columns: var(--llq-gallery-rail-size) minmax(0, 1fr);
}

.llq-gallery-viewer .llq-gallery-stage {
	box-sizing: border-box;
	grid-column: -2;
	grid-row: 1;
	min-width: 0;
	aspect-ratio: var(--llq-gallery-ratio, 4 / 5);
	padding: min(var(--llq-gallery-padding, 12px), 12%);
}

.llq-gallery-viewer .llq-gallery-stage img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.llq-gallery-viewer .llq-gallery-rail {
	display: flex;
	grid-column: 1;
	grid-row: 1;
	flex-direction: column;
	gap: 8px;
	max-height: 360px;
	margin: 0;
	padding: 4px;
	overflow: auto;
	list-style: none;
}

.llq-gallery-viewer .llq-gallery-rail > li {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
}

.llq-gallery-viewer .llq-gallery-rail button,
.llq-gallery-viewer .llq-gallery-rail a {
	box-sizing: border-box;
	display: grid;
	width: 100%;
	min-height: 44px;
	padding: 3px;
	place-items: center;
	aspect-ratio: 1;
	border: 1px solid #757575;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.llq-gallery-viewer .llq-gallery-rail img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 0;
	object-fit: contain;
}

.llq-gallery-viewer .llq-gallery-colors {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-block-start: 12px;
}

.llq-gallery-viewer .llq-gallery-colors button {
	display: inline-flex;
	min-height: 44px;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	border: 1px solid #757575;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	overflow-wrap: anywhere;
	cursor: pointer;
}

.llq-gallery-viewer .llq-gallery-swatch {
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
	border: 1px solid #757575;
	border-radius: 50%;
}

.llq-gallery-viewer button[aria-pressed="true"] {
	outline: 2px solid currentColor;
	outline-offset: -3px;
	font-weight: 700;
}

.llq-gallery-viewer :is(button, a):focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

@media (max-width: 767px) {
	.llq-gallery-viewer .llq-gallery-layout {
		display: block;
	}

	.llq-gallery-viewer .llq-gallery-rail {
		flex-direction: row;
		max-width: 100%;
		margin-block-start: 8px;
	}

	.llq-gallery-viewer .llq-gallery-rail > li {
		flex-basis: var(--llq-gallery-rail-size);
	}
}
