/* =========================================================
   Gallery — masonry columns + lightbox
   ========================================================= */

.gallery-masonry {
  column-count: 3;
  column-gap: var(--space-6, 24px);
  margin: 0;
  padding: 0;
}

@media (max-width: 900px) {
  .gallery-masonry { column-count: 2; column-gap: 18px; }
}

@media (max-width: 560px) {
  .gallery-masonry { column-count: 1; }
}

.gallery-tile {
  display: block;
  position: relative;
  break-inside: avoid;
  margin: 0 0 var(--space-6, 24px);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  background: var(--cream-100, #f3ece0);
  box-shadow: 0 1px 2px rgba(30, 30, 50, 0.06), 0 8px 24px -12px rgba(30, 30, 50, 0.14);
  cursor: zoom-in;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  text-decoration: none;
  color: inherit;
}

.gallery-tile:hover,
.gallery-tile:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(30, 30, 50, 0.08), 0 20px 40px -16px rgba(30, 30, 50, 0.25);
  outline: none;
}

.gallery-tile img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s ease;
}

.gallery-tile:hover img {
  transform: scale(1.03);
}

.gallery-tile__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 32px 16px 14px;
  color: #fff;
  background: linear-gradient(180deg, rgba(26, 37, 71, 0) 0%, rgba(26, 37, 71, 0.82) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-tile:hover .gallery-tile__overlay,
.gallery-tile:focus-visible .gallery-tile__overlay {
  opacity: 1;
}

.gallery-tile__caption {
  font-family: var(--font-sans, 'Nunito', sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}

.gallery-tile__tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--terracotta-300, #e6b09a);
  margin-bottom: 4px;
}

/* On touch devices where hover isn't reliable, always show a compact caption bar */
@media (hover: none) {
  .gallery-tile__overlay {
    opacity: 1;
    padding: 24px 14px 12px;
  }
  .gallery-tile__tag { display: none; }
  .gallery-tile__caption { font-size: 0.85rem; }
}

/* =========================================================
   Lightbox
   ========================================================= */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 40, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox.is-open {
  display: flex;
  opacity: 1;
}

.lightbox__stage {
  position: relative;
  max-width: min(92vw, 1400px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox__img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  background: #1a2547;
}

.lightbox__caption {
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-sans, 'Nunito', sans-serif);
  font-size: 0.95rem;
  text-align: center;
  margin: 0;
  max-width: 720px;
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
}

.lightbox__btn:hover,
.lightbox__btn:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  outline: none;
  transform: translateY(-50%) scale(1.05);
}

.lightbox__btn--prev { left: -72px; }
.lightbox__btn--next { right: -72px; }

.lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.lightbox__close:hover { background: rgba(255, 255, 255, 0.26); }

.lightbox__counter {
  position: absolute;
  top: 20px;
  left: 20px;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-sans, 'Nunito', sans-serif);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

@media (max-width: 720px) {
  .lightbox__btn--prev { left: 6px; }
  .lightbox__btn--next { right: 6px; }
  .lightbox__btn { width: 44px; height: 44px; font-size: 22px; background: rgba(0,0,0,0.4); }
}
