/*
 * Istituti Atlante - pagina Gallery (inc/gallery.php)
 * Si appoggia a pagine.css (variabili --p-*, impaginazione larga .atl-pg-larga).
 */

.atl-pg-gallery .post_type_exist .atl-ico {
	width: 20px;
	height: 20px;
}

/* testo scritto nella pagina (se c'è) al posto della frase introduttiva */
.atl-gal-testo {
	max-width: 760px;
	margin: 0 auto 40px;
	text-align: center;
}

/* ==========================================================================
   VIDEO
   ========================================================================== */
.atl-gal-video {
	display: grid;
	grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
	align-items: center;
	gap: 48px;
	max-width: 1040px;
	margin: 0 auto 72px;
	padding: 36px 48px 36px 36px;
	border-radius: 28px;
	background:
		radial-gradient(120% 90% at 100% 0%, rgba(232, 181, 47, .18), transparent 55%),
		linear-gradient(135deg, var(--p-navy-900), var(--p-navy));
	box-shadow: var(--p-shadow);
	color: #fff;
}
.atl-gal-video__player {
	position: relative;
	padding: 6px;
	border-radius: 26px;
	background: linear-gradient(160deg, var(--p-gold), var(--p-gold-2) 45%, rgba(232, 181, 47, .35));
	box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .55);
}
.atl-gal-video__player video {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 480 / 848;
	max-height: 70vh;
	border-radius: 20px;
	background: var(--p-navy-950);
	object-fit: cover;
}
.atl-gal-kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px 6px 10px;
	border-radius: 999px;
	background: rgba(232, 181, 47, .16);
	color: var(--p-gold-2);
	font: 700 13px/1 Montserrat, sans-serif;
	letter-spacing: .08em;
	text-transform: uppercase;
}
.atl-gal-kicker .atl-ico {
	width: 16px !important;
	height: 16px !important;
}
body.atl-pg-gallery .post_type_exist .atl-gal-video h2 {
	margin: 16px 0 12px !important;
	padding: 0 !important;
	color: #fff !important;
	font-size: clamp(26px, 3vw, 36px) !important;
}
body.atl-pg-gallery .post_type_exist .atl-gal-video h2::before {
	display: none;
}
body.atl-pg-gallery .post_type_exist .atl-gal-video p {
	margin: 0 0 22px !important;
	color: rgba(255, 255, 255, .82) !important;
	font-size: 17px !important;
	line-height: 1.6 !important;
}
.post_type_exist ul.atl-gal-video__list {
	display: grid;
	gap: 10px;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}
body.atl-pg-gallery .post_type_exist .atl-gal-video__list li {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 !important;
	padding: 0 !important;
	color: #fff !important;
	font-weight: 600;
}
.atl-gal-video__list li::before {
	display: none !important;
}
.atl-gal-video__list .atl-ico {
	padding: 3px;
	border-radius: 50%;
	background: var(--p-gold);
	color: var(--p-navy-950);
}

/* ==========================================================================
   FOTO: titolo, filtri, griglia a mattoncini (colonne: le foto si vedono intere)
   ========================================================================== */
.atl-gal__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 24px;
	margin-bottom: 28px;
	padding-bottom: 18px;
	border-bottom: 1px solid var(--p-line);
}
body.atl-pg-gallery .post_type_exist .atl-gal__head h2 {
	margin: 0 !important;
}
.atl-gal__filtri {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.atl-gal__filtri button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	padding: 8px 16px;
	border: 1px solid var(--p-line);
	border-radius: 999px;
	background: #fff;
	color: var(--p-navy-900);
	font: 600 14.5px/1.2 Montserrat, sans-serif;
	cursor: pointer;
	transition: background .2s, border-color .2s, color .2s;
}
.atl-gal__filtri button span {
	min-width: 22px;
	padding: 2px 6px;
	border-radius: 999px;
	background: var(--p-bg);
	color: var(--p-muted);
	font-size: 12px;
	text-align: center;
}
.atl-gal__filtri button:hover {
	border-color: var(--p-gold);
}
.atl-gal__filtri button.is-active {
	border-color: var(--p-navy-900);
	background: var(--p-navy-900);
	color: #fff;
}
.atl-gal__filtri button.is-active span {
	background: var(--p-gold);
	color: var(--p-navy-950);
}
.atl-gal__filtri button:focus-visible,
.atl-gal__item a:focus-visible {
	outline: 3px solid var(--p-gold);
	outline-offset: 3px;
}

.atl-gal__grid {
	columns: 3;
	column-gap: 20px;
}
.atl-gal__item {
	display: block;
	break-inside: avoid;
	margin: 0 0 20px !important;
	overflow: hidden;
	border-radius: 20px;
	background: #fff;
	box-shadow: var(--p-shadow);
	animation: atl-gal-in .45s var(--p-ease) both;
}
.atl-gal__item[hidden] {
	display: none;
}
@keyframes atl-gal-in {
	from { opacity: 0; transform: translateY(12px); }
}
.atl-gal__item a {
	position: relative;
	display: block;
	overflow: hidden;
	cursor: zoom-in;
}
body:not(.home) .post_type_exist .atl-gal__item img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	border-radius: 0;
	box-shadow: none;
	transition: transform .6s var(--p-ease);
}
.atl-gal__item a:hover img {
	transform: scale(1.04);
}
.atl-gal__zoom {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(4, 18, 43, .72);
	color: #fff;
	opacity: 0;
	transform: scale(.8);
	transition: opacity .25s, transform .25s var(--p-ease);
}
.atl-gal__item a:hover .atl-gal__zoom,
.atl-gal__item a:focus-visible .atl-gal__zoom {
	opacity: 1;
	transform: none;
}
/* (body:not(.home) ... per scavalcare le didascalie generiche di pagine.css) */
body:not(.home) .post_type_exist .atl-gal__item figcaption {
	margin: 0;
	padding: 14px 16px 16px;
	color: var(--p-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	overflow-wrap: anywhere;
}
.atl-gal__item figcaption span {
	display: block;
	margin-bottom: 4px;
	color: #a77b06;
	font: 700 11.5px/1.2 Montserrat, sans-serif;
	letter-spacing: .08em;
	text-transform: uppercase;
}

/* ==========================================================================
   VISORE A TUTTO SCHERMO (assets/js/gallery.js)
   ========================================================================== */
.atl-gal-lb {
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(4, 18, 43, .98);
	color: #fff;
	overscroll-behavior: contain;
}
.atl-gal-lb::backdrop {
	background: rgba(4, 18, 43, .6);
}
.atl-gal-lb[open] {
	display: grid;
	place-items: center;
}
.atl-gal-lb__fig {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	max-width: calc(100vw - 160px);
	margin: 0;
}
.atl-gal-lb__fig img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 150px);
	max-height: calc(100dvh - 150px);
	width: auto;
	height: auto;
	border-radius: 14px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
	user-select: none;
	-webkit-user-drag: none;
}
.atl-gal-lb__cap {
	max-width: 760px;
	color: rgba(255, 255, 255, .9);
	font: 600 16px/1.45 Montserrat, sans-serif;
	text-align: center;
}
.atl-gal-lb__num {
	position: absolute;
	top: 26px;
	left: 24px;
	color: var(--p-gold-2);
	font: 700 14px/1 Montserrat, sans-serif;
	letter-spacing: .08em;
}
.atl-gal-lb__btn {
	position: absolute;
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 50%;
	background: rgba(255, 255, 255, .08);
	color: #fff;
	cursor: pointer;
	transition: background .2s, color .2s;
}
.atl-gal-lb__btn:hover,
.atl-gal-lb__btn:focus-visible {
	background: var(--p-gold);
	color: var(--p-navy-950);
	outline: none;
}
.atl-gal-lb__btn .atl-ico {
	width: 24px;
	height: 24px;
}
.atl-gal-lb__chiudi {
	top: 14px;
	right: 14px;
}
.atl-gal-lb__prev,
.atl-gal-lb__next {
	top: 50%;
	transform: translateY(-50%);
}
.atl-gal-lb__prev {
	left: 20px;
}
.atl-gal-lb__next {
	right: 20px;
}
html.atl-gal-lb-aperto {
	overflow: hidden;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 991px) {
	.atl-gal-video {
		grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
		gap: 32px;
		padding: 28px;
	}
	.atl-gal__grid {
		columns: 2;
	}
}
@media (max-width: 767px) {
	.atl-gal-video {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
		margin-bottom: 48px;
		padding: 20px 20px 26px;
		border-radius: 22px;
	}
	.atl-gal-video__player {
		width: min(100%, 300px);
		margin: 0 auto;
	}
	.atl-gal-video__txt {
		text-align: center;
	}
	.post_type_exist ul.atl-gal-video__list {
		justify-content: center;
		text-align: left;
	}
	.atl-gal__head {
		justify-content: center;
		text-align: center;
	}
	.atl-gal__filtri {
		justify-content: center;
	}
	.atl-gal__grid {
		column-gap: 12px;
	}
	.atl-gal__item {
		margin-bottom: 12px !important;
		border-radius: 16px;
	}
	body:not(.home) .post_type_exist .atl-gal__item figcaption {
		padding: 10px 12px 12px;
		font-size: 13.5px;
	}
	.atl-gal__zoom {
		display: none;
	}
	/* su telefono si scorre col dito: frecce piccole in basso, foto più grande */
	.atl-gal-lb__fig {
		max-width: calc(100vw - 24px);
	}
	.atl-gal-lb__fig img {
		max-height: calc(100dvh - 190px);
	}
	.atl-gal-lb__cap {
		padding: 0 8px;
		font-size: 14.5px;
	}
	.atl-gal-lb__prev,
	.atl-gal-lb__next {
		top: auto;
		bottom: 18px;
		transform: none;
		width: 46px;
		height: 46px;
	}
	.atl-gal-lb__prev {
		left: calc(50% - 56px);
	}
	.atl-gal-lb__next {
		right: calc(50% - 56px);
	}
}
@media (max-width: 479px) {
	/* due colonne anche su telefono (meno da scorrere): didascalia corta, senza categoria */
	.atl-gal__grid {
		column-gap: 10px;
	}
	.atl-gal__item {
		margin-bottom: 10px !important;
		border-radius: 14px;
	}
	body:not(.home) .post_type_exist .atl-gal__item figcaption {
		padding: 8px 10px 10px;
		font-size: 12.5px;
		line-height: 1.35;
	}
	.atl-gal__item figcaption span {
		display: none;
	}
	.atl-gal__filtri button {
		min-height: 38px;
		padding: 6px 12px;
		font-size: 13.5px;
	}
}
@media (max-width: 359px) {
	.atl-gal__grid {
		columns: 1;
	}
}
@media (prefers-reduced-motion: reduce) {
	.atl-gal__item,
	.atl-gal__item img {
		animation: none;
		transition: none;
	}
}
