/* An architect's contact sheet: one working print in front, the rest of the
   set stacked behind it, and a strip you drag through. Choosing a frame pushes
   the current one back into the stack and brings the new one forward. */
.gallery { padding-block: clamp(4rem, 10vh, 7rem); }
.gallery__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 1rem 2rem; margin-bottom: clamp(1.4rem, 3.4vh, 2.4rem); }
.gallery__body {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(6rem, 9vw, 8.5rem);
  /* align-items:start matters: stretched to the strip's height, an
     aspect-ratio box would derive its *width* from that height and blow the
     grid column wide open */
  gap: clamp(1rem, 2.4vw, 2.2rem); align-items: start;
}
.gallery__stage {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: rgba(23,32,42,.08);
  touch-action: pan-y;
}
.gallery__stage::before, .gallery__stage::after {
  /* the rest of the stack, seen edge-on */
  content: ""; position: absolute; top: 3%; bottom: 3%; width: 1px; background: var(--rule-2); opacity: .5;
}
.gallery__stage::before { right: -8px; }
.gallery__stage::after { right: -16px; top: 6%; bottom: 6%; opacity: .3; }
.shot {
  position: absolute; inset: 0;
  opacity: 0; transform: translateX(3.5%) scale(.955);
  transition: opacity .55s var(--ease), transform .95s var(--slow);
  will-change: transform, opacity;
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot.is-on { opacity: 1; transform: none; z-index: 2; }
.shot.was-on { opacity: 0; transform: translateX(-2.2%) scale(.94); z-index: 1; }
.gallery__meta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1rem, 2vw, 1.6rem) clamp(.8rem, 2vw, 1.2rem);
  background: linear-gradient(to top, rgba(23,32,42,.62), rgba(23,32,42,0));
  color: var(--warm-white);
  font-size: .58rem; letter-spacing: .2em; text-transform: uppercase;
}
.gallery__count b { font-family: var(--serif); font-size: 1.5em; font-weight: 400; letter-spacing: .02em; }

.gallery__strip { display: grid; gap: .6rem; align-content: start; }
.gallery__strip button {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  opacity: .48; transition: opacity .5s var(--ease), transform .6s var(--slow);
}
.gallery__strip img { width: 100%; height: 100%; object-fit: cover; }
.gallery__strip button::after {
  content: ""; position: absolute; inset: 0; border: 1px solid transparent;
  transition: border-color .45s var(--ease);
}
.gallery__strip button:hover, .gallery__strip button:focus-visible { opacity: .8; }
.gallery__strip button[aria-current="true"] { opacity: 1; transform: translateX(-.35rem); }
.gallery__strip button[aria-current="true"]::after { border-color: var(--ink); }

@media (max-width: 720px) {
  .gallery__body { grid-template-columns: 1fr; }
  .gallery__stage { aspect-ratio: 4 / 3; }
  .gallery__stage::before, .gallery__stage::after { display: none; }
  .gallery__strip {
    grid-auto-flow: column; grid-auto-columns: 22vw;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: calc(var(--gut) * -1); padding-inline: var(--gut);
  }
  .gallery__strip::-webkit-scrollbar { display: none; }
  .gallery__strip button { scroll-snap-align: start; }
  .gallery__strip button[aria-current="true"] { transform: none; }
}
