/* ============================================================
   Trainee-to-Trainer project page — vanilla CSS
   No external fonts / frameworks. System font stack only.
   ============================================================ */

:root {
    /* Brand */
    --bg:           #ffffff;
    --bg-soft:      #f8fafc;
    --fg:           #1f2937;
    --fg-muted:     #4b5563;
    --accent:       #2563eb;
    --accent-dark:  #1e40af;

    /* Case-study panels */
    --case-base-bg:    #fffbe6;   /* light yellow */
    --case-base-tag:   #b45309;
    --case-train-bg:   #ecfdf5;   /* light green */
    --case-train-tag:  #047857;

    /* Tables */
    --tbl-stripe:    #f8fafc;
    --tbl-border:    #e5e7eb;
    --tbl-head-bg:   #f1f5f9;
    --tbl-ours-bg:   #eef6ff;
    --tbl-sum-bg:    #fffaf0;

    /* Layout */
    --container-max:    1140px;
    --container-narrow: 760px;
    --radius:           12px;
    --shadow-sm:        0 1px 2px rgba(15, 23, 42, .06),
                        0 4px 14px rgba(15, 23, 42, .04);
    --shadow-md:        0 4px 6px rgba(15, 23, 42, .07),
                        0 12px 32px rgba(15, 23, 42, .08);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--fg);
    background: var(--bg);
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
    color: var(--fg);
    line-height: 1.25;
    margin: 0 0 .5em;
    letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); font-weight: 650; }
h3 { font-size: 1.2rem; font-weight: 650; }
p  { margin: 0 0 1em; color: var(--fg); }
a  { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: #eef2f7;
    padding: .1em .35em;
    border-radius: 4px;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}
.container.narrow { max-width: var(--container-narrow); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
    background:
        radial-gradient(80% 60% at 50% 0%, rgba(37, 99, 235, .08), transparent 70%),
        linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
    padding: 72px 0 56px;
    border-bottom: 1px solid #eef2f7;
    text-align: center;
}
.hero .title { margin-bottom: .55rem; }
.hero .subtitle {
    font-size: 1.1rem;
    color: var(--fg-muted);
    max-width: 760px;
    margin: 0 auto 1.4rem;
}
.hero .authors {
    font-size: 1.02rem;
    margin: 1.2rem 0 .35rem;
    color: var(--fg);
}
.hero .author { font-weight: 600; }
.hero .affil {
    color: var(--fg-muted);
    font-size: .92rem;
    margin: 0 0 .4rem;
}
.hero .affil.mark-key { font-size: .85rem; margin-bottom: 1.5rem; }
.hero .dot { margin: 0 .55em; color: #94a3b8; }
.aff {
    font-size: .72em;
    vertical-align: super;
    line-height: 0;
    color: var(--accent);
    font-weight: 600;
    margin-left: 2px;
}
.mark {
    font-size: .72em;
    vertical-align: super;
    line-height: 0;
    color: #b91c1c;
    margin-left: 2px;
}

/* ---------- Link pills ---------- */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 1.6rem;
}
.link-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.96rem;
    border: 1px solid transparent;
    text-decoration: none !important;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.link-pill:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: #ffffff;
}
.link-pill .icon { width: 20px; height: 20px; }
.link-pill.hf {
    background: linear-gradient(135deg, #ffcd1c 0%, #ff9d00 100%);
    color: #111827;
}
.link-pill.hf:hover {
    color: #111827;
    background: linear-gradient(135deg, #ffd543 0%, #ffb22e 100%);
}
.link-pill .hf-emoji { font-size: 1.25rem; line-height: 1; }

/* ============================================================
   Section scaffolding
   ============================================================ */
.section { padding: 72px 0; }
.section-light { background: var(--bg-soft); }

/* ============================================================
   Framework overview figure (Section 0)
   ============================================================ */
.framework-figure {
    margin: 0;
    text-align: center;
}
.framework-card {
    display: inline-block;
    width: 100%;
    max-width: 1140px;         /* ~1.5x previous; fills the .container */
    background: #ffffff;
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    line-height: 0;            /* kill stray gap under inline-img */
}
.framework-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: calc(var(--radius) - 6px);
}
.framework-figure figcaption {
    margin: 14px auto 0;
    max-width: 980px;
    color: var(--fg-muted);
    font-size: .95rem;
    line-height: 1.55;
    text-align: center;
}
.framework-figure figcaption strong { color: var(--fg); }
.section-heading { text-align: center; margin-bottom: .5rem; }
.section-lead {
    text-align: center;
    max-width: 820px;
    margin: 0 auto 2.5rem;
    color: var(--fg-muted);
}

#abstract p {
    font-size: 1.05rem;
    color: var(--fg);
    text-align: justify;
}

/* ============================================================
   Case study blocks
   ============================================================ */
.case-block {
    padding: 56px 0;
    border-top: 1px solid rgba(15, 23, 42, .06);
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}
.case-block + .case-block { border-top: none; }
.case-base  { background: var(--case-base-bg);  }
.case-train { background: var(--case-train-bg); }

/* Sub-headings that announce each sub-case INSIDE the Case Study section.
   They sit in a normal .container (white background), between the global
   <h2> and the next .case-block. */
.case-subheading {
    margin: 48px 0 .35rem;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--fg);
    text-align: center;
    line-height: 1.35;
}
/* First sub-heading (right after the section lead) sits closer. */
.section .container > .case-subheading:first-child,
.section > .container + .container > .case-subheading {
    margin-top: 28px;
}
.case-sublead {
    max-width: 760px;
    margin: 0 auto 28px;
    color: var(--fg-muted);
    text-align: center;
    line-height: 1.6;
}
.case-sublead strong { color: var(--fg); }

/* Pill markers next to the sub-heading (e.g. "5 agents", "50% holes"). */
.case-sub-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 10px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--fg-muted);
    background: rgba(15, 23, 42, .06);
    border-radius: 999px;
    vertical-align: middle;
}

.case-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.15fr);
    gap: 40px;
    align-items: center;
}
@media (max-width: 820px) {
    .case-grid { grid-template-columns: 1fr; }
}

.case-text { padding: 8px 0; }
.case-text h3 { margin-top: .25rem; }

.case-tag {
    display: inline-block;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .65);
}
.tag-base  { color: var(--case-base-tag);  border: 1px solid rgba(180,83,9,.25);  }
.tag-train { color: var(--case-train-tag); border: 1px solid rgba(4,120,87,.25); }

/* "Tokens generated: N" line above the metric chips. Forced onto its
   own row, slightly larger than the chips, with a thin top divider so
   it visually separates from the descriptive paragraph above. */
.case-tokens {
    margin: 1.1rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(15, 23, 42, .12);
    font-size: 1.02rem;
    color: var(--fg);
    letter-spacing: .01em;
}
.case-tokens strong { font-weight: 700; }

.case-metrics {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.case-metrics li {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, .8);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 8px;
    font-size: .92rem;
}
.case-metrics li span { color: var(--fg-muted); }
.case-metrics li b { color: var(--fg); }

.case-figure {
    margin: 0;
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    padding: 8px;
}
.case-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: calc(var(--radius) - 4px);
    image-rendering: pixelated;
    background: #f1f5f9;
}
.case-figure figcaption {
    margin: .55rem .25rem .15rem;
    font-size: .85rem;
    color: var(--fg-muted);
    text-align: center;
}

/* ============================================================
   Results tables — wide multi-column main results

   Each of the 3 tables sits in its own white card (.result-table-wrap).
   The card is full-width within .container, so all 3 cards have the
   IDENTICAL outer width and the IDENTICAL left edge — captions and
   tables align across the three.

   The table itself uses table-layout: fixed and a 220px Model column,
   so the "Model" header on every table starts at the same X position.
   Data columns split the remaining width equally within each table
   (so 3-agent cells are narrower, 5-agent cells are wider — that's
   expected: each table's right edge still lines up with the others).
   ============================================================ */
.result-table-wrap {
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 22px 20px;
    margin-bottom: 28px;
    /* Horizontal scrollbar appears only when the *table* exceeds the wrap
       (narrow phones). The wrap itself always fills the container, so the
       outer cards line up perfectly. */
    overflow-x: auto;
}
.result-table-wrap:last-child { margin-bottom: 0; }

/* Caption pulled OUT of <table>. Lives directly inside .result-table-wrap
   so its X position is the wrap's padding edge — i.e. identical for all
   three tables. */
.result-table-title {
    margin: 0 0 12px;
    padding: 0 2px;
    color: var(--fg-muted);
    font-size: .95rem;
    line-height: 1.5;
}
.result-table-title strong { color: var(--fg); }

.results-table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    table-layout: fixed;       /* equal-share columns within each table */
    font-size: .9rem;
    color: var(--fg);
}

/* Per-table min-widths: same Model column (220px) + data-column floor
   (~52px each). Different col counts → different min-widths, but all
   three are well below the .container width, so on normal viewports
   they render at the full card width with NO horizontal scroll and
   look identically sized. */
.results-table--w17 { min-width: 1104px; }  /* 3-agent: 17 data cols + Model */
.results-table--w15 { min-width: 1000px; }  /* 4-agent: 15 data cols + Model */
.results-table--w13 { min-width:  896px; }  /* 5-agent: 13 data cols + Model */

.results-table th,
.results-table td {
    text-align: center;
    padding: 7px 8px;
    border-bottom: 1px solid var(--tbl-border);
    white-space: nowrap;
}

/* Header */
.results-table thead th {
    background: var(--tbl-head-bg);
    font-weight: 600;
    border-bottom: 1px solid #cbd5e1;
    border-top: 1px solid var(--tbl-border);
}
.results-table thead tr:first-child th {
    border-top: 2px solid #94a3b8;     /* booktabs-style toprule */
}
.results-table thead tr:last-child th {
    border-bottom: 1.5px solid #94a3b8;
    font-weight: 500;
    color: var(--fg-muted);
}
.results-table th.th-model {
    text-align: left;
    padding-left: 14px;
    background: var(--tbl-head-bg);
    border-right: 1px solid var(--tbl-border);
    width: 220px;            /* identical across all 3 tables -> aligned */
    min-width: 220px;
}
.results-table th.th-sum,
.results-table td.td-sum {
    background: var(--tbl-sum-bg);
    border-left: 1.5px solid #cbd5e1;
}

/* Body cells */
.results-table td.model {
    text-align: left;
    padding-left: 14px;
    border-right: 1px solid var(--tbl-border);
    font-weight: 500;
    background: #fdfdfd;
}
.results-table tbody tr:nth-child(odd) td:not(.model):not(.td-sum) {
    background: var(--tbl-stripe);
}

/* Group separator between proprietary baselines and Qwen3-4B variants
   — replicates LaTeX \midrule */
.results-table tr.row-group-end td {
    border-bottom: 1.5px solid #94a3b8;
}

/* Highlight the "Ours" row */
.results-table tr.row-ours td {
    background: var(--tbl-ours-bg);
}
.results-table tr.row-ours td.model { background: #dbeafe; color: #1e3a8a; }
.results-table tr.row-ours td.td-sum {
    background: #d6e8ff;
}

/* Bottom rule (booktabs) */
.results-table tbody tr:last-child td {
    border-bottom: 2px solid #94a3b8;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    padding: 28px 0 36px;
    text-align: center;
    color: var(--fg-muted);
    font-size: .9rem;
    border-top: 1px solid #eef2f7;
    background: #ffffff;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .link-pill:hover { transform: none; }
}
