/* GUP Lightbox 1.1.0 */
.gupl-trigger { cursor: zoom-in; }
.gupl-trigger:focus-visible { outline: 2px solid #c9a24a; outline-offset: 2px; }

html.gupl-open, html.gupl-open body { overflow: hidden !important; }

.gupl {
	--gupl-bg: rgba(8, 7, 6, .97);
	--gupl-fg: #f2ede4;
	--gupl-accent: #c9a24a;
	--gupl-top: 64px;      /* miejsce na pasek u góry */
	--gupl-side: 64px;     /* miejsce na strzałki */
	--gupl-bottom: 64px;   /* miejsce na podpis */
	--gupl-thumb: 64px;    /* rozmiar miniatury */
	position: fixed; inset: 0; z-index: 2147483000;
	background: var(--gupl-bg); color: var(--gupl-fg);
	opacity: 0; transition: opacity .18s ease;
	-webkit-tap-highlight-color: transparent;
	touch-action: none;
	font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.gupl.has-thumbs { --gupl-bottom: calc(var(--gupl-thumb) + 72px); }
.gupl[hidden] { display: none; }
.gupl.is-visible { opacity: 1; }
.gupl *, .gupl *::before, .gupl *::after { box-sizing: border-box; }

/* ---- scena z obrazem ---- */
.gupl__stage {
	position: absolute;
	top: var(--gupl-top); right: var(--gupl-side); bottom: var(--gupl-bottom); left: var(--gupl-side);
	display: flex; align-items: center; justify-content: center;
	overflow: hidden;
	touch-action: pan-x pan-y;
}
.gupl__img {
	display: block; flex: none;
	max-width: calc(100vw - 2 * var(--gupl-side));
	max-height: calc(100vh - var(--gupl-top) - var(--gupl-bottom));
	max-height: calc(100dvh - var(--gupl-top) - var(--gupl-bottom));
	width: auto; height: auto; object-fit: contain;
	user-select: none; -webkit-user-drag: none;
	cursor: zoom-in;
	transition: opacity .15s ease;
}
.gupl.is-loading .gupl__img { opacity: 0; }

/* powiększenie: scena na cały ekran, przewijanie / przeciąganie */
.gupl.is-zoomed .gupl__stage {
	inset: 0; overflow: auto; overscroll-behavior: contain;
	justify-content: flex-start; align-items: flex-start;
	cursor: zoom-out; scrollbar-width: thin;
}
.gupl.is-zoomed .gupl__img { max-width: none; max-height: none; margin: auto; cursor: grab; image-rendering: auto; }
.gupl.is-dragging .gupl__stage, .gupl.is-dragging .gupl__img { cursor: grabbing; }
.gupl.is-zoomed .gupl__caption,
.gupl.is-zoomed .gupl__thumbs,
.gupl.is-zoomed .gupl__prev,
.gupl.is-zoomed .gupl__next { display: none; }

.gupl__spinner {
	position: absolute; width: 36px; height: 36px; left: 50%; top: 50%; margin: -18px 0 0 -18px;
	border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--gupl-accent);
	border-radius: 50%; animation: gupl-spin .8s linear infinite; display: none;
}
.gupl.is-loading .gupl__spinner { display: block; }
@keyframes gupl-spin { to { transform: rotate(360deg); } }

.gupl__error { display: none; margin: 0; }
.gupl.has-error .gupl__error { display: block; }

/* ---- podpis i licznik ---- */
.gupl__caption {
	position: absolute; left: var(--gupl-side); right: var(--gupl-side);
	bottom: calc(var(--gupl-bottom) - 46px);
	text-align: center; font-weight: 600; letter-spacing: .01em;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}
.gupl__caption[hidden] { display: none; }
.gupl__counter {
	position: absolute; left: 16px; top: 22px; z-index: 2;
	font-size: 13px; opacity: .75; font-variant-numeric: tabular-nums;
	pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}

/* ---- przyciski ---- */
.gupl__btn, .gupl__level {
	display: flex; align-items: center; justify-content: center;
	padding: 0; margin: 0; border: 0;
	color: var(--gupl-fg); cursor: pointer;
	box-shadow: none; text-shadow: none; min-height: 0; line-height: 1;
	font: inherit; transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.gupl__btn {
	position: absolute; z-index: 2;
	width: 44px; height: 44px; border-radius: 50%;
	background: rgba(255, 255, 255, .08);
}
.gupl__btn[hidden] { display: none; }
.gupl__btn:hover, .gupl__btn:focus-visible,
.gupl__level:hover, .gupl__level:focus-visible { background: rgba(255, 255, 255, .18); color: var(--gupl-accent); outline: none; }
.gupl__btn:focus-visible, .gupl__level:focus-visible { box-shadow: 0 0 0 2px var(--gupl-accent); }
.gupl__btn:disabled { opacity: .35; cursor: default; background: transparent; color: var(--gupl-fg); }
.gupl__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gupl__close { top: 10px; right: 10px; }
.gupl__prev { left: 10px; top: 50%; transform: translateY(-50%); }
.gupl__next { right: 10px; top: 50%; transform: translateY(-50%); }
.gupl.has-thumbs .gupl__prev, .gupl.has-thumbs .gupl__next { top: calc((100% - var(--gupl-bottom) + var(--gupl-top)) / 2); }

/* ---- pasek powiększenia ---- */
.gupl__toolbar {
	position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 2;
	display: flex; align-items: center; gap: 2px; padding: 3px;
	background: rgba(20, 18, 16, .78); border: 1px solid rgba(255, 255, 255, .1);
	border-radius: 999px; backdrop-filter: blur(6px);
}
.gupl.is-loading .gupl__toolbar, .gupl.has-error .gupl__toolbar { visibility: hidden; }
.gupl__toolbar .gupl__btn { position: static; width: 38px; height: 38px; background: transparent; }
.gupl__toolbar .gupl__btn svg { width: 20px; height: 20px; }
.gupl__level {
	min-width: 64px; height: 38px; padding: 0 10px; border-radius: 999px;
	background: transparent; font-size: 14px; font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* ---- miniatury ---- */
.gupl__thumbs {
	position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
	display: flex; gap: 6px; padding: 8px 16px 12px;
	overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain;
	touch-action: pan-x; scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, .25) transparent;
	background: linear-gradient(to top, rgba(0, 0, 0, .35), transparent);
}
.gupl__thumbs[hidden] { display: none; }
/* wyśrodkuj, gdy miniatury mieszczą się na ekranie */
.gupl__thumbs::before, .gupl__thumbs::after { content: ""; flex: 1 0 0; }
.gupl__thumb {
	flex: none; width: var(--gupl-thumb); height: var(--gupl-thumb);
	padding: 4px; margin: 0; border: 2px solid transparent; border-radius: 6px;
	background: rgba(255, 255, 255, .06); cursor: pointer;
	opacity: .55; transition: opacity .15s ease, border-color .15s ease, background .15s ease;
	box-shadow: none; min-height: 0;
}
.gupl__thumb img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.gupl__thumb:hover { opacity: .9; background: rgba(255, 255, 255, .12); }
.gupl__thumb:focus-visible { outline: none; opacity: 1; box-shadow: 0 0 0 2px var(--gupl-fg); }
.gupl__thumb.is-active { opacity: 1; border-color: var(--gupl-accent); background: rgba(201, 162, 74, .15); }

/* ---- telefon ---- */
@media (max-width: 640px) {
	.gupl { --gupl-side: 8px; --gupl-top: 60px; --gupl-bottom: 60px; --gupl-thumb: 52px; }
	.gupl.has-thumbs { --gupl-bottom: calc(var(--gupl-thumb) + 70px); }
	.gupl__prev, .gupl__next { top: auto !important; bottom: 8px; transform: none; }
	.gupl.has-thumbs .gupl__prev, .gupl.has-thumbs .gupl__next { display: none; } /* przewijanie gestem lub miniaturami */
	.gupl__caption { left: 56px; right: 56px; font-size: 14px; }
	.gupl.has-thumbs .gupl__caption { left: 12px; right: 12px; }
	.gupl__counter { top: 64px; }
	.gupl__toolbar { left: 8px; transform: none; }
	.gupl__toolbar .gupl__btn { width: 34px; height: 34px; }
	.gupl__level { min-width: 54px; height: 34px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
	.gupl, .gupl__img, .gupl__thumb { transition: none; }
	.gupl__spinner { animation-duration: 2s; }
}
