/* ============================================================
   GALLERY PAGE — Filters, masonry grid, lightbox
   ============================================================ */

/* ============================================================
   HERO
   ============================================================ */
.gallery-hero {
  background:
    radial-gradient(ellipse 50% 40% at 30% 60%, rgba(92, 26, 42, 0.35) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 70% 40%, rgba(58, 14, 27, 0.25) 0%, transparent 70%),
    var(--bg-deep);
}

/* ============================================================
   FILTERS — sticky below nav
   ============================================================ */
.gallery-filters {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 5, 8, 0.88);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  padding: 20px 0;
  transition: box-shadow 0.4s var(--ease);
}
.gallery-filters.scrolled {
  box-shadow: 0 8px 40px -12px rgba(0, 0, 0, 0.6);
}
.gallery-filters-inner {
  width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.gallery-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.gallery-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(26, 10, 15, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s var(--ease);
  white-space: nowrap;
  font-family: var(--font-body);
}
.gallery-filter-pill:hover {
  border-color: rgba(212, 175, 55, 0.35);
  color: var(--cream);
  background: rgba(92, 26, 42, 0.25);
}
.gallery-filter-pill.active {
  background: var(--gold);
  color: var(--bg-deep);
  border-color: var(--gold);
  font-weight: 600;
}
.gallery-filter-pill .count {
  display: inline-block;
  font-size: 10px;
  opacity: 0.7;
  padding-left: 2px;
}
.gallery-photo-count {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ============================================================
   GRID — masonry-style
   ============================================================ */
.gallery-grid-wrap {
  width: var(--container);
  margin: 0 auto;
  padding: 48px 0 var(--section-pad);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  grid-auto-flow: dense;
  gap: 16px;
}
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  cursor: zoom-in;
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.08);
  isolation: isolate;
  opacity: 0;
  transform: translateY(20px);
  animation: galleryFadeIn 0.6s var(--ease) forwards;
}
@keyframes galleryFadeIn {
  to { opacity: 1; transform: translateY(0); }
}
.gallery-item.span-tall { grid-row: span 2; }
.gallery-item.span-wide { grid-column: span 2; }
.gallery-item.span-big { grid-row: span 2; grid-column: span 2; }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s var(--ease), filter 0.5s var(--ease);
  filter: brightness(0.92) saturate(1.05);
}
.gallery-item:hover img {
  transform: scale(1.06);
  filter: brightness(1) saturate(1.1);
}
.gallery-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(13, 5, 8, 0.85) 100%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  z-index: 2;
  pointer-events: none;
}
.gallery-item:hover::before { opacity: 1; }

.gallery-caption {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
  pointer-events: none;
}
.gallery-item:hover .gallery-caption {
  transform: translateY(0);
  opacity: 1;
}
.gallery-caption p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  line-height: 1.3;
  color: var(--cream);
  margin: 0;
  flex: 1;
}
.gallery-caption .zoom-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg-deep);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}
.gallery-caption .zoom-icon svg {
  width: 14px;
  height: 14px;
}

/* Empty state */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
}
.gallery-empty p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  color: var(--cream-muted);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 2, 4, 0.94);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
  padding: 80px 80px 60px;
}
.gallery-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}
body.lightbox-open {
  overflow: hidden;
}

.lightbox-stage {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease);
}
.gallery-lightbox.active .lightbox-img {
  transform: scale(1);
  opacity: 1;
}
.lightbox-img.swipe-next { animation: swipeNext 0.35s var(--ease); }
.lightbox-img.swipe-prev { animation: swipePrev 0.35s var(--ease); }
@keyframes swipeNext {
  0% { transform: translateX(40px) scale(0.96); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes swipePrev {
  0% { transform: translateX(-40px) scale(0.96); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

/* Close */
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(26, 10, 15, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--cream);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  z-index: 2;
}
.lightbox-close:hover {
  background: var(--wine);
  border-color: var(--gold);
  color: var(--gold);
  transform: rotate(90deg);
}
.lightbox-close svg {
  width: 18px;
  height: 18px;
}

/* Prev / Next */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(26, 10, 15, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--cream);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  z-index: 2;
}
.lightbox-nav:hover {
  background: var(--wine);
  border-color: var(--gold);
  color: var(--gold);
}
.lightbox-nav.prev { left: 24px; }
.lightbox-nav.next { right: 24px; }
.lightbox-nav svg { width: 22px; height: 22px; }

/* Caption + counter */
.lightbox-info {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  width: 100%;
  text-align: center;
}
.lightbox-caption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  line-height: 1.3;
  color: var(--cream);
  margin: 0;
}
.lightbox-counter {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Swipe hint line for mobile */
.lightbox-swipe-hint {
  display: none;
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  pointer-events: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .gallery-filters { padding: 14px 0; }
  .gallery-filters-inner { gap: 12px; }
  .gallery-filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    width: 100%;
  }
  .gallery-filter-pills::-webkit-scrollbar { display: none; }
  .gallery-filter-pill {
    padding: 7px 16px;
    font-size: 11px;
  }
  .gallery-photo-count { display: none; }

  .gallery-grid-wrap { padding: 32px 0 60px; }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 160px;
    gap: 10px;
  }
  .gallery-item.span-wide { grid-column: span 2; }
  .gallery-item.span-tall { grid-row: span 2; }
  .gallery-item.span-big  { grid-row: span 2; grid-column: span 2; }

  .gallery-caption {
    left: 14px;
    right: 14px;
    bottom: 14px;
    opacity: 1;
    transform: translateY(0);
  }
  .gallery-item::before { opacity: 1; }
  .gallery-caption p { font-size: 13px; }
  .gallery-caption .zoom-icon { width: 28px; height: 28px; }

  .gallery-lightbox {
    padding: 56px 12px 40px;
  }
  .lightbox-close {
    width: 40px; height: 40px;
    top: 14px; right: 14px;
  }
  .lightbox-nav {
    width: 44px; height: 44px;
  }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
  .lightbox-caption { font-size: 16px; }
  .lightbox-swipe-hint { display: block; }
}
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 220px;
  }
  .gallery-item.span-wide { grid-column: span 1; }
  .gallery-item.span-big  { grid-row: span 2; grid-column: span 1; }
}
