//
// Copyright 2018 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions://
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@import "@material/animation/functions";
@import "@material/animation/variables";
@import "@material/rtl/mixins";
@import "@material/typography/mixins";
@import "@material/typography/variables";
@import "@material/theme/variables";
@import "@material/theme/mixins";
@import "./variables";
@import "./mixins";

// postcss-bem-linter: define drawer

.mdc-drawer {
  @include mdc-drawer-title-ink-color($mdc-drawer-title-ink-color);
  @include mdc-drawer-subtitle-ink-color($mdc-drawer-subtitle-ink-color);
  @include mdc-drawer-border-color($mdc-drawer-divider-color);
  @include mdc-drawer-surface-fill-color($mdc-drawer-surface-fill-color);
  @include mdc-drawer-item-icon-ink-color($mdc-drawer-item-inactive-ink-color);
  @include mdc-drawer-item-text-ink-color($mdc-drawer-item-inactive-ink-color);
  @include mdc-drawer-item-activated-icon-ink-color($mdc-drawer-item-activated-ink-color);
  @include mdc-drawer-item-activated-text-ink-color($mdc-drawer-item-activated-ink-color);
  @include mdc-drawer-item-corner-radius(4px);

  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-sizing: border-box;
  width: $mdc-drawer-width;
  max-width: $mdc-drawer-width;
  height: 100%;
  transition-property: transform;
  transition-timing-function: $mdc-animation-standard-curve-timing-function;
  border-right-width: 1px;
  border-right-style: solid;
  overflow: hidden;
  z-index: $mdc-drawer-z-index;

  @include mdc-rtl {
    border-right-width: 0;
    border-left-width: 1px;
    border-right-style: none;
    border-left-style: solid;
  }

  // postcss-bem-linter: ignore
  .mdc-list-item {
    @include mdc-typography(subtitle2);

    height: calc(48px - 2 * #{$mdc-drawer-list-item-spacing});
    // To accomodate margin conflict.
    margin: ($mdc-drawer-list-item-spacing * 2) 8px;
    padding: 0 $mdc-drawer-surface-padding / 2;
  }

  // postcss-bem-linter: ignore
  .mdc-list-item:nth-child(1) {
    margin-top: 2px;
  }

  // postcss-bem-linter: ignore
  .mdc-list-item:nth-last-child(1) {
    margin-bottom: 0;
  }

  // postcss-bem-linter: ignore
  .mdc-list-group__subheader {
    @include mdc-typography(body2);
    @include mdc-typography-baseline-top(24px);

    margin: 0;
    padding: 0 $mdc-drawer-surface-padding;
  }

  // postcss-bem-linter: ignore
  .mdc-list-divider {
    margin: 3px 0 4px 0;
  }

  // Prevents list item children from being included in the click target.
  // postcss-bem-linter: ignore
  .mdc-list-item__text,
  .mdc-list-item__graphic {
    pointer-events: none;
  }
}

.mdc-drawer--open {
  transition: mdc-animation-standard(transform, $mdc-drawer-animation-enter);
}

.mdc-drawer--animate {
  transform: translateX(-100%);

  @include mdc-rtl {
    transform: translateX(100%);
  }
}

.mdc-drawer--opening {
  transform: translateX(0);
  transition-duration: $mdc-drawer-animation-enter;

  // Required to level the specificity with animate class.
  @include mdc-rtl {
    transform: translateX(0);
  }
}

.mdc-drawer--closing {
  transform: translateX(-100%);
  transition-duration: $mdc-drawer-animation-exit;

  @include mdc-rtl {
    transform: translateX(100%);
  }
}

.mdc-drawer__header {
  flex-shrink: 0;
  box-sizing: border-box;
  min-height: 64px; // same as $mdc-top-app-bar-row-height
  padding: 0 $mdc-drawer-surface-padding 4px;
}

.mdc-drawer__title {
  @include mdc-typography(headline6);
  @include mdc-typography-baseline-top(36px);
  @include mdc-typography-baseline-bottom(20px);
}

.mdc-drawer__subtitle {
  @include mdc-typography(body2);
  @include mdc-typography-baseline-top(20px);

  margin-bottom: 0;
}

.mdc-drawer__content {
  height: 100%;
  overflow-y: auto;
}

// postcss-bem-linter: end
