/* ============================================================
   SIDEBAR TOC WRAPPER
   ============================================================

   STICKY PREREQUISITES — if sticky stops working silently:
   • No ancestor of .sidebar may have overflow: hidden/auto/scroll.
   • The sidebar column must be taller than the TOC itself.
   • The `top` value is set inline from value.top_offset in the template.

   RESPONSIVE STRATEGY:
   • .sidebar-toc-wrapper--hide-mobile  → hidden below the breakpoint
     (controlled by TocBlock.hide_on_mobile in the sidebar widget)
   • .toc-block--hide-desktop           → hidden above the breakpoint
     (controlled by ThemeSettings.toc_hide_on_desktop in Blocks tab)

   Both classes use the same breakpoint (1024px) so only one TOC
   is ever visible at a time:
     Mobile  → inline TOC block inside the post body
     Desktop → sidebar TOC widget
   ============================================================ */

/* ── Wrapper base ─────────────────────────────────────────── */
.sidebar-toc-wrapper {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-bottom: var(--space-2, 8px);
}

/* ── Sticky variant ───────────────────────────────────────── */
/* `top` is applied inline by the template from value.top_offset */
.sidebar-toc-wrapper--sticky {
  position: sticky;
}

/* ── Hide sidebar TOC on mobile ───────────────────────────── */
@media (max-width: 1023px) {
  .sidebar-toc-wrapper--hide-mobile {
    display: none;
  }
}

/* ── Hide inline TOC block on desktop ────────────────────── */
/* Applied when ThemeSettings.toc_hide_on_desktop is checked. */
@media (min-width: 1024px) {
  .toc-block--hide-desktop {
    display: none;
  }
}

/* ── Hover ────────────────────────────────────────────────── */
#sidebar-toc-list .toc__link:hover {
  color: var(--color-accent);
}

#sidebar-toc-list .toc__link:hover::before {
  color: var(--color-accent);
}

/* ── Active-link highlight (scroll-spy) ──────────────────────
   .is-active is toggled by SidebarTOC in main.js             */
#sidebar-toc-list .toc__link.is-active {
  color: var(--color-accent);
}

#sidebar-toc-list .toc__link.is-active::before {
  color: var(--color-accent);
}
