#interactive-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#interactive-popup.hidden,
#interactive-popup-button.hidden,
.interactive-image.hidden,
.interactive-image-overlay.hidden {
  display: none;
}


.interactive-popup-content {
  background-color: var(--popup-bg, #ffffff);
  background-image: var(--popup-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 2rem;
  width: 75vw;
  height: 75vh;
  overflow-y: auto;
  position: relative;
  border-radius: 8px;
}

.interactive-popup-content.has-bg-image {
  width: min(75vw, calc(75vh * var(--popup-bg-image-ratio)));
  height: auto;
  aspect-ratio: var(--popup-bg-image-aspect-ratio);
}

.interactive-popup-content h2,
.interactive-image-message h2 {
  color: var(--popup-header-color, #000000);
  text-align: var(--popup-title-align, left);
}

.interactive-popup-body {
  color: var(--popup-body-color, #000000);
}

.interactive-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
}

#interactive-popup-button {
  position: fixed;
  z-index: 1500;
  width: 100px;
  height: 100px;
  padding: 0;
  overflow: hidden;
}

#interactive-popup-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#interactive-popup-button.float-pos--bottom-left  { bottom: 20px; left: 20px; }
#interactive-popup-button.float-pos--bottom-right { bottom: 20px; right: 20px; }
#interactive-popup-button.float-pos--top-left     { top: 20px; left: 20px; }
#interactive-popup-button.float-pos--top-right    { top: 20px; right: 20px; }

.interactive-image-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.interactive-image-overlay.fade-out {
  opacity: 0;
}

.interactive-image {
  position: fixed;
  top: 50%;
  left: -200px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.interactive-image img {
  width: 120px;
}

.interactive-image-message {
  background-color: var(--popup-bg, #ffffff);
  background-image: var(--interactive-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  width: 50vw;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  margin-top: 0.5rem;
  max-height: calc(50vh - 80px);
  overflow-y: auto;
}

.interactive-image-message.has-interactive-bg {
  width: min(50vw, calc(40vh * var(--interactive-bg-image-ratio)));
  height: auto;
  max-height: none;
  aspect-ratio: var(--interactive-bg-image-aspect-ratio);
  padding: 0;
}

.interactive-image-message.has-interactive-bg h2,
.interactive-image-message.has-interactive-bg .interactive-popup-body {
  display: none;
}

.interactive-image-message h2 {
  margin: 0 0 0.5rem;
}

.interactive-image.direction--ltr {
  animation: floatAcross var(--popup-anim-speed, 8s) ease-in-out forwards;
}

.interactive-image.direction--rtl {
  left: auto;
  right: -200px;
  animation: floatAcrossRTL var(--popup-anim-speed, 8s) ease-in-out forwards;
}

@keyframes floatAcross {
  from { transform: translateY(-50%) translateX(calc(200px - 50vw)); }
  to { transform: translateY(-50%) translateX(calc(100vw + 200px)); }
}

@keyframes floatAcrossRTL {
  from { transform: translateY(-50%) translateX(calc(50vw - 200px)); }
  to { transform: translateY(-50%) translateX(calc(-100vw - 200px)); }
}

@keyframes floatUp {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(-120vh); }
}

@keyframes floatDown {
  from { transform: translateX(-50%) translateY(0); }
  to { transform: translateX(-50%) translateY(120vh); }
}

@media (max-width: 767px) {
  .interactive-image.direction--ltr.mobile-direction--bottom-to-top,
  .interactive-image.direction--rtl.mobile-direction--bottom-to-top {
    top: auto;
    bottom: -200px;
    left: 50%;
    right: auto;
    animation: floatUp var(--popup-anim-speed, 8s) ease-in-out forwards;
  }

  .interactive-image.direction--ltr.mobile-direction--top-to-bottom,
  .interactive-image.direction--rtl.mobile-direction--top-to-bottom {
    top: -200px;
    bottom: auto;
    left: 50%;
    right: auto;
    animation: floatDown var(--popup-anim-speed, 8s) ease-in-out forwards;
  }

  .interactive-image-message {
    width: 90vw;
    max-width: none;
  }

  .interactive-image-message.has-interactive-bg {
    width: min(90vw, calc(40vh * var(--interactive-bg-image-ratio)));
    padding: 0;
  }
}
