/* ============================================================
   GALLERY — CSS masonry grid with lightbox
   ============================================================ */

.gallery__heading {
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  margin-top: var(--space-3);
}

.gallery__subhead {
  max-width: 520px;
  margin-inline: auto;
  margin-top: var(--space-4);
  color: var(--color-cream-muted);
}

/* ── Masonry grid (CSS columns approach) ── */
.gallery__grid {
  columns: 3;
  column-gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ── Gallery item ── */
.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--space-3);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-charcoal-border);
  transition: all var(--transition-base);
  display: block;
}

.gallery-item:hover {
  border-color: rgba(200, 169, 110, 0.45);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--color-champagne-glow);
  transform: translateY(-3px);
}

/* ── Photo placeholders (kept for any remaining empty slots) ── */
.photo-placeholder--gallery {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0;
  border: none;
  display: block;
}

.gallery-item--tall .photo-placeholder--gallery {
  aspect-ratio: 3 / 4;
}

.gallery-item--wide .photo-placeholder--gallery {
  aspect-ratio: 16 / 9;
}

/* ── Real images ── */
.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.6s var(--ease-out);
  border-radius: 0;
}

/* Tall items show more height — portrait orientation */
.gallery-item--tall img {
  aspect-ratio: 3 / 4;
  object-position: center 20%;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ── Caption overlay ── */
.gallery-item__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(
    to top,
    rgba(13, 13, 13, 0.9) 0%,
    transparent 100%
  );
  font-size: var(--text-xs);
  color: var(--color-cream-muted);
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition-base);
}

.gallery-item:hover .gallery-item__caption {
  opacity: 1;
  transform: translateY(0);
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox__close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  font-size: var(--text-xl);
  color: var(--color-cream-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  line-height: 1;
  transition: color var(--transition-fast), transform var(--transition-fast);
  z-index: 1;
}

.lightbox__close:hover {
  color: var(--color-cream);
  transform: rotate(90deg);
}

.lightbox__content {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.lightbox__img {
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

.lightbox__caption {
  font-size: var(--text-sm);
  color: var(--color-cream-muted);
  text-align: center;
  font-family: var(--font-sans);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .gallery__grid {
    columns: 2;
  }
}

@media (max-width: 640px) {
  .gallery__grid {
    columns: 1;
  }
}
