/* MODEL UP! 2026 · Enric gallery lightbox full-image fit hotfix · V16.8.5 · 2026-08-21 */

/*
   V16.8.4 correctly changed the viewer to object-fit:contain, but the image box
   itself was forced to width:100% + height:100%. In some browsers/grid sizing
   combinations the replaced element can still overflow its stage and appear
   visually cropped. This patch sizes the actual image intrinsically and only
   constrains it by the available stage, so the ENTIRE source image is always
   visible in the modal.
*/
.enric-lightbox__stage{
  position:relative;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-width:0!important;
  min-height:0!important;
  overflow:hidden!important;
}

.enric-lightbox__stage > img.enric-lightbox__image{
  display:block!important;
  width:auto!important;
  height:auto!important;
  min-width:0!important;
  min-height:0!important;
  max-width:100%!important;
  max-height:100%!important;
  aspect-ratio:auto!important;
  object-fit:contain!important;
  object-position:center center!important;
  margin:auto!important;
  transform:none!important;
  flex:0 1 auto!important;
}

/* Explicit viewport fallback: even if a browser cannot resolve percentage
   max-height against the grid track, the artwork still cannot exceed the
   visible lightbox area. */
@supports (height: 1dvh){
  .enric-lightbox__stage > img.enric-lightbox__image{
    max-height:calc(92dvh - 125px)!important;
  }
}
@supports not (height: 1dvh){
  .enric-lightbox__stage > img.enric-lightbox__image{
    max-height:calc(92vh - 125px)!important;
  }
}

@media(max-width:780px){
  @supports (height: 1dvh){
    .enric-lightbox__stage > img.enric-lightbox__image{
      max-height:calc(88dvh - 115px)!important;
    }
  }
  @supports not (height: 1dvh){
    .enric-lightbox__stage > img.enric-lightbox__image{
      max-height:calc(88vh - 115px)!important;
    }
  }
}
