/* Revision 39: remove the outgoing-page flash and size gallery previews to their artwork. */
#modal:has(.page-sheet) .modal-window,
.teaching-modal .modal-window {
  width: max-content;
  max-width: 94vw;
}

#modal:has(.page-sheet) .modal-stage,
.teaching-modal .modal-stage {
  width: max-content;
  max-width: 100%;
  min-height: 0;
  margin-inline: auto;
  background: transparent;
}

#modal:has(.page-sheet) .modal-stage .page-sheet,
.teaching-modal .modal-stage .page-sheet {
  flex: 0 1 auto;
  width: auto;
  max-width: calc(94vw - 100px);
  min-height: 0;
  height: auto;
  background: #deded7;
}

#modal:has(.page-sheet) .modal-stage .page-sheet > img,
.teaching-modal .modal-stage .page-sheet > img {
  display: block;
  max-width: 100%;
  max-height: 67vh;
}

#modal:has(.page-sheet) .modal-info,
.teaching-modal .modal-info {
  max-width: calc(94vw - 44px);
  margin-inline: auto;
}

@media (max-width: 800px) {
  #modal:has(.page-sheet) .modal-window,
  .teaching-modal .modal-window {
    width: calc(100vw - 24px);
    max-width: none;
  }

  #modal:has(.page-sheet) .modal-stage,
  .teaching-modal .modal-stage {
    width: 100%;
    max-width: 100%;
    gap: 6px;
  }

  #modal:has(.page-sheet) .modal-stage .page-sheet,
  .teaching-modal .modal-stage .page-sheet {
    max-width: calc(100% - 76px);
  }

  #modal:has(.page-sheet) .modal-stage .page-sheet > img,
  .teaching-modal .modal-stage .page-sheet > img {
    max-height: 64vh;
  }

  #modal:has(.page-sheet) .modal-info,
  .teaching-modal .modal-info {
    max-width: 100%;
  }
}
