/* ============================================
   BLOG INDEX — Section Header + Card Grid
   ============================================ */

.blog-section-header {
    max-width: none;
}

.blog-subtitle {
    clear: both;
    padding-top: 18px;
    font-size: 18px;
    line-height: 1.6;
    color: var(--color-para-text);
    font-family: 'PT Sans', sans-serif;
    margin: 0;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.insight-card {
    background: var(--color-bg-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--color-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px var(--color-shadow-medium);
}

.insight-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.insight-card-body {
    padding: 20px 22px 26px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insight-card-date {
    font-size: 12px;
    font-family: Poppins, sans-serif;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.insight-card-title {
    font-size: 17px;
    font-weight: 600;
    font-family: Poppins, sans-serif;
    color: var(--color-text-secondary-light);
    line-height: 1.35;
    margin: 0;
}

.insight-card-description {
    font-size: 14px;
    font-family: 'PT Sans', sans-serif;
    color: var(--color-text-secondary);
    line-height: 1.55;
    margin: 0;
    flex: 1;
}

.insight-card-cta {
    display: inline-block;
    font-size: 13px;
    font-family: Poppins, sans-serif;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 6px;
}

.insights-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-tertiary);
    font-family: Poppins, sans-serif;
    font-size: 16px;
    padding: 40px 0;
}

/* ============================================
   ARTICLE PAGE — Hero
   ============================================ */

body.article-page {
    background-color: var(--color-bg-cream);
}

.article-hero {
    width: 100%;
    height: 420px;
    overflow: hidden;
    background-color: var(--color-bg-cream-secondary);
}

.article-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================
   ARTICLE PAGE — Content Column
   ============================================ */

.article-wrapper {
    background-color: var(--color-bg-cream);
}

.article-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 52px 24px 84px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-family: Poppins, sans-serif;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    margin-bottom: 40px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--color-primary);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.article-date,
.article-read-time {
    font-size: 12px;
    font-family: Poppins, sans-serif;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.article-meta-dot {
    width: 3px;
    height: 3px;
    background-color: var(--color-text-tertiary);
    border-radius: 50%;
    flex-shrink: 0;
}

.article-title {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 700;
    font-family: Poppins, sans-serif;
    color: var(--color-text-secondary-light);
    line-height: 1.2;
    margin-bottom: 14px;
}

.article-title-divider {
    width: 44px;
    height: 3px;
    background-color: var(--color-primary);
    margin-bottom: 40px;
    border-radius: 2px;
}

/* ============================================
   ARTICLE BODY — Rich Typography
   ============================================ */

.article-body {
    font-family: 'PT Sans', sans-serif;
    font-size: 18px;
    line-height: 1.78;
    color: var(--color-para-text);
}

.article-body p {
    font-size: 18px;
    line-height: 1.78;
    color: var(--color-para-text);
    margin-bottom: 1.4em;
}

.article-body p:last-child {
    margin-bottom: 0;
}

.article-body h2 {
    font-size: 23px;
    font-weight: 700;
    font-family: Poppins, sans-serif;
    color: var(--color-text-secondary-light);
    margin-top: 2.2em;
    margin-bottom: 0.6em;
    line-height: 1.25;
    scroll-margin-top: 88px;
}

.article-body h3 {
    font-size: 19px;
    font-weight: 600;
    font-family: Poppins, sans-serif;
    color: var(--color-text-secondary-light);
    margin-top: 1.8em;
    margin-bottom: 0.5em;
    line-height: 1.3;
    scroll-margin-top: 88px;
}

.article-body ul,
.article-body ol {
    padding-left: 1.6em;
    margin-bottom: 1.4em;
}

.article-body li {
    font-size: 18px;
    line-height: 1.7;
    color: var(--color-para-text);
    margin-bottom: 0.45em;
}

.article-body strong {
    font-weight: 700;
    color: var(--color-text-secondary-light);
}

.article-body a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: currentColor;
    text-underline-offset: 2px;
}

.article-body a:hover {
    color: var(--color-primary-hover);
}

.article-body blockquote {
    border-left: 3px solid var(--color-primary);
    margin: 2em 0;
    padding: 4px 0 4px 20px;
}

.article-body blockquote p {
    font-size: 19px;
    color: var(--color-text-secondary);
    font-style: italic;
    margin-bottom: 0;
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--color-border-tan);
    margin: 2.5em 0;
}

.article-body code {
    font-family: monospace;
    font-size: 15px;
    background-color: var(--color-bg-cream-secondary);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Inline images (no caption) */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 2em auto;
}

/* Captioned images — use <figure> / <figcaption> in the markdown */
.article-body figure {
    margin: 2.5em 0;
}

.article-body figure img {
    width: 100%;
    margin: 0;
    border-radius: 8px;
}

.article-body figcaption {
    text-align: center;
    font-size: 14px;
    font-family: Poppins, sans-serif;
    color: var(--color-text-tertiary);
    font-style: italic;
    margin-top: 10px;
    line-height: 1.5;
}

/* Side-by-side image pair — wrap two <figure>s in <div class="figure-pair"> */
.article-body .figure-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 2.5em 0;
}

.article-body .figure-pair figure {
    margin: 0;
}

@media (max-width: 600px) {
    .article-body .figure-pair {
        grid-template-columns: 1fr;
    }
}

/* Stat highlight blocks (e.g. 71% / 29%) */
.bsp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 2em 0;
}
.bsp-stat {
    background: var(--color-bg-cream-secondary);
    border-radius: 10px;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bsp-stat-number {
    font-size: 52px;
    font-weight: 700;
    font-family: Poppins, sans-serif;
    line-height: 1;
}
.bsp-stat-label {
    font-size: 15px;
    font-family: Poppins, sans-serif;
    font-weight: 500;
    color: var(--color-text-secondary-light);
}
.bsp-stat-sub {
    font-size: 13px;
    font-family: Poppins, sans-serif;
    color: var(--color-text-tertiary);
}
@media (max-width: 480px) {
    .bsp-stats { grid-template-columns: 1fr; }
    .bsp-stat-number { font-size: 42px; }
}

/* Interactive charts embedded in article body */
.bsp-chart {
    margin: 2em 0;
    width: 100%;
}

/* Two charts side by side */
.bsp-chart-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 2em 0;
    align-items: start;
}
.bsp-chart-pair .bsp-chart {
    margin: 0;
}
@media (max-width: 600px) {
    .bsp-chart-pair { grid-template-columns: 1fr; }
}

/* Chart captions — match photo figcaption style */
.article-body .chart-caption {
    text-align: center;
    font-size: 14px;
    font-family: Poppins, sans-serif;
    color: var(--color-text-tertiary);
    font-style: italic;
    margin-top: 8px;
    line-height: 1.5;
}

.article-loading,
.article-error {
    text-align: center;
    padding: 60px 0;
    color: var(--color-text-secondary);
    font-family: Poppins, sans-serif;
    font-size: 16px;
}

/* ============================================
   ARTICLE PAGE — Two-column layout with ToC
   ============================================ */

.article-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 760px);
    column-gap: 56px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
    align-items: start;
}

/* ToC sidebar */
.toc-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    margin-top: 20px;
    padding: 12px 0 14px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: none;
    background: var(--color-bg-white);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

.toc-sidebar::-webkit-scrollbar {
    display: none;
}

.toc-title {
    font-size: 10px;
    font-family: Poppins, sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-tertiary);
    margin: 0 0 6px 10px;
    text-align: left;
}

.toc-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

/* Collapsible group wrapper */
.toc-group {
    margin-bottom: 0;
}

.toc-h2-row {
    display: flex;
    align-items: flex-start;
}

.toc-h2-row .toc-link {
    flex: 1;
    min-width: 0;
}

.toc-toggle {
    background: none;
    border: none;
    padding: 2px 8px 2px 2px;
    cursor: pointer;
    font-size: 11px;
    color: var(--color-text-tertiary);
    line-height: 1.35;
    flex-shrink: 0;
    transform: rotate(0deg);
    transition: transform 0.18s ease, color 0.15s ease;
    margin-top: 3px;
}

.toc-toggle.toc-toggle-open {
    transform: rotate(90deg);
    color: var(--color-text-secondary);
}

.toc-sub-list {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.22s ease;
}

.toc-sub-list.toc-sub-open {
    max-height: 600px;
}

.toc-link {
    display: block;
    font-size: 12px;
    font-family: Poppins, sans-serif;
    font-weight: 400;
    color: var(--color-text-secondary);
    text-decoration: none;
    line-height: 1.35;
    padding: 3px 10px 3px 10px;
    border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    text-align: left;
}

.toc-link:hover {
    color: var(--color-text-secondary-light);
    border-left-color: rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.toc-link.toc-link-active {
    color: var(--color-text-secondary-light);
    border-left-color: rgba(0, 0, 0, 0.25);
    font-weight: 600;
}

.toc-link-sub {
    font-size: 11px;
    padding-left: 18px;
    color: var(--color-text-tertiary);
}

.toc-link-sub.toc-link-active {
    color: var(--color-text-secondary);
    font-weight: 600;
}

@media (max-width: 1100px) {
    .toc-sidebar {
        display: none;
    }

    .article-layout {
        grid-template-columns: 1fr;
        column-gap: 0;
        max-width: none;
        padding: 0;
    }
}

/* ============================================
   RELATED ARTICLES
   ============================================ */

.related-section {
    background-color: var(--color-bg-cream-secondary);
    padding: 52px 60px 64px;
}

.related-heading {
    max-width: 1200px;
    margin: 0 auto 24px;
    font-size: 12px;
    font-family: Poppins, sans-serif;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .insights-grid {
        grid-template-columns: 1fr;
    }

    .article-hero {
        height: 260px;
    }

    .article-container {
        padding: 40px 20px 68px;
    }

    .article-body,
    .article-body p,
    .article-body li {
        font-size: 17px;
    }

    .article-body h2 {
        font-size: 21px;
    }

    .related-section {
        padding: 40px 40px 52px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .article-hero {
        height: 200px;
    }

    .article-container {
        padding: 32px 16px 60px;
    }

    .related-section {
        padding: 36px 20px 48px;
    }
}
