/* ============================================
   THE DATA CHRONICLE - Newspaper Style CSS
   ============================================ */

/* CSS Variables - Color Palette */
:root {
    --background: #ededf0;
    --focus-section: #bebebf;
    --text-primary: #090917;
    --accent-coral: #F79A78;
    --accent-lavender: #A8B0FB;
    --pinstripe: #000005;
    --highlight-1: #d5d5d8;
    --highlight-2: #c8c8cb;
    --shadow-1: #a8a8ab;
    
    --font-masthead: 'Bodoni Moda', serif;
    --font-headline: 'Libre Baskerville', serif;
    --font-body: 'Source Serif 4', Georgia, serif;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

body {
    font-family: var(--font-body);
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--background);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headline);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.25;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; border-bottom: 2px solid var(--pinstripe); padding-bottom: 0.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    text-align: justify;
    hyphens: auto;
}

/* Drop Cap for first paragraph */
.drop-cap::first-letter {
    float: left;
    font-family: var(--font-masthead);
    font-size: 4rem;
    line-height: 0.8;
    padding-right: 0.5rem;
    padding-top: 0.1rem;
    color: var(--text-primary);
}

/* ============================================
   LAYOUT - NEWSPAPER COLUMNS
   ============================================ */

.columns-2 {
    column-count: 2;
    column-gap: 2.5rem;
    column-rule: 1px solid var(--highlight-2);
}

.columns-3 {
    column-count: 3;
    column-gap: 2rem;
    column-rule: 1px solid var(--highlight-2);
}

.columns-4 {
    column-count: 4;
    column-gap: 1.5rem;
    column-rule: 1px solid var(--highlight-2);
}

@media (max-width: 1200px) {
    .columns-4 { column-count: 3; }
}

@media (max-width: 900px) {
    .columns-3, .columns-4 { column-count: 2; }
}

@media (max-width: 600px) {
    .columns-2, .columns-3, .columns-4 { column-count: 1; }
}

/* Grid Layout */
.newspaper-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
}

.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

@media (max-width: 900px) {
    .col-span-3, .col-span-4, .col-span-6, .col-span-8 { grid-column: span 12; }
}

/* ============================================
   SECTION STYLES
   ============================================ */

.section {
    margin-bottom: 2rem;
}

.section-header {
    font-family: var(--font-headline);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    border-bottom: 3px double var(--pinstripe);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-header.accent {
    border-bottom-color: var(--accent-coral);
}

/* Focus Section - Highlighted Area */
.focus-section {
    background: var(--focus-section);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* ============================================
   PINSTRIPE SEPARATORS
   ============================================ */

.pinstripe {
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        var(--pinstripe) 0px,
        var(--pinstripe) 1px,
        transparent 1px,
        transparent 3px
    );
    margin: 1.5rem 0;
}

.pinstripe-double {
    border-top: 1px solid var(--pinstripe);
    border-bottom: 1px solid var(--pinstripe);
    height: 4px;
    margin: 1.5rem 0;
}

.pinstripe-vertical {
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        var(--pinstripe) 0px,
        var(--pinstripe) 1px,
        transparent 1px,
        transparent 3px
    );
}

.rule-thin {
    border-bottom: 1px solid var(--pinstripe);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.rule-thick {
    border-bottom: 2px solid var(--pinstripe);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

/* ============================================
   DATA TABLES - NEWSPAPER STYLE
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.data-table thead {
    border-top: 2px solid var(--pinstripe);
    border-bottom: 1px solid var(--pinstripe);
}

.data-table th {
    font-family: var(--font-headline);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    padding: 0.75rem 0.5rem;
    color: var(--text-primary);
    background: transparent;
}

.data-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--highlight-1);
    vertical-align: top;
}

.data-table tbody tr:hover {
    background: var(--highlight-1);
}

.data-table a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--accent-coral);
}

.data-table a:hover {
    color: var(--accent-coral);
}

/* Compact Table Variant */
.data-table.compact td,
.data-table.compact th {
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
}

/* ============================================
   STATISTICS & FIGURES
   ============================================ */

.stat-row {
    display: flex;
    gap: 2rem;
    padding: 1.5rem 0;
    border-top: 2px solid var(--pinstripe);
    border-bottom: 1px solid var(--highlight-2);
    margin-bottom: 1.5rem;
}

.stat-item {
    flex: 1;
    text-align: center;
    border-right: 1px solid var(--highlight-2);
    padding-right: 1.5rem;
}

.stat-item:last-child {
    border-right: none;
}

.stat-number {
    font-family: var(--font-masthead);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-number.accent {
    color: var(--accent-coral);
}

.stat-number.lavender {
    color: var(--accent-lavender);
}

.stat-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0.7;
}

/* Individual stat block */
.stat-block {
    text-align: center;
    padding: 1rem;
    border-left: 3px solid var(--pinstripe);
}

.stat-block.highlight {
    background: var(--focus-section);
    border-left-color: var(--accent-coral);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    display: inline-block;
}

.status-pending {
    background: var(--highlight-1);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-coral);
}

.status-running {
    background: var(--accent-lavender);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-lavender);
}

.status-completed {
    background: var(--highlight-1);
    color: var(--text-primary);
    border-left: 3px solid var(--pinstripe);
}

.status-failed {
    background: var(--accent-coral);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-coral);
}

/* ============================================
   BUTTONS - NEWSPAPER STYLE
   ============================================ */

.btn {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--pinstripe);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--text-primary);
    color: var(--background);
}

.btn-primary {
    background: var(--text-primary);
    color: var(--background);
    border-color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--pinstripe);
}

.btn-accent {
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.btn-accent:hover {
    background: var(--accent-coral);
    color: var(--text-primary);
}

.btn-danger {
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.btn-danger:hover {
    background: var(--accent-coral);
    color: var(--background);
}

.btn-success {
    border-color: var(--pinstripe);
}

.btn-small {
    font-size: 0.65rem;
    padding: 0.4rem 0.8rem;
}

/* ============================================
   FORMS - NEWSPAPER STYLE
   ============================================ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-family: var(--font-headline);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.75rem;
    border: 1px solid var(--highlight-2);
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--text-primary);
    border-bottom: 2px solid var(--text-primary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   ALERTS - NEWSPAPER STYLE
   ============================================ */

.alert {
    font-family: var(--font-body);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--pinstripe);
    background: var(--highlight-1);
}

.alert-success {
    border-left-color: var(--pinstripe);
}

.alert-error {
    border-left-color: var(--accent-coral);
    background: rgba(247, 154, 120, 0.15);
}

.alert-info {
    border-left-color: var(--accent-lavender);
    background: rgba(168, 176, 251, 0.15);
}

.alert-title {
    font-family: var(--font-headline);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid var(--highlight-2);
}

.pagination a,
.pagination span {
    font-family: var(--font-body);
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
}

.pagination a {
    border: 1px solid var(--highlight-2);
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--text-primary);
    color: var(--background);
    border-color: var(--text-primary);
}

.pagination .current {
    font-weight: 700;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-small { font-size: 0.85rem; }
.text-tiny { font-size: 0.75rem; letter-spacing: 0.05em; }
.text-muted { opacity: 0.6; }
.text-accent { color: var(--accent-coral); }
.text-lavender { color: var(--accent-lavender); }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.py-1 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2 { padding-top: 1rem; padding-bottom: 1rem; }
.px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2 { padding-left: 1rem; padding-right: 1rem; }

.bg-focus { background: var(--focus-section); }
.bg-highlight { background: var(--highlight-1); }

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner {
    border: 2px solid var(--highlight-1);
    border-top: 2px solid var(--text-primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   ARTICLE STYLES
   ============================================ */

.article-headline {
    font-family: var(--font-headline);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.article-subhead {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-primary);
    opacity: 0.8;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.article-meta {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0.6;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--highlight-2);
}

.article-content {
    font-size: 1rem;
    line-height: 1.7;
}

.article-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

/* Byline */
.byline {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   CALLOUT / PULLQUOTE
   ============================================ */

.pullquote {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-style: italic;
    line-height: 1.4;
    text-align: center;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-top: 3px double var(--pinstripe);
    border-bottom: 3px double var(--pinstripe);
    color: var(--text-primary);
}

.pullquote-attribution {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-style: normal;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 0.75rem;
    opacity: 0.7;
}

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

@media (max-width: 768px) {
    .masthead-title {
        font-size: 1.75rem;
    }
    
    .nav-bar nav a {
        padding: 0.5rem 0.75rem;
        font-size: 0.7rem;
    }
    
    .stat-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-item {
        border-right: none;
        border-bottom: 1px solid var(--highlight-2);
        padding-right: 0;
        padding-bottom: 1rem;
    }
    
    .stat-item:last-child {
        border-bottom: none;
    }
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background);
}

.auth-container {
    max-width: 400px;
    width: 100%;
    padding: 2rem;
    background: var(--highlight-1);
    border-top: 3px solid var(--pinstripe);
    border-bottom: 3px solid var(--pinstripe);
}

.auth-title {
    font-family: var(--font-masthead);
    text-align: center;
    margin-bottom: 2rem;
}

/* ============================================
   EVENING EDITION - DARK MODE
   ============================================ */

[data-edition="evening"] {
    --background: #1a1a2e;
    --background-alt: #16162a;
    --focus-section: #2d2d44;
    --text-primary: #e8e8ec;
    --text-secondary: #a0a0b0;
    --accent-coral: #F79A78;
    --accent-lavender: #A8B0FB;
    --pinstripe: #e8e8ec;
    --highlight-1: #2a2a3e;
    --highlight-2: #3a3a4e;
    --shadow-1: #252538;
}

[data-edition="evening"] .data-table tbody tr:hover {
    background: var(--highlight-2);
}

[data-edition="evening"] .btn:hover {
    background: var(--text-primary);
    color: var(--background);
}

[data-edition="evening"] .status-running {
    background: rgba(168, 176, 251, 0.3);
}

[data-edition="evening"] .status-failed {
    background: rgba(247, 154, 120, 0.3);
}

/* ============================================
   PRINT STYLES - 8.5" x 11" B&W
   ============================================ */

@media print {
    /* Page Setup */
    @page {
        size: letter portrait;
        margin: 0.75in;
    }

    /* Reset everything to black and white */
    *,
    *::before,
    *::after {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body {
        width: 8.5in;
        font-size: 10pt;
        line-height: 1.35;
        background: white !important;
    }

    /* Hide interactive/navigation elements */
    .nav-bar,
    .system-health-bar,
    .edition-toggle,
    .btn,
    button,
    .no-print,
    .pagination,
    .classifieds,
    form,
    input,
    select,
    textarea,
    .sidebar-column .classifieds {
        display: none !important;
    }

    /* Container */
    .container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Masthead for print */
    .masthead {
        border-bottom: 2pt solid black !important;
        padding: 0 0 12pt 0 !important;
        margin-bottom: 12pt !important;
    }

    .masthead-inner {
        text-align: center;
    }

    .masthead-meta {
        justify-content: center !important;
    }

    .masthead-title {
        font-size: 22pt !important;
        letter-spacing: 0.03em !important;
    }

    .masthead-subtitle {
        font-size: 8pt !important;
        margin-top: 4pt !important;
    }

    .masthead-date {
        font-size: 7pt !important;
        margin-bottom: 6pt !important;
    }

    /* Typography for print */
    h1 {
        font-size: 16pt !important;
        margin-bottom: 8pt !important;
        border-bottom: none !important;
    }

    h2 {
        font-size: 13pt !important;
        margin-bottom: 6pt !important;
        margin-top: 12pt !important;
        border-bottom: 0.5pt solid black !important;
        padding-bottom: 4pt !important;
    }

    h3 {
        font-size: 11pt !important;
        margin-bottom: 4pt !important;
    }

    p, li, td, th {
        font-size: 9pt !important;
        line-height: 1.3 !important;
    }

    /* Tables */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-bottom: 12pt !important;
        page-break-inside: auto;
    }

    thead {
        display: table-header-group;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th, td {
        border: 0.5pt solid black !important;
        padding: 4pt 6pt !important;
        text-align: left !important;
        vertical-align: top !important;
    }

    th {
        font-weight: bold !important;
        font-size: 8pt !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
    }

    /* Links */
    a {
        text-decoration: none !important;
        color: black !important;
    }

    a[href^="http"]::after,
    a[href^="https"]::after {
        content: " [" attr(href) "]";
        font-size: 7pt;
        font-style: italic;
        word-break: break-all;
    }

    /* Don't show URL for internal links */
    a[href^="/"]::after {
        content: none;
    }

    /* Stat rows for print */
    .stat-row {
        border-top: 1pt solid black !important;
        border-bottom: 1pt solid black !important;
        padding: 8pt 0 !important;
        margin-bottom: 12pt !important;
        display: flex !important;
        justify-content: space-around !important;
    }

    .stat-item {
        border-right: 0.5pt solid black !important;
        padding-right: 12pt !important;
    }

    .stat-item:last-child {
        border-right: none !important;
    }

    .stat-number {
        font-size: 18pt !important;
        font-weight: bold !important;
    }

    .stat-label {
        font-size: 7pt !important;
        text-transform: uppercase !important;
        letter-spacing: 0.1em !important;
    }

    /* Lead story for print */
    .lead-story {
        border-top: 2pt solid black !important;
        border-bottom: 1pt solid black !important;
        padding: 10pt 0 !important;
        margin-bottom: 12pt !important;
    }

    .lead-story h1 {
        font-size: 14pt !important;
    }

    .lead-stats {
        display: flex !important;
        gap: 24pt !important;
        margin-top: 8pt !important;
    }

    .lead-stat-number {
        font-size: 20pt !important;
    }

    .lead-stat-label {
        font-size: 7pt !important;
    }

    /* Front page grid adjustments */
    .front-page {
        display: block !important;
    }

    .main-column,
    .sidebar-column {
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }

    /* Sections */
    .section,
    article,
    .section-header {
        page-break-inside: avoid;
    }

    .section-header {
        border-bottom: 1pt solid black !important;
        font-size: 10pt !important;
        padding-bottom: 4pt !important;
        margin-bottom: 8pt !important;
    }

    /* Status badges for print */
    .status-badge {
        border: 0.5pt solid black !important;
        padding: 1pt 4pt !important;
        font-size: 7pt !important;
    }

    /* Footer for print */
    .footer {
        position: fixed;
        bottom: 0;
        left: 0.75in;
        right: 0.75in;
        text-align: center;
        border-top: 0.5pt solid black !important;
        padding-top: 6pt !important;
        font-size: 7pt !important;
    }

    /* Page numbers (if supported) */
    .footer::after {
        content: " — Page " counter(page);
    }

    /* Sidebar sections for print */
    .sidebar-section {
        margin-top: 12pt !important;
        padding-top: 8pt !important;
        border-top: 0.5pt solid black !important;
    }

    .sidebar-header {
        font-size: 9pt !important;
        border-bottom: 0.5pt solid black !important;
    }

    .sidebar-stat {
        padding: 3pt 0 !important;
        border-bottom: none !important;
    }

    .sidebar-stat-value {
        font-size: 11pt !important;
    }

    /* Activity list for print */
    .activity-list {
        list-style: none !important;
        padding: 0 !important;
    }

    .activity-item {
        padding: 4pt 0 !important;
        border-bottom: 0.5pt dotted black !important;
        font-size: 8pt !important;
    }

    .activity-time {
        font-size: 7pt !important;
    }

    /* Force colors to print as black */
    .accent,
    .lavender,
    .text-accent,
    .text-lavender,
    .lead-stat-number.accent,
    .lead-stat-number.lavender,
    .stat-number.accent,
    .stat-number.lavender {
        color: black !important;
    }

    /* Ensure charts/graphics don't break */
    img, svg, canvas {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    /* Orphan/widow control */
    p, li {
        orphans: 3;
        widows: 3;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
}
