.TableOfContentsFixedWrapper {
  min-height: 100%;
  position: relative;
  z-index: 1;
  top: 0;

  @include media-breakpoint-down(xl) {
    background: #000;
    bottom: 0;
    color: #fff;
    font-size: 1.6rem;
    left: 0;
    min-height: auto;
    max-height: 50vh;
    position: fixed;
    top: auto;
    width: 100%;

    .TableOfContentsHeading {
      text-transform: capitalize;
    }

    .TableOfContentsHeading,
    button {
      &,
      &:hover {
        color: #fff;
      }
    }

    .TableOfContentsHeadingsItem {
      font-size: 1.6rem;
      margin-top: 1.6rem;
    }
  }

  &:not(.TableOfContentsFixedWrapperLefted) {
    margin-top: -0.2em;

    .TableOfContentsPrimaryButton {
      transform: rotate(180deg);
    }
  }
}

.TableOfContentsFixedWrapperLefted {
  margin-top: -2em;
  right: auto;

  .TableOfContentsPrimaryButton {
    left: auto;
    right: 40px;

    &:hover {
      filter: invert(1);
    }
  }

  .TableOfContentsPrimaryButtonLefted {
    left: 0;
    right: auto;
  }
}

.TableOfContentsContainer {
  top: 100px;
  right: 20px;
  display: flex;
  width: 100%;
  overflow: auto;
  align-items: flex-start;
  background-color: transparent;

  @include media-breakpoint-up(xl) {
    flex-direction: column;
    height: calc(100vh - 120px);
    position: sticky;

    .TableOfContentsFixedWrapperLefted & {
      height: calc(100vh - 250px);
    }
  }
}

.TableOfContentsContainerInner {
  @include media-breakpoint-down(xl) {
    flex: 1 100%;
    max-height: 50vh;
    overflow: auto;
    padding: 1.4rem 2rem;
  }
}

.TableOfContentsHeader {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.TableOfContentsHeading {
  margin: 0;
  color: #000;
  font-size: 22px;
  font-style: normal;
  font-weight: 700;
  line-height: 24px;
}

.TableOfContentsPrimaryButton {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;

  @include media-breakpoint-down(xl) {
    background: #fff;
    border: 1px solid #000;
    border-radius: 100%;
    bottom: 1rem;
    height: 40px;
    position: fixed;
    right: 1rem;
    top: auto;
    width: 40px;
  }

  &:hover {
    filter: invert(1);
  }
}

.TableOfContentsCloseButton {
  height: 2.4rem;
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  width: 2.4rem;
}

.TableOfContentsHeadingsList {
  position: relative;
  display: flex;
  flex-direction: column;
  list-style-type: none;
  margin: 0;
  padding: 0 38px 0 0;
  width: 100%;
}

.TableOfContentsHeadingsItem {
  margin-top: 20px;
  color: #000;
  font-size: 14px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.8rem;
  text-align: left;
  vertical-align: bottom;

  &:hover {
    color: rgb(0 0 0 / 50%);
  }

  &.active {
    font-weight: 700 !important;
  }
}

.TableOfContentsHeadingsItemH3,
.TableOfContentsHeadingsItemH4 {
  margin-top: 8px;
}

.TableOfContentsHeadingsItemH3 {
  padding-left: 8px;
}

.TableOfContentsHeadingsItemH4 {
  padding-left: 16px;
}
