.toc {
  --toc-accent: var(--brand, var(--blue, #3182f6));
  position: sticky;
  top: 104px;
  align-self: start;
  display: block;
  max-height: calc(100vh - 128px);
  padding: 0 8px 16px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line, #e5e8eb) transparent;
}

.toc::-webkit-scrollbar {
  width: 4px;
}

.toc::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line, #e5e8eb);
}

.toc::before,
.toc::after {
  display: none;
  content: none;
}

.toc > strong {
  display: block;
  margin: 0 0 12px;
  padding-left: 14px;
  color: #8b95a1;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

.toc nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc a {
  position: relative;
  display: block;
  margin: 0;
  padding: 7px 8px 7px 14px;
  border-radius: 0;
  color: #8b95a1;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
  word-break: keep-all;
  transition: color 160ms ease;
}

.toc a::before {
  position: absolute;
  inset: 7px auto 7px 0;
  width: 1px;
  height: auto;
  border: 0;
  border-radius: 0;
  background: var(--toc-accent);
  box-shadow: none;
  content: "";
  opacity: 0;
  transform: none;
  transition: opacity 160ms ease;
}

.toc a:hover {
  color: var(--toc-accent);
  background: transparent;
}

.toc a.is-read {
  color: #6b7684;
  font-weight: 500;
}

.toc a.is-read::before {
  background: var(--toc-accent);
  box-shadow: none;
  opacity: 0;
}

.toc a.is-active,
.toc a[aria-current="location"] {
  color: var(--toc-accent);
  background: transparent;
  font-weight: 700;
}

.toc a.is-active::before,
.toc a[aria-current="location"]::before {
  width: 1px;
  height: auto;
  background: var(--toc-accent);
  box-shadow: none;
  opacity: 1;
}

.toc a:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--toc-accent);
  outline-offset: 2px;
}

@media (max-width: 1024px) {
  .toc {
    position: relative;
    top: auto;
    display: block;
    max-height: none;
    margin: 0 0 36px;
    padding: 16px 0 10px;
    overflow: visible;
    border-bottom: 1px solid var(--line, #e5e8eb);
  }

  .toc > strong {
    margin-bottom: 8px;
    padding-left: 0;
  }

  .toc nav {
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .toc nav::-webkit-scrollbar {
    display: none;
  }

  .toc a {
    flex: 0 0 auto;
    max-width: 240px;
    padding: 8px 12px 9px;
  }

  .toc a::before {
    inset: auto 12px 0;
    width: auto;
    height: 1px;
  }

  .toc a.is-active::before,
  .toc a[aria-current="location"]::before {
    width: auto;
    height: 1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toc a,
  .toc a::before {
    transition: none;
  }
}
