/* ----------------------------------------------------------------
 * Automatische inhoudsopgave — [to_post_toc] VC block
 * --------------------------------------------------------------*/

/* Zorg dat anchor-jumps niet onder een sticky header verdwijnen.
 * 110px is een veilige ondergrens — overrule via je theme als je
 * header anders meet. Alleen toegepast op headings binnen de echte
 * post-content om geen interferentie elders te krijgen. */
.single-post .entry-content h2,
.single-post .entry-content h3,
.single-post .entry-content h4,
.single-post .l-section-h h2,
.single-post .l-section-h h3,
.single-post .l-section-h h4,
.single .w-post-elm.post_content h2,
.single .w-post-elm.post_content h3,
.single .w-post-elm.post_content h4 {
    scroll-margin-top: 110px;
}

.to-toc {
    --to-toc-bg:        var(--to-bg-card, #fff);
    --to-toc-border:    var(--to-line-soft, #eadfc8);
    --to-toc-ink:       var(--to-ink, #3a2f22);
    --to-toc-muted:     var(--to-ink-muted, #6b5e4d);
    --to-toc-accent:    var(--to-accent, #b87a3d);
    --to-toc-radius:    var(--to-radius, 12px);
    --to-toc-shadow:    var(--to-shadow-sm, 0 2px 10px rgba(58,47,34,.06));

    background: var(--to-toc-bg);
    border: 1px solid var(--to-toc-border);
    border-radius: var(--to-toc-radius);
    padding: 18px 22px;
    margin: 28px 0;
    color: var(--to-toc-ink);
    font-size: 15px;
    line-height: 1.55;
    box-shadow: var(--to-toc-shadow);
}

.to-toc__title {
    font-family: var(--to-font-display, "Fraunces", Georgia, serif);
    font-weight: 500;
    font-size: clamp(17px, 1.4vw, 19px);
    letter-spacing: -0.005em;
    margin: 0 0 10px;
    color: var(--to-toc-ink);
}

.to-toc__details { margin: 0; }

.to-toc__summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.to-toc__summary::-webkit-details-marker { display: none; }
.to-toc__summary > .to-toc__title { margin: 0; }

.to-toc__toggle {
    width: 14px;
    height: 14px;
    border-right: 2px solid var(--to-toc-muted);
    border-bottom: 2px solid var(--to-toc-muted);
    transform: rotate(45deg);
    transition: transform .2s ease;
    flex: 0 0 auto;
    margin-right: 4px;
}
.to-toc__details[open] .to-toc__toggle {
    transform: rotate(-135deg);
    margin-top: 6px;
}

/* Lijsten — geneste <ol> houden we counter-driven zodat 1, 1.1, 1.1.1 etc. */
.to-toc__list,
.to-toc__sublist {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    counter-reset: to-toc-c;
}
.to-toc__details[open] .to-toc__list { margin-top: 12px; }
.to-toc__sublist {
    margin: 6px 0 6px 14px;
    padding-left: 12px;
    border-left: 1px solid var(--to-toc-border);
}

.to-toc__item {
    counter-increment: to-toc-c;
    margin: 4px 0;
    position: relative;
}

.to-toc__link {
    display: inline-block;
    color: var(--to-toc-ink);
    text-decoration: none;
    padding: 3px 0;
    border-bottom: 1px solid transparent;
    transition: color .15s, border-color .15s;
}
.to-toc__link:hover,
.to-toc__link:focus-visible {
    color: var(--to-toc-accent);
    border-bottom-color: currentColor;
}

/* Genummerde varianten — pak je liever ongenummerd, comment dit blok dan uit. */
.to-toc__item--l2 > .to-toc__link::before {
    content: counter(to-toc-c) ". ";
    color: var(--to-toc-muted);
    margin-right: 4px;
    font-variant-numeric: tabular-nums;
}

.to-toc__item--l3 > .to-toc__link,
.to-toc__item--l4 > .to-toc__link {
    color: var(--to-toc-muted);
}

/* Actieve sectie — gezet door to-toc.js via IntersectionObserver. */
.to-toc__link.is-active {
    color: var(--to-toc-accent);
    font-weight: 500;
}
.to-toc__link.is-active::after {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 6px;
    background: currentColor;
    border-radius: 50%;
    vertical-align: middle;
}

/* Sticky variant — alleen op desktop, anders neemt het te veel ruimte op mobiel. */
@media (min-width: 1100px) {
    .to-toc--sticky {
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
    .to-toc--sticky::-webkit-scrollbar { width: 6px; }
    .to-toc--sticky::-webkit-scrollbar-thumb {
        background: var(--to-toc-border);
        border-radius: 3px;
    }
}

@media (max-width: 680px) {
    .to-toc {
        padding: 14px 16px;
        margin: 20px 0;
        font-size: 14.5px;
    }
}

/* Print: TOC mag uitstaan in print. */
@media print {
    .to-toc { display: none; }
}
