/* ================================================================
   BLOG ARTICLE — sticky sidebar with auto table of contents
   and related blogs. Loaded after each article's inline <style>.
   Class prefix: bcp-
================================================================ */

/* overflow-x:hidden on html+body turns body into a scroll container,
   which stops position:sticky working; clip prevents sideways scroll without that */
@supports (overflow: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

.bp-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
}

.bp-body h2,
.bp-body h3 {
    scroll-margin-top: 130px;
}

/* Sidebar: sticky on desktop, scrolls internally if taller than the screen */
.bp-sidebar {
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(225,178,97,.35) transparent;
    gap: 24px;
}

.bcp-side-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 18px;
}

/* ---------- Table of contents ---------- */
.bcp-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    cursor: default;
    text-align: left;
}

.bcp-toc-toggle .bcp-side-title { margin: 0; }
.bcp-toc-toggle i { display: none; }

.bcp-toc-list,
.bcp-toc-sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bcp-toc-list { margin-top: 18px; }

.bcp-toc-list > li + li { margin-top: 4px; }

.bcp-toc-sub { margin: 4px 0 6px 12px; }

.bcp-toc-link {
    display: block;
    padding: 6px 0 6px 12px;
    border-left: 2px solid rgba(255,255,255,.08);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
    text-decoration: none;
    transition: color .25s var(--ease), border-color .25s var(--ease);
}

.bcp-toc-sub .bcp-toc-link {
    font-size: 12.5px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.bcp-toc-link:hover { color: var(--white); }

.bcp-toc-link.bcp-active {
    color: var(--gold);
    border-left-color: var(--gold);
}

/* ---------- Related blogs ---------- */
.bcp-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bcp-related-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    text-decoration: none;
}

.bcp-related-item img {
    width: 76px;
    height: 60px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.08);
    transition: border-color .3s var(--ease);
}

.bcp-related-title {
    font-family: var(--font-disp);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--white);
    transition: color .3s var(--ease);
}

.bcp-related-item:hover .bcp-related-title { color: var(--gold); }
.bcp-related-item:hover img { border-color: rgba(225,178,97,.5); }

/* ---------- CTA card (moved below the article) ---------- */
.bcp-cta {
    margin-top: 50px;
}

.bcp-cta .btn-gold { margin-right: 12px; margin-bottom: 12px; }

.bcp-cta .bp-side-call {
    display: inline-flex;
    padding: 14px 24px;
}

/* ---------- Tablet & mobile: single column ---------- */
@media (max-width: 1024px) {
    .bp-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Let the TOC sit above the article and related blogs below it */
    .bp-sidebar {
        display: contents;
    }

    .bcp-toc { order: -1; }

    .bcp-toc-toggle { cursor: pointer; }

    .bcp-toc-toggle i {
        display: block;
        color: var(--gold);
        font-size: 12px;
        transition: transform .3s var(--ease);
    }

    .bcp-toc.bcp-open .bcp-toc-toggle i { transform: rotate(180deg); }

    .bcp-toc:not(.bcp-open) .bcp-toc-list { display: none; }

    .bp-body h2,
    .bp-body h3 {
        scroll-margin-top: 100px;
    }
}

@media (max-width: 768px) {
    .bcp-cta .btn-gold { width: 100%; justify-content: center; margin-right: 0; }
    .bcp-cta .bp-side-call { display: flex; }
}
