/* arXiv-style Full LaTeX Academic Typography */
:root {
    --bg-color: #fbf9f4; /* Warm off-white / cream */
    --text-color: #22201c; /* Dark charcoal, warm */
    --accent-color: #8c3a3a; /* Deep burgundy / oxblood */
    --accent-light: #f5eaea; /* Very light burgundy tint */
    --border-color: #d1cbc2; /* Warm subtle border */
    --border-dark: #1a1a1a; /* Academic tables */
    --font-serif: 'STIX Two Text', 'Latin Modern Roman', 'Computer Modern', Georgia, serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
    --max-width: 800px; /* Precise LaTeX measure */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-serif);
    font-size: 1.15rem; /* Clean readable scale */
    line-height: 1.6;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-serif);
    color: #1a1815;
    line-height: 1.3;
}

/* Title block arXiv style */
.title-block {
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 2rem;
}

.title-block h1 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.title-block .byline {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.title-block .affiliation {
    font-size: 1rem;
    color: #5a544a;
}

.abstract-block {
    margin: 3rem auto;
    width: 85%;
    font-size: 1.05rem;
    line-height: 1.6;
    text-align: justify;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.abstract-block strong {
    font-size: 1.05rem;
}

/* Headings (Strict LaTeX Spacing) */
h2 {
    font-size: 1.45rem;
    font-weight: 600;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.sec-num {
    font-variant-caps: small-caps;
    margin-right: 0.5rem;
    color: var(--accent-color);
}

p {
    margin-bottom: 1.25rem;
    text-align: justify;
}

a {
    color: var(--accent-color);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s, color 0.2s;
}

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

strong {
    font-weight: 600;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.15em 0.25em;
    background: #f0eDe3;
    border-radius: 2px;
}

/* Layout */
.content {
    max-width: var(--max-width);
    padding: 2rem;
    box-sizing: border-box;
    width: 100%;
}

/* TOC */
.toc {
    position: fixed;
    top: 4rem;
    left: max(1rem, calc(50% - var(--max-width)/2 - 240px));
    width: 200px;
    font-size: 0.95rem;
    font-family: var(--font-serif);
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0.75rem;
}

.toc a {
    color: var(--accent-color);
    font-weight: 500;
    border: none;
    transition: color 0.2s;
}

.toc a:hover {
    color: var(--text-color);
}

.toc .sec-num {
    font-weight: 600;
}

/* Lists */
ul {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.standard-list li {
    margin-bottom: 0.75rem;
}

/* KPIs - Data Science Stat Cards */
.kpi-strip.stat-cards {
    display: flex;
    gap: 1.5rem;
    margin: 3.5rem 0;
    flex-wrap: wrap;
    justify-content: space-around;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    padding: 2rem 1rem;
}

.kpi-card {
    text-align: center;
}

.kpi-value {
    display: block;
    color: var(--accent-color);
    font-size: 2.2rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

.kpi-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a453d;
    margin-top: 0.25rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Academic Tables */
.table-block {
    margin: 4rem 0;
}

.table-caption {
    font-size: 1rem;
    color: #4a453d;
    text-align: left;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.academic-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    font-family: var(--font-serif);
    border-top: 2px solid var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
}

.academic-table th, .academic-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border: none;
}

.academic-table thead tr {
    border-bottom: 1px solid var(--border-dark);
}

.academic-table .numeric-col {
    text-align: right;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.academic-table .highlight-row td {
    font-weight: 600;
    color: var(--accent-color);
}

.academic-table .circular-note {
    font-size: 0.85em;
    color: #7a7468;
    font-weight: normal;
}

/* Figures */
.figure-block {
    margin: 4rem auto;
    text-align: center;
    max-width: 100%;
}

.chart-wrapper {
    margin-bottom: 1.25rem;
}

figcaption {
    font-size: 1rem;
    color: #4a453d;
    text-align: left;
    line-height: 1.5;
    margin-top: 1rem;
}

/* Equations */
.display-equation {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 3rem 0;
    position: relative;
    width: 100%;
    overflow-x: auto;
}

.math-display {
    flex-grow: 1;
    text-align: center;
}

.equation-number {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-family: var(--font-serif);
}

/* SVG Custom Diagram */
.intro-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 3.5rem 0;
}

.intro-diagram svg {
    max-width: 100%;
    height: auto;
}

/* Pull Quotes / Emphasis */
.pull-quote {
    display: block;
    margin: 3rem 0;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    border-left: 4px solid var(--accent-color);
    background-color: #f7edea;
    color: var(--accent-color);
    font-size: 1.15rem;
    font-style: italic;
    border-radius: 0 4px 4px 0;
    line-height: 1.6;
}

/* Action Badges */
.action-list { 
    list-style: none; 
    padding: 0; 
}
.action-list li { 
    margin-bottom: 1.5rem; 
    line-height: 1.6;
}
.action-badge { 
    font-family: var(--font-mono); 
    font-size: 0.8rem; 
    padding: 0.2rem 0.5rem; 
    border-radius: 3px; 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    white-space: nowrap; 
    margin-right: 0.5rem;
    display: inline-block;
    vertical-align: middle;
}
.badge-structural { background: #f5eaea; color: var(--accent-color); border: 1px solid #d9c4c4; }
.badge-investigate { background: #e8eaec; color: #3b5c7a; border: 1px solid #c8d0d6; }
.badge-verify { background: #efebe4; color: #7a6a4f; border: 1px solid #d4cdc1; }
.badge-refresh { background: #efefef; color: #555; border: 1px solid #ddd; }

/* Reproducibility Appendix */
.appendix-section {
    background-color: #f7f5ef;
    padding: 3rem 3.5rem;
    border-radius: 6px;
    border: 1px solid #e8e4d8;
    margin: 5rem 0;
}

.appendix-section h2 { 
    margin-top: 0; 
}

/* Acknowledgments Closing */
.closing-section {
    margin-top: 6rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 4rem;
}
.closing-mark {
    font-size: 1.8rem;
    color: var(--accent-color);
    display: block;
    margin-bottom: 1.5rem;
}
.closing-section h2 { 
    margin-top: 0; 
    border: none; 
    justify-content: center; 
    display: flex; 
}

/* Footnotes (LaTeX style block) */
.footnote-ref {
    font-size: 0.75em;
    vertical-align: super;
    border: none;
    color: var(--accent-color);
    margin-left: 0.1em;
}

.footnote-backref {
    color: var(--accent-color);
    font-weight: 600;
    margin-right: 0.5rem;
}

.footnotes {
    margin-top: 5rem;
    font-size: 0.95rem;
    color: #5a544a;
}
.footnotes hr {
    border: none;
    border-top: 1px solid var(--border-color);
    width: 25%;
    margin-left: 0;
    margin-bottom: 2rem;
}
.footnotes p {
    margin-bottom: 0.75rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .toc {
        display: none;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 2rem 1.5rem;
    }
    
    .title-block h1 {
        font-size: 1.9rem;
    }
    
    .abstract-block {
        width: 100%;
        text-align: left;
    }
    
    .kpi-strip {
        gap: 1rem;
    }
    
    .figure-block {
        max-width: 100%;
    }
    
    .academic-table {
        font-size: 0.85rem;
    }
    .academic-table th, .academic-table td {
        padding: 0.6rem 0.5rem;
    }

    .appendix-section {
        padding: 2rem 1.5rem;
    }
}
