/* Article TOC: sticky in the desktop sidebar, icon/dialog below 1200px. */
.bns-sidebar-toc {
    --bns-toc-accent: var(--e-global-color-primary, #014f7f);
    --bns-toc-border: #d9dee8;
    --box-background-color: #fff;
}

.bns-sidebar-toc[hidden],
.bns-article-toc-tools[hidden] {
    display: none;
}

.bns-sidebar-toc .elementor-toc__header {
    border-bottom: 0;
    padding-bottom: 1rem;
}

.bns-sidebar-toc .elementor-toc__header-title::after {
    background: var(--bns-toc-accent);
    content: "";
    display: block;
    height: 2px;
    margin-top: 1rem;
    width: 4rem;
}

.bns-sidebar-toc .elementor-toc__body {
    padding-top: 0;
}

.bns-sidebar-toc .elementor-toc__list-wrapper {
    margin: 0;
}

.bns-sidebar-toc .bns-toc-fallback-list {
    list-style: none;
    padding: 0;
}

.bns-article-content .bns-toc-anchor {
    scroll-margin-top: var(--bns-toc-scroll-offset, 144px);
}

.bns-sidebar-toc .elementor-toc__list-item {
    margin-bottom: 0;
}

.bns-sidebar-toc .elementor-toc__list-item + .elementor-toc__list-item {
    border-top: 1px solid var(--bns-toc-border);
}

.bns-sidebar-toc .elementor-toc__list-item-text-wrapper::before,
.bns-sidebar-toc .elementor-toc__list-item-text-wrapper > :is(i, svg) {
    display: none;
}

.bns-sidebar-toc .elementor-toc__list-item-text {
    display: block;
    padding: 1.125rem 0.75rem;
    width: 100%;
}

.bns-sidebar-toc .elementor-toc__list-item-text:is(:hover, :focus-visible, .elementor-item-active) {
    background-color: color-mix(in srgb, var(--bns-toc-accent) 8%, white);
    color: var(--bns-toc-accent);
}

.bns-sidebar-toc .elementor-toc__list-item-text:focus-visible {
    outline: 2px solid var(--bns-toc-accent);
    outline-offset: -2px;
}

.elementor .e-con.bns-article-main,
.elementor .e-con.bns-article-sidebar {
    min-width: 0;
}

.elementor .e-con.bns-article-layout > .bns-article-sidebar {
    align-self: stretch;
}

.bns-article-faq:not(:has(.e-loop-item)) {
    display: none;
}

.bns-article-toc-tools {
    display: none;
    position: fixed;
    top: var(--bns-toc-tools-top, 128px);
    right: 16px;
    z-index: 100;
}

.bns-article-toc-dialog:not([open]) {
    display: none;
}

.bns-article-toc-dialog {
    background: #fff;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
    color: var(--e-global-color-text, #414141);
    height: 100dvh;
    inset: 0 auto 0 0;
    margin: 0;
    max-height: none;
    max-width: none;
    padding: 0;
    position: fixed;
    width: 80vw;
}

.bns-article-toc-dialog[open] {
    display: flex;
    flex-direction: column;
}

.bns-article-toc-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.bns-article-toc-dialog__header {
    align-items: center;
    border-bottom: 1px solid #d9dee8;
    display: flex;
    flex: 0 0 auto;
    gap: var(--space-1, 16px);
    justify-content: space-between;
}

.bns-article-toc-dialog .bns-article-toc-dialog__title {
    font-size: 1.25rem;
    margin: 0;
}

.bns-article-toc-dialog__content {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.bns-article-toc-dialog .bns-article-toc-dialog__close,
.bns-article-toc-tools .bns-article-toc-tools__button {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 48px;
    justify-content: center;
    padding: 0;
    width: 48px;
}

.bns-article-toc-dialog .bns-article-toc-dialog__close {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: inherit;
}

.bns-article-toc-dialog .bns-article-toc-dialog__close:is(:hover, :focus, :active) {
    background: transparent;
    border: 0;
    color: inherit;
}

.bns-article-toc-tools .bns-article-toc-tools__button {
    background: var(--e-global-color-primary, #014f7f);
    border: 1px solid var(--e-global-color-primary, #014f7f);
    border-radius: 50%;
    color: #fff;
}

.bns-article-toc-dialog .bns-article-toc-dialog__close svg,
.bns-article-toc-tools .bns-article-toc-tools__button svg {
    fill: none;
    height: 24px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 24px;
}

.bns-article-toc-tools .bns-article-toc-tools__button:is(:hover, :focus-visible) {
    background: var(--e-global-color-secondary, #414141);
    border-color: var(--e-global-color-secondary, #414141);
    color: #fff;
}

.bns-article-toc-tools .bns-article-toc-tools__button:focus-visible,
.bns-article-toc-dialog .bns-article-toc-dialog__close:focus-visible {
    outline: 2px solid var(--e-global-color-primary, #014f7f);
    outline-offset: 3px;
}

.bns-article-toc-dialog .elementor-toc__header {
    display: none;
}

.bns-article-toc-dialog .elementor-widget-container {
    border: 0;
}

.bns-article-toc-dialog .elementor-toc__body {
    max-height: none;
    overflow: visible;
    padding: 0;
}

.bns-toc-modal-open {
    overflow: hidden;
}

@media (min-width: 1200px) {
    .elementor .bns-article-sidebar > .bns-sidebar-toc {
        position: sticky;
        top: var(--bns-toc-tools-top, 192px);
        max-height: calc(100dvh - var(--bns-toc-tools-top, 192px) - 16px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        flex-shrink: 0;
    }

    /* Let the sticky widget scroll instead of clipping Elementor's inner box. */
    .elementor .bns-article-sidebar > .bns-sidebar-toc > .elementor-widget-container {
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 1199.98px) {
    .elementor .e-con.bns-article-layout,
    .elementor .e-con.bns-article-layout > .e-con-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .bns-toc-ready .bns-article-sidebar > .bns-sidebar-toc {
        display: none;
    }

    .bns-toc-ready .bns-article-toc-tools {
        display: block;
        right: 16px;
        top: var(--bns-toc-tools-top, 96px);
    }
}

@media (max-width: 575px) {
    .bns-article-toc-dialog {
        width: 100%;
    }
}
