/* Farebene Gallerie Storiche - Stile Petrolio & Arancio + Lightbox con Zoom Documenti */
.fb-ngg-wrap {
  background: #FAF9F6;
  border: 1px solid #DCE5E8;
  border-radius: 16px;
  padding: 24px;
  margin: 36px 0;
  box-shadow: 0 4px 18px rgba(9, 52, 63, 0.04);
}

.fb-ngg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #DCE5E8;
}

.fb-ngg-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #09343F;
}

.fb-ngg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EA6820;
  display: inline-block;
}

.fb-ngg-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: #136375;
  background: #E3EFF2;
  padding: 4px 11px;
  border-radius: 999px;
}

.fb-ngg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

.fb-ngg-item {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #DCE5E8;
  border-radius: 11px;
  padding: 6px;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(9, 52, 63, 0.04);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  cursor: zoom-in;
  overflow: hidden;
}

.fb-ngg-item:hover {
  transform: translateY(-3px);
  border-color: #EA6820;
  box-shadow: 0 10px 24px rgba(9, 52, 63, 0.12);
}

.fb-ngg-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  overflow: hidden;
  background: #F1F6F8;
}

.fb-ngg-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transition: transform 0.35s ease;
}

.fb-ngg-item:hover .fb-ngg-thumb img {
  transform: scale(1.05);
}

.fb-ngg-zoom-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(9, 52, 63, 0.82);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  pointer-events: none;
}

.fb-ngg-item:hover .fb-ngg-zoom-badge {
  opacity: 1;
  transform: scale(1);
  background: #EA6820;
}

.fb-ngg-cap {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #364B52;
  padding: 8px 4px 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------- LIGHTBOX FULLSCREEN CON ZOOM DOCUMENTI ---------------- */
.fb-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(6, 28, 35, 0.95);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.fb-lb-overlay.is-open {
  display: flex;
  opacity: 1;
}

.fb-lb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(6, 22, 28, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  flex-shrink: 0;
  gap: 12px;
}

.fb-lb-counter {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #FCD6BE;
  background: rgba(255, 255, 255, 0.08);
  padding: 5px 12px;
  border-radius: 999px;
}

.fb-lb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-lb-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.fb-lb-btn:hover {
  background: #EA6820;
  border-color: #EA6820;
}

.fb-lb-btn.is-active {
  background: #EA6820;
  border-color: #EA6820;
}

.fb-lb-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px 64px;
}

.fb-lb-overlay.is-zoomed .fb-lb-stage {
  align-items: flex-start;
  overflow: auto;
  padding: 24px 16px 40px;
}

.fb-lb-img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  cursor: zoom-in;
  transition: transform 0.2s ease;
  background: #FFFFFF;
}

.fb-lb-overlay.is-zoomed .fb-lb-img {
  max-height: none;
  width: min(1320px, 94vw);
  max-width: none;
  cursor: zoom-out;
  margin: 0 auto;
}

.fb-lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000002;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(9, 52, 63, 0.82);
  color: #FFFFFF;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease;
}

.fb-lb-nav:hover {
  background: #EA6820;
  border-color: #EA6820;
}

.fb-lb-prev { left: 16px; }
.fb-lb-next { right: 16px; }

.fb-lb-caption {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.92rem;
  padding: 10px 24px 16px;
  background: rgba(6, 22, 28, 0.75);
  min-height: 20px;
  flex-shrink: 0;
}

.fb-lb-caption:empty {
  display: none;
}

@media (max-width: 680px) {
  .fb-ngg-wrap {
    padding: 16px;
  }
  .fb-ngg-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .fb-lb-stage {
    padding: 12px 12px;
  }
  .fb-lb-nav {
    width: 38px;
    height: 38px;
    top: auto;
    bottom: 20px;
    transform: none;
  }
  .fb-lb-prev { left: 20px; }
  .fb-lb-next { right: 20px; }
  .fb-lb-btn span.fb-lb-hide-sm {
    display: none;
  }
}
