
/* DOSMOS Gallery v3 hotfix
   Scope: /gallery/ only.
   Goal: compact square thumbnails + bright image-only lightbox.
*/

body[data-page="gallery"] .portal-gallery-masonry{
  columns:auto !important;
  column-gap:0 !important;
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:14px !important;
  align-items:start !important;
}

body[data-page="gallery"] .portal-gallery-item{
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  margin:0 !important;
  break-inside:auto !important;
  border-radius:14px !important;
  overflow:hidden !important;
  background:#0d0d0d !important;
  transform:none !important;
}

body[data-page="gallery"] .portal-gallery-item:hover{
  transform:none !important;
}

body[data-page="gallery"] .portal-gallery-item > img{
  display:block !important;
  width:100% !important;
  height:auto !important;
  aspect-ratio:1 / 1 !important;
  max-height:none !important;
  object-fit:cover !important;
  object-position:center !important;
  opacity:1 !important;
  filter:none !important;
  transform:none !important;
}

body[data-page="gallery"] .portal-gallery-item > div{
  padding:10px 11px !important;
  min-height:0 !important;
}

body[data-page="gallery"] .portal-gallery-item strong{
  display:-webkit-box !important;
  -webkit-box-orient:vertical !important;
  -webkit-line-clamp:2 !important;
  overflow:hidden !important;
  font-size:13px !important;
  line-height:1.35 !important;
}

body[data-page="gallery"] .portal-gallery-item small{
  display:block !important;
  margin-top:4px !important;
  font-size:10px !important;
  line-height:1.35 !important;
  overflow:hidden !important;
  white-space:nowrap !important;
  text-overflow:ellipsis !important;
}

/* LIGHTBOX: image only. No long caption panel. */
body[data-page="gallery"] .portal-lightbox{
  position:fixed !important;
  inset:0 !important;
  z-index:100000 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  box-sizing:border-box !important;
  padding:64px 18px 24px !important;
  overflow:hidden !important;
  background:rgba(0,0,0,.88) !important;
}

body[data-page="gallery"] .portal-lightbox[hidden]{
  display:none !important;
}

body[data-page="gallery"] #portalLightboxImage{
  position:static !important;
  display:block !important;
  width:auto !important;
  height:auto !important;
  min-width:0 !important;
  min-height:0 !important;
  max-width:94vw !important;
  max-height:calc(100vh - 92px) !important;
  margin:auto !important;
  padding:0 !important;
  border:0 !important;
  border-radius:10px !important;
  object-fit:contain !important;
  object-position:center !important;
  opacity:1 !important;
  filter:none !important;
  -webkit-filter:none !important;
  mix-blend-mode:normal !important;
  transform:none !important;
  background:transparent !important;
  box-shadow:none !important;
}

body[data-page="gallery"] #portalLightboxCaption{
  display:none !important;
}

body[data-page="gallery"] #portalLightboxClose{
  position:fixed !important;
  top:16px !important;
  right:16px !important;
  left:auto !important;
  bottom:auto !important;
  z-index:100002 !important;
  width:44px !important;
  height:44px !important;
  padding:0 !important;
  display:grid !important;
  place-items:center !important;
  border-radius:50% !important;
  font-size:28px !important;
  line-height:1 !important;
}

@media (max-width:900px){
  body[data-page="gallery"] .portal-gallery-masonry{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
}

@media (max-width:650px){
  body[data-page="gallery"] .portal-gallery-masonry{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px !important;
  }

  body[data-page="gallery"] .portal-gallery-item{
    border-radius:12px !important;
  }

  body[data-page="gallery"] .portal-gallery-item > div{
    padding:8px 9px !important;
  }

  body[data-page="gallery"] .portal-gallery-item strong{
    font-size:11px !important;
  }

  body[data-page="gallery"] .portal-lightbox{
    padding:62px 10px 16px !important;
  }

  body[data-page="gallery"] #portalLightboxImage{
    max-width:calc(100vw - 20px) !important;
    max-height:calc(100vh - 82px) !important;
  }
}

/* V31.7.10 — keep the complete Gallery compact and orderly on small phones. */
@media (max-width:390px){
  body[data-page="gallery"] .portal-gallery-masonry{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  body[data-page="gallery"] .portal-gallery-item > img{
    width:100% !important;
    height:auto !important;
    aspect-ratio:1 / 1 !important;
    object-fit:contain !important;
  }
}
