/**
 * Promo popup (telle_popup) — front-end modal.
 * Shown/dismissed by js/promo-popup.js. Each popup: .promotion-custom-popups
 * with a unique id (#promotion-custom-popups-<post id>).
 *
 * Desktop: image at its natural width/height (capped to the viewport).
 * Mobile:  image width 100%, height auto. Always centered on screen.
 * The × close button sits above the popup, top-right.
 */
.promotion-custom-popups {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.promotion-custom-popups[hidden] {
  display: none;
}

/* Lock page scroll while a popup is open (toggled by js/promo-popup.js) */
html.promotion-custom-popups-open,
html.promotion-custom-popups-open body {
  overflow: hidden;
}

.promotion-custom-popups.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.promotion-custom-popups__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.promotion-custom-popups__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 90vw;
}

/* × above the popup, top-right */
.promotion-custom-popups__close {
  flex: 0 0 auto;
  margin: 0 0 8px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.55);
  border: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.promotion-custom-popups__close:hover,
.promotion-custom-popups__close:focus {
  background: rgba(0, 0, 0, 0.8);
}

.promotion-custom-popups__dialog {
  max-width: 100%;
  max-height: 82vh;
  max-height: 82dvh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.promotion-custom-popups__link {
  display: block;
}

/* Desktop: natural image size (only scaled down if larger than the viewport) */
.promotion-custom-popups__dialog img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 82vh;
  max-height: 82dvh;
}

/* Mobile: fill the width, natural height */
@media (max-width: 640px) {
  .promotion-custom-popups__inner {
    width: 100%;
    max-width: 100%;
  }

  .promotion-custom-popups__dialog {
    width: 100%;
    max-width: 100%;
  }

  .promotion-custom-popups__dialog img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }
}
