.toc-container {
  flex: 0 0 265px;
  @include medium {
    margin-bottom: 1rem;
    flex: none;
  }
}

.toc-mobile-dropdown {
  display: none;
  cursor: pointer;
  width: 100%;
  padding: 0.8rem 1rem 1rem;
  color: white;
  background-color: $steelGray;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  position: relative;
  line-height: 1;
  @include medium {
    display: flex;
  }
  justify-content: space-between;
  align-items: center;
  path {
    stroke: white;
    opacity: 0.6;
  }
  svg {
    transition: transform $transitionDuration;
  }
  &.mobile-open {
    svg {
      transform: rotate(180deg);
      transition: transform $transitionDuration;
    }
  }
}

#toc {
  position: sticky;
  top: 1rem;
  @include medium {
    display: none;
    &.mobile-open {
      display: block;
    }
  }
  ul {
    padding: 0;
  }
  > ul {
    box-shadow: 0 4px 15px rgb(0 0 0 / 15%);
    border-radius: 0.375rem;
    padding: 1.25rem 1.5625rem 1.25rem 1.875rem;
    background-color: $white;
    display: block;
    @include medium {
      top: 1px;
      position: relative;
      background-color: $steelGray;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
      padding: 0.8rem 1rem 1rem;
    }
    li {
      font-size: 0.8125rem;
      line-height: 1.375rem;
      padding: 0.1875rem 0;
      list-style: none;
    }
    a {
      position: relative;
      display: inline-block;
      font-weight: 500;
      font-size: toRem(13);
      color: $ebony;
      @include medium {
        color: white;
      }

      &:before {
        content: '▸';
        position: absolute;
        left: -0.875rem;
        opacity: 0;
        transition: opacity 300ms ease;
      }

      &.active {
        animation: tocHeadingSlideIn 300ms ease;
        animation-fill-mode: forwards;
        @media screen and (min-width: $breakpoint_Medium) {
          background: linear-gradient(175deg, $royalBlue 30%, $cerise 93.14%);
          background-clip: text;
          -moz-background-clip: text;
          -webkit-text-fill-color: transparent;
          -moz-text-fill-color: transparent;
          text-fill-color: transparent;
          &:before {
            content: '▸';
            background: linear-gradient(175deg, $royalBlue 30%, $cerise 93.14%);
            background-clip: text;
            -moz-background-clip: text;
            -webkit-text-fill-color: transparent;
            -moz-text-fill-color: transparent;
            text-fill-color: transparent;
            opacity: 1;
          }
        }
      }
    }
    li > ul {
      padding-left: 1rem;
      li > ul {
        padding-left: 2rem;
      }
    }
  }
}

@keyframes tocHeadingSlideIn {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(0.875rem);
  }
}
