body::before {
    content: ' ';
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: var(--bs-body-bg);
    will-change: transform;
    z-index: -1;
}

main img:not(.label-icon) {
    max-width: 100%;
    display: inline-block;
    padding: 4px;
    line-height: 1.428571429;
    background-color: var(--bs-secondary-bg-subtle);
    border: 1px solid var(--bs-secondary-border-subtle);
    border-radius: 4px;
    margin: 20px auto 30px auto;
}

/* Add bottom padding so the last few sections can scroll up to the trigger line */
main {
    padding-bottom: 65vh;
}

/* Ensure anchor links scroll to a comfortable offset and ScrollSpy registers them accurately */
main header,
main h1,
main h2,
main h3,
main h4,
main h5,
main h6 {
    scroll-margin-top: 5rem;
}

/* TOC Link Styling */
#toc-nav .nav-link {
    color: var(--bs-body-color);
    border-radius: 0.25rem;
}

#toc-nav .nav-link.active {
    color: #fff !important;
    background-color: var(--bs-primary) !important;
}

/* Remove heavy highlight from parent categories when a sub-category is active */
#toc-nav .nav-link.active:has(+ ul .active) {
    color: var(--bs-primary) !important;
    background-color: transparent !important;
    font-weight: bold;
}

/* Header Anchor Links */
.header-anchor {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.category-header:hover .header-anchor {
    opacity: 1;
}

/* Hide scrollbar for TOC but keep it scrollable */
#toc-collapse::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

#toc-collapse {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}