// stylelint-disable selector-max-type

@use "@coreui/coreui/scss/functions/math" as *;
@use "@coreui/coreui/scss/mixins/border-radius" as *;
@use "@coreui/coreui/scss/mixins/breakpoints" as *;
@use "@coreui/coreui/scss/vendor/rfs" as *;

.docs-toc {
  @include media-breakpoint-up(xl) {
    position: sticky;
    top: 5rem;
    right: 0;
    z-index: 2;
    height: subtract(100vh, 7rem);
    overflow-y: auto;
  }

  nav {
    @include font-size(.875rem);

    ul {
      padding-left: 0;
      margin-bottom: 0;
      list-style: none;

      ul {
        padding-left: 1rem;
        margin-top: .25rem;
      }
    }

    li {
      margin-bottom: .25rem;
    }

    a {
      color: inherit;

      &:not(:hover) {
        text-decoration: none;
      }

      code {
        font: inherit;
      }
    }
  }
}

.docs-toc-toggle {
  display: flex;
  align-items: center;

  @include media-breakpoint-down(sm) {
    justify-content: space-between;
    width: 100%;
  }

  @include media-breakpoint-down(lg) {
    color: var(--cui-body-color);
    border: 1px solid var(--cui-border-color);
    @include border-radius(var(--cui-border-radius));

    &:hover,
    &:focus,
    &:active,
    &[aria-expanded="true"] {
      color: var(--cui-primary);
      background-color: var(--cui-body-bg);
      border-color: var(--cui-primary);
    }

    &:focus,
    &[aria-expanded="true"] {
      box-shadow: 0 0 0 3px rgba(var(--cui-primary-rgb), .25);
    }
  }
}

.docs-toc-collapse {
  @include media-breakpoint-down(lg) {
    nav {
      padding: 1.25rem 1.25rem 1.25rem 1rem;
      background-color: var(--cui-tertiary-bg);
      border: 1px solid var(--cui-border-color);
      @include border-radius(var(--cui-border-radius));
    }
  }

  @include media-breakpoint-up(lg) {
    display: block !important; // stylelint-disable-line declaration-no-important
  }
}
