/* =============================================
   GALLERIA.CSS – Stili pagina Galleria Fotografica
   ============================================= */

/* ─── HERO A STRIPS ──────────────────────────── */
.gal-hero {
  position: relative;
  height: 60vh;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.gal-hero-strips {
  position: absolute;
  inset: 0;
  display: flex;
}

.gal-strip {
  flex: 1;
  overflow: hidden;
}

.gal-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: brightness(0.45) saturate(0.75);
  animation: strip-zoom 16s ease-in-out infinite alternate;
}

.gal-strip:nth-child(2) img { animation-delay: 1.5s; }
.gal-strip:nth-child(3) img { animation-delay: 3s; }
.gal-strip:nth-child(4) img { animation-delay: 4.5s; }

@keyframes strip-zoom {
  from { transform: scale(1.04) translateY(0); }
  to   { transform: scale(1.10) translateY(-4%); }
}

.gal-strip + .gal-strip {
  border-left: 1px solid rgba(201,162,39,0.15);
}

.gal-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(to bottom, rgba(26,18,9,0.1) 0%, rgba(26,18,9,0.0) 40%, rgba(26,18,9,0.85) 100%),
    linear-gradient(to right, rgba(26,18,9,0.5) 0%, transparent 40%, transparent 60%, rgba(26,18,9,0.5) 100%);
}

.gal-hero-content {
  position: relative;
  z-index: 3;
  padding-bottom: var(--space-2xl);
}

.gal-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  color: white;
  margin: 0.4rem 0 0.6rem;
  animation: fade-in-up 0.7s ease both;
}

.gal-hero-sub {
  font-family: var(--font-elegant);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  max-width: 540px;
  animation: fade-in-up 0.7s ease 0.15s both;
}

.gal-hero-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: var(--space-sm);
  background: rgba(201,162,39,0.18);
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: var(--radius-full);
  padding: 0.35rem 1rem;
  animation: fade-in-up 0.7s ease 0.25s both;
}

.count-num {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary-light);
}

.count-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── FILTRI BAR ─────────────────────────────── */
.gal-filters-bar {
  background: var(--color-off-white);
  border-bottom: 1px solid rgba(139,105,20,0.12);
  padding: var(--space-sm) 0;
  position: sticky;
  top: var(--header-h);
  z-index: 100;
  box-shadow: 0 2px 16px rgba(26,18,9,0.06);
}

.gal-filters-inner {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

.gal-filter {
  background: transparent;
  border: 1.5px solid rgba(139,105,20,0.2);
  border-radius: var(--radius-full);
  padding: 0.45rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.gal-filter:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gal-filter.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 12px rgba(139,105,20,0.3);
}

/* ─── GRIGLIA MASONRY ────────────────────────── */
.gal-main { padding-top: var(--space-xl); }

.gal-grid {
  columns: 4;
  column-gap: var(--space-sm);
}

.gal-item {
  break-inside: avoid;
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--color-surface-2);
  transition: all var(--transition-normal);
  display: inline-block;
  width: 100%;
}

.gal-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.gal-item:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Animazione filtro hide */
.gal-item.hidden {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.gal-img-wrap {
  position: relative;
  overflow: hidden;
}

.gal-img-wrap img {
  width: 100%;
  display: block;
  height: auto;
  transition: transform var(--transition-slow);
  object-fit: cover;
}

.gal-item.tall .gal-img-wrap img {
  /* Le foto verticali occupano più spazio naturalmente */
}

.gal-item:hover .gal-img-wrap img {
  transform: scale(1.07);
}

/* Overlay hover */
.gal-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(26,18,9,0.75) 0%,
    rgba(26,18,9,0.1) 60%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gal-item:hover .gal-overlay,
.gal-item:focus .gal-overlay {
  opacity: 1;
}

.gal-zoom {
  font-size: 1.8rem;
  transform: scale(0.7);
  transition: transform var(--transition-normal);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

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

/* Caption sotto foto */
.gal-caption {
  padding: 0.6rem 0.8rem 0.8rem;
  background: var(--color-off-white);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gal-caption p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin: 0;
}

.gal-caption em {
  font-family: var(--font-elegant);
  font-style: italic;
}

/* Badge categoria */
.gal-cat-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  display: inline-block;
  width: fit-content;
}

.altare-badge  { background: rgba(139,105,20,0.12); color: var(--color-primary); }
.navata-badge  { background: rgba(41,128,185,0.12); color: #2980b9; }
.statue-badge  { background: rgba(142,68,173,0.12); color: #8e44ad; }
.crucis-badge  { background: rgba(192,57,43,0.12);  color: #c0392b; }

/* Crediti */
.gal-credit {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: var(--space-xl);
  padding-bottom: var(--space-md);
  border-top: 1px solid rgba(139,105,20,0.1);
  padding-top: var(--space-sm);
}

/* ─── LIGHTBOX ───────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] { display: none; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 10, 5, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}

.lb-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  gap: var(--space-sm);
  animation: lb-in 0.25s ease;
}

@keyframes lb-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.lb-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 80vh;
}

.lb-img {
  max-width: 88vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: block;
}

.lb-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: var(--space-md);
  padding: 0 0.5rem;
}

.lb-caption {
  font-family: var(--font-elegant);
  font-size: 1rem;
  font-style: italic;
  color: rgba(255,255,255,0.8);
  margin: 0;
}

.lb-counter {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* Bottoni lightbox */
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-close {
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.lb-prev, .lb-next {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 1.8rem;
  font-weight: 300;
}

.lb-prev { left: 1.5rem; }
.lb-next { right: 1.5rem; }

.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgba(201,162,39,0.25);
  border-color: rgba(201,162,39,0.4);
  color: white;
  transform: translateY(-50%) scale(1.08);
}

.lb-close:hover { transform: scale(1.08); }

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1200px) {
  .gal-grid { columns: 3; }
}

@media (max-width: 768px) {
  .gal-hero { height: 45vh; min-height: 320px; }
  .gal-strip:nth-child(3),
  .gal-strip:nth-child(4) { display: none; }
  .gal-grid { columns: 2; }
  .gal-filters-inner { gap: 0.4rem; }
  .gal-filter { font-size: 0.75rem; padding: 0.35rem 0.8rem; }
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
  .lb-prev, .lb-next { width: 40px; height: 40px; font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .gal-grid { columns: 1; }
  .gal-strip:nth-child(2) { display: none; }
}
