/* NexChron.com — Publication-Grade Styles
   Typography specs sourced from NYT, The Atlantic, Ars Technica, Bloomberg.
   Research date: 2026-04-12 */

/* ================================================================
   CSS Custom Properties
   ================================================================ */
:root {
    --nc-primary: #0A1628;
    --nc-accent: #3B82F6;
    --nc-surface: #FFFFFF;
    --nc-surface-alt: #F8FAFC;
    --nc-text: #1E293B;
    --nc-text-muted: #64748B;
    --nc-text-caption: #666666;
    --nc-success: #10B981;
    --nc-warning: #F59E0B;
    --nc-danger: #EF4444;
    --nc-font-heading: 'Inter', system-ui, sans-serif;
    --nc-font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --nc-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --nc-content-width: 680px;
}

.dark {
    --nc-surface: #0F172A;
    --nc-surface-alt: #1E293B;
    --nc-text: #E2E8F0;
    --nc-text-muted: #94A3B8;
    --nc-text-caption: #94A3B8;
}

/* ================================================================
   Base Typography
   ================================================================ */
body {
    font-family: var(--nc-font-heading);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================================
   Article Body — Publication-Grade Typography
   Based on NYT (18px Georgia, 1.6 LH), The Atlantic (Tiempos 18px),
   Ars Technica, Bloomberg. Optimal reading column: 65-70 chars/line.
   ================================================================ */
/* Higher specificity to override Tailwind prose defaults */
.article-body.prose {
    font-family: var(--nc-font-body) !important;
    font-size: 20px !important;
    line-height: 1.75 !important;
    color: var(--nc-text);
    max-width: none !important;
}

.prose {
    font-family: var(--nc-font-body);
    color: var(--nc-text);
    max-width: none;
}

/* Fix duplicate list numbering — Tailwind prose adds counter-reset/increment
   that conflicts with the default list-style. Override to use native numbering only. */
.article-body.prose ol {
    list-style-type: decimal !important;
    counter-reset: none !important;
}

.article-body.prose ol > li {
    padding-left: 0.25em !important;
}

.article-body.prose ol > li::before {
    content: none !important;
    display: none !important;
}

.article-body.prose ol > li::marker {
    color: var(--nc-text) !important;
    font-weight: 600;
}

.article-body.prose ul > li::marker {
    color: var(--nc-accent) !important;
}

/* Headings — sans-serif for contrast */
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    font-family: var(--nc-font-heading);
    letter-spacing: -0.01em;
}

.prose h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 2.5em;
    margin-bottom: 0.75em;
    color: var(--nc-text);
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2em;
    margin-bottom: 0.5em;
}

/* Paragraphs */
.prose p {
    margin-bottom: 1.5em;
}

/* First paragraph — slightly larger (The Atlantic pattern) */
.article-body.prose > p:first-of-type {
    font-size: 22px !important;
    line-height: 1.65 !important;
}

/* Drop cap on first paragraph (NYT/Atlantic style) */
.article-body > p:first-of-type::first-letter {
    float: left;
    font-family: var(--nc-font-heading);
    font-size: 4em;
    line-height: 0.85;
    font-weight: 800;
    margin-right: 0.08em;
    margin-top: 0.05em;
    color: var(--nc-accent);
}

/* Blockquotes — editorial left border */
.prose blockquote {
    border-left: 3px solid var(--nc-accent);
    padding-left: 1.25em;
    font-style: italic;
    color: var(--nc-text-muted);
    margin: 2em 0;
}

/* Pull quotes (use <blockquote class="pullquote">) */
.prose .pullquote {
    border-left: none;
    text-align: center;
    font-size: 1.35rem;
    line-height: 1.4;
    max-width: 560px;
    margin: 2.5em auto;
    padding: 0;
    color: var(--nc-text);
    font-style: italic;
    font-weight: 600;
}

/* Lists */
.prose ul, .prose ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.prose ul > li, .prose ol > li {
    margin-bottom: 0.5em;
    line-height: 1.65;
}

.prose ul > li::marker {
    color: var(--nc-accent);
}

/* Links */
.prose a {
    color: var(--nc-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 150ms ease;
}

.prose a:hover {
    border-bottom-color: var(--nc-accent);
}

/* Bold */
.prose strong {
    font-weight: 700;
    color: var(--nc-text);
}

/* Horizontal rules — section breaks */
.prose hr {
    border: none;
    border-top: 1px solid #E2E8F0;
    margin: 3em 0;
}

.dark .prose hr {
    border-top-color: #334155;
}

/* Images within articles */
.prose img {
    border-radius: 0.5rem;
    margin: 2em 0;
    width: 100%;
}

.prose figcaption {
    font-family: var(--nc-font-heading);
    font-size: 13px;
    color: var(--nc-text-caption);
    margin-top: 0.5em;
    line-height: 1.4;
}

/* Tables */
.prose table {
    font-size: 0.9rem;
    font-family: var(--nc-font-heading);
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
}

.prose th {
    text-align: left;
    font-weight: 600;
    padding: 0.75em 1em;
    border-bottom: 2px solid #E2E8F0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nc-text-muted);
}

.prose td {
    padding: 0.75em 1em;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: top;
}

.dark .prose th { border-bottom-color: #334155; }
.dark .prose td { border-bottom-color: #1E293B; }

/* Code */
.prose code {
    font-family: var(--nc-font-mono);
    font-size: 0.85em;
    background: var(--nc-surface-alt);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

.prose pre {
    font-family: var(--nc-font-mono);
    font-size: 0.85rem;
    background: var(--nc-surface-alt);
    padding: 1.25em 1.5em;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 2em 0;
    line-height: 1.6;
}

.prose pre code {
    background: none;
    padding: 0;
}

/* ================================================================
   Callout Box (TL;DR, Key Takeaways)
   Usage: <div class="callout">...</div> inside article body
   ================================================================ */
.callout, .prose .callout {
    background: var(--nc-surface-alt);
    border-left: 4px solid var(--nc-primary);
    padding: 1.25em 1.5em;
    margin: 2em 0;
    font-size: 0.95rem;
    font-family: var(--nc-font-heading);
    line-height: 1.6;
    border-radius: 0 0.375rem 0.375rem 0;
}

.dark .callout, .dark .prose .callout {
    background: #1E293B;
}

.callout strong:first-child {
    display: block;
    margin-bottom: 0.5em;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nc-text-muted);
}

/* ================================================================
   Article Header — Kicker / Vertical Label
   ================================================================ */
.article-kicker {
    font-family: var(--nc-font-heading);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--nc-accent);
}

/* ================================================================
   Article Meta (author, date, read time)
   ================================================================ */
.article-meta {
    font-family: var(--nc-font-heading);
    font-size: 14px;
    color: var(--nc-text-muted);
    letter-spacing: 0.02em;
}

/* ================================================================
   Hero Image Treatment
   ================================================================ */
.hero-image-container {
    margin: 0 -1rem 2rem;
    overflow: hidden;
    border-radius: 0.75rem;
}

@media (min-width: 640px) {
    .hero-image-container {
        margin: 0 0 2.5rem;
    }
}

.hero-image-container img {
    width: 100%;
    display: block;
}

/* ================================================================
   Engagement Bar — Stronger Visual Weight
   ================================================================ */
.engagement-bar {
    padding: 1em 0;
    border-top: 1px solid #E2E8F0;
    border-bottom: 1px solid #E2E8F0;
    margin: 2em 0;
}

.dark .engagement-bar {
    border-color: #334155;
}

/* ================================================================
   Newsletter CTA — Inline Editorial Style (The Atlantic pattern)
   ================================================================ */
.newsletter-inline {
    background: var(--nc-surface-alt);
    border-top: 2px solid var(--nc-primary);
    padding: 1.5em;
    margin: 2.5em 0;
    font-family: var(--nc-font-heading);
}

.dark .newsletter-inline {
    background: #1E293B;
    border-top-color: var(--nc-accent);
}

/* ================================================================
   Reading Progress Bar
   ================================================================ */
.reading-progress {
    position: fixed;
    top: 64px;
    left: 0;
    height: 2px;
    background: var(--nc-accent);
    z-index: 50;
    transition: width 150ms ease;
}

/* ================================================================
   Line clamp utilities
   ================================================================ */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================================================================
   Responsive — Mobile adjustments
   ================================================================ */
@media (max-width: 767px) {
    .prose {
        font-size: 18px;
        line-height: 1.7;
    }

    .prose > p:first-of-type {
        font-size: 19px;
    }

    .prose h2 {
        font-size: 1.3rem;
        margin-top: 2em;
    }

    .article-body > p:first-of-type::first-letter {
        font-size: 3.2em;
    }
}

/* ================================================================
   Print styles
   ================================================================ */
@media print {
    header, footer, .engagement-bar, nav, .newsletter-cta, .newsletter-inline, .sidebar {
        display: none !important;
    }
    .prose { font-size: 12pt; max-width: 100%; }
    a { color: inherit; text-decoration: none; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
}

/* ================================================================
   Dark mode transitions
   ================================================================ */
body, header, footer, main {
    transition: background-color 200ms ease, color 200ms ease;
}

/* ================================================================
   Self-hosted fonts
   ================================================================ */
@font-face {
    font-family: 'Inter';
    src: url('/css/fonts/inter-var.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
