.pm-gallery {
  margin: 1rem 0 1.5rem;
}

.pm-gallery__hint {
  text-align: center;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.pm-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.pm-gallery__item {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f3f3;
}

.pm-gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.pm-gallery__item:hover img {
  transform: scale(1.03);
}

.pm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  background: rgba(0, 0, 0, 0.92);
  touch-action: pan-y;
}

.pm-lightbox.is-open {
  display: block;
}

.pm-lightbox__viewport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 12px 56px;
}

.pm-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.pm-lightbox__btn,
.pm-lightbox__close {
  position: absolute;
  z-index: 2;
  border: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  line-height: 1;
}

.pm-lightbox__btn {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 28px;
}

.pm-lightbox__prev {
  left: 10px;
}

.pm-lightbox__next {
  right: 10px;
}

.pm-lightbox__close {
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 30px;
}

.pm-lightbox__counter {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 10px;
  border-radius: 999px;
}

@media (max-width: 640px) {
  .pm-gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .pm-lightbox__btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
}
