/* drift-column-gallery: a pinned white screen with a small centred title ("Gallery" + a pale "(24)") holding still while
   a loose 3-column grid of mixed-size photos streams up past it and over it, LINEAR, 1.6 px per px scrolled (the grid
   outruns the page). Rewritten from 250 Broadway's "Gallery Section" (Home 22254-23030 + the grid CSS in the Home rule
   array at 23609). Without JS or under reduced motion: the title, then a plain grid, nothing pinned. */


.dcg {
  --dcg-ground: #fff;
  --dcg-ink: #3c3c3c;                    /* the title */
  --dcg-count-ink: #c6c6c6;              /* the superscript count */
  --dcg-font: "PP Neue York", Arial, Helvetica, sans-serif;
  --dcg-title-size: 56px;                /* phones 32px */
  --dcg-count-size: 20px;                /* phones 14px */
  --dcg-cols: 3;
  --dcg-gap: 80px;                       /* between columns and rows */
  --dcg-pad: 16px;
  --dcg-tile-ground: #e7e4df;            /* behind a photo while it loads */
  --dcg-pin: 1;                          /* screens held (set by part.js from data-dcg-pin / -pin-m) */
  position: relative;
  background: var(--dcg-ground);
  overflow: clip;
}
.dcg *, .dcg *::before, .dcg *::after { box-sizing: border-box; }

.dcg__sticky { position: relative; }
.dcg__title { position: relative; display: flex; justify-content: center; align-items: flex-start; gap: 8px; margin: 0;
  padding: 96px 16px 48px; font-family: var(--dcg-font); font-weight: 500; color: var(--dcg-ink); }
.dcg__name { font-size: var(--dcg-title-size); line-height: 1.1; letter-spacing: -0.03em; }
.dcg__count { font-size: var(--dcg-count-size); line-height: 1; letter-spacing: -0.03em; color: var(--dcg-count-ink); }

.dcg__grid { display: grid; grid-template-columns: repeat(var(--dcg-cols), minmax(0, 1fr)); grid-auto-rows: min-content;
  align-content: start; gap: var(--dcg-gap); padding: var(--dcg-pad); }

/* a tile: a share of its column (--dcg-w, phones --dcg-wm) at its own shape (--dcg-ratio), loose at the column's start */
.dcg__tile { position: relative; display: block; overflow: hidden; justify-self: start; align-self: start;
  width: calc(var(--dcg-w, .8) * 100%); aspect-ratio: var(--dcg-ratio, .8); background: var(--dcg-tile-ground); color: inherit; }
.dcg__tile > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover;
  object-position: var(--dcg-pos, 50% 50%); transform-origin: var(--dcg-pos, 50% 50%); }
.dcg__tile:focus-visible { outline: 2px solid var(--dcg-ink); outline-offset: 3px; }

/* the source's 15-tile pattern, repeating: 333x416 / 166x208 / 416x520 / 233x280 / 100x133 at 1440 (shares of a 416 column) */
.dcg__tile:nth-child(15n+1), .dcg__tile:nth-child(15n+3), .dcg__tile:nth-child(15n+5) { --dcg-w: .8; --dcg-wm: 1.515; --dcg-ratio: .8; }
.dcg__tile:nth-child(15n+2), .dcg__tile:nth-child(15n+4), .dcg__tile:nth-child(15n+6) { --dcg-w: .4; --dcg-wm: .8; --dcg-ratio: .8; }
.dcg__tile:nth-child(15n+7) { --dcg-w: 1; --dcg-wm: 1.515; --dcg-ratio: .8; }
.dcg__tile:nth-child(15n+8) { --dcg-w: .4; --dcg-wm: .97; --dcg-ratio: .8; }
.dcg__tile:nth-child(15n+9) { --dcg-w: 1; --dcg-wm: 1; --dcg-ratio: .8; }
.dcg__tile:nth-child(15n+10) { --dcg-w: .56; --dcg-wm: .56; --dcg-ratio: .833; }
.dcg__tile:nth-child(15n+11), .dcg__tile:nth-child(15n+13) { --dcg-w: .24; --dcg-wm: 1; --dcg-ratio: .75; }
.dcg__tile:nth-child(15n+12) { --dcg-w: .56; --dcg-wm: .8; --dcg-ratio: .833; }
.dcg__tile:nth-child(15n+14) { --dcg-w: .56; --dcg-wm: 1; --dcg-ratio: .833; }
.dcg__tile:nth-child(15n+15) { --dcg-w: .24; --dcg-wm: 1; --dcg-ratio: .75; }

/* live: the screen pins; the title sits dead centre under the grid, which covers the whole screen and moves */
.dcg--live { height: calc((1 + var(--dcg-pin)) * 100svh); }
.dcg--live .dcg__sticky { position: sticky; top: 0; height: 100svh; overflow: clip; }
.dcg--live .dcg__title { position: absolute; left: 50%; top: 50%; padding: 0; transform: translate(-50%, -50%); white-space: nowrap; }
.dcg--live .dcg__grid { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 1;
  transform-origin: 50% 50%; will-change: transform; }
.dcg--live .dcg__tile > img { will-change: transform; }

@media (max-width: 743.98px) {
  .dcg { --dcg-title-size: 32px; --dcg-count-size: 14px; }
  .dcg__count { line-height: 1.2; }
  .dcg__tile { width: calc(var(--dcg-wm, var(--dcg-w, .8)) * 100%); }
  .dcg__title { padding: 64px 16px 32px; }
}
