/**
 * Article TOC - Table of Contents navigation
 * Supports post-optimizer auto-TOC + site's own shell TOC structures
 */

/* ========== Container ========== */
#toc-nav-container,
.article-toc,
.toc-nav {
  box-sizing: border-box;
  padding: 1.25rem 1.25rem 1rem;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  margin: 2rem 0;
}

/* When .toc-nav is nested inside #toc-nav-container (post-optimizer shell-TOC mode),
   only the outer wrapper renders the box — strip the inner duplicate frame. */
#toc-nav-container .toc-nav,
#toc-nav-container .article-toc {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

@media (min-width: 992px) {
  .article-sidebar .article-toc,
  .article-sidebar .toc-nav,
  .blog-sidebar .article-toc,
  .blog-sidebar .toc-nav {
    position: sticky;
    top: 100px;
    margin: 0 0 1.5rem;
  }
}

/* ========== Title ========== */
.article-toc-title,
.toc-nav .toc-title,
#toc-nav-container .toc-title {
  margin: 0 0 0.85rem;
  padding: 0 0 0.6rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-secondary, #004E89);
  border-bottom: 1px solid #e0e0e0;
}

/* ========== List ========== */
#toc-list-content,
.article-toc-list,
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#toc-list-content li,
.article-toc-item,
.toc-list li {
  margin: 0;
  padding: 0;
}

/* ========== Links ========== */
.article-toc-link,
.toc-list li a,
.toc-list a {
  display: block;
  padding: 0.45rem 0.75rem;
  margin: 0.1rem 0;
  color: #555;
  font-size: 0.9375rem;
  line-height: 1.45;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.article-toc-link:hover,
.article-toc-link.active,
.toc-list li a:hover,
.toc-list li a.active,
.toc-list a:hover,
.toc-list a.active {
  color: var(--brand-primary, #1EB7E6);
  background: rgba(30, 183, 230, 0.08);
  border-left-color: var(--brand-primary, #1EB7E6);
}

/* Nested TOC (h3 under h2) */
.article-toc-item .article-toc-list,
.toc-list ul {
  padding-left: 0.75rem;
  margin: 0.1rem 0;
}

.article-toc-item .article-toc-link,
.toc-list ul a {
  font-size: 0.875rem;
  color: #666;
}
