/*
 * ps-toc.css — Inhaltsverzeichnis-Styles für den per post-toc-inject erzeugten TOC.
 *
 * Markup:
 *   <nav class="ps-toc" aria-label="Inhaltsverzeichnis">
 *     <p class="ps-toc__title">Inhalt</p>
 *     <ol class="ps-toc__list">
 *       <li><a href="#anchor">Section</a></li>
 *     </ol>
 *   </nav>
 */

.ps-toc {
    background: #f7f7f9;
    border: 1px solid #e1e1e6;
    border-left: 3px solid #2271b1;
    border-radius: 4px;
    padding: 18px 24px 18px 28px;
    margin: 1.6em 0 2em;
    font-size: 0.95em;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ps-toc__title {
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555;
    margin: 0 0 10px;
    padding: 0;
}

.ps-toc__list {
    list-style: none !important;
    counter-reset: ps-toc-counter;
    padding: 0 !important;
    margin: 0 !important;
}

.ps-toc__list > li {
    list-style: none !important;
    counter-increment: ps-toc-counter;
    padding: 4px 0 4px 32px !important;
    position: relative !important;
    margin: 0 !important;
    line-height: 1.45;
}

.ps-toc__list > li::before {
    content: counter(ps-toc-counter) ".";
    position: absolute;
    left: 0;
    top: 4px;
    color: #2271b1;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    width: 28px;
    text-align: right;
    padding-right: 6px;
}

.ps-toc__list a {
    color: #1d2327;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.12s ease, border-color 0.12s ease;
}

.ps-toc__extra {
    display: none !important;
}

.ps-toc--open .ps-toc__extra {
    display: list-item !important;
}

.ps-toc__toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 3px 10px 3px 6px;
    background: none;
    border: 1px solid #c5c5cc;
    border-radius: 3px;
    font-size: 0.85em;
    color: #2271b1;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.12s, border-color 0.12s;
}

.ps-toc__toggle:hover {
    background: #eef3f9;
    border-color: #2271b1;
}

.ps-toc__list a:hover,
.ps-toc__list a:focus {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

/* Smooth-Scroll-Offset für Anchor-Targets — wegen Sticky-Header */
:target,
[id^="psinv-"],
.ps-toc__list a[href^="#"] {
    scroll-margin-top: 90px;
}

/* H2/H3 mit id-Attribut bekommen ebenfalls scroll-margin */
h2[id],
h3[id] {
    scroll-margin-top: 90px;
}

/* Mobile */
@media (max-width: 640px) {
    .ps-toc {
        padding: 14px 18px 14px 22px;
        font-size: 0.92em;
    }
    .ps-toc__list > li {
        padding-left: 28px !important;
    }
    .ps-toc__list > li::before {
        width: 24px;
    }
}

/* Dark-mode-Hint (optional, falls Theme dark unterstützt) */
@media (prefers-color-scheme: dark) {
    .ps-toc {
        background: #1f2937;
        border-color: #2d3748;
        border-left-color: #60a5fa;
        box-shadow: none;
    }
    .ps-toc__title {
        color: #9ca3af;
    }
    .ps-toc__list a {
        color: #e5e7eb;
    }
    .ps-toc__list a:hover,
    .ps-toc__list a:focus {
        color: #60a5fa;
        border-bottom-color: #60a5fa;
    }
    .ps-toc__list li::before {
        color: #60a5fa;
    }
}
