.docs {
  $top: 1rem;
  $menu-width: 17rem;
  $mobile-menu-width: 300px;
  $toc-width: 14rem;
  $menu-item-padding-spacer: 6px;
  $menu-line-height: 18px;
  max-width: 1440px;
  margin: 0 auto;

  .algolia-autocomplete .ds-dropdown-menu {
    width: 100%;
    max-width: 2000px !important;
    z-index: 99999 !important;
  }

  aside nav ul {
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 14px;
  }

  &-menu {
    flex: 0 0 $menu-width;
    font-size: 1rem;
    margin-right: auto;

    &-category {
      font-size: 14px;
      font-weight: 600;
      display: inline-block;
      color: $gray-dark;
      width: calc(100% - 20px);
      padding: 1rem 0 0.5rem 0;
    }

    &-content {
      margin-left: -6px !important;
      padding-right: 20px !important;
    }

    nav {
      height: calc(100vh - $top);
      position: relative;
      width: $menu-width;
      padding: 1rem 0 1rem 1rem;
      overflow-x: hidden;
      overflow-y: auto;
      scrollbar-width: thin;
    }
    .right-transform {
      transform: none;
    }
    .left-transform {
      transform: none;
    }

    .docs-menu-mobile-show {
      display: none;
    }

    .docs-menu-mobile-right-space {
      display: none;
      width: 0;
      height: 0;
    }

    a {
      color: $gray-dark;
    }

    &-title {
      display: flex;
      align-items: center;
      font-weight: 400;
      font-size: 14px;
      line-height: $menu-line-height;
      color: $gray-darkish !important;
      padding: $menu-item-padding-spacer 0px;

      &:hover {
        cursor: pointer;
      }
      &::before {
        width: 3 * $menu-item-padding-spacer;
        height: 3 * $menu-item-padding-spacer;
        background: url(/images/icons/svg/chevron.svg);
        background-size: 100%;
        margin: 0 $menu-item-padding-spacer 0 0;
        content: '';
        display: inline-block;
        transition: .15s transform ease;
      }
    }

    &-reference-link {
      display: flex;
      align-items: center;
      font-weight: 400;
      font-size: 14px;
      line-height: $menu-line-height;
      padding: $menu-item-padding-spacer;

      > a {
        color: $gray-darkish !important;
      }

      &:hover {
        cursor: pointer;
      }
    }

    .active {
      color: $gray-dark !important;
      font-weight: 500;
      &::before {
        transform: rotate(90deg);
      }
    }
    .menu-display {
      margin-bottom: 12px;
      display: block;
    }
    &-sub {
      list-style-type: none;
      padding-left: 0;
      margin-bottom: .5rem;
      display: none;

      &.active {
        display: block;
      }

      &-item {
        & & {
          margin-left: 8px;
        }

        a {
          padding: $menu-item-padding-spacer $menu-item-padding-spacer $menu-item-padding-spacer 4 * $menu-item-padding-spacer;
          display: block;
          color: $gray-darkish;
        }
        &.active {
          > a {
            background: $blue-light;
            border-radius: .25rem;
            color: $blue;
            font-weight: 500;
          }
        }
      }
    }

    &-item {
      line-height: $menu-line-height;
      padding-left: 0;
      h3 {
        color: $gray-dark;
        font-size: $font-size-base;
        font-weight: 500;
        display: block;
        margin-top: 2rem;
        margin-bottom: .5rem;
      }
    }

    .api-reference-link {
      display: inline-block;
      font-size: 14px;
      line-height: 16.94px;
      color: $gray-dark;
      width: calc(100% - 20px);
      padding-bottom: 1rem;
      margin-bottom: 10px;

      &:hover {
        text-decoration: none;
        color: $brand-primary
      }
    }

    .slack-link {
      padding-top: 1rem;
      margin-top: 1em;
      border-top: 1px solid $gray-light;
      display: flex;
      align-items: center;
      font-weight: 600;
      font-size: 14px;
      color: $gray-darkish;
      width: calc(100% - 20px);
      margin-top: 10px;

      &::before {
        width: 18px;
        height: 18px;
        background: url(/images/slack/slack-logo-small.png);
        background-size: 100%;
        margin: 0 8px 0 0;
        content: '';
        display: inline-block;
      }
    }
  }

  &-page {
    min-width: 20rem;
    flex-grow: 1;
    padding: 1rem 0 1rem 30px;
    margin-left: 0;
    margin-right: 0;

    .markdown {
      padding-right: 30px;

      .mobile-toc-button {
        display: none;
      }

      code {
        box-shadow: none;
      }
    }

    .form-inline {
      width: 100%;
      position: relative;

      span {
        width: 100%;
        max-width: 2000px;
        height: 100%;
      }
      img {
        position: absolute;
        top: 11px;
        left: 10px;
      }
      input {
       width: 100%;
       height: 100%;
       background: none;
       border: 1px solid $gray-light;
       padding-left: 30px;
      }
    }
  }

  &-toc {
    display: flex;
    flex-direction: column;
    flex: 0 0 $toc-width;
    font-size: .875rem;
    margin-right: auto;
    width: 232px;

    &-content {
      padding: 1rem 0 1rem 1rem;
      height: calc(100vh - 1rem);
      overflow-x: hidden;
      overflow-y: auto;
      scrollbar-width: thin;
    }

    nav {
      width: $toc-width;
      bottom: 0;
      overflow-x: hidden;
      overflow-y: auto;
      ul ul {
        padding-left: 1rem;
        border-left: none !important;
      }
    }
    // hacky way to hide 3rd level heading in little page TOC because Hugo does not allow filtering the TOC by level

    nav#TableOfContents {
      ul {
        padding-left: 2 * $menu-item-padding-spacer;

        ul {
          padding-left: 0.75rem;
        }

        li {
          a {
            display: block;
            padding-bottom: $menu-item-padding-spacer;
            color: $gray-darkish;
          }
        }
      }
    }

    &-header {
      padding-left: 2 * $menu-item-padding-spacer;
      color: $gray-dark;
      font-weight: 600;
      margin: 1rem 0 .75rem;
    }

    &-community, &-support {
      margin-top: 4 * $menu-item-padding-spacer;

      nav {
        ul {
          padding-left: 2 * $menu-item-padding-spacer !important;

          li {
            a {
              display: flex;
              align-items: center;
              padding-bottom: $menu-item-padding-spacer;
              color: $gray-darkish;

              &::before {
                width: 12px;
                height: 12px;
                background-size: 100%;
                background-repeat: no-repeat;
                background-position: bottom;
                margin: 0 8px 0 0;
                content: '';
                display: inline-block;
              }
            }
          }
        }
      }

      &-slack-link {
        &::before {
          background: url(/images/icons/slack-icon.svg);
        }
      }

      &-github-link {
        &::before {
          background: url(/images/icons/github-icon.svg);
        }
      }
      &-youtube-link {
        &::before {
          background: url(/images/icons/youtube-icon.svg);
        }
      }
      &-question-link {
        &::before {
          background: url(/images/icons/question.svg);
        }
      }
    }

    &-mobile {
      display: none;
      .docs-toc-header {
        top: 0;
        position: relative;
        padding-top: 0;
      }
    }
  }

  // Responsive styles
  aside nav,
  .docs-page,
  .markdown {
    transition: 0.2s ease-in-out;
    transition-property: transform, margin-left, opacity;
    will-change: transform, margin-left;

    h1, h2, h3, h4, h5 {
      color: $black;
    }

    .heading-anchor {
      color: $black;

      & > * {
        scroll-margin-top: 3rem;
      }
    }

    .breadcrumb {
      display: flex;
      align-items: center;
      margin: 1rem 0 .75rem;
      padding: 0;
      background: none;
      font-size: 14px;

      & a {
        color: $gray;
        &:hover {
          text-decoration: none;
          color: $gray-dark;
        }
      }

      & a:last-child {
        color: $gray-dark;
      }

      & span {
        margin: 0 5px;
        color: $gray;
      }

      .badge-beta {
        margin-left: auto;
        margin-right: 1rem;
        color: $white;
        background: $pink;
        font-weight: 600;
        text-transform: capitalize;
        border-radius: 8px;
        padding: 0.25rem 0.5rem;
      }
    }

    nav#TableOfContents {
      ul {
        border-left: 2px solid $brand-primary;
        padding-left: .5rem;

        li > ul {
          display: none;
        }
      }
    }
    .cards-list {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      width: 100%;
      margin-top: 20px;

      a {
        &:hover {
          text-decoration: none;
        }
      }

      .image-wrap {
        width: 42px;
        margin-right: 1rem;
        margin-bottom: 1rem;

        img {
          border: none;
        }
      }

      .text-wrap {
        h2 {
          margin: 3px 0;
          img {
            margin-right: 4px;
            vertical-align: text-bottom;
          }
        }

        h3 {
          margin: 0;
          padding: 0;
          font-size: 20px;
          line-height: 30px;

          img {
            margin-right: 4px;
            vertical-align: text-bottom;
          }
        }

        p {
          font-size: 16px;
          line-height: 24px;
          margin-top: 8px;
          margin-bottom: 8px;
        }
      }

      .basic-card {
        transition: border-color .15s ease-out, box-shadow .15s ease-out,transform .15s ease-out,opacity .15s ease-out;
        &:hover {
          box-shadow: 0px 1px 2px rgba(2,8,20,.06),0px 2px 8px rgba(2,8,20,.08);
          border-color: $blue;
        }
      }

      .full-width-card {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-bottom: 1rem;
        padding: 20px 24px;
        border-radius: 6px;
        border: 1px solid $gray-light;
      }

      .two-column-card {
        width: 49%;
        display: flex;
        justify-content: space-between;
        padding: 20px 24px;
        border-radius: 6px;
        border: 1px solid $gray-light;
      }
      .three-column-card {
        width: calc((100% - 50px)/3);
        display: flex;
        justify-content: space-between;
        padding: 20px 24px;
        border-radius: 6px;
        border: 1px solid $gray-light;

        .text-wrap {
          width: 100%;
          h3 {
            font-size: 16px;
            line-height: 24px;
          }
        }
      }

    }
  }

  .docs-meta {
    img {
      width: 2.5em;
      height: 2.5em;
      margin: .5em 0;
      overflow: hidden;
      border-radius: 10em;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
    }
  }

  @include media-breakpoint-down(md) {
    .docs-page {
      padding: .5rem;
      margin-left: auto;
      margin-right: auto;
    }

    .docs-menu {
      position: fixed;
      z-index: 10000;
      width: 100%;
      height: calc(100vh + 80px);
      top: 0;
      left: -100%;
      font-size: $font-size-base;
      background: rgba(0, 0, 0, .2);

      nav {
        border: 0;
        border-radius: 0;
        height: 100%;
        width: $mobile-menu-width;
        left: -$mobile-menu-width;
        margin-top: 0;
        background: white;
      }
      .right-transform {
        transform: translateX($mobile-menu-width);
      }
      .left-transform {
        transform: translateX(-$mobile-menu-width);
      }
      .docs-menu-mobile-show {
        display: block;
      }
      .docs-menu-mobile-right-space {
        display: none;
        position: fixed;
        right: 0;
        top: 0;
        width: calc(100% - $mobile-menu-width);
        height: 100%;
        backdrop-filter: blur(3px);
      }
    }

    .docs-toc {
      display: none;
    }
    .docs-toc-mobile {
      display: block;
    }
    .docs-page {
      .markdown {
        padding-right: 0;
      }
    }
  }

  @include media-breakpoint-down(sm) {
    .book-header {
      display: flex;
    }

    #menu-control:checked + main {
      .book-menu nav,
      .book-page {
        transform: translateX($menu-width);
      }

      .book-header label {
        transform: rotate(90deg);
      }

      .markdown {
        opacity: 0.25;

      }
    }
    .docs-page {
      .markdown {
        .cards-list {
          .two-column-card {
            width: 100%;
            margin-bottom: 30px;
          }
          .three-column-card {
            width: 100%;
            margin-bottom: 30px;
          }
        }
      }
    }
  }
  .nav-docs {
    display: flex;
    align-items: center;
  }
  .contribute-doc {
    color: #697280;
    font-size: 14px;
}

  &-cta-section-shortcode {
    margin-top: 1.5 * $spacer-y;
    margin-bottom: $spacer-y;
    padding-top: $spacer-y;
    border: 1px solid $blue-light;
    border-radius: 8px;
    background: $blue-lightest;
  }

  &-md-helper-dropdown {
    position: relative;
    display: inline-block;
    font-size: 14px;
    &:hover {
      .docs-md-helper-dropdown-content {
          display: block;
      }
    }
    &-button {
      color: $gray-darkish;
      background: $white;
      border: none;
      cursor: pointer;
      border-radius: 4px;
      padding: .5rem;
      &:hover {
        background: $gray-lightest;
      }
    }
    &-content {
      display: none;
      position: absolute;
      right: 0;
      min-width: 184px;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      border-radius: 8px;
      background-color: $white;
      padding: 0.5rem 1rem;
      a {
        text-decoration: none;
        display: block;
        color: $gray-dark;
        &:hover {
          color: $gray-darkish;
          text-decoration: underline;
        }
      }
    }
    &-copy {
      background: $white;
      border-radius: 4px;
      margin-bottom: 2px;
      &::before {
        width: 16px;
        height: 16px;
        background-color: $gray;
        background-repeat: no-repeat;
        background-clip: content-box;
        mask: url(/images/icons/copy.svg);
        background-size: 100%;
        margin: 0 8px -2px 0;
        content: '';
        display: inline-block;
      }
      &--copied {
        &::before {
          background-color: $gray;
          mask: url(/images/icons/check.svg);
        }
      }
    }
    &-view {
      background: $white;
      border-radius: 4px;
      &::before {
        width: 12px;
        height: 12px;
        background: url(/images/icons/arrow-up-right.svg);
        background-size: 100%;
        margin: 0 13px 0 0;
        content: '';
        display: inline-block;
      }
    }
  }
}
