.smart-popup {
  overflow: hidden;
  overflow-y: auto;
  border-radius: 3px;
  position: fixed;
  /* Centred by default, which is also what a page cached before positions
     existed (no smart-popup--<position> class) gets. `translate`, not
     `transform`, so the animations below can use transform freely. */
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: min(500px, calc(100% - 40px));
  max-height: calc(100vh - 40px);
  height: auto;
  z-index: 9999;
  box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 30px;
}

.smart-popup.smart-popup--top-left,
.smart-popup.smart-popup--top-right,
.smart-popup.smart-popup--bottom-left,
.smart-popup.smart-popup--bottom-right {
  translate: none;
}

.smart-popup.smart-popup--top-left,
.smart-popup.smart-popup--top-right {
  top: 20px;
}

.smart-popup.smart-popup--bottom-left,
.smart-popup.smart-popup--bottom-right {
  top: auto;
  bottom: 20px;
}

.smart-popup.smart-popup--top-left,
.smart-popup.smart-popup--bottom-left {
  left: 20px;
}

.smart-popup.smart-popup--top-right,
.smart-popup.smart-popup--bottom-right {
  left: auto;
  right: 20px;
}

/* The animations run when smart-popup.js removes [hidden]. */
.smart-popup.smart-popup--anim-fade {
  animation: smart-popup-fade 0.35s ease-out;
}

.smart-popup.smart-popup--anim-slide {
  animation: smart-popup-slide-up 0.4s ease-out;
}

.smart-popup.smart-popup--anim-slide.smart-popup--top-left,
.smart-popup.smart-popup--anim-slide.smart-popup--bottom-left {
  animation-name: smart-popup-slide-right;
}

.smart-popup.smart-popup--anim-slide.smart-popup--top-right,
.smart-popup.smart-popup--anim-slide.smart-popup--bottom-right {
  animation-name: smart-popup-slide-left;
}

.smart-popup.smart-popup--anim-shake {
  animation: smart-popup-fade 0.2s ease-out, smart-popup-shake 0.6s ease-in-out 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  .smart-popup {
    animation: none !important;
  }
}

.smart-popup .smart-popup-title {
  padding: 5px;
  font-size: 30px;
  margin-bottom: 20px;
}

.smart-popup .smart-popup-content {
  margin-bottom: 20px;
}

.smart-popup .smart-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 16px;
}

.smart-popup .smart-popup-close:hover {
  color: #000;
}

.smart-popup .smart-popup-button {
  padding: 10px 0;
}

.smart-popup .smart-popup-button>a {
  background-color: #d4d4d4;
  padding: 10px 20px;
  border-radius: 60px;
  text-decoration: none;
}

@keyframes smart-popup-fade {
  from { opacity: 0; }
}

@keyframes smart-popup-slide-up {
  from { opacity: 0; transform: translateY(40px); }
}

@keyframes smart-popup-slide-right {
  from { opacity: 0; transform: translateX(-60px); }
}

@keyframes smart-popup-slide-left {
  from { opacity: 0; transform: translateX(60px); }
}

@keyframes smart-popup-shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* Hidden until smart-popup.js decides, so one cached page serves every
   visitor. The noscript block in smart-popup-display.php overrides this. */
.smart-popup[hidden] {
  display: none;
}
