/* ============================================================
   GALLERY — justified rows. Every tile takes the shape of its own
   picture/video; gallery.js packs them into rows that fill the width. Rides on project.css (+ the footer styles
   in true-detective.css, which is why the body also carries .td).
   ============================================================ */
body.gal-page{
  --gal-fill:var(--color-bg-deep);          /* empty tile background while images load */
}
html.gal-lock{overflow:hidden;}

.gal-nav-current{border-bottom-width:calc(2 * var(--u));padding-bottom:calc(5 * var(--u));}
.site-nav a.is-current{border-bottom-width:calc(2 * var(--u));padding-bottom:calc(5 * var(--u));}

.gal{
  max-width:var(--canvas);
  margin:0 auto;
  padding:0 var(--gutter) clamp(calc(72 * var(--u)),8vw,calc(115 * var(--u)));
}
.gal-head{
  padding:clamp(calc(96 * var(--u)),9vw,calc(132 * var(--u))) 0 clamp(calc(28 * var(--u)),4vw,calc(57 * var(--u)));
}
.gal-title{
  margin:0;
  font-size:var(--fs-title-md);
  font-weight:var(--fw-medium);
  line-height:normal;
  color:#fff;
}

/* ---- the board: justified rows, each tile sized by its own picture ---- */
.gal-grid{
  display:flex;
  flex-wrap:wrap;
  gap:var(--gal-gap,calc(8 * var(--u)));
  align-items:flex-start;
}
.gal-item{
  position:relative;
  display:block;
  flex:0 0 auto;
  width:calc(200 * var(--u));                 /* real size is set per row by gallery.js */
  aspect-ratio:var(--ar,1);
  margin:0;padding:0;border:0;
  overflow:hidden;
  background:var(--color-bg-deep);
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.gal-item img{
  display:block;
  width:100%;height:100%;
  object-fit:cover;
  opacity:0;
  filter:blur(calc(14 * var(--u)));
  transform:translateY(calc(18 * var(--u))) scale(1.04);
  transition:opacity .8s var(--ease-site) calc(var(--c,0) * var(--stagger)),
             filter .8s var(--ease-site) calc(var(--c,0) * var(--stagger)),
             transform .8s var(--ease-site) calc(var(--c,0) * var(--stagger));
}
.gal-item.is-in img{opacity:1;filter:blur(0);transform:none;}
.gal-item.is-in:hover img{transform:scale(1.05);transition-delay:0s;transition-duration:.6s;}
.gal-hover{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;
  opacity:0;
  transition:opacity .25s ease;
  pointer-events:none;
}
.gal-item.is-playing .gal-hover{opacity:1;}
.gal-play{transition:opacity .25s ease;}
.gal-item.is-playing .gal-play{opacity:0;}
.gal-play{
  position:absolute;left:50%;top:50%;
  width:calc(56 * var(--u));height:calc(56 * var(--u));margin:calc(-28 * var(--u)) 0 0 calc(-28 * var(--u));
  border-radius:50%;
  background:rgba(12,15,15,.55);
  box-shadow:inset 0 0 0 calc(1.5 * var(--u)) rgba(255,255,255,.85);
  pointer-events:none;
}
.gal-play::after{
  content:"";position:absolute;left:calc(22 * var(--u));top:calc(17 * var(--u));
  border-left:calc(17 * var(--u)) solid #fff;
  border-top:calc(11 * var(--u)) solid transparent;border-bottom:calc(11 * var(--u)) solid transparent;
}
.gal-item:focus-visible{outline:calc(2 * var(--u)) solid #fff;outline-offset:calc(-2 * var(--u));z-index:1;}

/* ---- lightbox ---- */
.gal-lightbox[hidden]{display:none;}
.gal-lightbox{
  position:fixed;inset:0;z-index:var(--z-lightbox);
  display:flex;align-items:center;justify-content:center;
  background:rgba(12,15,15,.96);
  opacity:0;
  transition:opacity .25s ease;
}
.gal-lightbox.is-open{opacity:1;}
.gal-lb-img{
  display:block;
  max-width:min(92vw,calc(1600 * var(--u)));
  max-height:80vh;
  object-fit:contain;
  box-shadow:0 0 0 1px rgba(255,255,255,.12);
  user-select:none;
}
.gal-lb-video{
  display:block;
  max-width:min(92vw,calc(1600 * var(--u)));
  max-height:80vh;
  background:#000;
  box-shadow:0 0 0 1px rgba(255,255,255,.12);
}
.gal-lb-video[hidden]{display:none;}
.gal-lb-btn{
  position:absolute;
  width:calc(48 * var(--u));height:calc(48 * var(--u));
  display:flex;align-items:center;justify-content:center;
  background:none;border:0;padding:0;cursor:pointer;
  color:#fff;
  -webkit-tap-highlight-color:transparent;
}
.gal-lb-btn:hover{opacity:.65;}
.gal-lb-btn:focus-visible{outline:calc(2 * var(--u)) solid #fff;outline-offset:calc(-4 * var(--u));}
.gal-lb-btn svg{width:calc(24 * var(--u));height:calc(24 * var(--u));display:block;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.gal-lb-close{top:calc(14 * var(--u));right:calc(14 * var(--u));}
.gal-lb-prev{left:calc(14 * var(--u));top:50%;margin-top:calc(-24 * var(--u));}
.gal-lb-next{right:calc(14 * var(--u));top:50%;margin-top:calc(-24 * var(--u));}
.gal-lb-count{
  position:absolute;bottom:calc(22 * var(--u));left:0;right:0;
  text-align:center;
  font-size:var(--fs-caption);font-weight:var(--fw-medium);
  letter-spacing:.14em;text-transform:uppercase;
  color:var(--color-accent-moss);
}
@media (max-width:700px){
  .gal-lb-img,.gal-lb-video{max-height:72vh;}
  .gal-lb-prev,.gal-lb-next{top:auto;bottom:calc(10 * var(--u));margin-top:0;}
  .gal-lb-prev{left:calc(14 * var(--u));}
  .gal-lb-next{right:calc(14 * var(--u));}
}

@media (prefers-reduced-motion:reduce){
  .gal-item img{opacity:1;filter:none;transform:none;transition:none;}
  .gal-lightbox{transition:none;}
}

/* ---- dynamic grid (desktop + mouse): gallery.js eases each tile's width/height and sets --fd
   (0 = under the cursor .. 1 = far away) which dims the tiles that are not near the cursor ---- */
.gal-item::after{
  content:"";position:absolute;inset:0;
  background:rgb(12,15,15);
  opacity:0;pointer-events:none;
}
@media (hover:hover) and (pointer:fine) and (min-width:901px){
  .gal-grid.is-dynamic .gal-item::after{opacity:calc(var(--fd,0) * .5);}
}
