@use '../core/variables' as *;
@use '../core/mixins' as *;
@use '../core/bootstrap';

.site-toc {
  ul {
    padding-left: 0;
    margin-left: 0;
    list-style: none;
  }

  &__title {
    font-family: $site-font-family-alt;
    font-size: 18px;
    margin-bottom: bootstrap.bs-spacer(2);
  }
}

#site-toc--side {
  padding: $top-content-padding 20px $content-padding 28px;

  @include sidenav-top-position;
  display: none;
  position: fixed;
  bottom: 0;
  right: 0;
  width: 246px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: break-word;
  z-index: 5;

  @include bootstrap.media-breakpoint-up(xl) {
    display: block;
  }

  .toc-entry {
    padding-bottom: bootstrap.bs-spacer(2);
    font-size: bootstrap.$font-size-sm;

    // Indent subsequent lines.
    margin-left: 1rem;
    text-indent: -1rem;

    .nav {
      padding-top: 0.5rem;
      display: block;
    }
  }

  .nav-link {
    color: $site-color-body;
    font-size: $font-size-small;
    line-height: normal;
    padding: 1px 0;

    &:hover {
      color: $brand-primary;
    }

    &.active {
      color: $brand-primary;

      &:hover {
        color: $flutter-color-dark-blue;
      }
    }
  }

  body.hide_toc & {
    display: none;
  }
}

#site-toc--inline {
  background: #f5f5f7;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;

  @include bootstrap.media-breakpoint-up(xl) {
    display: none;
  }

  .toc-entry ul {
    padding-left: 1rem;
  }

  > .section-nav {
    margin-bottom: 0.25rem;
  }

  &.toc-collapsible {
    .site-toc--inline__toggle {
      float: right;
    }

    .toc-toggle-down, .toc-toggle-more-items {
      display: none;
    }

    .toc-toggle-more-items {
      float: unset;
    }

    .toc-toggle-up, .toc-toggle-down, .toc-toggle-more-items {
      user-select: none;
      cursor: pointer;
    }

    &.toc-collapsed {
      .section-nav {
        max-height: 72px;
        overflow: hidden;
      }

      .toc-toggle-up {
        display: none;
      }

      .toc-toggle-down, .toc-toggle-more-items {
        display: inline-block;
      }
    }
  }
}
