/* Album page shared by archive and auto: big title, numbered grid,
   lightbox. */

/* Lightbox open/close: the clicked thumbnail morphs into (and
   back out of) the centered photo — see openLightbox/closeLightbox. */
::view-transition-group(lb-photo) {
  animation-duration: 0.5s;
  animation-timing-function: var(--ease);
}

.yr-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  text-decoration: none;
  margin-bottom: 24px;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding: 0 var(--locs-gap);
}
a.yr-head:hover .yr-y,
a.yr-head:hover .yr-meta {
  opacity: 0.55;
}
.yr-y,
.yr-meta {
  font-size: 72px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  transition: opacity 0.3s;
}
.yr-meta {
  color: var(--muted);
}

/* ============================================================
   GRID — level 3. A strict 6-column grid (2 on mobile): six
   evenly-spaced vertical tracks, one photo per track per row.
   Every thumbnail shares one fixed height (--row-h) and keeps
   its own natural aspect ratio — never stretched to fill its
   column — and is centered horizontally within that column, so
   a portrait photo reads narrow and a landscape one reads wide,
   but their centers stay on the same six axes. The index number
   is pinned to the column's own position, not the image's.
   ============================================================ */
.grid {
  --grid-gap: 20px;
  --row-gap: 56px;
  --row-h: 115px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--row-gap) var(--grid-gap);
  width: 100vw;
  padding: 26px var(--grid-gap) 0;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}
.grid-cell {
  position: relative;
  display: flex;
  justify-content: center;
}
.grid-idx {
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.grid button {
  display: block;
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
}
.grid-thumb {
  height: var(--row-h);
  background: #f2f2f2;
}
.grid-thumb img {
  height: 100%;
  width: auto;
  display: block;
  transition:
    clip-path 0.7s var(--ease),
    opacity 0.4s var(--ease);
}
.grid button:focus-visible .grid-thumb {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}

/* Images wipe in bottom-to-top as they finish loading: the clip
   rectangle's top edge starts pinned to the bottom (nothing
   visible) and eases up to 0, so the reveal grows upward. */
.js .grid-thumb img {
  clip-path: inset(100% 0 0 0);
  opacity: 0;
}
.grid-thumb img.loaded {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  /* white only while open: iOS Safari tints the top of the screen from
     full-screen fixed elements, even invisible ones */
  background: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s var(--ease),
    background-color 0.35s var(--ease),
    visibility 0s linear 0.35s;
}
.lb.open {
  background: #fff;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
/* One .lb-item per photo, all absolutely stacked and positioned
   by JS (layoutLightbox) exactly like the homepage's group
   carousel: centered active photo, a sliver of its neighbours
   peeking in at each edge, everything else parked just off-
   screen at opacity 0. Moving the active index only ever changes
   each item's target transform/opacity — this transition is what
   animates the slide, there's no separate JS-driven animation. */
.lb-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
}
.lb-item {
  position: absolute;
  top: 50%;
  left: 0;
  max-width: 78vw;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  opacity: 0;
  transform: translate3d(0, -50%, 0);
  transition:
    transform 0.7s var(--ease),
    opacity 0.5s var(--ease);
  pointer-events: none;
}
/* Suspends the transition above so the initial layout on open
   (and any resize) can snap items into place instead of sliding
   in from their untouched default position. */
.lb-no-anim .lb-item {
  transition: none;
}
.lb-close,
.lb-nav {
  position: absolute;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.lb-close {
  top: 22px;
  right: 26px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.5;
  transition: opacity 0.2s;
  z-index: 2;
}
.lb-close:hover {
  opacity: 1;
}
.lb-nav {
  top: 0;
  bottom: 0;
  width: 15%;
  font-size: 0;
  z-index: 1;
}
.lb-nav.prev {
  left: 0;
}
.lb-nav.next {
  right: 0;
}
.lb-counter {
  position: absolute;
  bottom: 24px;
  left: 26px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 700px) {
  .yr-y,
  .yr-meta {
    font-size: 46px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
    --grid-gap: 12px;
    --row-gap: 34px;
    --row-h: 90px;
  }
  .grid-idx {
    top: -16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid button,
  .grid-thumb img,
  .lb,
  .lb-item {
    transition: none;
  }
}
