/* Article table of contents (blog posts) */

.article-toc {
  margin: 1.15rem 0 1.35rem;
  max-width: min(100%, 34rem);
  border: 1px solid rgba(10, 178, 133, 0.16);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--white) 72%);
  box-shadow: 0 1px 10px rgba(10, 178, 133, 0.05);
  overflow: hidden;
}

.article-toc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.65rem 0.45rem 0.8rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}

.article-toc[data-expanded="true"] .article-toc__header {
  border-bottom-color: rgba(10, 178, 133, 0.14);
}

.article-toc__title {
  margin: 0.65rem 0 0;
  font-family: var(--font-accent);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--brand-deep);
  letter-spacing: 0.01em;
}

.article-toc__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.article-toc__toggle:hover {
  color: var(--brand-deep);
  background: rgba(10, 178, 133, 0.1);
}

.article-toc__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(10, 178, 133, 0.28);
}

.article-toc__toggle-chevron {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.article-toc[data-expanded="false"] .article-toc__toggle-chevron {
  transform: rotate(-90deg);
}

.article-toc__panel {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.35s ease;
}

.article-toc[data-expanded="false"] .article-toc__panel {
  grid-template-rows: 0fr;
}

.article-toc__panel-inner {
  overflow: hidden;
}

.article-toc__list {
  margin: 0 0 0.25em;
  padding: 0.45rem 0.75rem 0.6rem 0.8rem;
  list-style: none;
  counter-reset: article-toc;
  color: var(--ink);
}

.article-toc__item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 0.3rem;
  padding: 0;
  line-height: 1.4;
  font-size: 0.88rem;
  counter-increment: article-toc;
}

.article-toc__item:last-child {
  margin-bottom: 0;
}

.article-toc__item::before {
  content: counter(article-toc) ".";
  flex-shrink: 0;
  min-width: 1.1rem;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.article-toc__item--level-3 {
  margin-left: 0.55rem;
  font-size: 0.84rem;
}

.article-toc__item--level-3::before {
  content: "–";
  min-width: 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.article-toc__link {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.article-toc__link:hover {
  color: var(--brand-deep);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .article-toc__panel,
  .article-toc__toggle-chevron {
    transition: none;
  }
}


/* Beat long-form content selectors on exported posts. */
.content-page .article-toc .article-toc__title {
  margin: 0;
}

.content-article .article-toc .article-toc__list {
  margin: 0 0 0.25em;
}
