/* Complément strictement nécessaire au rendu du bloc natif Kadence Table of Contents. */
.editorial-layout .sticky-sidebar-column { min-width: 0; }
.editorial-layout .sticky-sidebar { position: sticky; top: var(--gm-sticky-offset, 175px); align-self: start; }
.editorial-layout .sidebar-nav .kb-table-of-content-title { display: none; }
.editorial-layout .sidebar-nav .kb-table-of-content-list,
.editorial-layout .sidebar-nav .kb-table-of-content-list ul { list-style: none; margin: 0; padding: 0; }
.editorial-layout .sidebar-nav .kb-table-of-content-list { display: flex; flex-direction: column; gap: 14px; counter-reset: jb-toc; }
.editorial-layout .sidebar-nav .kb-table-of-content-list li { margin: 0; padding: 0; counter-increment: jb-toc; }
.editorial-layout .sidebar-nav .kb-table-of-content-list a { display: flex; align-items: baseline; gap: 10px; border: 0; color: var(--gm-ink-dark, #111); font-family: 'Cormorant Upright', serif; font-size: 1.25rem; line-height: 1.1; text-decoration: none; }
.editorial-layout .sidebar-nav .kb-table-of-content-list a::before { content: counter(jb-toc, decimal-leading-zero) '.'; flex: 0 0 auto; color: var(--gm-terracotta, #C37358); font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.editorial-layout .sidebar-nav .kb-table-of-content-list a:hover { color: var(--gm-terracotta, #C37358); }

/* ==========================================================================
   SOMMAIRE STICKY MOBILE / TABLETTE : barre de pastilles
   ========================================================================== */
@media (max-width: 920px) {

    /* Écrase le flex nowrap de Gutenberg (spécificité supérieure) */
    .wp-block-columns.editorial-layout {
        display: block !important;
    }
    .editorial-layout > .main-content {
        width: 100% !important;
        flex-basis: auto !important;
        min-width: 0;
    }
    .editorial-layout > .sticky-sidebar-column {
        display: contents !important;
    }

    .editorial-layout .sticky-sidebar {
        position: sticky !important;
        top: 0;
        z-index: 50;
        margin: 0 -24px 32px !important;
        width: auto !important;
        max-width: none !important;
        padding: 10px 24px;
        background: #fff;
        border-bottom: 1px solid var(--gm-line);
        box-shadow: 0 8px 14px -12px rgba(0, 0, 0, .35);
    }

    .editorial-layout .sidebar-label { display: none; }
    .editorial-layout .sidebar-nav { display: block; }
    .editorial-layout .sidebar-nav .kb-table-of-content-wrap { min-width: 0; }

    .editorial-layout .sidebar-nav .kb-table-of-content-list {
        position: relative;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .editorial-layout .sidebar-nav .kb-table-of-content-list::-webkit-scrollbar { display: none; }
    .editorial-layout .sidebar-nav .kb-table-of-content-list li { flex: 0 0 auto; }

    .editorial-layout .sidebar-nav .kb-table-of-content-list a {
        white-space: nowrap;
        padding: 8px 14px;
        border: 1px solid var(--gm-line);
        background: var(--gm-bg-muted);
        font-size: 1.05rem;
        transition: background .2s, color .2s, border-color .2s;
    }
    .editorial-layout .sidebar-nav .kb-table-of-content-list a.is-active {
        background: var(--gm-plum-dark);
        border-color: var(--gm-plum-dark);
        color: #fff;
    }
    .editorial-layout .sidebar-nav .kb-table-of-content-list a.is-active::before {
        color: var(--gm-terracotta-light);
    }
        /* Dégradé : indique que la barre défile horizontalement */
    .editorial-layout .sticky-sidebar::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 1px;
        width: 56px;
        background: linear-gradient(to left, #fff 25%, rgba(255, 255, 255, 0));
        pointer-events: none;
        transition: opacity .25s;
    }
    .editorial-layout .sticky-sidebar.is-end::after {
        opacity: 0;
    }
}

/* Barre d'admin WordPress */
@media (min-width: 601px) and (max-width: 782px) {
    body.admin-bar .editorial-layout .sticky-sidebar { top: 46px; }
}
@media (min-width: 783px) and (max-width: 920px) {
    body.admin-bar .editorial-layout .sticky-sidebar { top: 32px; }
}