/* ═══════════════════════════════════════════════════════════════════════
   Lavrenroof — Gallery
   gallery.css · Masonry layout (masonry-layout@4 + imagesloaded@5)
   ═══════════════════════════════════════════════════════════════════════ */

.gallery-section {
  background: var(--bg);
  padding: var(--s-11) 0;
  position: relative;
}

/* ─── Header ──────────────────────────────────────────────────────── */
.gallery-head {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 80px;
  align-items: end;
  margin-bottom: var(--s-9);
}
.gallery-head h2 { max-width: 16ch; }
.gallery-head .meta { max-width: 44ch; color: var(--ink-3); }
.gallery-head .meta p { color: var(--ink-3); }
.gallery-section .eyebrow { margin-bottom: 24px; }

/* ─── MASONRY GRID ────────────────────────────────────────────────── */
/* position: relative is required for Masonry's absolute positioning  */
.gallery-grid {
  position: relative;
}

/* Sizer element injected by gallery.js — defines column width for Masonry */
/* 4 cols, 16px gutter: (containerW + 16) / (sizerW + 16) = 4            */
/* → sizerW = (100% - 3×16px) / 4 = 25% - 12px                          */
.gallery-sizer { width: calc(25% - 12px); }

.gallery-item {
  width: calc(25% - 12px);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-3);
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  /* Entrance: clean fade-up, no blur */
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 500ms var(--ease),
    transform 550ms var(--ease-power);
  will-change: opacity, transform;
}

.gallery-item.is-in {
  opacity: 1;
  transform: none;
}

/* Natural image height — Masonry uses it to calculate row placement */
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 700ms var(--ease-power);
  will-change: transform;
}
.gallery-item:hover img { transform: scale(1.05); }

/* Hover overlay — dark gradient + meta info */
.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 9, 8, 0) 40%, rgba(10, 9, 8, 0.85) 100%);
  opacity: 0;
  transition: opacity 320ms var(--ease);
  pointer-events: none;
  z-index: 1;
}
.gallery-item:hover::before { opacity: 1; }

.gallery-meta {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 360ms var(--ease) 80ms,
    transform 380ms var(--ease) 80ms;
  pointer-events: none;
}
.gallery-item:hover .gallery-meta {
  opacity: 1;
  transform: none;
}
.gallery-meta-text {
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  max-width: 220px;
}
.gallery-meta-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
  margin-top: 6px;
}

/* Zoom icon — appears bottom-right on hover */
.gallery-zoom {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 320ms var(--ease);
}
.gallery-item:hover .gallery-zoom { background: var(--accent); }
.gallery-zoom svg { width: 16px; height: 16px; }

/* Focus state for keyboard nav */
.gallery-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ─── HIDDEN / LOAD MORE ──────────────────────────────────────────── */
.gallery-item.gallery-hidden {
  display: none !important;
}

.gallery-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}

.gallery-load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */
/* 3 cols, 16px gutter: sizerW = (100% - 2×16) / 3 ≈ 33.333% - 10.667px */
@media (max-width: 1280px) {
  .gallery-sizer,
  .gallery-item { width: calc(33.333% - 10.667px); }
}

@media (max-width: 1100px) {
  .gallery-head { grid-template-columns: 1fr; gap: 32px; }
  .gallery-head h2 { max-width: 24ch; }
}

/* 2 cols, 16px gutter: sizerW = (100% - 1×16) / 2 = 50% - 8px */
@media (max-width: 700px) {
  .gallery-sizer,
  .gallery-item { width: calc(50% - 8px); }
  .gallery-item { margin-bottom: 12px; }
  .gallery-meta { left: 12px; right: 12px; bottom: 12px; }
  .gallery-meta-text { font-size: 12px; }
  .gallery-zoom { width: 32px; height: 32px; }
  .gallery-zoom svg { width: 14px; height: 14px; }
}

/* ─── REDUCED MOTION ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gallery-item {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .gallery-item img,
  .gallery-meta,
  .gallery-item::before {
    transition: none !important;
    transform: none !important;
  }
}
