/* Masonry grid */
.photo-grid {
  column-count: 3;
  column-gap: 12px;
  padding: 24px 40px;
}

.photo-item {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-surface);
  min-height: 120px;
}

.photo-item.has-img {
  min-height: 0;
}

.photo-item:hover {
  opacity: 0.85;
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.photo-item img.loaded {
  opacity: 1;
}

/* External sentinel for infinite scroll */
#photoSentinel {
  height: 1px;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  background: none;
  border: none;
  line-height: 1;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  background: none;
  border: none;
  padding: 16px;
  line-height: 1;
}

.lightbox-arrow:hover {
  opacity: 1;
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
  .photo-grid {
    column-count: 2;
    padding: 20px 24px;
  }
}

@media (max-width: 768px) {
  .photo-grid {
    column-count: 2;
    column-gap: 8px;
    padding: 12px 16px;
  }

  .photo-item {
    margin-bottom: 8px;
  }
}
