/* Sticky article contents in the sidebar (web/js/blog-toc.js). */
.blog-page .article-content .article-toc {
  position: sticky; top: var(--article-toc-top, 20px); margin-top: 24px;
  background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgb(0 0 0 / 5%);
  padding: 26px 0 18px; overflow: hidden;
}
.blog-page .article-content .article-toc[hidden] { display: none; }
.blog-page .article-content .article-toc__progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: #f3efe9; }
.blog-page .article-content .article-toc__progress-bar {
  display: block; height: 100%; background: #fe7e02; transform-origin: 0 50%; transform: scaleX(0); transition: transform .1s linear;
}
.blog-page .article-content .article-toc__title { padding: 0 28px; margin: 0 0 14px; font-size: 20px; font-weight: 600; color: #565656; }
.blog-page .article-content .article-toc__list {
  list-style: none; margin: 0; padding: 0 16px 0 28px;
  max-height: calc(100vh - var(--article-toc-top, 20px) - 110px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #e2ddd6 transparent;
}
.blog-page .article-content .article-toc .article-toc__list > li.article-toc__item {
  margin: 0; padding: 0; list-style: none; line-height: inherit; text-align: left;
}
.blog-page .article-content .article-toc .article-toc__list > li.article-toc__item::before { content: none; display: none; }
.blog-page .article-content .article-toc__item a {
  position: relative; display: block; padding: 7px 10px 7px 14px; margin-left: -14px;
  border-left: 2px solid #eee9e2; color: #565656; font-size: 15px; line-height: 1.4; text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.blog-page .article-content .article-toc__item--sub a { padding-left: 28px; font-size: 14px; color: #777; }
.blog-page .article-content .article-toc__item a:hover { color: #fe7e02; text-decoration: none; }
.blog-page .article-content .article-toc__item.is-active a {
  color: #222; font-weight: 600; border-left-color: #fe7e02; background: linear-gradient(90deg, #fff4e8, rgba(255, 244, 232, 0));
}
.blog-page .article-content .article-toc__item a:focus-visible { outline: 2px solid #fe7e02; outline-offset: -2px; }

/* Sidebar sits below the article on phones — a sticky TOC makes no sense there. */
@media (max-width: 767.98px) {
  .blog-page .article-content .article-toc { display: none !important; }
}

/* The site's critical CSS sets `html, body { overflow-x: hidden }`, which turns body into a scroll
   container and breaks position: sticky. `clip` crops horizontal overflow the same way without that
   side effect; browsers that don't support it keep `hidden`. Scoped to article pages. */
html:has(.blog-page .article-toc),
html:has(.blog-page .article-toc) body { overflow-x: clip; }
