/* =============================================================================
   MÓDULO DE SUMÁRIO DINÂMICO (TABLE OF CONTENTS - TOC)
   Renderizado Server-Side, Ultra-Leve com Botão de Collapse
   ============================================================================= */

.gbp-toc-container,
.fwx-toc-container {
    border-left: 4px solid var(--gbp-color-primary);
    background: var(--gbp-color-surface);
    padding: 18px 20px;
    margin: 30px 0;
    border-radius: 0 var(--gbp-rad-8) var(--gbp-rad-8) 0;
    border-top: 1px solid var(--gbp-color-border);
    border-right: 1px solid var(--gbp-color-border);
    border-bottom: 1px solid var(--gbp-color-border);
}

[data-theme='dark'] .gbp-toc-container,
html[data-theme='dark'] .fwx-toc-container {
    background: var(--gbp-color-surface-card);
    border-color: var(--gbp-color-border-dark);
    border-left-color: var(--gbp-color-primary);
}

.gbp-toc-header,
.fwx-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.gbp-toc-title,
.fwx-toc-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gbp-color-heading, var(--gbp-color-text));
    display: flex;
    align-items: center;
    gap: 8px;
}

.gbp-toc-toggle,
.fwx-toc-toggle {
    background: none;
    border: 1px solid var(--gbp-color-border);
    border-radius: var(--gbp-rad-4);
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    color: var(--gbp-color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--gbp-transition);
    padding: 0;
}

.gbp-toc-toggle:hover,
.fwx-toc-toggle:hover {
    background: var(--gbp-color-primary);
    color: #ffffff;
    border-color: var(--gbp-color-primary);
}

.gbp-toc-list,
.fwx-toc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1200px;
    opacity: 1;
}

.gbp-toc-list.gbp-toc-collapsed,
.fwx-toc-list.fwx-toc-collapsed {
    max-height: 0;
    opacity: 0;
}

.gbp-toc-list li,
.fwx-toc-list li {
    margin-bottom: 8px;
    font-size: 0.925rem;
    line-height: 1.4;
}

.gbp-toc-list li:last-child,
.fwx-toc-list li:last-child {
    margin-bottom: 0;
}

.gbp-toc-list a,
.fwx-toc-list a {
    color: var(--gbp-color-text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--gbp-transition);
    display: inline-block;
}

.gbp-toc-list a:hover,
.fwx-toc-list a:hover {
    color: var(--gbp-color-primary);
    transform: translateX(3px);
}

.gbp-toc-list li.gbp-toc-active a,
.fwx-toc-list li.fwx-toc-active a {
    color: var(--gbp-color-primary, #0066cc);
    font-weight: 700;
    transform: translateX(4px);
}

/* =============================================================================
   SUMÁRIO FLUTUANTE (enable_sticky_toc) — paridade Fast WebX, v1.2.0
   Desktop ≥ 1250px: coluna à esquerda do texto, fixa durante a rolagem.
   ============================================================================= */

.gbp-actual-content h2[id],
.fwx-actual-content h2[id],
.entry-content h2[id] {
    scroll-margin-top: 100px;
}

.gbp-sticky-toc .gbp-toc-container {
    margin-top: 0;
}

@media (min-width: 1250px) {
    .gbp-content-with-toc {
        position: relative;
        display: block;
    }

    .gbp-sticky-toc {
        position: absolute;
        top: 0;
        right: 100%;
        margin-right: 20px;
        width: 240px;
        height: 100%;
        pointer-events: none;
        z-index: 10;
    }

    .gbp-sticky-toc .gbp-toc-container {
        position: sticky;
        top: 110px;
        margin: 0;
        pointer-events: auto;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
        scrollbar-width: thin;
        font-size: 0.85rem;
        padding: 14px 16px;
    }

    /* Abre espaço à esquerda para o sumário sem esmagar o texto */
    .gbp-single-layout:has(.gbp-content-with-toc) {
        padding-left: 260px;
        max-width: calc(var(--gbp-container-max, 1200px) + 260px);
    }
}
