/**
 * @package   Akeeba DocImport
 * @copyright Copyright (c) 2011-2026 Nicholas K. Dionysopoulos / Akeeba Ltd
 * @license   GNU General Public License version 3, or later
 *
 * Shared styling for the "Table of Contents" and "On This Page" site modules. Both rely on
 * Bootstrap's own .collapse/.show, .btn, .nav/.nav-link and .active classes for behaviourally
 * meaningful styling; this file only adds what Bootstrap doesn't already provide for them: the
 * pinned, independently-scrollable container and the chapter-collapse chevron.
 */

.docimport-toc,
.docimport-onthispage {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

/*
 * CSS position: sticky is bounded by the nearest ancestor with a scroll mechanism - but some
 * template chrome (e.g. Gantry5's #g-page-surround offcanvas wrapper) sets overflow: hidden on a
 * div that never itself scrolls, only the page does, which silently defeats sticky everywhere
 * below it. toc.js drives the pinned state itself via getBoundingClientRect() instead, which
 * isn't affected by that.
 *
 * The pinned element isn't always .docimport-toc/.docimport-onthispage themselves: toc.js pins
 * whichever ancestor the template's own module-title heading is a direct child of, so the title
 * rides along with the nav instead of scrolling away before the nav reaches the pin threshold -
 * hence a standalone class rather than compounding on the nav's own class.
 */
.is-docimport-pinned {
    position: fixed;
    z-index: 10;
    background-color: var(--bs-body-bg, #fff);
}

.docimport-sticky-placeholder {
    display: none;
}

.docimport-toc-title,
.docimport-onthispage-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.docimport-toc .docimport-toc-sections {
    font-size: 0.9em;
}

.docimport-toc-toggle {
    flex: 0 0 auto;
    width: 1.5em;
    height: 1.5em;
    line-height: 1;
    text-decoration: none;
}

.docimport-toc-toggle::before {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin: 0.4em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s ease-in-out;
}

.docimport-toc-toggle.collapsed::before {
    transform: rotate(-45deg);
}

.docimport-toc-link,
.docimport-onthispage .nav-link {
    display: block;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.docimport-toc-link.active,
.docimport-onthispage .nav-link.active {
    border-left-color: var(--bs-primary, #0d6efd);
    background-color: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.08));
    color: var(--bs-primary, #0d6efd);
    font-weight: 600;
}

.docimport-onthispage .nav-link {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

.docimport-onthispage .nav .nav {
    padding-left: 1rem;
}
