/* Standalone popup styles. No framework, theme variables, or web fonts required. */
html.universal-popup-lock {
  overflow: hidden !important;
}

dialog.universal-popup {
  all: initial;
  --upop-close-background: #450e16;
  --upop-close-color: #ffffff;
  --upop-accent: #e4c38b;
  --upop-image-gap: 16px;
  box-sizing: border-box;
  display: block;
  position: fixed;
  inset: 0;
  width: fit-content;
  height: fit-content;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: visible;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  box-shadow: 0 20px 80px rgb(0 0 0 / 35%);
  font: 400 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: start;
  white-space: normal;
}

dialog.universal-popup[hidden],
dialog.universal-popup:not([open]),
dialog.universal-popup [hidden] {
  display: none !important;
}

dialog.universal-popup::backdrop {
  background: rgb(0 0 0 / 75%);
}

dialog.universal-popup *,
dialog.universal-popup *::before,
dialog.universal-popup *::after {
  box-sizing: border-box;
}

dialog.universal-popup .universal-popup__close {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--upop-accent);
  border-radius: 50%;
  background: var(--upop-close-background);
  color: var(--upop-close-color);
  box-shadow: 0 2px 8px rgb(0 0 0 / 30%);
  font: 400 30px/1 Arial, sans-serif;
  cursor: pointer;
}

dialog.universal-popup .universal-popup__close:hover {
  background: #681b26;
}

dialog.universal-popup .universal-popup__content {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--upop-image-gap);
  width: fit-content;
  max-width: 100%;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 55%) transparent;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: inherit;
  overflow-wrap: anywhere;
}

dialog.universal-popup .universal-popup__content img {
  display: block;
  float: none;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  object-fit: contain;
}

/* Show posters in a row on desktop and keep the stacked layout on mobile. */
@media (min-width: 768px) {
  dialog.universal-popup {
    max-width: min(1000px, 85vw);
  }

  dialog.universal-popup .universal-popup__content {
    grid-auto-flow: column;
  }
}

dialog.universal-popup .universal-popup__content .universal-popup__image-error {
  margin: 0;
  padding: 20px;
  padding-right: 78px;
  background: #202124;
  color: #ffffff;
}

dialog.universal-popup :focus-visible {
  outline: 3px solid var(--upop-accent);
  outline-offset: -3px;
}
