/* Distill-inspired typography */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Clean colors */
    --bg-paper: #ffffff;
    --bg-subtle: #fafafa;
    --text-primary: rgba(0, 0, 0, 0.8);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.05);
    --accent: #004276;
    --accent-light: #006bd6;

    /* Distill Typography - Georgia serif with system sans fallbacks */
    --font-serif: Georgia, 'Times New Roman', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Roboto", Helvetica, sans-serif;
    --font-mono: Consolas, Monaco, 'Andale Mono', monospace;

    /* Distill Layout - wider body for readability */
    --content-max-width: 768px;
    --middle-width: 900px;
    --page-width: 1080px;
    --line-height: 1.6;
}

body {
    font-family: var(--font-serif);
    background: var(--bg-paper);
    color: var(--text-primary);
    line-height: 1.55em;
    font-size: 18px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Main Content Area */
.main-wrapper {
    min-height: 100vh;
    background: var(--bg-paper);
}

header {
    padding: 48px 24px 32px;
    max-width: var(--page-width);
    margin: 0 auto;
}

.title {
    font-size: 50px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 28px;
    color: rgba(0, 0, 0, 0.9);
    text-align: center;
    font-family: var(--font-serif);
}

/* Author list */
.author-list {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    align-items: baseline;
    text-align: center;
}

.author-list.secondary {
    margin-bottom: 12px;
}

.author-list .separator {
    color: var(--text-secondary);
    font-size: 14pt;
}

.author-link {
    font-size: 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
}

.author-link:hover {
    border-bottom-color: var(--accent);
    text-decoration: none;
}

.author-link.highlighted {
    font-weight: 600;
}

.author-link sup {
    font-size: 10px;
    margin-left: 1px;
}

/* Affiliations */
.affiliations {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
}

.affiliation-item {
    display: inline;
}

.affiliation-item sup {
    font-size: 9px;
    margin-right: 2px;
}

/* Paper links buttons */
.paper-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.paper-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--bg-paper);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
}

.paper-btn:hover {
    background: var(--bg-subtle);
    border-color: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.paper-btn:active {
    transform: translateY(1px);
}

.paper-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.paper-authors {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    margin-bottom: 24px;
    font-family: var(--font-sans);
}

/* Legacy support */
.authors {
    font-size: 12pt;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-align: center;
}

.authors .equal-contrib {
    font-size: 9pt;
    vertical-align: super;
}

.affiliation {
    font-size: 10pt;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 20px;
    text-align: center;
}

/* Abstract/Hook */
.hook {
    font-size: 20px;
    line-height: 1.6;
    color: var(--text-primary);
    padding: 0;
    margin: 48px auto;
    max-width: var(--content-max-width);
    border: none;
    border-left: 3px solid rgba(0, 0, 0, 0.1);
    padding-left: 24px;
    background: transparent;
    text-align: left;
}

.hook .highlight {
    font-style: italic;
}

/* Hook followup text */
.hook-followup {
    max-width: var(--content-max-width);
    margin: 0 auto 36px;
    padding: 0 24px;
}

.hook-followup p {
    font-size: 18px;
    line-height: 1.55;
    text-align: left;
}

/* Figure Environment - Full Width */
.opening-figure {
    margin: 24px 0;
    width: 100vw;
    max-width: var(--page-width);
    padding: 12px 24px;
    background: #ffffff;
    border-radius: 0;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Wide figure - breaks out of content container */
.wide-figure {
    width: 100vw;
    max-width: var(--page-width);
    margin: 24px 0;
    padding: 12px 24px;
    background: #ffffff;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.figure-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    letter-spacing: 0.5px;
}

.figure-caption {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 0 0;
    font-style: normal;
    text-align: left;
    max-width: var(--content-max-width);
    margin: 0 auto;
    line-height: 1.5;
}

/* Algorithm boxes */
.algorithm-box {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 20px 24px;
    margin: 32px 0;
    background: rgba(0, 0, 0, 0.02);
    font-family: var(--font-serif);
    border-radius: 4px;
}

.algorithm-box .algorithm-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
    font-family: var(--font-sans);
    color: var(--text-secondary);
}

.algorithm-box .algorithm-input,
.algorithm-box .algorithm-output {
    margin: 10px 0;
    font-size: 15px;
}

.algorithm-box .algorithm-input strong,
.algorithm-box .algorithm-output strong {
    font-weight: 600;
}

.algorithm-box ol {
    margin: 16px 0 16px 24px;
    padding: 0;
    font-size: 15px;
}

.algorithm-box ol li {
    margin: 8px 0;
    line-height: 1.5;
}

.algorithm-box .keyword {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 13px;
}

.algorithm-box .comment {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
}

/* Content Sections */
article {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 24px 48px;
    overflow: visible;
}

main {
    overflow: visible;
}

.main-wrapper {
    overflow-x: clip;
}

section {
    margin-bottom: 48px;
}

h2 {
    font-size: 26px;
    font-weight: 700;
    margin-top: 72px;
    margin-bottom: 20px;
    padding-top: 0;
    border-top: none;
    color: rgba(0, 0, 0, 0.9);
    font-family: var(--font-serif);
}

section#intro h2 {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

h3 {
    font-size: 20px;
    font-weight: 400;
    font-style: italic;
    margin-top: 36px;
    margin-bottom: 12px;
    padding-top: 0;
    color: rgba(0, 0, 0, 0.9);
    position: relative;
}

h3::before {
    display: none;
}

p {
    margin-bottom: 1em;
    color: var(--text-primary);
    text-align: left;
}

ul, ol {
    margin-left: 24px;
    margin-bottom: 1em;
}

li {
    margin-bottom: 0.5em;
}

/* Math notation */
.math {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05em;
}

/* Roman (non-italic) math - for text like "train", "val", etc. */
.math-rm {
    font-family: var(--font-serif);
    font-style: normal;
    font-size: 1.05em;
}

/* Code and Math */
code {
    font-family: var(--font-mono);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 6px;
    border-radius: 3px;
    border: none;
}

.equation {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 16px;
    padding: 24px;
    margin: 24px 0;
    background: transparent;
    border: none;
    text-align: center;
    overflow-x: auto;
}

/* Horizontal rules / separators */
hr {
    display: block;
    margin: 60px auto;
    width: 800px;
    max-width: calc(100vw - 40px);
    border: none;
    border-top: 2px solid #ddd;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Figures */
.figure {
    margin: 30px 0;
    text-align: center;
}

.figure img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
}

/* Constrain all content images to text width */
article img,
section img {
    max-width: 600px !important;
}
/* Allow wide/opening figures to use full container width */
.wide-figure img,
.opening-figure img {
    max-width: 100% !important;
}

/* Links - Distill style with bottom borders */
a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
    transition: border-color 0.15s;
}

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

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 9pt;
}

.data-table th,
.data-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: var(--bg-subtle);
    font-weight: 700;
    border-bottom: 1.5px solid var(--border-color);
}

.data-table td {
    font-family: var(--font-mono);
}

.data-table tr:hover {
    background: var(--bg-subtle);
}

.improvement {
    color: #006600;
    font-weight: 600;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin: 0 auto;
}

.results-table th,
.results-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
}

.results-table th {
    background: var(--bg-subtle);
    font-weight: 700;
    border-bottom: 1.5px solid var(--border-color);
    text-align: center;
}

.results-table th:first-child,
.results-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.results-table td {
    font-family: var(--font-mono);
}

.results-table tr:hover {
    background: var(--bg-subtle);
}

.results-table .best {
    background: rgba(0, 180, 0, 0.1);
    font-weight: 600;
}

.results-table .better {
    color: #006600;
    font-weight: 600;
}

.results-table .worse {
    color: #990000;
}

/* Acknowledgments */
.acknowledgments {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.02);
    border: none;
    border-radius: 4px;
    margin-top: 48px;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --content-max-width: 100%;
    }

    body {
        font-size: 17px;
    }

    .title {
        font-size: 32px;
    }

    h2 {
        font-size: 22px;
    }

    h3 {
        font-size: 18px;
    }

    article {
        padding: 0 16px 32px;
    }

    header {
        padding: 32px 16px 24px;
    }

    .hook {
        font-size: 17px;
        padding-left: 16px;
    }
}

/* Print Styles */
@media print {
    body {
        font-size: 11pt;
    }

    section {
        page-break-inside: avoid;
    }
}
