#toc-sidebar {
  display: none;
}

@media screen and (min-width: 81.25rem) {
  #toc-sidebar {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    width: 23.5rem;
    height: 100vh;
    overflow-y: auto;
    z-index: 70;
    padding: 5rem 1rem 1rem 1rem;
    box-sizing: border-box;
  }

  /* override theme's `body:not(.print) #body-inner.narrow` padding (specificity 0,1,2,1) */
  #body-inner {
    padding-right: 24.5rem !important;
  }

  /* sidebar replaces relearn's popup TOC on wide screens — hide its toggle button */
  #toc-menu {
    display: none;
  }
}

#toc-sidebar ul {
  margin: 0 0 0 1rem;
  padding: 0;
  border-left: 1px solid currentColor;
  list-style: none;
}

#toc-sidebar > ul {
  margin: 0;
  border-left: none;
}

#toc-sidebar li {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* space between top-level groups — macro rhythm of the sidebar */
#toc-sidebar > ul > li + li {
  margin-top: 0.5rem;
}

/* gap between Hugo's page TOC and toc-extras (changelog headings) */
#toc-sidebar > ul + ul {
  margin-top: 0.5rem;
}

#toc-sidebar a {
  display: block;
  padding: 3px 4px 3px 12px;
  color: var(--MAIN-TITLES-TEXT-color);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease;
}

/* top-level entries act as section headers — heavier weight, slightly larger */
#toc-sidebar > ul > li > a {
  font-weight: 600;
  font-size: 0.95rem;
  padding-top: 4px;
  padding-bottom: 4px;
}

#toc-sidebar a:hover {
  background: rgba(140, 140, 140, 0.1);
}

#toc-sidebar a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

#toc-sidebar ul ul a {
  padding-left: 22px;
}

#toc-sidebar ul ul ul a {
  padding-left: 32px;
  font-size: 0.85rem;
}

#toc-sidebar a.active {
  background: rgba(140, 140, 140, 0.18);
  font-weight: 700;
}
