/* ============================================================
   GALLERY PAGE
   ============================================================ */

/* Scroll-progress bar along the top of the filter strip */
.filter-bar {
  position: relative;
}
.filter-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 100%);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s linear;
  pointer-events: none;
}

/* JS in gallery page can drive --scroll-pct; here we hook into it */
body[style*="--scroll-pct"] .filter-bar::after {
  transform: scaleX(var(--scroll-pct, 0));
}

.filter-bar {
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
}

.filter-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 20px 36px;
  border-bottom: 2px solid transparent;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  background: none;
  cursor: pointer;
}
.filter-tab:hover  { color: var(--charcoal); }
.filter-tab.active { color: var(--charcoal); border-bottom-color: var(--gold); }

/* Gallery grid */
.gallery-section {
  padding: 2px 0 0;
  background: var(--cream-light);
  /* last grid block gets bottom breathing room before footer */
  padding-bottom: 80px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 320px;
  grid-auto-flow: dense;
  gap: 10px;
  padding: 10px 12px;
}

/* ---- Gallery item + scroll reveal ---- */
.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--cream-dark);
  border-radius: 10px;
  /* Reveal: start invisible, slide up */
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity   0.72s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.72s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Cascade stagger across the 4-column grid */
.gallery-grid .gallery-item:nth-child(4n+1) { transition-delay: 0ms;   }
.gallery-grid .gallery-item:nth-child(4n+2) { transition-delay: 90ms;  }
.gallery-grid .gallery-item:nth-child(4n+3) { transition-delay: 180ms; }
.gallery-grid .gallery-item:nth-child(4n+4) { transition-delay: 270ms; }

.gallery-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Once revealed, don't apply reveal delay on hover transitions */
.gallery-item.visible img {
  transition-delay: 0ms;
}

.gallery-tall  { grid-row: span 2; }
.gallery-wide  { grid-column: span 2; }

/* Parallax image — scale gives room for the ±22px shift without gaps */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
  transform: translateY(var(--py, 0px)) scale(1.14);
  transition: transform 0.6s var(--ease);
  will-change: transform;
}

.gallery-item:hover img {
  transform: translateY(var(--py, 0px)) scale(1.22);
}

/* ---- Parallax break sections ---- */
.gallery-parallax-break {
  height: 58vh;
  min-height: 340px;
  background-size: cover;
  background-position: center 30%;
  background-attachment: fixed;
  position: relative;
  margin: 10px 12px;
  border-radius: 14px;
  overflow: hidden;
}

.parallax-break-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 8, 5, 0.55) 0%,
    rgba(10, 8, 5, 0.20) 60%,
    transparent 100%
  );
  display: flex;
  align-items: flex-end;
  padding: clamp(32px, 5vw, 72px);
}

.parallax-break-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parallax-break-inner--right {
  margin-left: auto;
  text-align: right;
}

.parallax-break-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
}

.parallax-break-title {
  display: block;
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: clamp(32px, 4.5vw, 68px);
  font-weight: 400;
  font-optical-sizing: auto;
  font-variation-settings: 'opsz' 96;
  line-height: 1.05;
  color: var(--cream-light);
  -webkit-font-smoothing: antialiased;
}

.parallax-break-title em {
  font-style: italic;
  color: rgba(184, 147, 90, 0.9);
}

.gallery-item-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream-dark);
  border: 1px solid var(--border);
  text-align: center;
  padding: 20px;
}

.gallery-item-placeholder span {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}

/* Hide placeholder when image loads */
.gallery-item img[src]:not([src=""]) ~ .gallery-item-placeholder { display: none; }

.gallery-item-hover {
  position: absolute;
  inset: 0;
  background: rgba(26,21,16,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.gallery-item:hover .gallery-item-hover { opacity: 1; }

.gallery-item-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-light);
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

.gallery-item-expand {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  transition: all var(--dur);
  flex-shrink: 0;
}

.gallery-item-expand:hover {
  background: var(--gold);
  border-color: var(--gold);
}

/* Filtered out */
.gallery-item[data-hidden="true"] {
  display: none;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10,10,10,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.lightbox-caption {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 28px;
  cursor: pointer;
  transition: color var(--dur);
  padding: 12px;
  line-height: 1;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { color: var(--gold); }

.lightbox-close { top: 24px; right: 24px; font-size: 32px; }
.lightbox-prev  { left: 24px;  top: 50%; transform: translateY(-50%); font-size: 40px; }
.lightbox-next  { right: 24px; top: 50%; transform: translateY(-50%); font-size: 40px; }

/* Responsive */
@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 220px; }
  .gallery-tall, .gallery-wide { grid-row: span 1; grid-column: span 1; }
  .filter-tab { padding: 14px 18px; }
  /* background-attachment: fixed doesn't work well on iOS — fall back to scroll */
  .gallery-parallax-break {
    background-attachment: scroll;
    background-position: center center;
  }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: 180px; }
  .gallery-parallax-break { height: 44vh; min-height: 220px; }
}
