*:not(.is-dialog-open) {
  .dialog {
    &.dialog-max {
      .dialog_content {
        animation: dialog-max-out 300ms ease-in-out;
      }
    }
  }
}

.is-dialog-open {
  .dialog {
    &.dialog-max {
      .dialog_content {
        animation: dialog-max-in 300ms ease-in-out;
      }
    }
  }
}

.dialog {
  &.dialog-max {
    .dialog_header {
      padding: 0;
      border: 0;
      background-color: color(black);
      .dialog_title {
        padding-left: ms(-5);
        color: color(white);
      }
      .dialog_close {
        color: color(white);
      }
    }

    &.dialog_headerless {
      .dialog_footer {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        min-height: 40px;
        background: color(gray, plus4);
      }
    }

    .dialog_content {
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      min-width: 100%;
      max-width: 100%;
      max-height: 100%;
      transform: none;

      @include media('>=md') {
        right: 10%;
        left: 10%;
        min-width: 80%;
      }
    }
  }
}

@keyframes dialog-max-in {
  from {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 1);
  }

  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes dialog-max-out {
  from {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }

  to {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 1);
  }
}
