/* =========================================================
   NATURAL IMAGE SIZE + NO PAGE-JUMP GALLERY
   ========================================================= */

/* Let the gallery container grow according to the actual image ratio */
#photo-gallery .gallery-layout{
  align-items:start !important;
}

#photo-gallery .gallery-main{
  width:100% !important;
  min-width:0 !important;
}

#photo-gallery .featured{
  width:100% !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  aspect-ratio:auto !important;
  display:block !important;
  overflow:hidden !important;
}

/* Main image keeps its real width/height ratio.
   It scales down responsively without being cropped. */
#photo-gallery .featured img{
  display:block !important;
  width:100% !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  object-fit:contain !important;
  object-position:center center !important;
  background:#fff !important;
}

/* Keep caption attached to the actual image box */
#photo-gallery .caption{
  left:6px !important;
  right:6px !important;
  bottom:6px !important;
}

/* Thumbnail column follows the visible main image area without forcing page height */
@media(min-width:761px){
  #photo-gallery .gallery-thumbs{
    height:auto !important;
    max-height:520px !important;
    overflow-y:auto !important;
    overscroll-behavior:contain;
    scroll-behavior:auto !important;
  }

  #photo-gallery .gallery-thumb{
    height:auto !important;
    min-height:86px !important;
  }

  #photo-gallery .gallery-thumb img{
    width:100% !important;
    height:82px !important;
    object-fit:cover !important;
  }
}

@media(max-width:760px){
  #photo-gallery .featured{
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
  }

  #photo-gallery .featured img{
    width:100% !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    object-fit:contain !important;
  }
}
