.masonry-gallery {
  column-count: 4;
  column-gap: 12px;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  cursor: pointer;
}
.masonry-item img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.gallery-credit {
  text-align: center;
  color: whitesmoke;
  font-size: 16px;
  margin: 1rem auto 2rem auto;
  line-height: 24px;
}

.gallery-credit a:hover {
  text-decoration: underline;
}

.gallery-credit-edit {
  color: rgb(200, 200, 200);
  font-size: 14px;
}

.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox.active {
  display: flex;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
}
.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  font-size: 24px;
  padding: 15px 20px;
  cursor: pointer;
  border-radius: 5px;
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

@media screen and (max-width: 900px) {
  .masonry-gallery { column-count: 3; }
}
@media screen and (max-width: 600px) {
  .masonry-gallery { column-count: 2; column-gap: 8px; }
}