/* Phase 37.6e — final gallery glass override.
   Loaded last on gallery.php so legacy phase14 desktop rules cannot restore the dark viewer. */
html body .gallery-lightbox[hidden]{display:none!important}
html body .gallery-lightbox:not([hidden]){
  position:fixed!important;inset:0!important;z-index:100000!important;
  display:grid!important;place-items:center!important;
  padding:clamp(1rem,3vw,2.5rem)!important;
  background:rgba(225,237,255,.48)!important;
  background-image:
    radial-gradient(circle at 14% 14%,rgba(57,137,255,.22),transparent 34%),
    radial-gradient(circle at 86% 82%,rgba(74,151,255,.16),transparent 38%),
    linear-gradient(135deg,rgba(255,255,255,.38),rgba(177,210,255,.16))!important;
  backdrop-filter:blur(30px) saturate(145%)!important;
  -webkit-backdrop-filter:blur(30px) saturate(145%)!important;
}
html body .gallery-lightbox:not([hidden]) .lightbox-content{
  position:relative!important;z-index:2!important;display:block!important;
  width:min(1120px,calc(100vw - 8rem))!important;
  max-height:calc(100dvh - 4rem)!important;overflow:hidden!important;
  border:1px solid rgba(255,255,255,.88)!important;border-radius:26px!important;
  background:rgba(255,255,255,.72)!important;
  box-shadow:0 34px 100px rgba(29,72,139,.20),inset 0 1px 0 rgba(255,255,255,.96)!important;
  backdrop-filter:blur(24px) saturate(145%)!important;
  -webkit-backdrop-filter:blur(24px) saturate(145%)!important;
}
html body .gallery-lightbox:not([hidden]) .lightbox-stage{
  display:grid!important;place-items:center!important;
  min-height:0!important;height:min(66dvh,690px)!important;
  padding:clamp(.7rem,1.4vw,1rem)!important;
  background:linear-gradient(145deg,rgba(255,255,255,.52),rgba(215,233,255,.44))!important;
  backdrop-filter:blur(18px) saturate(130%)!important;
  -webkit-backdrop-filter:blur(18px) saturate(130%)!important;
}
html body .gallery-lightbox:not([hidden]) .lightbox-stage img{
  display:block!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;
  object-fit:contain!important;border-radius:16px!important;opacity:1!important;filter:none!important;
}
html body .gallery-lightbox:not([hidden]) .lightbox-information{
  display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:1.25rem!important;
  padding:1rem 1.25rem 1.15rem!important;color:#0b2148!important;
  background:rgba(255,255,255,.68)!important;
  backdrop-filter:blur(16px) saturate(135%)!important;-webkit-backdrop-filter:blur(16px) saturate(135%)!important;
}
html body .gallery-lightbox:not([hidden]) #lightboxCategory{color:#1761c9!important}
html body .gallery-lightbox:not([hidden]) #lightboxTitle{color:#0b2148!important}
html body .gallery-lightbox:not([hidden]) .lightbox-caption{color:#60708b!important}
html body .gallery-lightbox:not([hidden]) #lightboxCampus{color:#426184!important}
html body .gallery-lightbox:not([hidden]) #lightboxCounter{color:#0b4db7!important;background:rgba(18,91,210,.09)!important}
html body .gallery-lightbox:not([hidden]) .lightbox-close,
html body .gallery-lightbox:not([hidden]) .lightbox-nav{
  position:fixed!important;z-index:100002!important;display:grid!important;place-items:center!important;
  width:48px!important;height:48px!important;border:1px solid rgba(255,255,255,.78)!important;border-radius:50%!important;
  color:#fff!important;background:rgba(12,62,143,.62)!important;box-shadow:0 10px 30px rgba(20,61,126,.20)!important;
  backdrop-filter:blur(14px) saturate(140%)!important;-webkit-backdrop-filter:blur(14px) saturate(140%)!important;
}
html body .gallery-lightbox:not([hidden]) .lightbox-close{top:1.25rem!important;right:1.25rem!important}
html body .gallery-lightbox:not([hidden]) .lightbox-nav{top:50%!important;transform:translateY(-50%)!important}
html body .gallery-lightbox:not([hidden]) .lightbox-prev{left:1.25rem!important}
html body .gallery-lightbox:not([hidden]) .lightbox-next{right:1.25rem!important}
body.gallery-lightbox-open .advisor-fab{opacity:0!important;visibility:hidden!important;pointer-events:none!important}
@media(max-width:991.98px){
 html body .gallery-lightbox:not([hidden]){padding:1rem!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-content{width:min(760px,calc(100vw - 2rem))!important;max-height:calc(100dvh - 2rem)!important;border-radius:22px!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-stage{height:min(58dvh,560px)!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-nav{top:auto!important;bottom:1rem!important;transform:none!important}
}
@media(max-width:575.98px){
 html body .gallery-lightbox:not([hidden]){padding:.65rem!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-content{width:100%!important;max-height:calc(100dvh - 1.3rem)!important;border-radius:20px!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-stage{height:min(56dvh,470px)!important;padding:.55rem!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-information{padding:.85rem 1rem 1rem!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-close{top:.85rem!important;right:.85rem!important;width:42px!important;height:42px!important}
 html body .gallery-lightbox:not([hidden]) .lightbox-nav{bottom:.85rem!important;width:44px!important;height:44px!important}
}

/* Phase 37.6f — desktop image-fit correction.
   Reserve space for the information row and let the image stage consume only
   the remaining viewport height. This prevents large previews from clipping. */
@media (min-width: 992px){
  html body .gallery-lightbox:not([hidden]) .lightbox-content{
    display:grid!important;
    grid-template-rows:minmax(0,1fr) auto!important;
    height:min(820px,calc(100dvh - 5rem))!important;
    max-height:calc(100dvh - 5rem)!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-stage{
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-stage img{
    width:auto!important;
    height:auto!important;
    max-width:100%!important;
    max-height:100%!important;
    object-fit:contain!important;
    object-position:center center!important;
    margin:auto!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-information{
    min-height:0!important;
    flex:0 0 auto!important;
  }
}

/* Extra-wide/short desktop windows need a little more breathing room. */
@media (min-width: 992px) and (max-height: 760px){
  html body .gallery-lightbox:not([hidden]){padding:1.25rem 4rem!important}
  html body .gallery-lightbox:not([hidden]) .lightbox-content{
    height:calc(100dvh - 2.5rem)!important;
    max-height:calc(100dvh - 2.5rem)!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-information{
    padding:.75rem 1.1rem .85rem!important;
  }
}

/* Phase 37.6g — large-screen preview containment.
   Keep the complete photo inside the available stage; never crop/overflow it. */
@media (min-width: 992px){
  html body .gallery-lightbox:not([hidden]) .lightbox-stage{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-stage img{
    display:block!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-width:100%!important;
    max-height:100%!important;
    object-fit:contain!important;
    object-position:center center!important;
    margin:0!important;
  }
}

/* Phase 37.6h — adaptive desktop viewer.
   On large screens the glass card follows the displayed photo dimensions,
   so portrait images do not sit inside an unnecessarily wide empty stage. */
@media (min-width: 992px){
  html body .gallery-lightbox:not([hidden]) .lightbox-content{
    width:var(--gallery-viewer-width, min(1120px,calc(100vw - 8rem)))!important;
    height:auto!important;
    max-width:calc(100vw - 8rem)!important;
    max-height:calc(100dvh - 4rem)!important;
    grid-template-rows:auto auto!important;
    transition:width .28s ease!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-stage{
    width:100%!important;
    height:var(--gallery-viewer-image-height, min(66dvh,690px))!important;
    min-height:0!important;
    padding:.9rem!important;
    transition:height .28s ease!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-stage img{
    width:auto!important;
    height:auto!important;
    max-width:100%!important;
    max-height:100%!important;
    object-fit:contain!important;
    object-position:center!important;
    margin:auto!important;
  }
  html body .gallery-lightbox:not([hidden]) .lightbox-information{
    width:100%!important;
  }
}
@media (min-width: 992px) and (prefers-reduced-motion: reduce){
  html body .gallery-lightbox:not([hidden]) .lightbox-content,
  html body .gallery-lightbox:not([hidden]) .lightbox-stage{transition:none!important}
}
