:root {
  --modal-header-height: 2rem;
  --modal-transition-time: 200;
}

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-50%) scale(0);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%) scale(1);
  }
}

@keyframes scaleDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-50%) scale(0);
  }
}

.erg-modal-contents iframe {
  margin-top: -60px;
}

.erg-modal-contents {
  display: none;
}

.erg-modal-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100;
  transform: translateX(-50%) translateY(-50%);
  overflow-y: auto;
  border-radius: 0.375rem;
  width: calc(100% - 2rem);
  max-width: 40rem;
  max-height: calc(100vh - 2rem);
  background-color: white;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.375);
  /* modal scale up transition */
  animation-name: scaleUp;
  animation-duration: calc(var(--modal-transition-time) * 1ms);
  animation-timing-function: ease-in;
  animation-fill-mode: both;
}

.erg-modal-header {
  position: relative;
  border-bottom: 1px solid rgba(0, 109, 182, 0.5); /* --erg-medium-blue */
  height: var(--modal-header-height);
  background-color: rgba(0, 109, 182, 0.375); /* --erg-medium-blue */
  background-color: #a4c8e4;
}

.erg-modal-close {
  display: flex;
  align-items: center;
  position: absolute;
  top: 0;
  right: 0;
  width: var(--modal-header-height);
  height: var(--modal-header-height);
  font-weight: bold;
  font-size: 1.5rem;
  line-height: var(--modal-header-height);
  text-decoration: none;
  text-align: center;
  text-shadow: 0 0 0.375rem rgba(0, 0, 0, 0.25);
  color: white;
  background-color:rgba(0, 109, 182, 0.5); /* --erg-medium-blue */
}

.erg-modal-close:hover,
.erg-modal-close:focus {
  background-color:rgba(0, 109, 182, 0.875); /* --erg-medium-blue */
}

.erg-modal-close span {
  width: 100%;
}

.erg-modal-body .erg-modal-contents {
  display: block;
}

body[data-modal-displayed],
body[data-modal-closing] {
  overflow: hidden;
}

body[data-modal-displayed]::after,
body[data-modal-closing]::after {
  content: '';
  position: fixed;
  z-index:10;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.75);
}

body[data-modal-displayed] .erg-modal-panel,
body[data-modal-closing] .erg-modal-panel {
  display: block;
}

body[data-modal-closing] .erg-modal-panel {
  animation-name: scaleDown;
}
