/* ════════════════════════════════════════════════
   Clean Post Content — TOC Styles
   ════════════════════════════════════════════════ */

/* ── The nav panel ────────────────────────────── */
.cpc-toc {
    position: sticky;
    top: 32px;                  /* distance from top when sticky */
    align-self: flex-start;     /* needed when parent is flex/grid */
    width: 100%;
}

/* ── Header row ───────────────────────────────── */
.cpc-toc__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: currentColor;
    opacity: 0.5;
}

/* ── List ─────────────────────────────────────── */
.cpc-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Each item ────────────────────────────────── */
.cpc-toc__item {
    border-radius: 6px;
    transition: background 150ms ease;
}

/* ── Link ─────────────────────────────────────── */
.cpc-toc__link {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 400;
    color: currentColor;
    opacity: 0.55;
    text-decoration: none;
    border-radius: 6px;
    transition: opacity 150ms ease, background 150ms ease;
    line-height: 1.4;
}

.cpc-toc__link:hover {
    opacity: 0.85;
    text-decoration: none;
}

/* ── Active state ─────────────────────────────── */
.cpc-toc__item--active .cpc-toc__link {
    opacity: 1;
    font-weight: 500;

    /* 
     * Background uses a CSS custom property so the user
     * can override it from the Divi section's background color
     * or via custom CSS in the child theme.
     *
     * Default: a subtle white/black overlay.
     * Override: .cpc-toc__item--active .cpc-toc__link { background: #yourcolor; }
     */
    background: var(--cpc-toc-active-bg, rgba(255,255,255,0.08));
    color: var(--cpc-toc-active-color, currentColor);
}

/* ── Smooth scroll for the whole page ────────────*/
html {
    scroll-behavior: smooth;
}

/* 
 * Offset for fixed headers (navbar).
 * Adjust --cpc-scroll-offset to match your navbar height.
 * Default: 80px. Override in child theme:
 *   :root { --cpc-scroll-offset: 100px; }
 */
:root {
    --cpc-scroll-offset: 80px;
}

.cpc-toc-anchor {
    display: block;
    position: relative;
    top: calc(-1 * var(--cpc-scroll-offset));
    visibility: hidden;
    pointer-events: none;
}
