.toc {
  margin: 0 0 32px;
  padding: 20px 24px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.toc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.toc__title {
  font-family: var(--font-display, inherit);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.toc__sign {
  position: relative;
  width: 12px;
  height: 12px;
  flex: none;
}

.toc__sign::before,
.toc__sign::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 1.6px;
  background: var(--color-text-muted);
  border-radius: 2px;
  transform-origin: center;
  transition: transform var(--duration-fast, .26s) var(--ease-out, ease);
}

.toc__sign::before {
  transform: translate(-50%, -50%) rotate(45deg) translateX(-2px);
}

.toc__sign::after {
  transform: translate(-50%, -50%) rotate(-45deg) translateX(2px);
}

.toc__head[aria-expanded="false"] .toc__sign::before {
  transform: translate(-50%, -50%) rotate(-45deg) translateX(-2px);
}

.toc__head[aria-expanded="false"] .toc__sign::after {
  transform: translate(-50%, -50%) rotate(45deg) translateX(2px);
}

.toc__list {
  margin: 16px 0 0;
  padding: 0 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: toc;
}

.toc__list[hidden] {
  display: none;
}

.toc__item {
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.toc__item--h3 {
  margin-left: 18px;
  list-style: none;
  font-size: 14px;
}

.toc__item--h3::before {
  content: "— ";
  color: var(--color-border-subtle);
}

.toc__link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--duration-fast, .26s) var(--ease-out, ease), border-color var(--duration-fast, .26s) var(--ease-out, ease);
}

.toc__link:hover,
.toc__link.is-current {
  color: var(--color-brand-600);
  border-bottom-color: currentColor;
}

@media (max-width: 700px) {
  .toc {
    padding: 16px 18px;
  }
}
