@use '../base/mixins' as *;

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

  &__title {
    font-family: var(--site-ui-fontFamily);
    font-size: 18px;
    margin-bottom: 0.5rem;
  }
}

//noinspection CssReplaceWithShorthandSafely
#site-toc--side {
  padding: 2rem;
  padding-left: 1rem;

  display: none;
  position: sticky;
  top: var(--site-header-height);
  order: 2;
  width: 15rem;
  min-width: 15rem;
  height: fit-content;
  max-height: calc(100vh - 3.25rem);
  overflow-y: auto;
  overflow-wrap: break-word;
  z-index: 5;

  @media (min-width: 1200px) {
    display: block;
  }

  .toc-entry {
    padding-bottom: 0.5rem;
    font-size: 0.875rem;

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

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

  .nav-link {
    color: var(--site-base-fgColor);
    font-size: 0.875rem;
    line-height: normal;
    padding: 1px 0;

    &:hover {
      color: var(--site-link-fgColor);
    }

    &.active {
      color: var(--site-link-fgColor-active);
    }
  }

  body.hide_toc & {
    display: none;
  }
}

#site-toc--inline {
  background: var(--site-inset-bgColor);
  padding: 1rem 1.5rem;
  margin-block-start: 1rem;
  margin-block-end: 1rem;

  @media (min-width: 1200px) {
    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;
      }
    }
  }
}
