// Copyright (c) 2017 Florian Klampfer <https://qwtel.com/>
//
// 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.

.sidebar {
  color: rgba(255,255,255,.75); // inline
  text-align: left; // inline

  a {
    color: #fff; // inline
    border-bottom-color: rgba(255, 255, 255, 0.2); // inline
    &:hover { border-bottom-color: #fff; } // link
  }
}

hy-drawer {
  position: relative; // inline
  padding: 1rem 0; // inline

  @media screen {
    padding: 2rem 1rem; // inline
    min-height: 640px; // link
    min-height: 100vh; // link

    // <<< link
    > .hy-drawer-content.hy-drawer-left {
      width: calc(18rem + 1px);
      left: -17.5rem;
      box-shadow: 0 0 1rem rgba(0, 0, 0, 0.25);
    }

    --hy-drawer-width: calc(18rem + 1px);
    --hy-drawer-slide-width: 17.5rem;
    --hy-drawer-box-shadow: 0 0 1rem rgba(0, 0, 0, 0.25);

    &.loaded {
      min-height: 0;
      padding: 0;
    }
    // >>>
  }

  @media screen and (min-width: $break-point-3) {
    // <<< inline
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 18rem;
    margin-left: 0;
    // >>>

    > .hy-drawer-content.hy-drawer-left { box-shadow: none; } // link
    --hy-drawer-box-shadow: none; // link
  }

  @media screen and (min-width: $break-point-dynamic) {
    width: calc(50% - 28rem); // inline
    > .hy-drawer-content.hy-drawer-left  { width: calc(50% - 28rem); left: calc(-50% + 28.5rem); } // link
    --hy-drawer-width: calc(50% - 28rem); // link
    --hy-drawer-slide-width: calc(50% - 28.5rem); // link
  }
}

.sidebar-bg {
  // <<< inline
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #202020 center / cover;

  /* make sidebar slightly darker to increase text readability (when using a background image) */
  &::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.05);
  }
  // >>> inline

  &.sidebar-overlay::after {
    /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#202020+0,202020+100&0+0,0.5+100 */
    background: -moz-linear-gradient(top, rgba(32,32,32,0) 0%, rgba(32,32,32,0.5) 100%); // link
    background: -webkit-linear-gradient(top, rgba(32,32,32,0) 0%,rgba(32,32,32,0.5) 100%); // link
    background: linear-gradient(to bottom, rgba(32,32,32,0) 0%,rgba(32,32,32,0.5) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00202020', endColorstr='#80202020',GradientType=0 ); // link
  }
}

.sidebar-sticky {
  // <<<<< INLINE
  position: relative;
  z-index: 3;

  @media screen {
    position: absolute;
    right: 1.5rem;
    left: 1.5rem;
    bottom: 1rem;
  }

  @media screen and (min-width: $break-point-dynamic) {
    left: auto;
    width: 15rem;
  }
  // >>>>>

  @media print { padding: 0 1.5rem; } // link
}

/* About section */
.sidebar-about > h1 {
  color: #fff;
  font-size: 2rem;
}

.sidebar-nav > ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: .5rem;
}

a.sidebar-nav-item {
  display: block;
  font-weight: $font-weight-heading;
  line-height: 1.75;
  padding: .25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

// >>>>>
// <<<<< LINK
a.sidebar-nav-item {
  &::before, &::after {
    position: absolute;
    right: 0;
    top: .75rem;
  }

  // &::before {
  //   content: "\2666";
  //   font-family: 'icomoon'!important;
  //   speak: none;
  //   font-style: normal;
  //   font-weight: normal;
  //   font-variant: normal;
  //   text-transform: none;
  //   line-height: 1;
  //   font-size: smaller;
  //   -webkit-font-smoothing: antialiased;
  //   -moz-osx-font-smoothing: grayscale;
  //   opacity: 0;
  //   transition: opacity 500ms;
  // }
  //
  // &.active::before {
  //   opacity: 0.33;
  // }
  //
  // &.active:hover::before {
  //   opacity: 1;
  //   transition: opacity 100ms;
  // }
}

@media print {
  .sidebar {
    page-break-before: always;
    break-before: always;
  }

  .sidebar-nav, .sidebar-social {
    display: none;
  }
}

header, body::before {
  backface-visibility: hidden;
}
// >>>>>