/*
 * Lightbox galerii produktu (qsuli-product-lightbox): PhotoSwipe 4 z WooCommerce, skórka domyślna + nasze kolory.
 * Klasy pswp__* to udokumentowane znaczniki PhotoSwipe 4 w naszym własnym kontenerze .qs-lb (qsuli-product-lightbox.php).
 * Kolory z palety Kadence: tło i pod zdjęciem palette8 (kolor tła zdjęć produktu), przyciski palette1.
 */
.qs-lb.pswp {
	z-index: 100001;
}

.qs-lb .pswp__bg {
	background: var(--global-palette8);
}

.qs-lb .pswp__img {
	background: var(--global-palette8);
}

.qs-lb .pswp__top-bar,
.qs-lb .pswp__ui--fit .pswp__top-bar {
	height: 64px;
	padding: 10px 16px;
	align-items: center;
	background: none;
}

.qs-lb .pswp__counter {
	height: auto;
	padding: 0 4px;
	font-size: 15px;
	font-weight: 600;
	line-height: 44px;
	color: var(--global-palette1);
	opacity: 1;
}

.qs-lb__btn {
	position: absolute;
	z-index: 1560;
	display: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--global-palette1);
	color: var(--global-palette9);
	cursor: pointer;
}

.qs-lb.pswp--open .qs-lb__btn {
	display: flex;
}

.qs-lb__btn svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.qs-lb__btn:hover,
.qs-lb__btn:focus-visible {
	background: var(--global-palette2);
}

.qs-lb__close {
	top: 8px;
	right: 16px;
}

.qs-lb__prev,
.qs-lb__next {
	top: calc(50% - 48px);
}

.qs-lb__prev {
	left: 16px;
}

.qs-lb__next {
	right: 16px;
}

.qs-lb.qs-lb--single .qs-lb__prev,
.qs-lb.qs-lb--single .qs-lb__next {
	display: none;
}

@media (hover: none) {
	.qs-lb.pswp--open .qs-lb__prev,
	.qs-lb.pswp--open .qs-lb__next {
		display: none;
	}
}

.qs-lb__thumbs {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1560;
	display: flex;
	gap: 8px;
	justify-content: safe center;
	padding: 12px 16px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	touch-action: pan-x;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.qs-lb__thumbs::-webkit-scrollbar {
	display: none;
}

.qs-lb__thumbs[hidden] {
	display: none;
}

.qs-lb__thumb {
	position: relative;
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	padding: 0;
	overflow: hidden;
	border: 2px solid var(--global-palette7);
	border-radius: 6px;
	background: var(--global-palette8);
	cursor: pointer;
	opacity: 0.7;
}

.qs-lb__thumb:hover,
.qs-lb__thumb:focus-visible,
.qs-lb__thumb.is-current {
	opacity: 1;
}

.qs-lb__thumb.is-current {
	border-color: var(--global-palette1);
}

.qs-lb__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.qs-lb__thumb--video::after {
	content: "\25B6";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	color: var(--global-palette9);
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.qs-lb__html {
	position: absolute;
	inset: 64px 16px 112px;
	display: flex;
	align-items: center;
	justify-content: center;
	container-type: size;
	pointer-events: none;
}

/* Ramka w proporcjach filmu (--qs-lb-ratio = szerokość / wysokość z lightbox.js), wpisana w wolne miejsce. */
.qs-lb__video {
	width: min(100cqw, 100cqh * var(--qs-lb-ratio, 0.5625));
	aspect-ratio: var(--qs-lb-ratio, 0.5625);
	overflow: hidden;
	background: var(--global-palette8);
	pointer-events: auto;
	cursor: grab;
}

.qs-lb__video iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	pointer-events: none;
}

.qs-lb-trigger .kadence-product-gallery-main .splide__slide img {
	cursor: zoom-in;
}

@media (max-width: 767px) {
	.qs-lb .pswp__top-bar,
	.qs-lb .pswp__ui--fit .pswp__top-bar {
		height: 56px;
		padding: 6px 12px;
	}

	.qs-lb .pswp__top-bar,
	.qs-lb .pswp__ui--fit .pswp__top-bar {
		padding-right: 64px;
	}

	.qs-lb .pswp__counter {
		margin-inline-start: auto;
		margin-inline-end: 0;
	}

	.qs-lb__close {
		top: 6px;
		right: 12px;
		width: 44px;
		height: 44px;
	}

	.qs-lb__thumbs {
		justify-content: flex-start;
		padding: 8px 12px 12px;
	}

	.qs-lb__thumb {
		flex-basis: 68px;
		width: 68px;
		height: 68px;
	}

	.qs-lb__html {
		inset: 56px 0 104px;
	}
}

/* Panel pod zdjęciem i przycisk: tylko telefon (klasa qs-lb--phone z lightbox.js). */
.qs-lb__info,
.qs-lb__cta {
	display: none;
}

@media (max-width: 767px) {
	.qs-lb.qs-lb--phone.pswp--open .qs-lb__info {
		position: absolute;
		top: 0;
		right: 16px;
		left: 16px;
		z-index: 1560;
		display: block;
		text-align: center;
		color: var(--global-palette4);
	}

	.qs-lb__name {
		margin: 0;
		font-size: 14px;
		line-height: 1.4;
		color: var(--global-palette3);
	}

	.qs-lb__variant:not(:empty) {
		display: block;
		font-size: 13px;
		color: var(--global-palette5);
	}

	.qs-lb__price {
		margin-top: 2px;
		font-size: 14px;
		font-weight: 600;
		line-height: 1.4;
		color: var(--global-palette2);
	}

	.qs-lb__price .price {
		margin: 0;
		font-size: inherit;
		color: inherit;
	}

	.qs-lb__swatches {
		display: flex;
		justify-content: center;
		margin-top: 8px;
	}

	/* Miniatury stałej wielkości (76 px, nie rosną z szerokością); układ rzędów i strony z lightbox.js. */
	.qs-lb.qs-lb--phone .qs-lb__thumbs {
		bottom: calc(72px + env(safe-area-inset-bottom, 0px));
		display: grid;
		grid-template-rows: repeat(2, 76px);
		grid-auto-columns: 76px;
		justify-content: safe center;
		gap: 8px;
		padding: 0 12px;
		scroll-padding: 0 12px;
		scroll-snap-type: x mandatory;
	}

	.qs-lb.qs-lb--phone.qs-lb--rows1 .qs-lb__thumbs {
		grid-template-rows: 76px;
	}

	.qs-lb.qs-lb--phone .qs-lb__thumbs[hidden] {
		display: none;
	}

	.qs-lb.qs-lb--phone .qs-lb__thumb {
		width: 76px;
		height: 76px;
	}

	.qs-lb.qs-lb--phone.qs-lb--compact .qs-lb__swatches {
		margin-top: 4px;
		zoom: 0.8;
	}

	.qs-lb.qs-lb--phone.qs-lb--compact .qs-lb__name,
	.qs-lb.qs-lb--phone.qs-lb--compact .qs-lb__price {
		line-height: 1.25;
	}

	.qs-lb.qs-lb--phone.pswp--open .qs-lb__cta:not([hidden]) {
		position: absolute;
		right: 12px;
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
		left: 12px;
		z-index: 1560;
		display: block;
		height: 48px;
		padding: 0 16px;
		border: 0;
		border-radius: 24px;
		background: var(--global-palette-btn-bg, var(--global-palette1));
		color: var(--global-palette-btn, var(--global-palette9));
		font-size: 16px;
		font-weight: 600;
		cursor: pointer;
	}

	.qs-lb.qs-lb--phone .qs-lb__html {
		inset: 56px 0 var(--qs-lb-media-bottom, 104px);
		align-items: flex-start;
	}
}
