/* ===== GALLERY HERO ===== */
.gal-hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.gal-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
}
.gal-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(17,17,17,0.3) 0%, rgba(17,17,17,0.65) 100%);
}
.gal-hero__content {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
  width: 100%;
  text-align: center;
}
.gal-hero__eyebrow {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.gal-hero__eyebrow::before, .gal-hero__eyebrow::after {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--orange);
}
.gal-hero__title {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 300;
  color: #fff;
  line-height: 1.05;
  margin-bottom: 24px;
}
.gal-hero__title em { font-style: italic; color: var(--orange); }
.gal-hero__count {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255,255,255,.6);
}
.gal-hero__count span { color: var(--orange); }

/* ===== FILTER ===== */
.gal-filter {
  background: #fff;
  border-bottom: 1px solid rgba(17,17,17,.08);
  border-top: 1px solid rgba(17,17,17,.06);
  padding: 20px 0;
  position: sticky;
  top: 72px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.gal-filter__inner { display: flex; gap: 12px; flex-wrap: wrap; max-width: 1400px; margin: 0 auto; padding: 0 32px; }
.gal-filter__btn {
  background: rgba(17,17,17,.04);
  border: 1px solid rgba(17,17,17,.1);
  color: rgba(17,17,17,.55);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 100px;
  cursor: none;
  transition: all .3s;
}
.gal-filter__btn:hover, .gal-filter__btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

/* ===== GALLERY GRID ===== */
.gal-section { background: #F7F5F2; padding: 60px 0 100px; }

.gal-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  columns: 4;
  column-gap: 12px;
}

.gal-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  background: #e8e4de;
  break-inside: avoid;
  margin-bottom: 12px;
  display: block;
}

/* Varied heights via nth-child patterns */
.gal-item:nth-child(1)  { aspect-ratio: 3/4; }
.gal-item:nth-child(2)  { aspect-ratio: 4/3; }
.gal-item:nth-child(3)  { aspect-ratio: 1/1; }
.gal-item:nth-child(4)  { aspect-ratio: 2/3; }
.gal-item:nth-child(5)  { aspect-ratio: 16/9; }
.gal-item:nth-child(6)  { aspect-ratio: 3/4; }
.gal-item:nth-child(7)  { aspect-ratio: 4/5; }
.gal-item:nth-child(8)  { aspect-ratio: 3/2; }
.gal-item:nth-child(9)  { aspect-ratio: 1/1; }
.gal-item:nth-child(10) { aspect-ratio: 2/3; }
.gal-item:nth-child(11) { aspect-ratio: 4/3; }
.gal-item:nth-child(12) { aspect-ratio: 3/4; }
.gal-item:nth-child(13) { aspect-ratio: 16/9; }
.gal-item:nth-child(14) { aspect-ratio: 1/1; }
.gal-item:nth-child(15) { aspect-ratio: 3/4; }
.gal-item:nth-child(16) { aspect-ratio: 4/3; }
.gal-item:nth-child(n+17):nth-child(odd)  { aspect-ratio: 3/4; }
.gal-item:nth-child(n+17):nth-child(even) { aspect-ratio: 4/3; }

/* Remove old span/wide modifiers — columns handles layout */
.gal-item--tall, .gal-item--wide { /* reset */ }

.gal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s var(--ease);
  display: block;
}
.gal-item:hover img { transform: scale(1.07); }

.gal-item__info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 18px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.82) 0%, transparent 100%);
  transform: translateY(6px);
  opacity: 0;
  transition: all .35s var(--ease);
}
.gal-item:hover .gal-item__info { transform: translateY(0); opacity: 1; }
.gal-item__info span {
  display: block;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}
.gal-item__info p {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Zoom indicator on hover */
.gal-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  transition: border-color .3s;
  pointer-events: none;
}
.gal-item:hover::after { border-color: rgba(232,98,10,.5); }

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.97);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.lightbox.open { opacity: 1; pointer-events: all; }

/* Zoom container */
.lightbox__zoom-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox__img-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  /* Slide animation only — zoom is on the img itself */
  user-select: none;
}

.lightbox__img-wrap img {
  max-width: 88vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  /* Zoom/pan applied via JS directly on this element */
  transform-origin: center center;
  cursor: zoom-in;
  pointer-events: all;
  touch-action: none; /* let JS handle all touch events */
}

.lightbox__caption {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.lightbox__caption strong {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.lightbox__caption span {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Controls */
.lightbox__close {
  position: absolute;
  top: 20px; right: 20px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .25s;
  z-index: 10;
}
.lightbox__close:hover { background: var(--orange); border-color: var(--orange); }

.lightbox__prev, .lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .25s;
  z-index: 10;
}
.lightbox__prev { left: 20px; }
.lightbox__next { right: 20px; }
.lightbox__prev:hover, .lightbox__next:hover { background: var(--orange); border-color: var(--orange); }

/* Zoom controls */
.lightbox__zoom-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 100px;
  padding: 6px 14px;
  z-index: 10;
}
.lightbox__zoom-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 18px;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
  line-height: 1;
}
.lightbox__zoom-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.lightbox__zoom-level {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.5);
  min-width: 36px;
  text-align: center;
  letter-spacing: 1px;
}

/* Counter */
.lightbox__counter {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255,255,255,.4);
  z-index: 10;
}

/* Slide animation */
.lightbox__img-wrap.slide-left  { animation: slideLeft  .25s ease forwards; }
.lightbox__img-wrap.slide-right { animation: slideRight .25s ease forwards; }
@keyframes slideLeft  { from { opacity:0; transform:translateX(40px);  } to { opacity:1; transform:translateX(0); } }
@keyframes slideRight { from { opacity:0; transform:translateX(-40px); } to { opacity:1; transform:translateX(0); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .gal-grid { columns: 3; }
}

/* ── Tablet / iPad (768–1024px) ── */
@media (max-width: 1024px) and (min-width: 769px) {
  .gal-grid { columns: 3; padding: 0 24px; column-gap: 10px; }
  .gal-item { margin-bottom: 10px; }
  /* Larger touch targets in lightbox */
  .lightbox__prev, .lightbox__next { width: 60px; height: 60px; }
  .lightbox__close { width: 52px; height: 52px; }
  .lightbox__zoom-btn { width: 40px; height: 40px; font-size: 20px; }
  .lightbox__zoom-controls { padding: 8px 18px; gap: 10px; bottom: 32px; }
  .lightbox__img-wrap img { max-width: 92vw; max-height: 78vh; }
  /* Filter scrollable on tablet */
  .gal-filter__inner {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 24px;
  }
  .gal-filter__inner::-webkit-scrollbar { display: none; }
  .gal-filter__btn { flex-shrink: 0; }
}

@media (max-width: 768px) {
  /* Hero — reduce from 100vh so filter + gallery are visible on load */
  .gal-hero { height: 55vh; min-height: 320px; }
  .gal-hero__content { padding: 0 20px 32px; }
  .gal-hero__title { font-size: clamp(2.2rem, 9vw, 3.5rem); }

  /* Filter bar — clear separation from hero */
  .gal-filter {
    padding: 18px 0;
    position: sticky;
    top: 60px;
    overflow: hidden;
  }
  .gal-filter__inner {
    max-width: 100%;
    padding: 0 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
  }
  .gal-filter__inner::-webkit-scrollbar { display: none; }
  .gal-filter__btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 11px;
    padding: 9px 18px;
  }

  /* Gallery section — breathing room above and below */
  .gal-section { padding: 32px 0 60px; }
  .gal-grid { columns: 2; padding: 0 16px; column-gap: 8px; }
  .gal-item { margin-bottom: 8px; }

  /* Lightbox touch targets */
  .lightbox__prev { left: 8px; width: 56px; height: 56px; }
  .lightbox__next { right: 8px; width: 56px; height: 56px; }
  .lightbox__close { width: 48px; height: 48px; top: 16px; right: 16px; }
  .lightbox__zoom-controls { bottom: 16px; }
}
@media (max-width: 480px) {
  .gal-hero { height: 50vh; min-height: 280px; }
  .gal-grid { columns: 1; padding: 0 12px; }
  .gal-item { aspect-ratio: 4/3 !important; }
  .gal-hero__title { font-size: clamp(2rem, 9vw, 2.8rem); }
  .gal-filter__btn { font-size: 11px; padding: 8px 16px; white-space: nowrap; flex-shrink: 0; }
  .lightbox__zoom-controls { bottom: 12px; }
  .lightbox__img-wrap img { max-width: 96vw; max-height: 75vh; }
}
