.modal {
  $base-border-color: #dcdcdc !default;
  $base-border-radius: 3px !default;
  $base-background-color: #fff !default;
  $base-font-size: 1em !default;
  $base-line-height: 1.5em !default;
  $action-color: #477dca !default;
  $dark-gray: #333 !default;
  $light-gray: #ddd !default;
  $medium-screen: 40em !default;
  $large-screen: 53.75em !default;
  $base-font-color: $dark-gray !default;
  $modal-padding: 3em;
  $modal-background: $base-background-color;
  $modal-close-color: $light-gray;
  $modal-image-height: 135px;
  $modal-image-width: $modal-image-height;
  $modal-trigger-image-width: 300px;
  $fade-screen-background-base-color: #3F3F44;

  transition: width ease .3s;
  animation: zoomIn .2s ease-out;

  label {
    cursor: pointer;
    margin-bottom: 0;
  }

  label img {
    border-radius: $modal-trigger-image-width / 2;
    display: block;
    max-width: $modal-trigger-image-width;
  }

  .modal-header {
    padding: 20px $space;
    border-bottom: 1px solid #e5e5e5;
  }

  .modal-footer {
    padding: 20px $space;
    border-top: 1px solid #e5e5e5;
  }

  .modal-body {
    padding: $space;
  }

  .modal-state {
    display: none;
  }

  .modal-trigger {
    padding: 0.8em 1em;
  }

  .brand-details {
    margin-bottom: 0;

    .brand-logo {
      width: $brand-icon;
      height: $brand-icon;
      margin-right: 0;
      float: none;
      margin: $pad auto;
    }
  }

  .modal-fade-screen { // overlay
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba($fade-screen-background-base-color, 0.80);
    opacity: 0;
    padding-top: 0.6em;
    text-align: left;
    transition: opacity 0.25s ease;
    visibility: hidden;
    z-index: 99999999999;

    .modal-bg {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      cursor: pointer;
    }
  }

  .modal-close-x {
    position: absolute;
    top: 15px;
    right: 15px;
    height: 1.5em;
    width: 1.5em;
    animation: fadeOut 0.1s ease-out;
    animation: zoomOut 0.1s ease-out;
    background: $modal-background;
    cursor: pointer;

    &::after,
    &::before {
      position: absolute;
      top: 3px;
      right: 3px;
      bottom: 0;
      left: 50%;
      height: 1.5em;
      width: 0.15em;
      background: $modal-close-color;
      content: "";
      display: block;
      margin: -3px 0 0 -1px;
      transform: rotate(45deg);
    }

    &:hover::after,
    &:hover::before {
      background: darken($modal-close-color, 10%);
    }

    &::before {
      transform: rotate(-45deg);
    }
  }

  .modal-inner {
    background: $modal-background;
    border-radius: $base-border-radius;
    margin: auto;
    margin-top: 0;
    position: relative;
    overflow: hidden;
    margin-top: $pad;

    @media screen and (min-width: 1400px) {
      margin-top: 10%;
    }

    @media screen and (min-width: 1241px) {
      width: 50%;
    }

    @media screen and (max-width: 559px) {
      width: 95%;
    }

    h1 {
      color: $base-font-color;
      text-align: left;
      text-transform: capitalize;
    }

    p {
      color: $base-font-color;
      line-height: $base-line-height;
    }

    .modal-intro {
      margin-bottom: 1em;
    }

    .modal-content {
      color: $base-font-color;

      @media screen and (max-width: $medium-screen) {
        columns: 2 8em;
      }
    }

    a.cta {
      color: $base-background-color;
      display: inline-block;
      margin-right: 0.5em;
      margin-top: 1em;

      &:last-child {
        padding: 0 2em;
      }
    }
  }

  .modal-state:checked + .modal-fade-screen {
    opacity: 1;
    visibility: visible;
  }

  .modal-state:checked + .modal-fade-screen .modal-inner {
    top: 0.5em;
  }
}

.modal-open {
  overflow: hidden;
}

// Based on code by Kasper Mikiewicz
