/* -----------------------------------------------
Drawer
----------------------------------------------- */

$timeout: 400ms;

.b-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: auto;
  max-width: 100%;
  z-index: 1000;
  pointer-events: none;
  transform: translateX(100%);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transition: all $timeout cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);
  &.is-visible {
    visibility: visible;
    pointer-events: all;
    opacity: 1;
    transform: none;
    transition: all 0.4s;
  }
  &.is-left {
    left: 0;
    right: auto;
    transform: translateX(-100%);
  }
  &.is-visible.is-left {
    transform: translateX(0);
  }
}

.b-drawer-overlay {
  visibility: hidden;
  pointer-events: none;
  display: flex;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 500;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  opacity: 0;
  border: none;
  transition: all $timeout ease-in;
  &.is-left {
    left: 0;
    right: auto;
  }
  &.is-visible {
    visibility: visible;
    pointer-events: all;
    opacity: 1;
    transition: all $timeout ease-out;
  }
}

.b-drawer-header-title {
  font-size: 1.25rem;
  @media all and (max-width: 640px) {
    font-size: 1rem;
  }
}

.b-drawer-content {
  display: flex;
  flex-direction: column;
  width: 480px;
  max-width: 100%;
  min-height: 100%;
  margin-left: auto;
  background: #fff;
}

.b-drawer-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  padding: 1rem;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.1);
}

.b-drawer-title {
  font-size: 1.25rem;
  color: #333;
}

.b-drawer-close {
  font-size: 2.25rem;
  line-height: 1;
  margin-left: auto;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 2rem;
  margin-right: -0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all $timeout cubic-bezier(0.4, 0, 0.2, 1);
  &:hover {
    color: #111;
  }
}

.b-drawer.lg .b-drawer-content {
  width: 640px;
}
.b-drawer.sm .b-drawer-content {
  width: 300px;
}

.b-drawer-container .b-drawer-overlay {
  right: 480px;
}

.b-drawer-container.sm .b-drawer-overlay {
  right: 480px;
}

.b-drawer-container.lg .b-drawer-overlay {
  right: 640px;
}
