/* Galleria Filtrabile per Elementor */

.efg-gallery {
	--efg-cols: 3;
	--efg-gap: 10px;
	--efg-ratio: 1 / 1;
	--efg-transition: 400ms;
	position: relative;
}

/* ---------- Reset stile globale pulsanti (Kit Elementor / tema) ----------
 * Il Kit applica a "button" sfondi a gradiente, ombre, testo ecc.
 * Specificità 0,3,0: batte ".elementor-kit-X button:hover/:focus" (0,2,1)
 * ma resta sotto ai selettori dei controlli del widget ({{WRAPPER}} ...). */
.efg-gallery .efg-filter:where(:not(.efg-btn-custom)),
.efg-gallery .efg-filter:where(:not(.efg-btn-custom)):hover,
.efg-gallery .efg-filter:where(:not(.efg-btn-custom)):focus,
.efg-gallery .efg-filter:where(:not(.efg-btn-custom)):active,
.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)),
.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)):hover,
.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)):focus,
.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)):active {
	background-image: none;
	text-shadow: none;
	box-shadow: none;
	text-decoration: none;
	letter-spacing: normal;
	word-spacing: normal;
	text-transform: none;
	width: auto;
	min-width: 0;
	height: auto;
	min-height: 0;
	outline-offset: 2px;
}

/* ---------- Filtri ---------- */

.efg-gallery .efg-filters {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0 0 24px;
}

.efg-gallery .efg-filters-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
}

.efg-gallery .efg-filters-row[hidden] {
	display: none !important;
}

.efg-gallery .efg-filter:where(:not(.efg-btn-custom)),
.efg-gallery .efg-filter:where(:not(.efg-btn-custom)):focus {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 8px 18px;
	font: inherit;
	font-size: 15px;
	line-height: 1.2;
	color: #333;
	background-color: #f1f1f1;
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: none;
	text-transform: none;
	transition: color .2s, background-color .2s, border-color .2s, box-shadow .2s;
}

.efg-gallery .efg-filters-row:not(.efg-level-0) .efg-filter:where(:not(.efg-btn-custom)) {
	font-size: 13px;
	padding: 6px 14px;
}

.efg-gallery .efg-filter:where(:not(.efg-btn-custom)):hover {
	background-color: #e2e2e2;
	color: #111;
}

.efg-gallery .efg-filter:where(:not(.efg-btn-custom)).is-active {
	background-color: #111;
	color: #fff;
}

.efg-gallery .efg-filter:focus-visible,
.efg-gallery .efg-load-more:focus-visible,
.efg-gallery .efg-link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.efg-gallery .efg-count {
	font-size: .8em;
	opacity: .65;
}

.efg-gallery .efg-count::before { content: "("; }
.efg-gallery .efg-count::after { content: ")"; }

/* ---------- Griglia ---------- */

.efg-gallery .efg-grid {
	display: grid;
	grid-template-columns: repeat(var(--efg-cols), minmax(0, 1fr));
	gap: var(--efg-gap);
}

.efg-gallery .efg-item.is-hidden {
	display: none;
}

.efg-gallery .efg-item-inner {
	position: relative;
	overflow: hidden;
	transition: transform var(--efg-transition), box-shadow var(--efg-transition);
}

.efg-gallery .efg-link {
	display: block;
	position: relative;
	color: inherit;
	text-decoration: none;
}

.efg-gallery .efg-media {
	position: relative;
	overflow: hidden;
}

.efg-gallery .efg-media > :is(img, video) {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	transition: transform var(--efg-transition), filter var(--efg-transition);
}

/* Grid: proporzioni fisse */
.efg-layout-grid:not(.efg-ratio-original) .efg-media {
	aspect-ratio: var(--efg-ratio);
}

.efg-layout-grid:not(.efg-ratio-original) .efg-media > :is(img, video) {
	position: absolute;
	inset: 0;
	height: 100%;
	object-fit: cover;
}

.efg-layout-grid.efg-ratio-original .efg-grid {
	align-items: start;
}

.efg-layout-grid.efg-ratio-original .efg-media > :is(img, video),
.efg-layout-masonry .efg-media > :is(img, video) {
	height: auto;
}

/* Masonry: righe da 1px, l'altezza viene calcolata in JS */
.efg-layout-masonry .efg-grid {
	row-gap: 0;
	grid-auto-rows: 1px;
	align-items: start;
}

.efg-layout-masonry .efg-item-inner {
	margin-bottom: var(--efg-gap);
}

/* ---------- Effetti hover ---------- */

.efg-hover-zoom .efg-item:hover .efg-media > :is(img, video) {
	transform: scale(1.08);
}

.efg-hover-zoom-out .efg-media > :is(img, video) {
	transform: scale(1.08);
}

.efg-hover-zoom-out .efg-item:hover .efg-media > :is(img, video) {
	transform: scale(1);
}

.efg-hover-grayscale .efg-media > :is(img, video) {
	filter: grayscale(1);
}

.efg-hover-grayscale .efg-item:hover .efg-media > :is(img, video) {
	filter: grayscale(0);
}

.efg-hover-lift .efg-item:hover .efg-item-inner {
	transform: translateY(-6px);
	box-shadow: 0 14px 28px rgba(0, 0, 0, .18);
}

/* ---------- Overlay ---------- */

.efg-gallery .efg-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 4px;
	padding: 16px;
	background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0) 60%);
	color: #fff;
	pointer-events: none;
	transition: opacity var(--efg-transition);
}

.efg-overlay-hover .efg-overlay {
	opacity: 0;
}

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

.efg-gallery .efg-caption {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
}

.efg-gallery .efg-cat {
	font-size: 12px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .8);
}

/* ---------- Paginazione ---------- */

.efg-gallery .efg-pagination {
	margin-top: 30px;
	text-align: center;
}

.efg-gallery .efg-pagination.is-hidden {
	display: none;
}

.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)),
.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)):focus {
	display: inline-block;
	margin: 0;
	padding: 12px 30px;
	font: inherit;
	font-size: 15px;
	line-height: 1.2;
	color: #fff;
	background-color: #111;
	border: 1px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	transition: color .2s, background-color .2s, border-color .2s, box-shadow .2s;
}

.efg-gallery .efg-load-more:where(:not(.efg-btn-custom)):hover {
	background-color: #333;
	color: #fff;
}

.efg-gallery .efg-pagination-infinite {
	position: relative;
	min-height: 40px;
}

.efg-gallery .efg-sentinel {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 1px;
}

.efg-gallery .efg-loader {
	display: inline-block;
	width: 28px;
	height: 28px;
	border: 3px solid rgba(0, 0, 0, .12);
	border-top-color: rgba(0, 0, 0, .55);
	border-radius: 50%;
	animation: efg-spin .8s linear infinite;
}

/* ---------- Editor ---------- */

.efg-empty {
	padding: 30px;
	text-align: center;
	border: 2px dashed #d5dadf;
	color: #6d7882;
}

/* ---------- Animazioni ---------- */

@keyframes efg-in {
	from { opacity: 0; transform: translateY(14px) scale(.98); }
	to { opacity: 1; transform: none; }
}

@keyframes efg-row-in {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: none; }
}

@keyframes efg-spin {
	to { transform: rotate(360deg); }
}

.efg-gallery .efg-anim {
	animation: efg-in .45s ease both;
}

.efg-gallery .efg-row-anim {
	animation: efg-row-in .3s ease both;
}

@media (prefers-reduced-motion: reduce) {
	.efg-gallery .efg-anim,
	.efg-gallery .efg-row-anim,
	.efg-gallery .efg-loader {
		animation: none;
	}
	.efg-gallery .efg-media > :is(img, video),
	.efg-gallery .efg-item-inner,
	.efg-gallery .efg-overlay {
		transition: none;
	}
}

/* ---------- Video ---------- */

/* Copertine automatiche (YouTube/Vimeo senza copertina): ritaglio 16:9. */
.efg-gallery .efg-media-169 .efg-media {
	aspect-ratio: 16 / 9;
}

.efg-gallery .efg-media-169 .efg-media > :is(img, video) {
	position: absolute;
	inset: 0;
	height: 100%;
	object-fit: cover;
}

.efg-gallery .efg-media > video {
	background: #111;
	pointer-events: none;
}

.efg-gallery .efg-video-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 120px;
	background: #1d1d1d;
}

.efg-gallery .efg-play {
	--efg-play-size: 64px;
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	width: var(--efg-play-size);
	height: var(--efg-play-size);
	margin: calc(var(--efg-play-size) / -2) 0 0 calc(var(--efg-play-size) / -2);
	border-radius: 50%;
	background-color: rgba(0, 0, 0, .55);
	color: #fff;
	pointer-events: none;
	transition: background-color var(--efg-transition), transform var(--efg-transition);
}

.efg-gallery .efg-play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	margin: calc(var(--efg-play-size) * -.18) 0 0 calc(var(--efg-play-size) * -.11);
	border-style: solid;
	border-width: calc(var(--efg-play-size) * .18) 0 calc(var(--efg-play-size) * .18) calc(var(--efg-play-size) * .3);
	border-color: transparent transparent transparent currentColor;
}

.efg-gallery .efg-item:hover .efg-play {
	background-color: rgba(0, 0, 0, .8);
	transform: scale(1.08);
}

@media (prefers-reduced-motion: reduce) {
	.efg-gallery .efg-play {
		transition: none;
	}
}

/* ---------- Pulsanti con classe personalizzata (stile base disattivato) ---------- */

.efg-gallery :where(.efg-filter.efg-btn-custom, .efg-load-more.efg-btn-custom) {
	cursor: pointer;
}

.efg-gallery :where(.efg-filter.efg-btn-custom) {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
