/* Dv255 — remove the unwanted dark/navy image backing and keep every
   gallery image entirely INSIDE the area between the top and bottom bars. */

/* Older styles attach dark backgrounds specifically to Alice II's #modalPan. */
html body.project-page #galleryModal,
html body.project-page #galleryModal .modal-stage,
html body.project-page #galleryModal #modalPan,
html body.project-page #galleryModal #modalPan:has(#modalImg[src*="/assets/statek/"]) {
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 0 !important;
}
html body.project-page #galleryModal::before,
html body.project-page #galleryModal .modal-stage::before,
html body.project-page #galleryModal #modalPan::before,
html body.project-page #galleryModal #modalPan::after {
  content: none !important;
  display: none !important;
  background: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Dedicated, non-overlapping header, image, and footer tracks. */
html body.project-page #galleryModal .modal-shell {
  box-sizing: border-box !important;
  width: min(1500px, calc(100% - 48px)) !important;
  height: min(820px, calc(100dvh - 84px)) !important;
  display: grid !important;
  grid-template-rows: 60px minmax(0, 1fr) 44px !important;
  gap: 14px !important;
  overflow: visible !important;
}
html body.project-page #galleryModal .modal-top,
html body.project-page #galleryModal .modal-bottom {
  box-sizing: border-box !important;
  min-height: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 12px !important;
  background: rgba(15, 15, 18, .74) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  position: relative !important;
  z-index: 3 !important;
}

/* The drawing/ship's actual displayed pixels are always contained by this track. */
html body.project-page #galleryModal #modalStage {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 78px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  position: relative !important;
  overflow: visible !important;
}
html body.project-page #galleryModal #modalPan {
  box-sizing: border-box !important;
  flex: 0 1 auto !important;
  width: min(100%, 1250px) !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
  isolation: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
html body.project-page #galleryModal #modalImg {
  box-sizing: border-box !important;
  display: block !important;
  flex: 0 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Keep navigation on both sides of the image, in the centre of its track. */
html body.project-page #galleryModal #modalPan > .modal-arrow {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 4 !important;
}
html body.project-page #galleryModal #modalPan > .modal-arrow.prev { left: -74px !important; }
html body.project-page #galleryModal #modalPan > .modal-arrow.next { right: -74px !important; }

@media (max-width: 900px) {
  html body.project-page #galleryModal .modal-shell {
    width: calc(100% - 8px) !important;
    height: min(96dvh, calc(100dvh - 14px)) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }
  html body.project-page #galleryModal .modal-top,
  html body.project-page #galleryModal .modal-bottom { height: auto !important; }
  html body.project-page #galleryModal #modalStage { padding: 0 46px !important; }
  html body.project-page #galleryModal #modalPan > .modal-arrow.prev { left: -44px !important; }
  html body.project-page #galleryModal #modalPan > .modal-arrow.next { right: -44px !important; }
}

/* Reveal only the site's original stripe artwork behind the gallery,
   not the underlying page text/cards while the full-screen viewer is open. */
html body.project-page.modal-open #r-main,
html body.project-page.modal-open #shared-footer {
  visibility: hidden !important;
}

/* Keep the desktop site navigation visible without colliding with the viewer top bar. */
@media (min-width: 901px) {
  html body.project-page #galleryModal.modal {
    padding: 94px 22px 18px !important;
  }
  html body.project-page #galleryModal .modal-shell {
    height: min(765px, calc(100dvh - 126px)) !important;
  }
}
@media (max-width: 900px) {
  html body.project-page #galleryModal.modal { padding: 8px !important; }
}
