/* ==========================================================================
   VISIONS OF NYC — gallery.css
   Grid, tiles, parallax columns, lightbox.
   ========================================================================== */

.gallery {
  position: relative;
  z-index: 1; /* beneath the pinned hero during the metamorphosis */
  padding: clamp(48px, 8vh, 120px) var(--gutter) 0;
}

.gallery__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(24px, 4vh, 56px);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--ash);
}

/* ---------- Columns (gallery.js distributes tiles 3 / 2 / 1) ---------- */

.grid {
  display: flex;
  gap: clamp(12px, 1.8vw, 28px);
  align-items: flex-start;
}

.grid__col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.8vw, 28px);
  will-change: transform;
}

/* ---------- Tiles ---------- */

.tile {
  position: relative;
  margin: 0;
}

/* motion path only: tiles start hidden, gallery.js wipes them in bottom-up */
html.js-motion .tile:not(.tile--video) {
  clip-path: inset(100% 0 0 0);
}

.tile__btn {
  position: relative; /* anchors the shared WebGL distortion canvas */
  display: block;
  width: 100%;
  padding: 0;
}

/* the one shared distortion canvas, parked over whichever tile is hovered */
.tile__btn .distort {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tile__btn img {
  width: 100%;
  height: auto;
  background: var(--carbon);
  transition: opacity 0.4s ease;
}

.tile__btn:hover img {
  opacity: 0.88;
}

.tile__num {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--ash);
}

/* ---------- Video landing tile (target of the hero metamorphosis) ---------- */

.tile--video .tile__slot {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: clip;
  background: var(--carbon);
}

.tile--video .tile__slot video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 22, 0.96); /* --carbon scrim */
}

.lightbox__stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  padding: clamp(48px, 8vh, 88px) clamp(16px, 5vw, 72px);
  pointer-events: none;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: auto;
}

.lightbox__counter {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  bottom: 24px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--ash);
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone);
  padding: 12px;
}

.lightbox__glyph {
  font-size: 1.375rem;
  line-height: 1;
  letter-spacing: 0;
}

.lightbox__close {
  top: 12px;
  right: var(--gutter);
}

.lightbox__prev {
  left: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__next {
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__prev:hover,
.lightbox__next:hover,
.lightbox__close:hover {
  color: var(--signal);
}

@media (max-width: 720px) {
  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: 18px;
    transform: none;
  }

  .lightbox__counter {
    left: 50%;
    transform: translateX(-50%);
  }
}
