/*
 * article.css — Shared stylesheet for The Dispatch news articles.
 *
 * All articles should link to this file:
 *   <link rel="stylesheet" href="../article.css">
 *
 * Articles may add inline <style> blocks for special elements:
 *   - Interactive charts or visualizations
 *   - Custom data tables with specific column widths
 *   - Embedded maps or timelines
 *   - Any one-off layout not covered here
 */

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --serif: "Playfair Display", Georgia, "Times New Roman", serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: "JetBrains Mono", "Fira Code", "Courier New", monospace;

    --black: #111111;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-800: #1F2937;
    --accent: #B91C1C;
    /* deep red — used for labels, links, highlights */
    --accent-light: #FEF2F2;

    --prose-width: 680px;
    /* comfortable reading width */
    --page-pad: clamp(1rem, 4vw, 2rem);
}

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--sans);
    background: var(--white);
    color: var(--black);
    line-height: 1.7;
}

/* ─── Page Shell ─── */
.article-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Site Header (mini masthead) ─── */
.site-header {
    border-bottom: 3px solid var(--black);
    padding: 1rem var(--page-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-header-name {
    font-family: var(--serif);
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--black);
}

.back-link {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.15s;
}

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

/* ─── Article Container (outer wrapper — two-column on wide screens) ─── */
.article-container {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 3.5rem) var(--page-pad);
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 3rem;
}

/* Main prose column */
.article-main {
    flex: 1;
    min-width: 0;
    /* prevents flexbox overflow */
    max-width: var(--prose-width);
}

/* Sidebar column */
.article-sidebar {
    width: 260px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .article-container {
        flex-direction: column;
        gap: 2rem;
    }

    .article-sidebar {
        width: 100%;
        border-top: 1px solid var(--gray-200);
        padding-top: 1.5rem;
    }
}

/* ─── Article Header ─── */
/* Defensive: constrain width even if agent omits .article-container */
.article-header {
    max-width: var(--prose-width);
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.article-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.article-headline {
    font-family: var(--serif);
    font-size: clamp(1.8rem, 4vw, 2.75rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    color: var(--black);
}

.article-dek {
    font-family: var(--serif);
    font-size: 1.125rem;
    font-style: italic;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.article-meta {
    font-size: 0.78rem;
    color: var(--gray-400);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ─── Article Body ─── */
/* Defensive: constrain width even if agent omits .article-container */
.article-body {
    max-width: var(--prose-width);
}

.article-body p {
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1.4rem;
    color: var(--black);
}

.article-body h2 {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 2.5rem 0 0.75rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
    color: var(--black);
}

.article-body h3 {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2rem 0 0.5rem;
    color: var(--black);
}

.article-body h4 {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-600);
    margin: 1.5rem 0 0.4rem;
}

.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: text-decoration-thickness 0.1s;
}

.article-body a:hover {
    text-decoration-thickness: 2px;
}

.article-body blockquote {
    border-left: 3px solid var(--black);
    margin: 2rem 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--gray-800);
    line-height: 1.65;
}

.article-body blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    font-style: normal;
    font-family: var(--sans);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
}

.article-body ul,
.article-body ol {
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.75;
    padding-left: 1.5rem;
    margin-bottom: 1.4rem;
    color: var(--black);
}

.article-body li {
    margin-bottom: 0.3rem;
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 2.5rem 0;
}

/* Inline footnote superscripts */
.article-body sup a {
    color: var(--accent);
    font-size: 0.72rem;
    font-family: var(--sans);
    text-decoration: none;
    font-weight: 600;
    vertical-align: super;
    line-height: 0;
}

/* ─── Callout / Stat box ─── */
/* Usage: <div class="stat-callout"><span class="stat-number">45%</span><span class="stat-label">...</span></div> */
.stat-callout {
    background: var(--gray-50);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.25rem;
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-number {
    font-family: var(--serif);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-family: var(--sans);
    line-height: 1.4;
}

/* ─── Fact check verdict box ─── */
/* Usage: <div class="verdict verdict--mostly-false">...</div> */
.verdict {
    padding: 1rem 1.25rem;
    margin: 2rem 0;
    border-left: 4px solid var(--gray-400);
    font-family: var(--sans);
}

.verdict-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    display: block;
}

.verdict--true {
    border-color: #15803D;
    background: #F0FDF4;
}

.verdict--true .verdict-label {
    color: #15803D;
}

.verdict--mixed {
    border-color: #B45309;
    background: #FFFBEB;
}

.verdict--mixed .verdict-label {
    color: #B45309;
}

.verdict--false {
    border-color: var(--accent);
    background: var(--accent-light);
}

.verdict--false .verdict-label {
    color: var(--accent);
}

.verdict--context {
    border-color: #1D4ED8;
    background: #EFF6FF;
}

.verdict--context .verdict-label {
    color: #1D4ED8;
}

/* ─── Data Table ─── */
.data-table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    margin: 2rem 0;
    border: 1px solid var(--gray-200);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--sans);
    font-size: 0.875rem;
}

.data-table caption {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--black);
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--gray-600);
}

.data-table td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
    vertical-align: top;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

/* ─── Sidebar Component ─── */
.sidebar-section {
    border-top: 3px solid var(--black);
    padding-top: 1rem;
    margin-bottom: 2rem;
}

.sidebar-heading {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.sidebar-article {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-article:last-child {
    border-bottom: none;
}

.sidebar-article a {
    text-decoration: none;
    color: inherit;
}

.sidebar-article-tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    display: block;
    margin-bottom: 0.25rem;
}

.sidebar-article-title {
    font-family: var(--serif);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    transition: color 0.15s;
}

.sidebar-article a:hover .sidebar-article-title {
    color: var(--accent);
}

.sidebar-article-date {
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 0.2rem;
}

/* ─── References Section ─── */
.references {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 3px solid var(--black);
}

.references h2 {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    border: none;
    padding: 0;
    color: var(--gray-600);
}

.references ol {
    font-family: var(--sans);
    font-size: 0.825rem;
    color: var(--gray-600);
    line-height: 1.6;
    padding-left: 1.25rem;
}

.references li {
    margin-bottom: 0.5rem;
}

.references a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

/* ─── Footer ─── */
.site-footer {
    border-top: 3px solid var(--black);
    padding: 1.5rem var(--page-pad);
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    font-size: 0.78rem;
    color: var(--gray-500);
    letter-spacing: 0.06em;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .article-container {
        padding: 1.5rem var(--page-pad);
    }

    .stat-number {
        font-size: 2rem;
    }
}