/**
 * Insight Article Styles
 * Design tokens match knowledge-page.css:
 *   Content width: 720px
 *   Base font: 18px, line-height 1.65
 *   Colors: #111 text, #333 secondary, #666 muted, #f8f8f8 bg-alt, #fff bg, #e0e0e0 border
 */

/* ==========================================================================
   Single Insight Article
   ========================================================================== */

.insight-article {
    max-width: 720px;
    margin: 0 auto;
    padding: 36px 16px 64px;
}

.insight-article__title {
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    color: #111;
    margin: 0 0 16px;
}

/* --- Article Meta --- */

.insight-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.insight-meta__author a {
    color: #333;
    text-decoration: none;
}

.insight-meta__author a:hover {
    color: #111;
    text-decoration: underline;
}

.insight-meta__separator {
    color: #e0e0e0;
}

.insight-meta__type-badge {
    display: inline-block;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

/* --- Data Freshness Badge --- */

.insight-freshness {
    margin-bottom: 24px;
}

.insight-freshness__badge {
    display: inline-block;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    padding: 6px 14px;
    font-size: 13px;
    color: #333;
}

.insight-freshness__badge strong {
    color: #111;
    font-weight: 700;
}

/* --- Snapshot Box (data callout) --- */

.ml-snapshot-box {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #333;
    padding: 20px 24px;
    margin: 24px 0;
}

.ml-snapshot-box__title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin: 0 0 12px;
}

.ml-snapshot-box__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.ml-snapshot-box__grid + .ml-snapshot-box__grid {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.ml-snapshot-box__item {
    display: flex;
    flex-direction: column;
}

.ml-snapshot-box__label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #666;
    margin-bottom: 4px;
}

.ml-snapshot-box__value {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}

.ml-snapshot-box__change {
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}

.ml-snapshot-box__change.up {
    color: #c0392b;
}

.ml-snapshot-box__change.down {
    color: #27ae60;
}

.ml-snapshot-box__change.flat {
    color: #666;
}

.ml-snapshot-box__footer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #999;
}

@media (max-width: 768px) {
    .ml-snapshot-box__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ml-snapshot-box__value {
        font-size: 18px;
    }
}

/* --- Summary Callout --- */

.insight-summary {
    background: #f8f8f8;
    border-left: 4px solid #333;
    padding: 20px 24px;
    margin-bottom: 32px;
    font-size: 18px;
    line-height: 1.65;
    color: #333;
}

.insight-summary p {
    margin: 0;
}

/* --- Article Body (Gutenberg content) --- */

.insight-article__body {
    font-size: 18px;
    line-height: 1.65;
    color: #111;
    margin-bottom: 48px;
}

.insight-article__body p {
    margin: 0 0 16px;
}

.insight-article__body h2 {
    font-size: 26px;
    line-height: 1.3;
    font-weight: 600;
    color: #111;
    margin: 40px 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #111;
}

.insight-article__body h3 {
    font-size: 21px;
    line-height: 1.4;
    font-weight: 600;
    color: #111;
    margin: 32px 0 12px;
}

.insight-article__body ul,
.insight-article__body ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.insight-article__body li {
    margin-bottom: 8px;
}

.insight-article__body blockquote {
    border-left: 4px solid #e0e0e0;
    padding: 12px 20px;
    margin: 24px 0;
    color: #333;
    font-style: italic;
}

.insight-article__body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
    line-height: 1.5;
    margin: 24px 0;
}

.insight-article__body th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #111;
    border-bottom: 2px solid #111;
    background: #f8f8f8;
}

.insight-article__body td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
    vertical-align: top;
}

/* --- Figcaptions (source attribution under tables and charts) --- */

.insight-article__body figcaption {
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
    color: #666;
    margin-top: 8px;
}

/* --- Chart Container --- */

.insight-article__body figure.ml-rate-chart {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px;
    margin: 24px 0;
    background: #fafbfc;
}

.insight-article__body figure.ml-rate-chart svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- Insight Box (top-of-article callout) --- */

.ml-insight-box {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #c0392b;
    padding: 20px 24px;
    margin: 24px 0;
}

.ml-insight-box__title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin: 0 0 16px;
}

.ml-insight-box__row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 12px;
    align-items: start;
    margin-bottom: 10px;
}

.ml-insight-box__stat {
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

.ml-insight-box__label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #666;
}

.ml-insight-box__value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: #111;
}

.ml-insight-box__value.up { color: #c0392b; }
.ml-insight-box__value.down { color: #27ae60; }

.ml-insight-box__reason {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}

.ml-insight-box__reason strong {
    color: #111;
}

/* --- Formula Block --- */

.ml-formula-box {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    padding: 20px 24px;
    margin: 24px 0;
    font-family: inherit;
}

.ml-formula-box__title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin: 0 0 12px;
}

.ml-formula-box__formula {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    margin-bottom: 16px;
}

.ml-formula-box__row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;
}

.ml-formula-box__row:last-child {
    border-bottom: none;
}

.ml-formula-box__label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    min-width: 220px;
}

.ml-formula-box__calc {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ml-formula-box__result {
    font-size: 18px;
    font-weight: 700;
}

.ml-formula-box__result.actual { color: #c0392b; }
.ml-formula-box__result.normal { color: #27ae60; }

.ml-formula-box__diff {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 15px;
    font-weight: 600;
    color: #c0392b;
}

/* Table overflow prevention - WP core sets overflow-x:auto on .wp-block-table */
.insight-article__body .wp-block-table {
    overflow-x: hidden;
}

.insight-article__body .wp-block-table table {
    table-layout: auto;
    width: 100%;
    max-width: 100%;
}

.insight-article__body .wp-block-table figcaption {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

@media (max-width: 768px) {
    .ml-insight-box__row { grid-template-columns: 1fr; gap: 4px; }
    .ml-insight-box__value { font-size: 18px; }
    .ml-formula-box__row { flex-wrap: wrap; }
}

/* --- CTA Block --- */

.insight-cta {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #333;
    padding: 24px;
    margin: 40px 0;
    text-align: center;
}

.insight-cta__text {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    margin: 0 0 16px;
}

.insight-cta__button {
    display: inline-block;
    background: #111;
    color: #fff;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: background 0.15s;
}

.insight-cta__button:hover {
    background: #333;
    color: #fff;
}

/* --- Unified Article Footer (collapsible sources, methodology, disclaimer, AI, reviewed) --- */

.insight-footer {
    margin-top: 48px;
}

.insight-footer__details {
    border: 1px solid #e0e0e0;
    background: #fafafa;
}

.insight-footer__details summary {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.insight-footer__details summary::-webkit-details-marker {
    display: none;
}

.insight-footer__details summary::after {
    content: '\25B6';
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
}

.insight-footer__details[open] summary::after {
    transform: rotate(90deg);
}

.insight-footer__details[open] summary {
    border-bottom: 1px solid #e0e0e0;
}

.insight-footer__body {
    padding: 20px;
}

.insight-footer__sources {
    margin: 0 0 20px;
    padding-left: 24px;
}

.insight-footer__sources li {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.insight-footer__sources li strong {
    font-weight: 600;
    color: #111;
}

.insight-footer__sources a {
    color: #333;
    text-decoration: underline;
}

.insight-footer__sources a:hover {
    color: #111;
}

.insight-footer__methodology {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 16px;
}

.insight-footer__methodology p {
    margin: 0 0 8px;
}

.insight-footer__disclaimer {
    font-size: 13px;
    line-height: 1.5;
    color: #999;
    margin: 0 0 12px;
    font-style: italic;
}

.insight-footer__ai {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    margin: 0 0 12px;
}

.insight-footer__reviewed {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* --- Related Topics (card grid) --- */

.insight-related {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.insight-related h3 {
    font-size: 21px;
    font-weight: 600;
    color: #111;
    margin: 0 0 16px;
}

.insight-related__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.insight-related__card {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-left: 4px solid #2d5a7b;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: border-left-color 0.15s, box-shadow 0.15s;
}

.insight-related__card:hover {
    border-left-color: #1e3f5a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.insight-related__card-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
    margin-bottom: 4px;
}

.insight-related__card:hover .insight-related__card-title {
    color: #333;
}

.insight-related__card-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #999;
}

/* ==========================================================================
   Insights Hub Page
   ========================================================================== */

.insights-hub {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 16px 64px;
}

.insights-hub__title {
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    color: #111;
    margin: 0 0 8px;
    text-align: center;
}

.insights-hub__subtitle {
    font-size: 18px;
    color: #666;
    text-align: center;
    margin: 0 0 32px;
}

/* --- Filter Buttons --- */

.insights-hub__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.insights-hub__filter-btn {
    display: inline-block;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
}

.insights-hub__filter-btn:hover {
    background: #f8f8f8;
    border-color: #333;
}

.insights-hub__filter-btn.active {
    background: #111;
    color: #fff;
    border-color: #111;
}

/* --- Card Grid --- */

.insights-hub__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.insights-hub__card {
    display: block;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-left: 4px solid #2d5a7b;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-left-color 0.15s, box-shadow 0.15s;
}

.insights-hub__card:hover {
    border-left-color: #1e3f5a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.insights-hub__card-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 2px 8px;
    margin-bottom: 8px;
}

.insights-hub__card-title {
    font-size: 20px;
    font-weight: 600;
    color: #111;
    margin: 0 0 8px;
    line-height: 1.3;
}

.insights-hub__card:hover .insights-hub__card-title {
    color: #333;
}

.insights-hub__card-date {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.insights-hub__card-summary {
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    margin: 0;
}

/* --- Empty State --- */

.insights-hub__empty {
    text-align: center;
    padding: 48px 24px;
    color: #666;
    font-size: 18px;
}

/* --- Pagination --- */

.insights-hub__pagination {
    margin-top: 48px;
    text-align: center;
}

.insights-hub__pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border: 1px solid #e0e0e0;
}

.insights-hub__pagination .page-numbers.current {
    background: #111;
    color: #fff;
    border-color: #111;
}

.insights-hub__pagination .page-numbers:hover:not(.current) {
    background: #f8f8f8;
    border-color: #333;
}

/* ==========================================================================
   Homepage Latest Insights Pattern
   ========================================================================== */

.ml-latest-insights {
    margin-top: 48px;
}

.ml-latest-insights h2 {
    text-align: center;
    font-size: 26px;
    font-weight: 600;
    color: #111;
    margin: 0 0 24px;
}

.ml-latest-insights__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.ml-latest-insights__card {
    display: block;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-left: 4px solid #2d5a7b;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-left-color 0.15s, box-shadow 0.15s;
}

.ml-latest-insights__card:hover {
    border-left-color: #1e3f5a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ml-latest-insights__card-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 2px 8px;
    margin-bottom: 6px;
}

.ml-latest-insights__card-title {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    margin: 0 0 6px;
    line-height: 1.3;
}

.ml-latest-insights__card:hover .ml-latest-insights__card-title {
    color: #333;
}

.ml-latest-insights__card-date {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.ml-latest-insights__card-summary {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin: 0;
}

.ml-latest-insights__view-all {
    text-align: center;
    margin-top: 16px;
}

.ml-latest-insights__view-all a {
    display: inline-block;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #2d5a7b;
    border: 1px solid #2d5a7b;
    text-decoration: none;
}

.ml-latest-insights__view-all a:hover {
    background: #1e3f5a;
    border-color: #1e3f5a;
    color: #fff;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .insight-article {
        padding: 24px 16px 48px;
    }

    .insight-article__title {
        font-size: 28px;
    }

    .insight-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .insight-meta__separator {
        display: none;
    }

    .insights-hub {
        padding: 24px 16px 48px;
    }

    .insights-hub__title {
        font-size: 28px;
    }

    .insights-hub__grid {
        grid-template-columns: 1fr;
    }

    .insight-related__grid {
        grid-template-columns: 1fr;
    }

    .ml-latest-insights__grid {
        grid-template-columns: 1fr;
    }
}
