/* Block: auto-toc */

/* Smooth scroll when an auto-toc is on the page */
html:has(.block-auto-toc) {
  scroll-behavior: smooth;
}

/* Offset target headings so they don't hide behind the fixed header */
.block-auto-toc ~ * h2[id],
.block-auto-toc ~ * h3[id] {
  scroll-margin-top: 6rem;
}

.block-auto-toc {
  margin-bottom: var(--spacing-xl, 32px);
}

.auto-toc__inner {
  background: #f8f8f8;
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--color-secondary, #36C3C1);
}

.auto-toc__title {
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--color-text, #323232);
  margin: 0 0 0.75rem;
}

.auto-toc__list,
.auto-toc__sublist {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}

.auto-toc__list > li {
  counter-increment: toc;
  counter-reset: toc-sub;
  margin-bottom: 0.4rem;
}

.auto-toc__list > li > a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.auto-toc__list > li > a::before {
  content: counter(toc) ".";
  flex-shrink: 0;
  color: var(--color-secondary, #36C3C1);
}

.auto-toc__sublist {
  margin-top: 0.25rem;
  margin-left: 1.5rem;
  counter-reset: toc-sub;
}

.auto-toc__sublist li {
  counter-increment: toc-sub;
  margin-bottom: 0.2rem;
}

.auto-toc__sublist a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 400;
  font-size: 0.875rem;
}

.auto-toc__sublist a::before {
  content: counter(toc) "." counter(toc-sub) ".";
  flex-shrink: 0;
  color: var(--color-secondary, #36C3C1);
  opacity: 0.85;
}

.auto-toc__list a {
  color: var(--color-text, #323232);
  text-decoration: none;
}

.auto-toc__list a:hover {
  color: var(--color-secondary, #36C3C1);
}
