/* Super Product Gallery — domyślny, samodzielny wygląd (namespace .spg). */
.spg {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

.spg__thumbs {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 0 0 72px;
	max-height: 520px;
	overflow-y: auto;
}

.spg__thumb {
	position: relative;
	width: 72px;
	height: 72px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, .1);
	border-radius: 8px;
	overflow: hidden;
	background: #f5f5f5;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
}

.spg__thumb.is-active {
	border-color: currentColor;
	box-shadow: 0 0 0 1px currentColor;
}

.spg__thumb img,
.spg__thumb video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.spg__play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: rgba(0, 0, 0, .55);
	border-radius: 50%;
	pointer-events: none;
}

.spg__play svg {
	width: 16px;
	height: 16px;
}

.spg__main {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	border-radius: 12px;
	overflow: hidden;
	background: #f5f5f5;
}

.spg__image,
.spg__video {
	display: block;
	width: 100%;
	height: auto;
	max-height: 560px;
	object-fit: contain;
}

.spg--square .spg__main {
	aspect-ratio: 1 / 1;
}

.spg--square .spg__image,
.spg--square .spg__video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (max-width: 600px) {
	.spg {
		flex-direction: column-reverse;
	}

	.spg__thumbs {
		flex-direction: row;
		flex: 0 0 auto;
		max-height: none;
		width: 100%;
		overflow-x: auto;
	}
}

/* --- Wariant mozaika --- */
.spg--mosaic {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.spg__hero {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 0;
	border: 0;
	border-radius: 12px;
	overflow: hidden;
	background: #f5f5f5;
	cursor: zoom-in;
	position: relative;
}

.spg__hero img,
.spg__hero video,
.spg__tile img,
.spg__tile video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.spg__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.spg__tile {
	position: relative;
	aspect-ratio: 1 / 1;
	padding: 0;
	border: 0;
	border-radius: 8px;
	overflow: hidden;
	background: #f5f5f5;
	cursor: zoom-in;
}

.spg__tile img,
.spg__tile video {
	transition: transform .3s ease;
}

.spg__tile:hover img,
.spg__tile:hover video {
	transform: scale(1.04);
}

/* --- Lightbox --- */
.spg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: grid;
	place-items: center;
}

.spg-lightbox[hidden] {
	display: none;
}

.spg-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .82);
}

.spg-lightbox__stage {
	position: relative;
	z-index: 1;
	width: min(92vw, 1100px);
	height: min(88vh, 900px);
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 8px;
}

.spg-lightbox__media {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
}

.spg-lightbox__el {
	max-width: 100%;
	max-height: 88vh;
	border-radius: 8px;
	object-fit: contain;
}

.spg-lightbox__close {
	position: absolute;
	top: -44px;
	right: 0;
	width: 40px;
	height: 40px;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	background: rgba(255, 255, 255, .12);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.spg-lightbox__nav {
	width: 44px;
	height: 44px;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	background: rgba(255, 255, 255, .12);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.spg-lightbox__nav[hidden] {
	visibility: hidden;
}

body.has-spg-lightbox {
	overflow: hidden;
}

@media (max-width: 768px) {
	.spg-lightbox__stage {
		grid-template-columns: 1fr;
	}

	.spg-lightbox__nav {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
	}

	.spg-lightbox__nav--prev {
		left: 4px;
	}

	.spg-lightbox__nav--next {
		right: 4px;
	}
}
