/* ---------- Gallery page (gallery.php) ---------- */

.pm-gallery { max-width: 1200px; margin: 0 auto; padding: 0 40px 120px; }
.pm-gallery__empty { color: #8a8780; }

/* Masonry: CSS columns keep each photo at its natural proportions */
.pm-masonry { column-count: 3; column-gap: 18px; }
.pm-masonry__item {
  position: relative;
  display: block;
  margin: 0 0 18px;
  break-inside: avoid;
  border-radius: 20px;
  overflow: hidden;
  background: #e9e5dc;
  cursor: zoom-in;
  /* fade-in on scroll (js/gallery.js adds .is-visible) */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
}
.pm-masonry__item.is-visible { opacity: 1; transform: none; }
.pm-masonry__item img {
  width: 100%;
  height: auto;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1), filter .4s ease;
}
.pm-masonry__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.35));
  opacity: 0;
  transition: opacity .4s ease;
}
.pm-masonry__item:hover img { transform: scale(1.04); }
.pm-masonry__item:hover::after { opacity: 1; }
.pm-masonry__zoom {
  position: absolute;
  right: 14px; bottom: 14px;
  z-index: 1;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  color: #fff;
  background: var(--primary, #FC4805);
  border-radius: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}
.pm-masonry__item:hover .pm-masonry__zoom { opacity: 1; transform: none; }
.pm-masonry__item:focus-visible { outline: 3px solid var(--primary, #FC4805); outline-offset: 3px; }

@media (max-width: 1023.98px) { .pm-masonry { column-count: 2; } }
@media (max-width: 600px) {
  .pm-gallery { padding: 0 16px 80px; }
  .pm-masonry { column-count: 1; }
  .pm-masonry__item { border-radius: 16px; margin-bottom: 14px; }
}

/* ---- Lightbox ---- */
.pm-glb {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center;
  padding: 72px 80px;
  background: rgba(8, 8, 10, 0.92);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}
.pm-glb.is-open { opacity: 1; visibility: visible; }
.pm-glb__img {
  max-width: 100%;
  max-height: calc(100vh - 144px);
  border-radius: 16px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .6);
  object-fit: contain;
}
.pm-glb__btn {
  position: absolute;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: background .2s ease;
}
.pm-glb__btn:hover { background: var(--primary, #FC4805); }
.pm-glb__btn:focus-visible { outline: 2px solid var(--primary, #FC4805); outline-offset: 2px; }
.pm-glb__close { top: 18px; right: 18px; }
.pm-glb__prev { left: 18px; top: 50%; transform: translateY(-50%); }
.pm-glb__next { right: 18px; top: 50%; transform: translateY(-50%); }
.pm-glb__count {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  font-size: 14px; color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
}
html.pm-glb-open { overflow: hidden; }
html.pm-glb-open .pm-header { visibility: hidden; }

@media (max-width: 600px) {
  .pm-glb { padding: 64px 12px; }
  .pm-glb__prev, .pm-glb__next { top: auto; bottom: 12px; transform: none; }
}
