/* @modal */
.modal-hider {
  display: none;
  position: absolute;
  left: -99999em;
}

.modal {
  display: none;

  @at-root body.modal-visible & {
    .modal-inner {
      transform: translate(-50%, -50%) scale(1) !important;
    }
  }

  &::before {
    content: none !important;
  }

  &-inner {
    transform: translate(-50%, -50%) !important;
    position: absolute !important;
    left: 50%;
    top: 50%;
  }
}

.vanilla-modal .modal {
  display: block;
  position: fixed;
  content: "";
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(#fff, 0.95);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.2s, z-index 0s 0.2s;
  text-align: center;
  overflow: hidden;
  overflow-y: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.vanilla-modal .modal > * {
  display: inline-block;
  white-space: normal;
  vertical-align: middle;
  text-align: left;
}

.vanilla-modal .modal:before {
  display: inline-block;
  overflow: hidden;
  width: 0;
  height: 100%;
  vertical-align: middle;
  content: "";
}

.vanilla-modal.modal-visible .modal {
  z-index: 99990;
  opacity: 1;
  transition: opacity 0.2s;
}

.modal-inner {
  @include poly-padding--large;
  padding-top: 50px !important;
  position: relative;
  overflow: hidden;
  width: 90%;
  max-width: 680px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  z-index: -1;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s, z-index 0s 0.2s;
  box-shadow: 18px 19px 50px 0 rgba(#000, 0.1);

  .modal-content {
    .cta {
      padding: 0.75em !important;
    }
  }
}

.modal-visible .modal-inner {
  z-index: 500;
  max-height: 70%;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.2s, transform 0.2s;
}

@media (max-width: 767px) {
  .modal-visible .modal-inner {
    max-height: 90% !important;
  }
}

.modal-close {
  position: absolute;
  z-index: 2;
  right: 0;
  top: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-align: center;
  background: #fff;

  svg {
    width: 25px;
    height: 25px;
    @include themify($themes) {
      fill: themed('ctaColor');
    }
  }
}
