

$shadow-color: rgba(0, 0, 0, .15);
$shadow-1-up: 0 2px 8px $shadow-color;
$shadow-1-down: 0 2px 8px $shadow-color;
$shadow-1-left: -2px 0 8px $shadow-color;
$ease-base-out: cubic-bezier(0.7, 0.3, 0.1, 1);
$heading-color: fade(#000, 85%);
$shadow-2: 0 4px 12px $shadow-color;

.at-drawer {
  position: fixed;
  top: 0;
  width: 0%;
  z-index: 1000;
  transition: transform .3s cubic-bezier(0.9, 0, 0.3, 0.7);
  > * {
    transition: transform .3s cubic-bezier(0.9, 0, 0.3, 0.7);
  }

  &-content-wrapper {
    position: fixed;
  }
  .at-drawer-content {
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity .3s linear;
  }
  &-left,
  &-right {
    width: 0%;
    height: 100%;
    .at-drawer-content-wrapper {
      height: 100%;
    }
    &.at-drawer-open {
      width: 100%;
    }
  }
  &-left {
    &.at-drawer-open {
      .at-drawer-content-wrapper {
        box-shadow: 2px 0 8px rgba(0, 0, 0, .15);
      }
    }
  }
  &-right {
    .at-drawer {
      &-content-wrapper {
        right: 0;
      }
    }
    &.at-drawer-open {
      .at-drawer-content-wrapper {
        box-shadow: $shadow-1-left;
      }
    }
  }

  &-top,
  &-bottom {
    .at-drawer-content-wrapper,
    .at-drawer-content {
      width: 100%;
    }
  }
  &-top {
    &.at-drawer-open {
      .at-drawer-content-wrapper {
        box-shadow: $shadow-1-down;
      }
    }
  }
  &-bottom {
    .at-drawer {
      &-content-wrapper {
        bottom: 0;
      }
    }
    &.at-drawer-open {
      .at-drawer-content-wrapper {
        box-shadow: $shadow-1-up;
      }
    }
  }

  &.at-drawer-open {
    .at-drawer {
      &-content {
        opacity: 1;
      }
      &-mask {
        opacity: 0.3;
        height: 100%;
        animation: antdDrawerFadeIn .3s $ease-base-out;
        transition: none;
      }
    }
  }

  &-title {
    margin: 0;
    font-size: $font-size-lg;
    line-height: 22px;
    font-weight: 500;
    color: $heading-color;
  }

  &-content {
    position: relative;
    background-color: #fff;
    border: 0;
    background-clip: padding-box;
    z-index: 1;
  }

  &-close {
    cursor: pointer;
    border: 0;
    background: transparent;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 10;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: color .3s;
    color: fade(#000, 45%);
    outline: 0;
    padding: 0;

    &-x {
      display: block;
      font-style: normal;
      text-align: center;
      text-transform: none;
      text-rendering: auto;
      width: 56px;
      height: 56px;
      line-height: 56px;
      font-size: $font-size-lg;

      &:before {
        content: "\e8f6";
        display: block;
        font-family: feather;
      }
    }

    &:focus,
    &:hover {
      color: #444;
      text-decoration: none;
    }
  }

  &-header {
    padding: 16px 24px;
    border-radius: $border-radius-base $border-radius-base 0 0;
    background: #fff;
    color: $text-color;
    border-bottom: 1px solid $border-color-split;
  }

  &-body {
    padding: 24px;
    font-size: $font-size-base;
    line-height: $line-height-base;
    word-wrap: break-word;
  }

  &-mask {
    position: fixed;
    width: 100%;
    height: 0;
    opacity: 0;
    background-color: rgba(0, 0, 0, 0.65);
    transition: opacity .3s linear, height 0s ease .3s;
  }
  &-open {
    transition: transform .3s $ease-base-out;
    > * {
      transition: transform .3s $ease-base-out;
    }
    &-content {
      box-shadow: $shadow-2;
    }
  }
}

@keyframes antdDrawerFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 0.3;
  }
}
