.gal-filtri {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.gal-filtro {
  background: var(--viola-chiaro);
  color: var(--viola-scuro);
  border: 2px solid transparent;
  border-radius: 100px;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.gal-filtro:hover,
.gal-filtro.attivo {
  background: var(--viola);
  color: white;
  border-color: var(--viola);
}

.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.gal-card {
  border-radius: 16px;
  overflow: hidden;
  background: white;
  border: 1px solid #E8E0F0;
  box-shadow: 0 2px 12px rgba(107, 63, 160, 0.07);
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
}

.gal-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 28px rgba(107, 63, 160, 0.16);
}

.gal-card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  aspect-ratio: auto;
  height: 220px;
  image-orientation: from-image;
  display: block;
  background: var(--viola-chiaro);
}

.gal-card-body {
  padding: 0.85rem 1rem;
}

.gal-card-cat {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--viola);
  margin-bottom: 0.25rem;
}

.gal-card-titolo {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--testo);
  line-height: 1.4;
}

.gal-vuoto {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem 2rem;
  color: var(--testo-muted);
  text-align: center;
}

.gal-vuoto span {
  font-size: 4rem;
  opacity: 0.4;
}

.gal-vuoto p {
  font-size: 1.05rem;
  max-width: 340px;
  line-height: 1.6;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.aperto {
  display: flex;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 4, 28, 0.94);
  backdrop-filter: blur(6px);
}

.lightbox-box {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-chiudi {
  position: absolute;
  top: -14px;
  right: -14px;
  background: var(--viola-scuro);
  border: none;
  color: white;
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

.lightbox-chiudi:hover {
  background: var(--viola);
}

.lightbox-info {
  margin-top: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 768px) {
  .gal-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8rem;
  }
}
