/* MMedAgent-Plus project page
   Palette: ink #16232E · paper #FBFDFD · clinical teal #0E7C7B · navy #1B4965 · mist #EAF3F3 · amber #C96F1E */

:root {
  --ink: #16232E;
  --ink-soft: #45555F;
  --paper: #FBFDFD;
  --teal: #0E7C7B;
  --teal-deep: #0A5958;
  --navy: #1B4965;
  --mist: #EAF3F3;
  --mist-line: #D3E3E3;
  --amber: #C96F1E;
  --card: #FFFFFF;
  --radius: 14px;
  --maxw: 980px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }
/* no scroll-behavior: smooth — anchor jumps are instant (see main.js alignToHash) */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--mist);
  border: 1px solid var(--mist-line);
  border-radius: 5px;
  padding: 0.08em 0.35em;
  white-space: nowrap;
}

/* ---------- top nav ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 253, 253, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--mist-line);
}
.topnav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.brand .plus { color: var(--teal); }
.navlinks {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.navlinks a {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.navlinks a:hover { color: var(--teal-deep); text-decoration: none; }
@media (max-width: 640px) { .navlinks { display: none; } }

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4.2rem 1.25rem 2.5rem;
  text-align: center;
}
.eyebrow, .section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 0.9rem;
}
.title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1.05;
  margin: 0 0 1.2rem;
  letter-spacing: -0.015em;
}
.title .plus { color: var(--teal); }
.subtitle {
  max-width: 46rem;
  margin: 0 auto 1.3rem;
  font-size: clamp(1rem, 2.2vw, 1.16rem);
  color: var(--ink-soft);
}
.subtitle strong { color: var(--ink); }
.authors { max-width: 52rem; margin: 0 auto 0.5rem; font-size: 1.02rem; line-height: 1.7; }
.authors .author { display: inline-block; margin-right: 0.35em; font-weight: 600; white-space: nowrap; }
.authors sup { font-size: 0.68em; font-weight: 500; color: var(--ink-soft); }
.corr { color: var(--teal); font-weight: 700; }
.affiliations { max-width: 52rem; margin: 0 auto 0.3rem; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.6; }
.affiliations sup { font-size: 0.72em; margin-right: 0.1em; }
.author-note { margin: 0 0 1.8rem; color: var(--ink-soft); font-size: 0.85rem; font-style: italic; }

.btn-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2.4rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.52rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(22, 35, 46, 0.14); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--mist-line); }
.btn[aria-disabled="true"] { opacity: 0.65; cursor: default; }
.btn[aria-disabled="true"]:hover { transform: none; box-shadow: none; }
.btn-icon { display: inline-flex; align-items: center; }
.soon {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

/* vitals strip */
.vitals {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--mist-line);
  border-radius: var(--radius);
  background: var(--card);
  max-width: 56rem;
  margin: 0 auto;
  overflow: hidden;
}
.vital {
  flex: 1 1 130px;
  padding: 1.1rem 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  border-right: 1px solid var(--mist-line);
}
.vital:last-child { border-right: none; }
.vital-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--navy);
}
.vital-num.accent { color: var(--teal); }
.vital-label { font-size: 0.74rem; color: var(--ink-soft); letter-spacing: 0.01em; }
.vitals-note {
  font-size: 0.74rem;
  color: var(--ink-soft);
  margin: 0.6rem auto 0;
  max-width: 56rem;
  text-align: right;
}
@media (max-width: 720px) {
  .vital { flex: 1 1 33%; border-bottom: 1px solid var(--mist-line); }
}

.teaser { margin: 2.6rem auto 0; }
.teaser img {
  border: 1px solid var(--mist-line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(27, 73, 101, 0.10);
}
.teaser-video { margin-top: 2.6rem; }
.video-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--ink);
  border: 1px solid var(--mist-line); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 14px 40px rgba(27, 73, 101, 0.10);
}
.video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.teaser-video figcaption { text-align: center; }
.teaser figcaption {
  max-width: 52rem;
  margin: 0.9rem auto 0;
  text-align: left;
}

/* ---------- ECG divider ---------- */
.ecg {
  max-width: var(--maxw);
  margin: 2.2rem auto;
  padding: 0 1.25rem;
  color: var(--teal);
  opacity: 0.55;
}
.ecg svg { width: 100%; height: 26px; display: block; }

/* ---------- sections ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3.2rem 1.25rem;
  scroll-margin-top: 4rem;
}
.section-tint {
  background: var(--mist);
  box-shadow: 0 0 0 100vmax var(--mist);
  clip-path: inset(0 -100vmax);
}
.section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.2;
  margin: 0 0 1.2rem;
  letter-spacing: -0.01em;
}
.section h3 {
  font-size: 1.05rem;
  margin: 2rem 0 0.8rem;
}
.prose { max-width: 46rem; }
.prose p { margin: 0 0 1rem; color: var(--ink-soft); }
.prose strong, .prose em { color: var(--ink); }
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  background: #fff;
  border: 1px solid var(--mist-line);
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 0.14em 0.7em;
  margin: 0 0.15em;
  white-space: nowrap;
}
.section-tint .chip, .section-tint code { background: #fff; }

.figure { margin: 2rem 0 0; }
.figure img {
  background: #fff;
  border: 1px solid var(--mist-line);
  border-radius: var(--radius);
  padding: 0.8rem;
}
figcaption {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.7rem;
  line-height: 1.5;
}

/* ---------- tool library ---------- */
.tool-groups { display: flex; flex-direction: column; gap: 2rem; margin-top: 2rem; }
.tool-group h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-text { background: #C9A227; }
.dot-visual { background: #5B6ABF; }
.dot-image { background: #0E7C7B; }
.dot-report { background: #C25E78; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.7rem;
}
.tool {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  background: var(--card);
  border: 1px solid var(--mist-line);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.tool:hover {
  text-decoration: none;
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(14, 124, 123, 0.12);
}
.tool-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}
.tool-task { font-size: 0.78rem; color: var(--ink-soft); }
.tool-mod {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-deep);
  margin-top: 0.25rem;
}

/* task cards reuse the tool-card layout but are not links */
.task-card:hover { border-color: var(--mist-line); transform: none; box-shadow: none; }
.task-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }

/* tasks section: cards on the left, Sankey on the right */
.tasks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 2rem;
  align-items: start;
  margin-top: 2rem;
}
.tasks-layout .tool-groups { margin-top: 0; gap: 1.5rem; }
.tasks-layout .tool-group h3 { margin-bottom: 0.65rem; }
.tasks-layout .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.tasks-layout .tool { padding: 0.65rem 0.8rem; }
.tasks-figure { margin: 0; position: sticky; top: 4.5rem; }
.tasks-figure img {
  background: #fff;
  border: 1px solid var(--mist-line);
  border-radius: var(--radius);
  padding: 0.9rem;
}
@media (max-width: 860px) {
  .tasks-layout { grid-template-columns: 1fr; }
  .tasks-figure { position: static; order: -1; }
}

/* ---------- examples ---------- */
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
  margin-top: 1.6rem;
}
.example {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--mist-line);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
}
.example img { border-radius: 8px; }
.example figcaption { margin-top: 0.8rem; }
.ex-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  margin-bottom: 0.35rem;
}

/* ---------- results ---------- */
.results-sub { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; }
.results-note {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.table-wrap { overflow-x: auto; margin-top: 0.4rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
  background: var(--card);
  border: 1px solid var(--mist-line);
  border-radius: 10px;
  overflow: hidden;
}
th, td { padding: 0.6rem 1rem; text-align: left; }
th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--mist);
  font-weight: 600;
}
td { border-top: 1px solid var(--mist-line); font-variant-numeric: tabular-nums; }
.row-best td { background: rgba(14, 124, 123, 0.07); font-weight: 600; }

/* overview comparison table: ours column highlighted */
table.compare tbody th {
  font-family: var(--font-body);
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--card);
  font-weight: 600;
  border-top: 1px solid var(--mist-line);
}
table.compare td { color: var(--ink-soft); }
table.compare .ours-col {
  background: rgba(14, 124, 123, 0.07);
  color: var(--ink);
  font-weight: 600;
}
table.compare thead .ours-col { color: var(--teal-deep); }
table.compare .yes { color: var(--teal-deep); font-weight: 700; }
table.compare .no { color: #b3564a; font-weight: 700; }

.split {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.6rem;
  align-items: start;
  margin-top: 0.6rem;
}
.split .prose { margin-top: 2rem; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } .split .prose { margin-top: 0; } }

.more-results {
  margin-top: 2.4rem;
  border: 1px solid var(--mist-line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0 1.2rem;
}
.more-results summary {
  cursor: pointer;
  padding: 1rem 0;
  font-weight: 600;
  color: var(--teal-deep);
  list-style-position: inside;
}
.more-results[open] { padding-bottom: 1.2rem; }

/* ---------- bibtex ---------- */
.bibtex-box {
  position: relative;
  background: var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}
.bibtex-box pre {
  margin: 0;
  padding: 1.4rem 1.6rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #DDEBEB;
}
.copy-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}
.copy-btn:hover { background: var(--mist); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--mist-line);
  margin-top: 3rem;
  padding: 2.2rem 1.25rem 2.8rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.footer p { margin: 0.3rem 0; }
.footer-small { font-size: 0.78rem; }

/* ---------- image viewer (Viewer.js) ---------- */
figure img { cursor: zoom-in; }
.viewer-download::before { content: "\2B07"; font-size: 18px; line-height: 1; color: #fff; display: block; text-align: center; }
.viewer-toolbar > ul > li.viewer-large.viewer-download { display: grid; place-items: center; }
.viewer-backdrop { background: rgba(10, 18, 24, 0.92); }
