﻿/* Article page container */
.article-detail-section .detail-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* Article header */
.article-header {
    max-width: 900px;
    margin: 28px auto;
}

    .article-header .detail-title {
        font-size: clamp(2rem, 4vw, 3rem);
        line-height: 1.2;
        font-weight: 750;
        letter-spacing: -0.035em;
        margin-bottom: 20px;
        overflow-wrap: anywhere;
    }

    .article-header .detail-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px 20px;
        margin: 16px 0;
        font-size: 0.9rem;
    }

    .article-header .detail-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 16px 0;
    }

    /* Sharing controls */
    .article-header .share-container {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
        margin-top: 20px;
    }

.copy-article-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

    .copy-article-link:hover {
        background: #f3f4f6;
    }

/* Featured image */
.article-detail-section .detail-image {
    max-width: 900px;
    margin: 24px auto 32px;
}

    .article-detail-section .detail-image img {
        display: block;
        width: 100%;
        border-radius: 12px;
    }

/* Video */
.article-detail-section .ratio {
    max-width: 900px;
    margin: 24px auto 32px;
    overflow: hidden;
    border-radius: 12px;
}

/* Two-column reading layout */
.article-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 820px);
    justify-content: center;
    align-items: start;
    gap: 32px;
    margin: 32px auto;
}
/* Use the full width when there is no Table of Contents */
.article-layout--full-width {
    grid-template-columns: minmax(0, 1fr);
}

/* Sticky table of contents */
.article-toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: var(--bs-body-bg, #ffffff);
}

    .article-toc summary {
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
        margin-bottom: 12px;
    }

#articleToc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#articleToc li {
    margin: 6px 0;
}

#articleToc a {
    display: block;
    padding: 7px 9px;
    border-radius: 6px;
    color: var(--bs-body-color, #212529);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.45;
}

    #articleToc a:hover {
        background: #f3f4f6;
        color: #0d6efd;
    }

/* Article body */
.article-content {
    min-width: 0;
    width: 100%;
    font-size: 1.05rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

    .article-content h2 {
        margin: 40px 0 16px;
        padding-bottom: 10px;
        border-bottom: 1px solid #e5e7eb;
        font-size: clamp(1.45rem, 2.5vw, 1.8rem);
        line-height: 1.4;
        scroll-margin-top: 24px;
    }

    .article-content h3 {
        margin: 28px 0 12px;
        padding-left: 12px;
        border-left: 3px solid #0d6efd;
        font-size: 1.2rem;
        line-height: 1.5;
        scroll-margin-top: 24px;
    }

    .article-content img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    .article-content pre {
        max-width: 100%;
        overflow-x: auto;
        border-radius: 8px;
        padding: 16px;
    }

    .article-content .article-table-scroll {
        max-width: 100%;
        overflow-x: auto;
        margin: 20px 0;
    }

    .article-content table {
        width: 100%;
        border-collapse: collapse;
    }

    .article-content th,
    .article-content td {
        padding: 10px 12px;
        border: 1px solid #dee2e6;
        text-align: left;
        vertical-align: top;
    }

    .article-content th {
        background: #f3f4f6;
    }

/* Articles without H2 headings */
.article-layout--no-toc {
    grid-template-columns: minmax(0, 820px);
}

/* Mobile and tablet */
@media (max-width: 991px) {
    .article-detail-section .detail-container {
        padding: 16px;
    }

    .article-header {
        margin: 24px 0;
    }

    .article-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
        margin-top: 24px;
    }

    .article-toc {
        position: static;
        max-height: none;
        padding: 14px;
    }

    .article-content {
        font-size: 1rem;
        line-height: 1.75;
    }
}

@media (max-width: 575px) {
    .article-header .detail-title {
        font-size: 1.8rem;
    }

    .article-header .detail-meta {
        gap: 10px;
    }

    .article-content h2 {
        margin-top: 30px;
    }
}

/* Keep the Table of Contents visible while scrolling */
.article-toc-shell {
    position: sticky;
    top: 90px; /* Adjust based on your header height */
    align-self: start;
    min-width: 0;
    z-index: 10;
}

/* Sidebar appearance and scrolling */
.article-toc {
    position: static;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: var(--bs-body-bg, #fff);
}

/* On mobile, return to normal document flow */
@media (max-width: 991px) {
    .article-toc-shell {
        position: static;
    }

    .article-toc {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

/* ===== Modern Table of Contents ===== */

.article-toc-shell {
    position: sticky;
    top: 90px;
    align-self: start;
    min-width: 0;
    z-index: 10;
}

.article-toc {
    padding: 0;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 3px solid #2563eb;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

    /* TOC header */
    .article-toc summary {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 16px;
        background: #f8fafc;
        border-bottom: 1px solid #e8edf4;
        cursor: pointer;
        list-style: none;
    }

        .article-toc summary::-webkit-details-marker {
            display: none;
        }

        .article-toc summary::after {
            content: "\f282";
            font-family: "bootstrap-icons";
            font-size: 13px;
            color: #64748b;
            transition: transform 0.2s ease;
        }

    .article-toc:not([open]) summary::after {
        transform: rotate(-90deg);
    }

.article-toc-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

    .article-toc-heading > i {
        display: grid;
        place-items: center;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: #eaf2ff;
        color: #2563eb;
        font-size: 19px;
    }

    .article-toc-heading strong {
        display: block;
        color: #0f172a;
        font-size: 0.95rem;
        font-weight: 700;
    }

    .article-toc-heading small {
        display: block;
        margin-top: 3px;
        color: #64748b;
        font-size: 0.75rem;
        font-weight: 400;
    }

/* Number of sections */
.article-toc-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 27px;
    height: 25px;
    padding: 0 8px;
    border-radius: 20px;
    background: #eaf2ff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Navigation list */
#articleToc {
    padding: 9px;
}

    #articleToc ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    #articleToc li {
        margin: 3px 0;
    }

    #articleToc a {
        display: block;
        padding: 10px 11px;
        border-left: 3px solid transparent;
        border-radius: 7px;
        color: #475569;
        font-size: 0.85rem;
        font-weight: 450;
        line-height: 1.5;
        text-decoration: none;
        overflow-wrap: anywhere;
        transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    }

        /* Hover effect */
        #articleToc a:hover {
            background: #f1f5f9;
            color: #1d4ed8;
            border-left-color: #93c5fd;
        }

        /* Currently viewed section */
        #articleToc a.is-active {
            background: #eff6ff;
            color: #1d4ed8;
            border-left-color: #2563eb;
            font-weight: 650;
        }

/* Smooth section navigation */
html {
    scroll-behavior: smooth;
}

.article-content h2,
.article-content h3 {
    scroll-margin-top: 95px;
}

/* Mobile layout */
@media (max-width: 991px) {
    .article-toc-shell {
        position: static;
    }

    .article-toc {
        max-height: none;
        overflow: visible;
    }

        .article-toc summary {
            position: static;
        }

    #articleToc a {
        padding: 11px;
    }
}


/* Reading progress bar */
.article-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 1200;
    pointer-events: none;
    background: #e2e8f0;
}

#articleReadingProgressBar {
    display: block;
    width: 0;
    height: 100%;
    background: #2563eb;
    transition: width 0.08s linear;
}

/* Back to Top */
.article-back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1100;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 25px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

    .article-back-to-top.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .article-back-to-top:hover {
        background: #1d4ed8;
    }

    .article-back-to-top:focus-visible {
        outline: 3px solid #93c5fd;
        outline-offset: 3px;
    }

@media (max-width: 576px) {
    .article-back-to-top {
        right: 16px;
        bottom: 16px;
        width: 42px;
        height: 42px;
    }
}



.article-toc-item a.is-active {
    color: #2563eb;
    font-weight: 700;
    border-left: 3px solid #2563eb;
    padding-left: 8px;
}


/* Code block container */
.article-code-container {
    position: relative;
    margin: 24px 0;
    border-radius: 10px;
    overflow: hidden;
}

/* Reserve space for the Copy button */
.article-content .article-code-container pre {
    margin: 0 !important;
    padding-top: 0 !important;
    max-width: 100%;
    border-radius: 10px;
}

/* Copy Code button */
.article-copy-code {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 36px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #64748b;
    border-radius: 6px;
    background: #334155;
    color: #ffffff;
    cursor: pointer;
}

    .article-copy-code:hover {
        background: #475569;
    }

    .article-copy-code svg {
        width: 17px;
        height: 17px;
    }

    .article-copy-code.is-copied {
        background: #166534;
        border-color: #166534;
    }



.copy-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    font: inherit;
    cursor: pointer;
}

    .copy-link-button:hover {
        background: #f1f5f9;
    }

    .copy-link-button.is-copied {
        color: #166534;
        border-color: #86efac;
        background: #f0fdf4;
    }


/******* Related Article*******/

/* More compelling related article cards */

.related-professional-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #2563eb;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.related-professional-header h2 {
    max-width: 700px;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    line-height: 1.25;
    letter-spacing: -0.7px;
}

.related-professional-header p {
    max-width: 650px;
}

.article-detail-section a.related-professional-card {
    min-height: 250px;
    padding: 22px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
    transform: none;
}

.related-professional-title {
    margin: 20px 0 10px;
    color: #172554;
    font-size: 1.13rem;
    font-weight: 750;
    line-height: 1.5;
}

.related-professional-summary {
    display: -webkit-box;
    margin: 0 0 22px;
    overflow: hidden;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.related-professional-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #e8edf4;
    color: #2563eb;
    font-size: 0.88rem;
    font-weight: 700;
}

    .related-professional-footer i {
        transition: transform 0.2s ease;
    }

.article-detail-section a.related-professional-card:hover {
    border-color: #93b4e8;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
    transform: translateY(-2px);
}

    .article-detail-section a.related-professional-card:hover
    .related-professional-footer i {
        transform: translateX(4px);
    }

@media (max-width: 600px) {
    .article-detail-section a.related-professional-card {
        min-height: 220px;
        padding: 18px;
    }
}

/* Two related article cards per row */
.related-professional-grid,
.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* One card per row on mobile */
@media (max-width: 600px) {
    .related-professional-grid,
    .related-articles-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.related-professional-card:hover .related-professional-category {
    color: #2563eb;
}


/* Print article button */
.article-print-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

    .article-print-button:hover {
        background: #f1f5f9;
        border-color: #94a3b8;
    }

/* Print-friendly page */
@page {
    size: A4;
    margin: 16mm;
}

@media print {
    body {
        background: #ffffff !important;
        color: #111827 !important;
        font-size: 10.5pt !important;
    }

    /* Remove navigation and interactive controls */
    nav,
    header:not(.article-page-header),
    footer,
    .article-reading-progress,
    .article-toc-sidebar,
    .article-share-actions,
    .article-back-to-top,
    .back-bottom,
    .related-articles,
    .back-link,
    .article-copy-code,
    .article-pdf-preview {
        display: none !important;
    }

    .article-detail-section {
        padding: 0 !important;
        margin: 0 !important;
    }

    .article-detail-container {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }

    .article-page-header {
        max-width: none !important;
        margin: 0 0 20px !important;
    }

    .article-page-title {
        font-size: 24pt !important;
        color: #111827 !important;
    }

    .article-layout {
        display: block !important;
    }

    .article-main-column {
        width: 100% !important;
        min-width: 0 !important;
    }

    .article-content {
        color: #111827 !important;
        font-size: 10.5pt !important;
        line-height: 1.65 !important;
    }

        .article-content h2,
        .article-content h3 {
            color: #111827 !important;
            break-after: avoid-page;
            page-break-after: avoid;
        }

        .article-content p,
        .article-content li {
            orphans: 3;
            widows: 3;
        }

        .article-content pre,
        .article-content blockquote,
        .article-content img,
        .article-content tr {
            break-inside: avoid;
            page-break-inside: avoid;
        }

        .article-content pre {
            white-space: pre-wrap !important;
            overflow-wrap: anywhere;
            border: 1px solid #d1d5db !important;
            color: #111827 !important;
        }

    .article-table-scroll {
        overflow: visible !important;
    }

        .article-table-scroll table {
            width: 100% !important;
            min-width: 0 !important;
        }

    .article-feature-media .ratio {
        display: none !important;
    }

    .article-feature-media img {
        max-width: 100% !important;
        height: auto !important;
    }

    .article-detail-section a {
        color: #111827 !important;
        text-decoration: none !important;
    }

    .article-page-title,
    .article-content h2,
    .article-content h3 {
        overflow-wrap: anywhere;
    }
}