/* Dv251: viewer panel matches the tab transparency, hugs the image better,
   fixes Alice II/drawing layout, and repositions photo arrows. */

/* Make the image transform container size itself to the displayed image instead of the full row width. */
html body.project-page .modal-stage {
  overflow: visible !important;
}
html body.project-page .modal-pan {
  width: fit-content !important;
  height: fit-content !important;
  max-width: calc(100% - 170px) !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  position: relative !important;
  isolation: isolate !important;
  overflow: visible !important;
  background: transparent !important;
}
html body.project-page .modal-pan img {
  display: block !important;
  max-width: min(100%, 1280px) !important;
  max-height: min(78vh, 100%) !important;
  width: auto !important;
  height: auto !important;
}

/* Replace older pseudo-panels with a closer, more transparent dark panel like the top/bottom bars. */
html body.project-page .modal-pan::before,
html body.project-page .modal-pan::after,
html body.project-page .modal-stage::before,
html body.project-page .modal::before {
  content: none !important;
  display: none !important;
}

html body.project-page .modal-pan::before {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: -28px !important;
  right: -28px !important;
  top: -22px !important;
  bottom: -22px !important;
  z-index: -2 !important;
  pointer-events: none !important;
  border-radius: 26px !important;
  background: rgba(15, 15, 18, 0.58) !important;
  filter: blur(14px) !important;
  opacity: 1 !important;
}
html body.project-page .modal-pan::after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: -18px !important;
  right: -18px !important;
  top: -14px !important;
  bottom: -14px !important;
  z-index: -1 !important;
  pointer-events: none !important;
  border-radius: 18px !important;
  background: rgba(15, 15, 18, 0.42) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02) !important;
}

/* Reposition photo navigation buttons a bit lower and inset from the edges. */
html body.project-page .modal-arrow {
  top: 58% !important;
  transform: translateY(-50%) !important;
  width: 52px !important;
  height: 62px !important;
  background: rgba(255,255,255,.08) !important;
}
html body.project-page .modal-arrow.prev { left: 14px !important; }
html body.project-page .modal-arrow.next { right: 14px !important; }

/* Keep bars visually consistent. */
html body.project-page .modal-top,
html body.project-page .modal-bottom {
  background: rgba(15, 15, 18, 0.72) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

@media (max-width: 900px) {
  html body.project-page .modal-pan {
    max-width: calc(100% - 92px) !important;
  }
  html body.project-page .modal-pan img {
    max-height: 74vh !important;
  }
  html body.project-page .modal-pan::before {
    left: -14px !important;
    right: -14px !important;
    top: -12px !important;
    bottom: -12px !important;
    border-radius: 18px !important;
    filter: blur(10px) !important;
  }
  html body.project-page .modal-pan::after {
    left: -8px !important;
    right: -8px !important;
    top: -8px !important;
    bottom: -8px !important;
    border-radius: 12px !important;
  }
  html body.project-page .modal-arrow {
    top: 50% !important;
    width: 44px !important;
    height: 54px !important;
  }
  html body.project-page .modal-arrow.prev { left: 6px !important; }
  html body.project-page .modal-arrow.next { right: 6px !important; }
}
