/* ===== Lightbox base ===== */
.pg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  opacity: 0;            /* mostrato via .is-open */
  visibility: hidden;
  z-index: 9999;
  transition: .6s;
}

.pg-overlay.is-open {opacity: 1;visibility: visible;}

.pg-content {
  position: absolute;
  inset: 0;
  display: flex;
  place-items: center;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.pg-image-wrap {
  position: initial;
  width: calc(100% - 160px);
  height: calc(100% - 160px);
  overflow: hidden;
}

.pg-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  overflow-clip-margin: initial;
}

/* ===== Frecce ===== */
.pg-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #fff;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  display: flex;
  place-items: center;
  transition: background .2s ease;
  user-select: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pg-arrow:hover {/* background: rgba(255,255,255,.25); */}

.pg-prev {left: 30px;}
.pg-next {right: 30px;}

/* ===== Close (la tua X) ===== */
.pg-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  z-index: 1;
}

.pg-close .contenitore-x {
  position: relative;
  width: 100%;
  height: 100%;
}

.pg-close .linea {
  position: absolute;
  left: -3px;
  right: 8px;
  top: 50%;
  height: 4px;
  background: var(--color3);
  transform-origin: 50% 50%;
  border-radius: 1px;
}

.pg-close .linea:first-child { transform: translateY(-50%) rotate(45deg); }
.pg-close .linea:last-child  { transform: translateY(-50%) rotate(-45deg); }

/* ===== Blocca lo scroll della pagina quando aperto ===== */
.pg-no-scroll {/* overflow: hidden; */}

/* Cursori/UX */
.pg-overlay, .pg-image {/* cursor: zoom-out; */}
.pg-arrow, .pg-close { cursor: pointer; }

/* Touch: allarga target su mobile */
@media (max-width: 768px) {
  .pg-arrow { width: 56px; height: 56px; font-size: 30px; }
}



.pg-stack { 
  position: relative; 
  width: 100%; 
  height: 100%;
}

.pg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;       /* il click sull'immagine NON chiude */
  will-change: opacity;
}
.pg-image.active {
  opacity: 1;
  pointer-events: auto;
}


@media(max-width:767px){
  .pg-image-wrap {
  position: initial;
  width: calc(100% - 30px);
  height: calc(100% - 30px);
  overflow: hidden;
}
}