.lightgallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-block: 2rem;
}

.lightgallery__item {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(18, 73, 144, .12);
}

.lightgallery__item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .25s ease;
}

.lightgallery__item:hover img,
.lightgallery__item:focus-visible img {
  transform: scale(1.035);
}

.lightgallery-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: rgba(3, 10, 22, .96);
  box-sizing: border-box;
}

.lightgallery-dialog::backdrop {
  background: rgba(3, 10, 22, .96);
}

.lightgallery-dialog__stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 64px 92px 78px;
  overflow: hidden;
  box-sizing: border-box;
}

.lightgallery-dialog__image {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.lightgallery-dialog__caption {
  position: absolute;
  right: 88px;
  bottom: 24px;
  left: 88px;
  color: #fff;
  text-align: center;
}

.lightgallery-dialog__button {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 48px;
  height: 48px;
  min-height: 0;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
  font: 700 28px/1 sans-serif;
}

.lightgallery-dialog__button:hover,
.lightgallery-dialog__button:focus-visible {
  background: #c0202d;
}

.lightgallery-dialog__close { top: 20px; right: 20px; }
.lightgallery-dialog__prev { top: 50%; left: 24px; transform: translateY(-50%); }
.lightgallery-dialog__next { top: 50%; right: 24px; transform: translateY(-50%); }

@media (max-width: 760px) {
  .lightgallery { grid-template-columns: 1fr; }
  .lightgallery-dialog__stage {
    padding: max(64px, env(safe-area-inset-top)) 16px max(86px, env(safe-area-inset-bottom));
  }
  .lightgallery-dialog__prev { left: 10px; }
  .lightgallery-dialog__next { right: 10px; }
  .lightgallery-dialog__caption { right: 16px; left: 16px; }
}
