/* Keep dialogs inside the visible part of the auto-height WordPress iframe. */
.modal-backdrop,
.global-wait {
  top: var(--nitm-visible-top, 0px);
  right: 0;
  bottom: auto;
  left: 0;
  height: var(--nitm-visible-height, 100vh);
  height: var(--nitm-visible-height, 100dvh);
  padding: 12px;
  box-sizing: border-box;
}

.modal-backdrop .modal {
  max-height: calc(var(--nitm-visible-height, 100vh) - 24px);
  max-height: calc(var(--nitm-visible-height, 100dvh) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: 60px;
}

.modal-backdrop .lightbox {
  width: 100%;
  height: auto;
  max-height: calc(var(--nitm-visible-height, 100vh) - 160px);
  max-height: calc(var(--nitm-visible-height, 100dvh) - 160px);
  object-fit: contain;
}

.modal-backdrop .modal-close {
  position: sticky;
  top: 0;
  float: right;
  min-width: 44px;
  min-height: 44px;
  margin: -48px -6px 8px 8px;
  z-index: 5;
}

/* Backdrop blur is expensive across a very tall iframe on mobile GPUs. */
@media (max-width: 700px), (prefers-reduced-motion: reduce) {
  .modal-backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
