/* Mobile-only containment. The approved desktop gallery rules stay unchanged. */
@media (max-width:900px), (orientation:landscape) and (max-height:500px), (hover:none) and (pointer:coarse){
  .page-gallery .gallery-lightbox{inset:auto;left:var(--gm-viewport-left,0px);top:var(--gm-viewport-top,0px);width:var(--gm-viewport-width,100vw);height:var(--gm-viewport-height,100vh);min-width:0;min-height:0;max-width:none;max-height:none;overflow:hidden}
  .page-gallery .gallery-lightbox-dialog{width:var(--gm-dialog-width,100%);height:var(--gm-dialog-height,100%);max-width:none;max-height:none;min-width:0;min-height:0}
  .page-gallery .gallery-lightbox-frame{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:hidden;touch-action:pan-y pinch-zoom}
  .page-gallery #gallery-lightbox-image{display:block;flex:0 0 auto;width:var(--gm-image-width,auto);height:var(--gm-image-height,auto);max-width:none;max-height:none;object-fit:contain;border:0;box-shadow:none}
}
/* A 4:3 photograph needs height, not a wide empty header, in phone landscape. */
@media (orientation:landscape) and (max-height:500px){
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-lightbox-dialog{grid-template-rows:minmax(0,1fr)}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-lightbox-frame{grid-row:1;padding:2px}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-lightbox-brand{position:absolute;left:0;top:10px;width:var(--gm-side-rail);height:44px;z-index:4;pointer-events:none}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-logo-3d-stage{width:44px;height:44px;left:calc(50% - 22px);top:0}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-control{width:48px;height:48px}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-prev{left:calc(var(--gm-side-rail)/2 - 24px)}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-next{right:calc(var(--gm-side-rail)/2 - 24px)}
  .page-gallery .gallery-lightbox[data-mobile-layout="landscape-photo"] .gallery-close{top:10px;right:calc(var(--gm-side-rail)/2 - 24px)}
}
