/* Article outline, independent of the theme's hidden legacy sidebar. */
.article-toc-rail { display:none; }
.article-toc-rail[hidden],.article-toc-panel[hidden],.article-toc-toggle[hidden],.article-toc-backdrop[hidden] { display:none !important; }
.article-toc-panel { border:1px solid var(--line,#dfe4ee); border-radius:12px; background:var(--surface,#fff); box-shadow:0 4px 18px #26373806; overflow:hidden; }
.article-toc-heading { display:flex; align-items:center; gap:8px; padding:15px 14px 12px; border-bottom:1px solid var(--line,#dfe4ee); }
.article-toc-heading > svg { width:17px; height:17px; color:var(--accent,#0e38b1); flex:none; }
.article-toc-heading strong { color:var(--ink,#263738); font-size:13px; font-weight:600; }
.article-toc-count { margin-left:auto; color:var(--muted,#617374); font-size:10px; white-space:nowrap; }
.article-toc-close { display:none; border:0; background:transparent; color:var(--muted,#617374); width:28px; height:28px; padding:0; font-size:22px; line-height:1; }
.article-toc-listwrap { padding:10px 8px 12px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#d0d9e9 transparent; }
.article-toc-list,.article-toc-sublist { list-style:none; margin:0; padding:0; }
.article-toc-sublist { padding-left:12px; }
.article-toc-list li { margin:1px 0; padding:0; }
.article-toc-link { display:block; position:relative; padding:5px 10px 5px 12px; border-radius:6px; color:var(--muted,#617374); font-size:14px; line-height:1.4; overflow-wrap:anywhere; text-decoration:none !important; transition:background .15s,color .15s; }
.article-toc-link:hover { background:#f5f7fc; color:var(--accent,#0e38b1); }
.article-toc-sublist .article-toc-link { font-size:13px; }
.article-toc-link[aria-current="location"] { color:var(--accent,#0e38b1); background:var(--accent-soft,#eef2fb); font-weight:600; }
.article-toc-link[aria-current="location"]::before { content:""; position:absolute; left:0; top:8px; bottom:8px; width:3px; border-radius:3px; background:var(--accent,#0e38b1); }
.artshow .words :is(h2,h3) { scroll-margin-top:calc(var(--toolbar-height,52px) + 20px); }
.article-toc-backdrop { display:none; }
.article-toc-toggle { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:32px; padding:6px 10px; border:1px solid var(--line,#dfe4ee); border-radius:7px; background:var(--surface,#fff); color:var(--accent,#0e38b1); font-size:12px; line-height:1.5; white-space:nowrap; cursor:pointer; }
.article-toc-toggle svg { width:15px; height:15px; flex:none; }
section.toolbar .article-toc-toggle { margin-left:auto; flex:0 0 auto; }
.article-toc-toggle:hover,.article-toc-toggle[aria-expanded="true"] { background:var(--accent-soft,#eef2fb); }

@media (min-width:1101px) {
 /* Desktop directory width; navigation collapse remains page-local. */
 body.article-toc-enabled { --NuliBlog-nav-expanded:210px; --NuliBlog-nav-collapsed:72px; --article-toc-width:250px; --nav-width:var(--NuliBlog-nav-collapsed); }
 html.nav-expanded body.article-toc-enabled { --nav-width:var(--NuliBlog-nav-expanded); }
 .artshow.content.has-article-toc.article-toc-visible { display:grid; grid-template-columns:minmax(0,1fr) var(--article-toc-width); align-items:start; overflow:visible; }
 .artshow.content.has-article-toc > .box { min-width:0; }
 .article-toc-rail { display:block; align-self:stretch; min-width:0; padding:20px 8px 28px 0; }
 .article-toc-heading { gap:5px; padding:12px 8px; }
 .article-toc-heading > svg { width:14px; height:14px; }
 .article-toc-heading strong { font-size:12px; }
 .article-toc-count { display:none; }
 .article-toc-listwrap { padding:8px 5px 10px; }
 .article-toc-link { padding:4px 8px 4px 10px; font-size:14px; line-height:1.4; }
 .article-toc-sublist { padding-left:7px; }
 .article-toc-sublist .article-toc-link { font-size:13px; }
 .article-toc-panel { position:sticky; top:calc(var(--toolbar-height,52px) + 20px); }
 .article-toc-listwrap { max-height:calc(100vh - var(--toolbar-height,52px) - 120px); max-height:calc(100dvh - var(--toolbar-height,52px) - 120px); }
}
@media (max-width:1100px) {
 .article-toc-rail { display:contents; }
 .article-toc-panel { position:fixed; right:16px; top:calc(var(--toolbar-height,52px) + 12px); width:min(320px,calc(100vw - 32px)); z-index:1103; box-shadow:0 12px 45px #182c4b26; }
 .article-toc-listwrap { max-height:min(65vh,480px); }
 .article-toc-close { display:block; margin-left:4px; cursor:pointer; }
 .article-toc-backdrop { display:block; position:fixed; inset:var(--toolbar-height,52px) 0 0; z-index:1101; width:100%; height:auto; padding:0; border:0; background:#17213b26; }
 section.toolbar .article-toc-toggle { min-height:30px; padding:5px 8px; font-size:11px; }
}
@media (prefers-reduced-motion:reduce) { .article-toc-link { transition:none; } }

/* H2 chapters use the theme colour even when not active. */
.article-toc-link.article-toc-link-h2 { color:var(--accent,#0e38b1); }
