.rt-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.rt-popup[hidden] {
  display: none;
}

.rt-popup.is-open {
  opacity: 1;
}

.rt-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.rt-popup__box {
  position: relative;
  width: min(720px, 100%);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.rt-popup.is-open .rt-popup__box {
  transform: none;
}

.rt-popup__link,
.rt-popup picture {
  display: block;
}

.rt-popup__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  object-fit: contain;
  border-radius: 17px;
}

.rt-popup__close {
  position: absolute;
  top: -16px;
  right: -16px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.rt-popup__close:hover {
  transform: rotate(90deg);
}

.rt-popup__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

html.rt-popup-lock,
html.rt-popup-lock body {
  overflow: hidden;
}

@media (max-width: 767px) {
  .rt-popup__img {
    border-radius: 12px;
  }

  .rt-popup__close {
    top: -12px;
    right: -8px;
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rt-popup,
  .rt-popup__box {
    transition: none;
  }
}
