/* ==========================================================
   Popup banner
   Markup : #popupBanner in index.html
   Script : js/popup-banner.js
   ========================================================== */

.popup-banner {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999999; /* above the fixed header, mobile menu and lightbox */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  background: rgba(10, 18, 44, 0.72);
  opacity: 0;
  pointer-events: none;
  overscroll-behavior: contain;
  touch-action: pinch-zoom;
  transition: opacity 0.3s ease;
}

.popup-banner:focus {
  outline: none;
}

.popup-banner[hidden] {
  display: none !important;
}

.popup-banner.is-open {
  opacity: 1;
  pointer-events: auto;
}

.popup-banner__card {
  position: relative;
  line-height: 0;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s ease;
}

.popup-banner.is-open .popup-banner__card {
  transform: none;
}

/* The banner scales down to fit any screen and keeps its proportions. */
.popup-banner__img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 64px);
  max-width: min(calc(100vw - 64px), 540px);
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  border-radius: 6px;
  background: #dcebf7;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

/* Close button sits on the top-right corner, outside the banner artwork. */
.popup-banner__close {
  position: absolute;
  top: -16px;
  right: -16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #2f3589;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.popup-banner__close svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
}

.popup-banner__close:hover {
  background: #ea6401;
  color: #fff;
}

.popup-banner__close:active {
  transform: scale(0.94);
}

.popup-banner__close:focus:not(:focus-visible) {
  outline: none;
}

.popup-banner__close:focus-visible {
  outline: 3px solid #1b73bd;
  outline-offset: 3px;
}

/* Phones and tablets: size the overlay to the real screen. This page is a little
   wider than a phone, and mobile browsers then stretch fixed elements past the
   screen edge, which would push the close button out of sight. */
@media (pointer: coarse), (max-width: 767px) {
  .popup-banner {
    right: auto;
    bottom: auto;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }
}

/* Short screens (phones held sideways) */
@media (max-height: 520px) {
  .popup-banner {
    padding: 20px 24px;
  }

  .popup-banner__img {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .popup-banner,
  .popup-banner__card,
  .popup-banner__close {
    transition: none;
  }

  .popup-banner__card {
    transform: none;
  }
}

@media print {
  .popup-banner {
    display: none !important;
  }
}
