@mixin Modal($Elem) {
  #{$Elem} {
    display: none;
    opacity: 0;
    transition: all ease 0.25s;
  }

  #{$Elem}[data-state="open"] {
    opacity: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    align-content: center;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  #{$Elem}__inner {
    background-color: #fff;
    padding: 6em;
    margin: 1.5em;
    border-radius: 2px;
    box-shadow: 0 0 2px 5px rgba(0, 0, 0, 0.1);
    max-width: 520px;
    min-width: 300px;
    z-index: 9999999;
    max-height: 100vh;
    overflow-x: auto;
    position: relative;

    @include onScreen($medium-down) {
      padding: 8em 6em;
    }
    @include onScreen($small) {
      padding: 7em 4em;
      font-size: 12px;
    }
  }

  #{$Elem}____content {
    margin-top: 1.25em;
  }

  #{$Elem}__close-btn {
    position: absolute;
    top: 1em;
    right: 1em;
    height: 2.5em;
    width: 2.5em;
    display: inline-block;
    color: #fff;
    text-align: center;
    cursor: pointer;

    img {
      padding: 0.75em;
    }
  }
}

@include Modal(".Modal");