/* Istruttrici: griglia a 3 colonne e ingrandimento foto (modale). Solo sito pubblico. */
.pi-team-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 32px);
  align-items: start;
}
.pi-team-grid > .wp-block-image {
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0;
}
.pi-team-grid > .wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}
.pi-team-grid > .wp-block-image figcaption { text-align: center; }
.pi-team-grid > .wp-block-image img:focus-visible { outline: 3px solid #f76d3e; outline-offset: 4px; }
@media (max-width: 781px) {
  .pi-team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Modale */
.pi-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(24, 57, 82, .88);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.pi-lightbox.is-open { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.pi-lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pi-lightbox img {
  display: block; max-width: 100%; max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px);
  width: auto; height: auto; object-fit: contain; border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .4); background: #fff;
}
.pi-lightbox figcaption { color: #fff; font: 600 1.1rem/1.3 Montserrat, Arial, sans-serif; text-align: center; }
.pi-lightbox-close {
  position: absolute; top: 12px; right: 12px;
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  border: 1px solid #fff; border-radius: 4px; background: #183952; color: #fff; cursor: pointer;
}
.pi-lightbox-close:hover { background: #316faf; }
.pi-lightbox-close:focus-visible { outline: 3px solid #f76d3e; outline-offset: 3px; }
.pi-lightbox-close svg { display: block; pointer-events: none; }
body.pi-lightbox-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .pi-lightbox, .pi-lightbox.is-open { transition: none; } }
