/* Gallery page — masonry grid + lightbox.
   Inherits tokens/fonts/header/footer from styles.css */

.gallery-hero {
  position: relative; text-align: center;
  padding: clamp(50px, 8vw, 96px) 0 clamp(34px, 5vw, 56px);
  background:
    linear-gradient(180deg, rgba(138,74,28,.06), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.gallery-hero h1 { max-width: 880px; margin: 6px auto 0; }
.gallery-hero .eyebrow { margin-inline: auto; }
.gallery-hero-sub { max-width: 620px; margin: 18px auto 0; color: var(--muted); font-size: 1.06rem; }

/* Masonry via CSS columns — keeps WhatsApp portrait/landscape photos natural */
.gallery-masonry {
  column-count: 4;
  column-gap: 16px;
}
@media (max-width: 1024px) { .gallery-masonry { column-count: 3; } }
@media (max-width: 720px)  { .gallery-masonry { column-count: 2; } }
@media (max-width: 420px)  { .gallery-masonry { column-count: 1; } }

.g-item {
  display: block; width: 100%; margin: 0 0 16px; padding: 0;
  border: 0; background: none; cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
  break-inside: avoid;
  position: relative;
  transition: transform .35s var(--ease), box-shadow .35s;
}
.g-item img {
  width: 100%; height: auto; display: block;
  transition: transform .5s var(--ease), filter .35s;
  background: var(--surface-soft);
}
.g-item::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(42,27,14,.32));
  opacity: 0; transition: opacity .35s;
}
.g-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.g-item:hover img { transform: scale(1.05); }
.g-item:hover::after { opacity: 1; }
.g-item:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(26, 16, 8, .92);
  backdrop-filter: blur(6px);
  opacity: 0; animation: lbFade .25s var(--ease) forwards;
}
.lightbox[hidden] { display: none; }
@keyframes lbFade { to { opacity: 1; } }

.lb-figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lb-figure img {
  max-width: min(92vw, 1100px); max-height: 80vh;
  width: auto; height: auto; object-fit: contain;
  border-radius: 12px; box-shadow: var(--shadow-lg);
  background: #2a1b0e;
}
.lb-count { color: rgba(255,255,255,.8); font-size: .9rem; font-weight: 700; letter-spacing: .04em; }

.lb-close, .lb-nav {
  position: absolute; z-index: 2; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  color: #fff; transition: background .25s, transform .25s;
}
.lb-close .icon, .lb-nav .icon { width: 24px; height: 24px; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-close { top: clamp(12px, 3vw, 28px); right: clamp(12px, 3vw, 28px); }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-nav:hover { transform: translateY(-50%) scale(1.06); }
.lb-prev { left: clamp(10px, 2vw, 26px); }
.lb-prev .icon { transform: rotate(180deg); }
.lb-next { right: clamp(10px, 2vw, 26px); }

.lb-close:focus-visible, .lb-nav:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

@media (max-width: 560px) {
  .lb-nav { width: 44px; height: 44px; }
  .lb-figure img { max-height: 72vh; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox { animation: none; opacity: 1; }
  .g-item, .g-item img { transition: none; }
}

.gallery-empty {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  font-size: 1.05rem; padding: 40px 0;
}
