/* ============================================================
   PageBuilder Gallery — Stili per 8 tipi di galleria + Lightbox
   ============================================================ */

/* ── Base ─────────────────────────────────────────────────── */
.pb-gallery { position: relative; }
.pb-gallery-item {
	position: relative;
	overflow: hidden;
	cursor: pointer;
	border-radius: 8px;
}
.pb-gallery-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease, filter 0.35s ease;
}
.pb-gallery-item:hover img {
	transform: scale(1.05);
	filter: brightness(0.85);
}
.pb-gallery-caption {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 1rem 0.75rem 0.65rem;
	background: linear-gradient(transparent, rgba(0,0,0,0.7));
	color: #fff;
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}
.pb-gallery-item:hover .pb-gallery-caption {
	opacity: 1;
	transform: translateY(0);
}
.pb-gallery-caption-title {
	font-size: 0.95rem;
	font-weight: 600;
	margin: 0 0 2px;
	text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.pb-gallery-caption-desc {
	font-size: 0.8rem;
	opacity: 0.85;
	margin: 0;
	text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ── 1. Masonry Grid ─────────────────────────────────────── */
.pb-gallery-masonry {
	column-count: 1;
	column-gap: 12px;
}
.pb-gallery-masonry .pb-gallery-item {
	break-inside: avoid;
	margin-bottom: 12px;
}
.pb-gallery-masonry .pb-gallery-item img {
	height: auto;
}
@media (min-width: 576px) {
	.pb-gallery-masonry { column-count: 2; }
}
@media (min-width: 992px) {
	.pb-gallery-masonry { column-count: 3; }
}

/* ── 2. Carousel / Slider ────────────────────────────────── */
.pb-gallery-carousel .carousel-item img {
	width: 100%;
	height: 450px;
	object-fit: cover;
	border-radius: 8px;
}
@media (max-width: 767.98px) {
	.pb-gallery-carousel .carousel-item img {
		height: 260px;
	}
}
.pb-gallery-carousel .carousel-caption {
	background: linear-gradient(transparent, rgba(0,0,0,0.55));
	bottom: 0;
	left: 0;
	right: 0;
	padding: 1.5rem 1rem 1rem;
	border-radius: 0 0 8px 8px;
}

/* ── 3. Justified Grid ───────────────────────────────────── */
.pb-gallery-justified {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.pb-gallery-justified .pb-gallery-item {
	flex-grow: 1;
	height: 220px;
	min-width: 150px;
	max-width: 100%;
}
@media (max-width: 575.98px) {
	.pb-gallery-justified .pb-gallery-item {
		height: 160px;
		min-width: 120px;
	}
}

/* ── 4. Thumbnail Grid + Lightbox ────────────────────────── */
.pb-gallery-lightbox-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
}
@media (min-width: 576px) {
	.pb-gallery-lightbox-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 992px) {
	.pb-gallery-lightbox-grid { grid-template-columns: repeat(4, 1fr); }
}
.pb-gallery-lightbox-grid .pb-gallery-item {
	aspect-ratio: 1;
}

/* ── 5. Tiled / Mosaic ───────────────────────────────────── */
.pb-gallery-mosaic {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 200px;
	grid-auto-flow: dense;
	gap: 10px;
}
.pb-gallery-mosaic .pb-gallery-item:nth-child(7n+1) {
	grid-column: span 2;
	grid-row: span 2;
}
.pb-gallery-mosaic .pb-gallery-item:nth-child(7n+4) {
	grid-row: span 2;
}
@media (max-width: 767.98px) {
	.pb-gallery-mosaic {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 150px;
	}
	.pb-gallery-mosaic .pb-gallery-item:nth-child(7n+1) {
		grid-column: span 1;
		grid-row: span 1;
	}
	.pb-gallery-mosaic .pb-gallery-item:nth-child(7n+4) {
		grid-row: span 1;
	}
}

/* ── 6. Full-Screen Slideshow ────────────────────────────── */
.pb-gallery-slideshow {
	position: relative;
	width: 100%;
	height: 100vh;
	overflow: hidden;
}
.pb-gallery-slideshow .carousel-item {
	height: 100vh;
}
.pb-gallery-slideshow .carousel-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.pb-gallery-slideshow .carousel-caption {
	background: linear-gradient(transparent, rgba(0,0,0,0.6));
	bottom: 0;
	left: 0;
	right: 0;
	padding: 2rem 1.5rem 1.5rem;
}
.pb-gallery-slideshow .carousel-control-prev,
.pb-gallery-slideshow .carousel-control-next {
	width: 8%;
}

/* ── 7. Horizontal Scroll ────────────────────────────────── */
.pb-gallery-horizontal {
	display: flex;
	flex-wrap: nowrap;
	gap: 12px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: rgba(128,128,128,0.4) transparent;
	padding-bottom: 8px;
}
.pb-gallery-horizontal::-webkit-scrollbar {
	height: 6px;
}
.pb-gallery-horizontal::-webkit-scrollbar-track {
	background: transparent;
}
.pb-gallery-horizontal::-webkit-scrollbar-thumb {
	background: rgba(128,128,128,0.35);
	border-radius: 3px;
}
.pb-gallery-horizontal .pb-gallery-item {
	flex: 0 0 auto;
	width: 280px;
	height: 220px;
	scroll-snap-align: start;
}
@media (max-width: 575.98px) {
	.pb-gallery-horizontal .pb-gallery-item {
		width: 220px;
		height: 170px;
	}
}

/* ── 8. Vertical Stack ───────────────────────────────────── */
.pb-gallery-stack {
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.pb-gallery-stack .pb-gallery-item {
	width: 100%;
	border-radius: 10px;
}
.pb-gallery-stack .pb-gallery-item img {
	height: auto;
	max-height: 600px;
}
.pb-gallery-stack .pb-gallery-caption {
	opacity: 1;
	transform: none;
}

/* ── Lightbox Overlay ────────────────────────────────────── */
.pb-lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0,0,0,0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}
.pb-lightbox-overlay.active {
	opacity: 1;
	visibility: visible;
}
.pb-lightbox-overlay img {
	max-width: 90vw;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 8px 40px rgba(0,0,0,0.5);
	transform: scale(0.92);
	transition: transform 0.35s ease;
}
.pb-lightbox-overlay.active img {
	transform: scale(1);
}
.pb-lightbox-close {
	position: absolute;
	top: 20px;
	right: 24px;
	color: #fff;
	font-size: 2rem;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s;
	background: none;
	border: none;
	line-height: 1;
	z-index: 10;
}
.pb-lightbox-close:hover { opacity: 1; }

.pb-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: #fff;
	font-size: 2.5rem;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s;
	background: none;
	border: none;
	padding: 1rem;
	z-index: 10;
}
.pb-lightbox-nav:hover { opacity: 1; }
.pb-lightbox-prev { left: 12px; }
.pb-lightbox-next { right: 12px; }

.pb-lightbox-caption {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	text-align: center;
	color: #fff;
	max-width: 80%;
	z-index: 10;
}
.pb-lightbox-caption h4 {
	font-size: 1.1rem;
	font-weight: 600;
	margin: 0 0 4px;
	text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.pb-lightbox-caption p {
	font-size: 0.85rem;
	opacity: 0.8;
	margin: 0;
}
.pb-lightbox-counter {
	position: absolute;
	top: 24px;
	left: 24px;
	color: rgba(255,255,255,0.7);
	font-size: 0.85rem;
	z-index: 10;
}
