/* ============================================================
   SECTION 4 — GALLERY  (editorial infinite marquee)
   ============================================================ */

/* ---- section shell ---- */
.section-gallery {
  position: relative;
  background: var(--jet);
  overflow: hidden;
  padding: clamp(5rem, 9vh, 7rem) 0 clamp(3.5rem, 5vh, 5rem);
}

/* ---- faint serif watermark ---- */
.gal-watermark {
  position: absolute;
  bottom: -6%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(12rem, 28vw, 24rem);
  line-height: 0.85;
  color: rgba(255, 255, 255, 0.013);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* ---- editorial two-column header ---- */
.gal-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 3rem;
  max-width: var(--maxw);
  margin: 0 auto clamp(2.8rem, 5.5vh, 4.5rem);
  padding-inline: var(--pad);
  flex-wrap: wrap;
}

.gal-header-left {
  flex: 0 0 auto;
}

.section-gallery .section-title {
  font-size: clamp(2.4rem, 3.8vw, 4.4rem);
  line-height: 0.98;
  margin-top: 1.1rem;
}

.gal-header-right {
  flex: 0 1 480px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2rem;
}

.gal-header-right .lede {
  margin: 0;
  max-width: 44ch;
  line-height: 1.75;
}

/* ---- arrow controls ---- */
.gal-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.gal-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  transition:
    background 0.4s var(--ease),
    color 0.4s,
    border-color 0.4s,
    transform 0.3s;
}
.gal-btn:hover {
  background: var(--gold);
  color: var(--jet);
  border-color: var(--gold);
}
.gal-btn:active {
  transform: scale(0.9);
}

/* ---- gallery viewport (clip + edge-fade mask) ---- */
.gal-viewport {
  position: relative;
  width: 100%;
  cursor: grab;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
  z-index: 1;
}
.gal-viewport.dragging {
  cursor: grabbing;
}

/* ---- scrolling track ---- */
.gal-track {
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 1.6vw, 24px);
  padding: 1rem 0 1.8rem;
  width: max-content;
  will-change: transform;
}

/* ---- cards ---- */
.gal-item {
  position: relative;
  width: clamp(240px, 23vw, 370px);
  height: clamp(320px, 46vh, 500px);
  flex: none;
  overflow: hidden;
  background: #090a0b;
}

/* center card of each 3-image set — taller for editorial crown effect */
.gal-item:nth-child(3n + 2) {
  height: clamp(380px, 54vh, 580px);
}

/* ---- image ---- */
.gal-img-wrap {
  position: absolute;
  inset: 0;
}
.gal-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.05);
  transition: transform 1.4s var(--ease);
  will-change: transform;
}
.gal-item:hover .gal-img-wrap img {
  transform: scale(1.13);
}

/* ---- dark gradient overlay ---- */
.gal-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.35) 38%,
    rgba(0, 0, 0, 0.08) 62%,
    transparent 82%
  );
  z-index: 1;
}

/* ---- inset gold frame (appears on hover) ---- */
.gal-frame {
  position: absolute;
  inset: 16px;
  border: 1px solid transparent;
  z-index: 2;
  pointer-events: none;
  transition: border-color 0.6s var(--ease);
}
.gal-item:hover .gal-frame {
  border-color: rgba(198, 161, 91, 0.28);
}

/* ---- oversized serif number top-left ---- */
.gal-num {
  position: absolute;
  top: 1.2rem;
  left: 1.4rem;
  z-index: 3;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 4.5vw, 4.4rem);
  font-weight: 300;
  color: rgba(198, 161, 91, 0.22);
  line-height: 1;
  pointer-events: none;
  transition: color 0.5s;
  letter-spacing: -0.02em;
}
.gal-item:hover .gal-num {
  color: rgba(198, 161, 91, 0.52);
}

/* ---- caption ---- */
.gal-cap {
  position: absolute;
  left: 1.4rem;
  bottom: 1.6rem;
  right: 1.4rem;
  z-index: 4;
  transform: translateY(10px);
  opacity: 0.88;
  transition:
    transform 0.55s var(--ease),
    opacity 0.45s;
}
.gal-item:hover .gal-cap {
  transform: none;
  opacity: 1;
}

/* gold horizontal rule above caption text */
.gal-cap::before {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  background: var(--gold);
  margin-bottom: 0.75rem;
  opacity: 0.65;
}

.gal-cap .k {
  font-size: 0.56rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.42rem;
  display: block;
}

.gal-cap h4 {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.65vw, 1.55rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--paper);
}

/* ---- zoom button (hover reveal, top-right) ---- */
.gal-item .zoom {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(198, 161, 91, 0.35);
  background: rgba(5, 5, 6, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--gold);
  font-size: 1rem;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7) rotate(-20deg);
  transition:
    opacity 0.4s,
    transform 0.4s var(--ease),
    background 0.3s,
    color 0.3s;
}
.gal-item:hover .zoom {
  opacity: 1;
  transform: none;
}
.gal-item .zoom:hover {
  background: var(--gold);
  color: var(--jet);
  border-color: var(--gold);
}

/* ---- footer: progress + hint ---- */
.gal-footer {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: clamp(1.8rem, 3.5vh, 2.8rem) auto 0;
  padding-inline: var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.gal-progress {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex: 1;
}

.gal-progress .bar {
  flex: 1;
  max-width: 280px;
  height: 1px;
  background: var(--line-soft);
  position: relative;
  overflow: hidden;
}
.gal-progress .bar i {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--gold), rgba(198, 161, 91, 0.22));
  transition: left 0.1s linear;
}

.gal-progress .state {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.gal-progress .state .pd {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 1.6s var(--ease) infinite;
}
.gal-progress.paused .state .pd {
  background: var(--muted);
  animation: none;
}

.gal-hint {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.22;
  }
}

/* ---- lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 60px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s var(--ease),
    visibility 0.5s;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}
.lightbox .lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 4, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lightbox figure {
  position: relative;
  z-index: 2;
  max-width: 900px;
  width: 100%;
}
.lightbox img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border: 1px solid var(--line);
}
.lightbox figcaption {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}
.lightbox figcaption b {
  color: var(--gold-soft);
  font-weight: 400;
  font-family: var(--serif);
  font-size: 1.2rem;
  display: block;
  margin-bottom: 0.3rem;
}
.lb-close {
  position: absolute;
  top: -3rem;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  color: var(--paper);
  display: grid;
  place-items: center;
  transition:
    transform 0.4s,
    background 0.3s,
    color 0.3s;
}
.lb-close:hover {
  transform: rotate(90deg);
  background: var(--gold);
  color: var(--jet);
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  background: var(--glass);
  color: var(--paper);
  display: grid;
  place-items: center;
  transition:
    background 0.3s,
    color 0.3s;
}
.lb-nav:hover {
  background: var(--gold);
  color: var(--jet);
}
.lb-nav.prev {
  left: -1.5rem;
}
.lb-nav.next {
  right: -1.5rem;
}

/* ---- responsive ---- */
@media (max-width: 900px) {
  .gal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.6rem;
  }
  .gal-header-right {
    flex: 1 0 100%;
  }
}

@media (max-width: 600px) {
  .gal-controls {
    display: none;
  }
  .gal-item:nth-child(3n + 2) {
    height: clamp(330px, 52vw, 440px);
  }
  .lb-nav.prev {
    left: 0.4rem;
  }
  .lb-nav.next {
    right: 0.4rem;
  }
}

/* desktop viewport-fit */
@media (min-width: 1024px) {
  .section-gallery {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5vh 0;
  }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gal-img-wrap img {
    transition: none;
  }
  .gal-progress .state .pd {
    animation: none;
  }
}
