/* =========================================
   1. CORE VARIABLES & RESET
   ========================================= */
:root {
    /* Color Palette - Modern Scientific */
    --bg-color: #ffffff;
    --text-main: #1f2937;
    /* Dark Grey for body */
    --text-header: #111827;
    /* Near Black for headings */
    --text-muted: #6b7280;
    /* Medium Grey for secondary text */
    --primary-color: #2563eb;
    /* Royal Blue */
    --primary-hover: #1d4ed8;

    /* UI Colors */
    --border-color: #e5e7eb;
    --surface-bg: #f9fafb;
    /* Very light grey for backgrounds */
    --code-bg: #f3f4f6;
    /* Light grey for inline code */
    --code-block-bg: #1e1e1e;
    /* Dark VS Code style for blocks */

    /* Status Colors */
    --color-success: #059669;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-accent: #7c3aed;
    /* Purple for special highlights */

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', 'Monaco', monospace;

    /* Dimensions */
    --container-width: 1000px;
    --header-height: 64px;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* =========================================
   2. LAYOUT & CONTAINER
   ========================================= */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 40px 0;
}

.doc-content {
    padding-top: 40px;
    padding-bottom: 80px;
}

/* =========================================
   3. HEADER & NAVIGATION
   ========================================= */
.site-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-header);
    letter-spacing: -0.02em;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.nav a:hover,
.nav a[aria-current="page"] {
    color: var(--text-header);
    text-decoration: none;
}

/* =========================================
   4. TYPOGRAPHY & CONTENT
   ========================================= */
h1,
h2,
h3,
h4 {
    color: var(--text-header);
    line-height: 1.25;
    margin-bottom: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.25rem;
    margin-bottom: 24px;
}

h2 {
    font-size: 1.75rem;
    margin-top: 48px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

h3 {
    font-size: 1.25rem;
    margin-top: 32px;
}

p {
    margin-bottom: 16px;
}

ul,
ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

li {
    margin-bottom: 8px;
}

/* Code Styles */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: #c026d3;
    /* Dark Pink/Purple for inline code */
}

pre {
    background-color: var(--code-block-bg);
    color: #e5e7eb;
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 24px 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
}

pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Utilities */
.muted {
    color: var(--text-muted);
}

.small {
    font-size: 0.875rem;
}

/* =========================================
   5. COMPONENTS (Pills, Cards, Stats)
   ========================================= */

/* Pills (Tags) */
.meta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

/* Hero Section */
.hero-section {
    padding: 80px 0 60px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 60px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.hero-desc {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Stat Cards (For Benchmarks) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin: 40px 0;
}

.stat-card {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.stat-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-header);
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* =========================================
   6. TABLES (Benchmarks & API)
   ========================================= */
.bench-group {
    margin-bottom: 40px;
}

.bench-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.bench-title {
    font-weight: 700;
    color: var(--text-header);
}

.bench-specs {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bench-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.bench-table th {
    text-align: left;
    padding: 10px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.bench-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
}

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

/* Table Value Colors */
.mode-fanout {
    color: var(--text-header);
    font-weight: 600;
}

.mode-cbrs {
    color: var(--primary-color);
    font-weight: 600;
}

.val-pass {
    color: var(--color-success);
    font-weight: 700;
}

.val-warn {
    color: var(--color-warning);
    font-weight: 700;
}

.val-fail {
    color: var(--color-danger);
    font-weight: 700;
}

.val-good {
    color: var(--color-success);
}

.val-bad {
    color: var(--color-danger);
}

/* =========================================
   7. ARTICLE LAYOUT (For Papers/Docs)
   ========================================= */
.article-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    /* Sidebar + Content */
    gap: 48px;
    padding-top: 40px;
    padding-bottom: 80px;
}

.toc {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.toc-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 16px;
    letter-spacing: 0.05em;
}

.toc-nav a {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 8px;
    border-left: 2px solid transparent;
    padding-left: 12px;
}

.toc-nav a:hover {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    text-decoration: none;
}

.toc-nav .toc-link-sub {
    margin-left: 12px;
}

/* References */
.refs {
    list-style: none;
    padding: 0;
    font-size: 0.9rem;
}

.refs li {
    margin-bottom: 12px;
    padding-left: 24px;
    text-indent: -24px;
}

/* Footer */
.article-footer {
    margin-top: 80px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

/* Diagrams */
.mermaid {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    background: white;
    /* Ensure visibility if bg changes */
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

/* =========================================
   8. RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .article-layout {
        grid-template-columns: 1fr;
    }

    .toc {
        display: none;
    }

    /* Hide TOC on mobile */
    .nav {
        gap: 16px;
    }

    .nav a {
        font-size: 0.9rem;
    }

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