/* Gallery Pati — usa i token del tema (pati.css) con fallback */
.pati-gallery {
	--pg-cols: 4;
	--pg-gap: 20px;
	--pg-ratio: 4 / 5;
	--pg-radius: 18px;
	--pg-ink: var(--pati-ink, #2e1a2b);
}

/* Filtri */
.pati-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .5rem;
	margin: 0 0 1.75rem;
}
.pati-gallery__filter {
	appearance: none;
	margin: 0;
	padding: .5rem 1.15rem;
	border: 2px solid var(--pg-ink);
	border-radius: 999px;
	background: transparent;
	color: var(--pg-ink);
	font: inherit;
	font-size: .95rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .2s, transform .2s, box-shadow .2s;
}
.pati-gallery__filter:hover { background: var(--pati-green-soft, #e6f0c4); color: var(--pg-ink); }
.pati-gallery__filter.is-active {
	background: var(--pati-green, #9dc32a);
	color: var(--pg-ink);
	box-shadow: 0 3px 0 var(--pg-ink);
	transform: translateY(-1px);
}
.pati-gallery__filter:focus-visible { outline: 3px solid var(--pati-plum, #a3496e); outline-offset: 2px; }

/* Griglia */
.pati-gallery--grid .pati-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--pg-cols), minmax(0, 1fr));
	gap: var(--pg-gap);
}
.pati-gallery--grid .pati-gallery__item img {
	aspect-ratio: var(--pg-ratio);
	height: 100%;
	object-fit: cover;
}

/* Masonry (colonne CSS: l'ordine va dall'alto in basso per colonna) */
.pati-gallery--masonry .pati-gallery__grid {
	columns: var(--pg-cols);
	column-gap: var(--pg-gap);
}
.pati-gallery--masonry .pati-gallery__item {
	break-inside: avoid;
	margin-bottom: var(--pg-gap);
}

/* Elemento */
.pati-gallery__item {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: var(--pg-radius);
	background: var(--pati-green-soft, #e6f0c4);
}
.pati-gallery-border-yes .pati-gallery__item {
	border: 2px solid var(--pg-ink);
	box-shadow: 0 2px 0 var(--pg-ink);
}
.pati-gallery__item[hidden] { display: none !important; }
.pati-gallery__item.is-in { animation: pati-gallery-in .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pati-gallery-in {
	from { opacity: 0; transform: translateY(10px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

.pati-gallery__link {
	display: block;
	position: relative;
	color: inherit;
	text-decoration: none;
}
a.pati-gallery__link { cursor: zoom-in; }
.pati-gallery__item img {
	display: block;
	width: 100%;
	max-width: none;
	border-radius: 0;
	transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.pati-gallery__item:hover img { transform: scale(1.04); }

/* Titolo in sovrimpressione */
.pati-gallery__caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: 2.75rem 1rem .9rem;
	background: linear-gradient(transparent, rgba(46, 26, 43, .75));
	color: #fff;
	font-family: var(--pati-font-head, inherit);
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.25;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .3s, transform .3s;
}
.pati-gallery__item:hover .pati-gallery__caption,
.pati-gallery__link:focus-visible .pati-gallery__caption { opacity: 1; transform: none; }
.pati-gallery__link:focus-visible { outline: 3px solid var(--pati-plum, #a3496e); outline-offset: -3px; }
@media (hover: none) {
	.pati-gallery__caption { opacity: 1; transform: none; padding-top: 2rem; font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
	.pati-gallery__item.is-in { animation: none; }
	.pati-gallery__item img,
	.pati-gallery__caption { transition: none; }
}
