/* Home documentary wall — loaded only on /. Image-only auto-discovered
   gallery (includes/gallery.php): 5 vertical tracks, alternating drift,
   seamless duplicated loops. Off-white ground, photos carry the colour. */
.gallery {
  background: var(--color-bg);
  padding: var(--space-7) 0 var(--space-8);
}

.docu-viewport {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-4);
  height: clamp(420px, 72vh, 620px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
}

/* align-self:start is load-bearing: %-translation resolves against the
   element's own box, so the column must be content-height (2 sets), not
   the stretched row height — otherwise -50% lands mid-set and the loop
   visibly jumps. */
.docu-col { overflow: hidden; min-width: 0; align-self: start; }

.docu-col--up { animation: docu-up 38s linear infinite; }
.docu-col--down { animation: docu-down 38s linear infinite; }

@keyframes docu-up {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, -50%, 0); }
}

@keyframes docu-down {
  from { transform: translate3d(0, -50%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

.docu-set {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
}

.docu-frame {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Slow-net reserve: sand warmth holds the frame's shape while the photo
     is in flight, so the drifting columns never collapse to zero height. */
  background: var(--tmj-sand);
  min-height: 120px;
}

.docu-frame img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 250ms cubic-bezier(0.22, 1, 0.36, 1);
}

.docu-frame:hover img { transform: scale(1.03); }

@media (max-width: 1023px) {
  .gallery { padding: var(--space-7) 0; }
  .docu-viewport { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
  .docu-col:nth-child(n+4) { display: none; }
  .docu-set { gap: var(--space-4); padding-bottom: var(--space-4); }
}

@media (max-width: 767px) {
  .docu-viewport {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    height: clamp(380px, 92vw, 520px);
    border-radius: var(--radius-md);
  }
  .docu-col:nth-child(n+3) { display: none; }
  .docu-set { gap: var(--space-3); padding-bottom: var(--space-3); }
  .docu-frame { border-radius: var(--radius-md); }
}

@media (prefers-reduced-motion: reduce) {
  .docu-col--up, .docu-col--down { animation: none; }
  .docu-viewport { height: auto; max-height: none; }
  .docu-set[aria-hidden="true"] { display: none; }
}
