.learn {
  $top: 1rem;
  $menu-width: 17rem;
  $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;

    &-content {
      overflow-y: auto;
      overflow-x: hidden;
    }

    nav {
      height: calc(100vh - 1rem);
      position: relative;
      width: $menu-width;
      padding: 30px 0 20px 20px;
      overflow-x: hidden;
      overflow-y: auto;
      scrollbar-width: thin;
      ul {
        list-style: none;
        font-size: 14px;
      }

    }
    .right-transform {
      transform: none;
    }
    .left-transform {
      transform: none;
    }
    .learn-menu-mobile-right-space {
      display: none;
      width: 0;
      height: 0;
    }

    a {
      color: $gray-dark;
    }

    &-search {
      padding-bottom: 1rem;
      position: sticky;
      top: 1rem;
      z-index: 1000;
      background-color: white;
    }

    &-title {
      display: flex;
      align-items: center;
      font-weight: 400;
      font-size: 14px;
      line-height: 17px;
      color: $gray-darkish !important;
      padding: $menu-item-padding-spacer 0;
      img {
        margin-right: 8px;
      }
      &::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;
      }
      &:hover {
        cursor: pointer;
      }
    }
    .active {
      color: $gray-dark !important;
      &::after {
        transform: rotate(90deg);
      }
    }
    .menu-display {
      display: block;
    }
    &-sub {
      list-style-type: none;
      padding-left: 0;
      margin-bottom: .5rem;
      display: none;

      &.active {
        display: block;
      }

      &-item {
        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 {
            color: $gray-dark;
            font-weight: 500;
          }
        }
      }
    }

    &-item {
      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 {
      margin-bottom: 10px;
      display: inline-block;
      font-size: 14px;
      line-height: 16.94px;
      color: $gray-dark;
      padding-bottom: 1rem;
      width: calc(100% - 20px);
      border-bottom: 1px solid $gray-light;

      &:hover {
        text-decoration: none;
        color: $brand-primary
      }
      &:after {
        margin-left: 1rem;
        color: $gray;
        font-family: Ionicons;
        content: '\f39c'
      }
    }
  }

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

    .markdown {
      padding-right: 30px;

      .breadcrumb {
        display: flex;
        align-items: center;
        margin: 20px 0 15px;
        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;
          color: $white;
          background: $pink;
          font-weight: 600;
          text-transform: capitalize;
        }
      }

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

      .search {
        margin-bottom: 30px;
      }
    }

    .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;
      }
    }
  }

  .nav-docs {
    display: flex;
    align-items: center;
  }
  .learn{
    fill: #FF4949;
  }
  .contribute-doc {
    color: #697280;
    font-size: 14px;
      a {
        color: #FF4949 !important;
    }
}

  &-toc {
    position: relative;
    flex: 0 0 $toc-width;
    font-size: .875rem;
    margin-right: auto;
    width: 232px;
    padding-top: 6rem;

    nav {
      width: $toc-width;
      bottom: 0;
      overflow-x: hidden;
      overflow-y: auto
    }

    nav#TableOfContents {
      // hacky way to hide 3rd level heading in little page TOC because Hugo does not allow filtering the TOC by level
      ul ul {
        display: none;
      }

      ul {
        border-left: 2px solid $red;
        padding-left: .5rem;

        ul {
          padding-left: 0.75rem;
        }

        li {
          a {
            color: $red;
            display: block;
            padding-block: 5px;
          }
        }
      }
    }

    nav ul ul {
      padding-left: 1rem;
      border-left: none !important;
    }

    &-header {
      padding-left: 2 * $menu-item-padding-spacer + 2px;
      color: $gray-dark;
      font-weight: 600;
      margin-bottom: $menu-item-padding-spacer;
    }

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



  // Responsive styles
  aside nav,
  .learn-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;
    }
    blockquote {
      border-left: .25rem solid $red;
      background-color: rgba(255,73,73,.1);
      color: $black;
    }
    .welcome {
      padding: 20px;
      margin-bottom: 30px;
      background: url('/learn/icons/pattern@2x.png');
      border-radius: 3px;
      h5 {
        margin-bottom: 0;
        font-size: 20px;
        line-height: 30px;
        color: $red;
        font-weight: 600;
      }
      p {
        margin-bottom: 0;
      }
    }
    .cta-link {
      color: $red;
    }
    nav#TableOfContents {
      ul {
        border-left: 2px solid $red;
        padding-left: .5rem;
      }

      li > ul {
        display: none;
      }
    }

    .cards-list {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      width: 100%;
      margin-top: 1rem;

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

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

        img {
          border: none;
        }
      }

      .text-wrap {
        width: calc(100% - 58px);

        h2 {
          margin: 3px 0;

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

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

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

        p {
          font-size: 16px;
          line-height: 1.6;
          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: $red;
        }
      }

      .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;
        margin-bottom: 20px;

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

      @include media-breakpoint-down(sm) {
        .two-column-card {
          width: 100%;
          margin-bottom: 30px;
        }
        .three-column-card {
          width: 100%;
          margin-bottom: 30px;
        }
      }

    }
  }

  .markdown {
    a {
      color: $red;
    }

    .markdown-tabs{
      input[type="radio"]:checked + label {
        color: $red;
        border-bottom-color: $red;
      }

      & + .console-output {
        margin-top: -2rem;
      }
    }

    .console-output {
      margin: 2rem 0;
      border-radius: 0.25rem;
      color: $gray-light;
      font-size: 14px;
      background-color: #272822;
      &--summary {
        user-select: none;
        &::marker {
          margin-right: 1ch;
        }
        &:hover {
          cursor: pointer;
        }
      }

      summary {
        padding: 1rem;
      }

      pre {
        margin: 0;
      }
    }
  }

  .next-nav > a {
    color: $red;
  }

  .learn-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;
    }
  }

  .mega-heading {
    font-size: 3.65rem;
    font-weight: 600;
    line-height: 1.6;
    width: 75%;
  }

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

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

      nav {
        border: 0;
        border-radius: 0;
        height: 100%;
        width: 260px;
        left: -260px;
        margin-top: 0px;
        background: white;
      }
      .right-transform {
        transform: translateX(260px);
      }
      .left-transform {
        transform: translateX(-260px);
      }
      .learn-menu-mobile-right-space {
        display: none;
        position: fixed;
        right: 0;
        top: 0;
        width: calc(100% - 260px);
        height: 100%;
      }
    }

    .learn-toc {
      display: none;
    }
    .learn-toc-mobile {
      display: block;
    }
    .learn-page {
      .markdown {
        padding-right: 0;
        .mobile-toc-button {
          display: block;
          width: 155px;
          margin-right: 10px;
          padding: 12px 9px;
          color: $gray-dark;
          border: 1px solid $gray;
          border-radius: 5px;
          background: $gray-lightest;
          font-size: 14px;
          line-height: 20px;

          &:hover {
            cursor: pointer;
          }

          img {
            margin-top: -4px;
          }
        }
        .form-inline {
          width: calc(100% - 165px);
          img {
            top: 15px;
          }
        }
      }
    }

    .mega-heading {
      width: 100%;
      font-size: 2rem;
    }
  }

  @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;
      }
    }
  }
  @include media-breakpoint-down(xs) {
    .learn-page {
      .markdown {
        .search {
          flex-wrap: wrap;
        }
        .mobile-toc-button {
          width: 100%;
          text-align: center;
          margin-bottom: 20px;
          margin-right: 0;
        }
        .form-inline {
          width: 100%;
          input {
            height: 45px;
          }
          img {
            top: 15px;
          }
          span {
            min-width: 100% !important;
          }
        }
      }
    }
  }

  &-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;
  }
}

.run-in-checkly {
  position: absolute;
  translate: -20px -70px;
  background-color: #0075ff;
  z-index: 100000000;
  right: 22px;
  color: #FFF;
  font-weight: bold;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  @include media-breakpoint-down(md) {
    translate: 10px -70px;
  }
}

.learn-cta-wrapper {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid $gray-light;
  border-radius: 6px;
  background: $blue-dark;
  max-width: 200px;
}

.learn-cta-wrapper h4 {
  margin-top: 0;
  line-height: 1.6rem;
  font-weight: 700;
  color: $white;
  font-size: 1.2rem;
}

.learn-cta-wrapper p {
  font-weight:500;
  line-height: 1.2rem;
  color: $white;
}

.learn-cta-wrapper .btn {
  font-size: .8rem;
}

.youtube-gallery {
  &-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 1rem;
  }

  &-cards {
    padding: 0 !important;
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  &-card {
    list-style-type: none;
    margin-bottom: 1rem;
    width: 32%;
    &-thumb {
      border-radius: 6px;
      border: 2px solid $red;
    }

    &-text {
      font-size: 14px;
      font-weight: 600;
      margin-top: .5rem;
      margin-bottom: 0 !important;
    }
  }

  @include media-breakpoint-down(sm) {
    &-cards {
        flex-direction: column;
      }

      &-card {
        width: 100%;
      }
    }
}
