/* =============================================================
   MEDSIGHT project page — original styles
   Designed to be clean, simple, and academic.
   ============================================================= */

:root {
  --bg:           #ffffff;
  --bg-alt:       #f7f8fa;
  --text:         #1a1a1a;
  --text-soft:    #555;
  --text-light:   #888;
  --brand:        #1f3a6e;
  --brand-dark:   #14264d;
  --brand-light:  #eee6ff;
  --accent:       #d62728;
  --border:       #e5e7eb;
  --code-bg:      #f1f3f6;
  --table-head:   #e9f3fe;
  --table-ours:   #dae0fb;
  --shadow:       0 1px 3px rgba(0,0,0,0.06);
  --radius:       6px;
  --maxw:         1180px;
  --maxw-narrow:  900px;
  --serif:        "Noto Serif", Georgia, serif;
  --sans:         "Google Sans", "Noto Sans", -apple-system, BlinkMacSystemFont,
                  "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:         "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
a:hover { border-bottom-color: var(--brand); }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--brand-dark);
}

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

/* ===================== HERO ===================== */
.hero {
  padding: 70px 0 56px 0;
  text-align: center;
  background:
    radial-gradient(ellipse at top, #eef2fb 0%, transparent 60%),
    #ffffff;
  border-bottom: 1px solid var(--border);
}
.venue-tag {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-weight: 500;
  letter-spacing: 1.2px;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
  text-transform: uppercase;
}

.paper-title {
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.2;
  margin: 0 0 28px 0;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Small-caps style for MEDSIGHT brand */
.brand-large { font-size: 1.0em; font-weight: 700; }
.brand-small { font-size: 0.78em; font-weight: 700; letter-spacing: 0.01em; }

/* MEDSIGHT brand text styled with small-caps */
.brand-inline {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant: small-caps;
  text-transform: lowercase;
}

.authors {
  font-size: 18px;
  margin-bottom: 8px;
  line-height: 1.9;
}
.authors .author {
  display: inline-block;
  margin: 0 6px;
  white-space: nowrap;
}
.authors a {
  color: var(--text);
  font-weight: 500;
  border-bottom: none;
}
.authors a:hover { color: var(--brand); }
.authors sup { color: var(--brand); font-weight: 600; }

.affiliations {
  font-size: 16px;
  color: var(--text-soft);
  margin-top: 4px;
}
.affiliations sup { color: var(--brand); }
.affiliations .dot { margin: 0 8px; color: var(--text-light); }

.footnote {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-light);
}

.button-row {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  border-bottom: none;
}
.btn .icon { display: inline-flex; }
.btn:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ===================== SECTIONS ===================== */
.section {
  padding: 56px 0;
}
.section.alt { background: var(--bg-alt); }
.section.teaser { padding: 36px 0 8px 0; }

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 18px 0;
  color: var(--brand-dark);
  letter-spacing: -0.005em;
}
.section-subtitle {
  color: var(--text-soft);
  margin-top: -6px;
  margin-bottom: 22px;
}
.sub-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--brand);
  margin: 32px 0 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sub-title .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 15px;
  font-weight: 700;
}

.abstract {
  font-size: 17.5px;
  line-height: 1.75;
  text-align: justify;
}

/* ===================== FIGURES ===================== */
/* The actual figure width is set per-element by the JS auto-fitter (see
   static/js/index.js) using the image's natural pixel size. This keeps
   figures from being stretched and removes "floating" small images.       */
figure {
  margin: 18px auto 8px auto;
  text-align: center;
  /* JS will set max-width per figure; this is the fallback cap. */
  max-width: 100%;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: #fff;
  margin: 0;
}
figcaption {
  margin: 10px auto 0 auto;
  font-size: 14.5px;
  color: var(--text-soft);
  line-height: 1.5;
  text-align: center;
  max-width: 100%;
}

/* ===================== CARDS (motivation) ===================== */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px 22px;
  position: relative;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 6px 0 8px 0;
  font-size: 18px;
  color: var(--brand-dark);
}
.card p {
  margin: 0;
  font-size: 15.5px;
  color: var(--text-soft);
  line-height: 1.6;
}
.card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ===================== PIPELINE ===================== */
.pipeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
  margin: 18px 0 8px 0;
}
.pipeline .stage {
  background: #fff;
  border: 1.5px solid var(--brand);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.pipeline .stage-title {
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 15px;
  letter-spacing: 0.5px;
}
.pipeline .stage p {
  margin: 0;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.55;
}
.pipeline .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-size: 22px;
  font-weight: 700;
}

.equation-box {
  margin: 22px auto 0 auto;
  max-width: 540px;
  text-align: center;
  background: var(--brand-light);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--brand-dark);
}

/* ===================== TABLES ===================== */
.table-wrapper {
  overflow-x: auto;
  margin: 18px 0;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
}
.results-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 15px;
}
.results-table th,
.results-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results-table thead th {
  background: var(--table-head);
  color: var(--brand-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.results-table tbody td:first-child {
  text-align: left;
  font-weight: 500;
}
.results-table tbody tr.ours td {
  background: var(--table-ours);
  font-weight: 600;
}
.results-table tbody tr:hover td:not([class]) {
  background: #fafbfd;
}

/* Compact dense table (used for main experiment tables) */
.results-table.compact { min-width: 980px; font-size: 13.5px; }
.results-table.compact th,
.results-table.compact td { padding: 6px 8px; }
.results-table.compact thead th {
  font-size: 13px;
}

/* Cell that visually groups multiple rows on the left */
.results-table .rotate-cell {
  background: #f3f5f9;
  font-weight: 600;
  color: var(--brand-dark);
  text-align: center;
  font-size: 13px;
  border-right: 1px solid var(--border);
}

/* Sub-group header above the column blocks */
.results-table .group-head {
  background: #d8e6f7;
  color: var(--brand-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
}
.results-table .group-head.alt-group { background: #e9defc; }

/* Rows whose training data overlaps eval sets (rendered subtly) */
.results-table tr.overlap td {
  background: #f5f5f5;
  color: #6a6a6a;
  font-style: italic;
}
.results-table tr.overlap td:first-child { font-style: italic; }

/* Thin divider row between groups */
.results-table tr.divider td {
  padding: 0;
  height: 4px;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
}

/* Italic gray inline note (used in body text + captions) */
.note-gray {
  color: #6a6a6a;
  font-style: italic;
}

/* Captions below tables */
.caption-note {
  font-size: 14.5px;
  color: var(--text-soft);
  line-height: 1.55;
  margin-top: 10px;
  text-align: left;
}

/* Callout box pointing readers to the paper */
.callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--brand-light);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 28px 0 0 0;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.6;
}
.callout-icon {
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 22px;
  padding-top: 2px;
}
.callout strong { color: var(--brand-dark); }
.callout em { font-style: italic; }

/* ===================== BIBTEX ===================== */
.bibtex {
  background: #1f2937;
  color: #e8eaed;
  border-radius: var(--radius);
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
}
.bibtex code { background: transparent; color: inherit; padding: 0; }

/* ===================== FOOTER ===================== */
.footer {
  padding: 32px 0 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-soft);
  font-size: 14.5px;
  background: var(--bg-alt);
}
.footer .small {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 8px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero { padding: 48px 0 36px 0; }
  .paper-title { font-size: 26px; }
  .authors { font-size: 16px; }
  .section { padding: 40px 0; }
  .section-title { font-size: 24px; }
  .cards { grid-template-columns: 1fr; }
  .pipeline {
    grid-template-columns: 1fr;
  }
  .pipeline .arrow {
    transform: rotate(90deg);
    height: 22px;
  }
  .btn { padding: 8px 14px; font-size: 14px; }
}
