/* ==========================================================================
   Galleria Tema — griglia masonry + lightbox
   ========================================================================== */

.galtema-gallery {
	column-count: var(--galtema-cols, 3);
	column-gap: 16px;
	margin: 24px 0;
}

@media (max-width: 900px) {
	.galtema-gallery {
		column-count: min(var(--galtema-cols, 3), 2);
	}
}

@media (max-width: 560px) {
	.galtema-gallery {
		column-count: 1;
	}
}

.galtema-item {
	break-inside: avoid;
	margin: 0 0 16px;
	border-radius: 14px;
	overflow: hidden;
	background: var(--galtema-color, #e2e8f0);
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
	opacity: 0;
	transform: translateY(24px) scale(0.98);
	animation: galtema-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	animation-delay: var(--galtema-delay, 0ms);
	transition: box-shadow 0.35s ease, transform 0.35s ease;
}

@keyframes galtema-in {
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.galtema-item {
		animation: none;
		opacity: 1;
		transform: none;
	}
}

.galtema-item:hover {
	transform: translateY(-4px);
	box-shadow: 0 14px 34px rgba(15, 23, 42, 0.2);
}

.galtema-link {
	display: block;
	position: relative;
	line-height: 0;
	text-decoration: none;
	outline-offset: 3px;
}

.galtema-item img {
	width: 100%;
	height: auto;
	display: block;
	transform: scale(1);
	transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
}

.galtema-item:hover img {
	transform: scale(1.06);
	filter: brightness(0.85) saturate(1.1);
}

/* Overlay hover */
.galtema-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(180deg, rgba(15, 23, 42, 0) 40%, rgba(15, 23, 42, 0.55) 100%);
	opacity: 0;
	transition: opacity 0.35s ease;
}

.galtema-item:hover .galtema-overlay,
.galtema-link:focus-visible .galtema-overlay {
	opacity: 1;
}

.galtema-zoom {
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30px;
	font-weight: 300;
	line-height: 1;
	color: #0f172a;
	background: rgba(255, 255, 255, 0.92);
	border-radius: 50%;
	transform: scale(0.6);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
}

.galtema-item:hover .galtema-zoom {
	transform: scale(1);
}

.galtema-credit {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 10px;
	font-size: 12px;
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.95);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Messaggio errore (solo admin) */
.galtema-error {
	padding: 14px 18px;
	margin: 16px 0;
	border-left: 4px solid #dc2626;
	background: #fef2f2;
	color: #7f1d1d;
	border-radius: 0 8px 8px 0;
	font-size: 14px;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.galtema-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(8, 11, 20, 0.94);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.galtema-lightbox.is-open {
	opacity: 1;
}

.galtema-lightbox-img {
	max-width: min(92vw, 1400px);
	max-height: 84vh;
	border-radius: 10px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
	transform: scale(0.92);
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	user-select: none;
}

.galtema-lightbox.is-open .galtema-lightbox-img {
	transform: scale(1);
}

.galtema-lightbox-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 20px;
	text-align: center;
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	padding: 0 70px;
}

.galtema-lightbox-caption a {
	color: #a5b4fc;
	text-decoration: none;
}

.galtema-lightbox-caption a:hover {
	text-decoration: underline;
}

.galtema-lightbox button {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.25s ease, transform 0.25s ease;
}

.galtema-lightbox button:hover {
	background: rgba(255, 255, 255, 0.22);
	transform: scale(1.08);
}

.galtema-lightbox-close {
	top: 20px;
	right: 20px;
}

.galtema-lightbox-prev {
	left: 20px;
	top: 50%;
	margin-top: -24px;
}

.galtema-lightbox-next {
	right: 20px;
	top: 50%;
	margin-top: -24px;
}

.galtema-lightbox-counter {
	position: absolute;
	top: 28px;
	left: 28px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 14px;
	letter-spacing: 0.06em;
}

@media (max-width: 560px) {
	.galtema-lightbox-prev,
	.galtema-lightbox-next {
		width: 42px;
		height: 42px;
	}

	.galtema-lightbox-caption {
		padding: 0 16px;
		font-size: 12px;
	}
}

body.galtema-no-scroll {
	overflow: hidden;
}
