/* ============================================================
   GALLERY.CSS — MNB Excavation
   ============================================================ */

/* ── Gallery Filter Bar ── */
.gallery-filter-bar {
  background: var(--clr-surface-light);
  border-bottom: 2px solid var(--clr-surface-mid);
  padding: 0;
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
}
.gallery-filter-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery-filter-tabs::-webkit-scrollbar { display: none; }
.gf-tab {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-navy);
  padding: 1rem 1.5rem;
  border-bottom: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.gf-tab:hover { color: var(--clr-navy); }
.gf-tab.active {
  color: var(--clr-navy);
  border-bottom-color: var(--clr-navy);
}

/* ── Gallery Section ── */
.gallery-section { background: #f8f8f8; }

/* ── Masonry Grid ── */
.gallery-masonry {
  columns: 3;
  column-gap: 1rem;
  orphans: 1;
  widows: 1;
}

/* ── Gallery Items ── */
.gallery-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  break-inside: avoid;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  transition: transform var(--transition), box-shadow var(--transition);
}
.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}
.gallery-item:hover img { transform: scale(1.06); }

/* Overlay */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26,18,9,0.85) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity var(--transition);
  gap: 0.6rem;
}
.gallery-item:hover .gallery-overlay,
.gallery-item:focus-within .gallery-overlay { opacity: 1; }
.gallery-label {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.9);
  text-align: center;
  text-transform: uppercase;
}
.gallery-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--clr-accent);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.gallery-view-btn:hover { background: #c94e00; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-img {
  max-width: 88vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  animation: scaleIn 0.3s ease;
}
@keyframes scaleIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lightbox-spinner {
  position: absolute;
  color: var(--clr-accent);
  font-size: 2rem;
  display: none;
}
.lightbox-spinner.loading { display: block; }

.lightbox-close {
  position: fixed;
  top: 1rem; right: 1.5rem;
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  z-index: 10;
}
.lightbox-close:hover { background: var(--clr-accent); border-color: var(--clr-accent); }

.lightbox-nav {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.lightbox-nav:hover { background: var(--clr-accent); border-color: var(--clr-accent); }

.lightbox-caption {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  text-align: center;
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.lightbox-counter {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.45);
  font-size: 0.8rem;
  font-family: var(--font-heading);
  letter-spacing: 0.1em;
}

/* ── Responsive ── */
@media (max-width: 992px) {
  .gallery-masonry { columns: 2; }
}
@media (max-width: 576px) {
  .gallery-masonry { columns: 1; }
  .lightbox-nav { width: 40px; height: 40px; font-size: 0.9rem; }
  .lightbox-caption { font-size: 0.78rem; bottom: 2rem; white-space: normal; text-align: center; padding: 0 1rem; width: 100%; }
  .gf-tab { padding: 0.85rem 1rem; font-size: 0.78rem; }
}
