/* Kontener główny lightboxa */
.lightbox-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%; /* Zmiana z 100vw na 100% */
	height: 100%; /* Zmiana z 100vh na 100% */
	background-color: rgba(0, 0, 0, 0.9);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	overflow: hidden; /* Kluczowe: twarda blokada rozciągania w Firefoxie */
	box-sizing: border-box;
}

.lightbox-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* Wyświetlane zdjęcie */
.lightbox-img {
	max-width: 90%;
	/* Odjęcie 220px rezerwuje bezpieczne, stałe miejsce na dole na opis i miniatury */
	max-height: calc(100% - 220px);
	box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
	border-radius: 2px;
	user-select: none;
	object-fit: contain; /* Zabezpiecza proporcje w Firefox */
	margin-bottom: 80px; /* Unosi obrazek, aby nie dotykał podpisu */
}

/* Przycisk zamykania (X) */
.lightbox-close {
	position: absolute;
	top: 20px;
	right: 30px;
	color: #fff;
	font-size: 45px;
	cursor: pointer;
	line-height: 1;
	user-select: none;
	transition: color 0.2s;
	z-index: 100001;
}
.lightbox-close:hover { color: #e54141; }

/* Strzałki nawigacyjne */
.lightbox-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: #fff;
	font-size: 50px;
	font-family: monospace;
	cursor: pointer;
	user-select: none;
	padding: 15px;
	transition: color 0.2s, background-color 0.2s;
	z-index: 100000;
	line-height: 1;
}
.lightbox-arrow:hover { color: #ccc; }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

/* Podpis zdjęcia */
.lightbox-caption {
	position: absolute;
	bottom: 110px;
	color: #ddd;
	font-size: 14px;
	text-align: center;
	width: 80%;
	max-height: 80px;
	overflow-y: auto;
	line-height: 1.5;
	font-family: sans-serif;
	z-index: 100000;
}

.lightbox-caption h3 {
	margin: 0 0 8px 0;
	font-size: 18px;
	color: #fff;
	font-weight: 600;
}

.lightbox-caption p {
	margin: 0;
}

/* Kontener na miniaturki */
.lightbox-thumbnails {
	position: absolute;
	bottom: 20px;
	left: 0;
	width: 100%;
	display: flex;
	justify-content: center;
	gap: 10px;
	padding: 1px 20px;
	box-sizing: border-box;
	z-index: 100000;
	overflow-x: auto;
}

/* Pojedyncza miniaturka */
.lightbox-thumbnail {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 4px;
	cursor: pointer;
	opacity: 0.4;
	transition: opacity 0.2s, transform 0.2s, border-color 0.2s;
	border: 2px solid transparent;
	user-select: none;
	flex-shrink: 0; /* Zabezpiecza miniatury przed zgniataniem */
}

.lightbox-thumbnail:hover {
	opacity: 0.8;
	transform: scale(1.05);
}

.lightbox-thumbnail.active {
	opacity: 1;
	border-color: #fff;
	transform: scale(1.05);
}
/* Kontener trzymający zdjęcia w jednym miejscu */
.lightbox-img-wrapper {
	position: relative;
	width: 90%;
	height: calc(100% - 220px);
	margin-bottom: 80px;
	display: flex;
	justify-content: center;
	align-items: center;
}

/* Pojedyncze zdjęcie (mogą być dwa na raz w trakcie animacji) */
.lightbox-img {
	position: absolute;
	max-width: 100%;
	max-height: 100%;
	box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
	border-radius: 2px;
	user-select: none;
	object-fit: contain;
	opacity: 0;
	transition: opacity 300ms ease-in-out; /* Czas trwania przenikania (300ms) */
	will-change: opacity;
}

/* Aktywne zdjęcie wychodzące na wierzch */
.lightbox-img.active {
	opacity: 1;
	z-index: 2;
}