/* FAME project page. Layout follows the HomeBody page (tml.stanford.edu/homebody),
   recoloured with the University of Notre Dame palette. */

:root {
  --nd-blue: #0C2340;        /* Notre Dame Blue */
  --nd-blue-mid: #143865;
  --nd-blue-link: #1C4F8F;
  --nd-gold: #AE9142;        /* Notre Dame Gold: rules, large type, marks */
  --nd-gold-text: #826A2A;   /* gold for small text (5.2:1 on white) */
  --nd-sky: #E1E8F2;

  --ink: var(--nd-blue);
  --text: #2E3A4F;
  --muted: #4B5468;
  --text-2: #5A6275;
  --line: #E3E7EE;
  --surface: #F5F7FA;
  --wash: #F0F4FA;
  --ok: #2E7D4F;
  --fail: #B3261E;

  --bar-fame: var(--nd-blue);
  --bar-base: #8792A6;

  color-scheme: light;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; }
body { margin: 0; background: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img, video { display: block; max-width: 100%; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, video:focus-visible {
  outline: 3px solid var(--nd-gold); outline-offset: 4px; border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: fixed; left: 20px; top: -60px; background: #fff; padding: 12px; z-index: 100; }
.skip:focus { top: 12px; }
.wide { width: calc(100% - 96px); max-width: 1180px; margin-left: auto; margin-right: auto; }

/* ---------- Header ---------- */
.header {
  height: 84px; padding: 0 4.5%;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-top: 6px solid var(--nd-blue);
  box-shadow: inset 0 3px 0 var(--nd-gold);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.lab-mark { display: flex; align-items: center; gap: 14px; color: var(--nd-blue); }
.lab-mark-name { font-size: 26px; font-weight: 700; letter-spacing: .04em; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px;
  border-radius: 40px; background: #F1F3F7; color: var(--nd-blue);
  font-size: 14px; font-weight: 600; white-space: nowrap; transition: background .2s, transform .2s;
}
.pill:hover { background: var(--nd-sky); transform: translateY(-2px); }
.pill.is-pending { position: relative; cursor: default; color: var(--text-2); }
.pill.is-pending:hover { background: #F1F3F7; transform: none; }

/* ---------- Intro ---------- */
.intro { text-align: center; padding: 48px 24px 34px; }
.intro h1 {
  max-width: 1080px; margin: 0 auto; color: var(--ink);
  font-size: clamp(30px, 3.1vw, 43px); font-weight: 600; line-height: 1.22; letter-spacing: -1px;
  text-wrap: balance;
}
.paper-name { color: var(--nd-gold); }
.authorship { margin-top: 24px; }
.author-list {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px;
  list-style: none; margin: 0; padding: 0; font-size: 17px; line-height: 1.6; color: var(--nd-blue-link);
}
.author-list li { white-space: nowrap; }
.author-list sup { color: var(--text-2); font-size: .68em; margin-left: 1px; }
.author-affiliations { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 24px; margin: 8px 0 0; font-size: 16px; color: var(--ink); font-weight: 550; }
.author-affiliations sup { color: var(--nd-gold-text); font-weight: 600; }
.publication-date {
  display: inline-block; margin: 14px 0 0; padding: 5px 12px; border-radius: 20px;
  background: var(--wash); color: var(--nd-blue); font-size: 14px; font-weight: 600;
}

/* ---------- Hero video ---------- */
.hero-video { margin-top: 0; margin-bottom: 0; }
.video-frame { position: relative; border-radius: 16px; overflow: hidden; background: #DDE2EA; aspect-ratio: 16 / 9; }
.video-frame video { width: 100%; height: 100%; object-fit: cover; }
.hero-play {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: 40px; padding: 12px 22px 12px 16px; cursor: pointer;
  background: var(--nd-blue); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(12, 35, 64, .28); transition: transform .2s, background .2s;
}
.hero-play:hover { background: var(--nd-blue-mid); transform: translateX(-50%) translateY(-2px); }
.hero-play svg { width: 22px; height: 22px; fill: var(--nd-gold); }
.hero-play small { font-size: 13px; font-weight: 500; color: #C9D3E3; }
.video-frame.is-playing .hero-play { display: none; }

/* ---------- Opening ---------- */
.opening { margin-top: 48px; }
.summary { max-width: 860px; margin: 0 auto; font-size: 18px; line-height: 1.7; color: var(--muted); }
.summary p { margin: 0 0 20px; }
.summary strong { color: var(--ink); font-weight: 600; }
.opening-question { color: var(--ink); text-decoration: underline; text-decoration-color: var(--nd-gold); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.opening .figure { margin-top: 36px; }

/* ---------- Figures ---------- */
.figure { margin: 40px 0 0; }
.figure-link { display: block; cursor: zoom-in; }
.figure img { width: 100%; height: auto; }
.figure figcaption, .chart-card figcaption {
  margin-top: 16px; font-size: 14px; line-height: 1.7; color: var(--text-2);
}
.figure figcaption strong { color: var(--ink); font-weight: 600; }

/* ---------- Article layout ---------- */
.article-layout {
  max-width: 1110px; margin: 88px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: 215px minmax(0, 760px); gap: 68px;
}
.contents { position: sticky; top: 40px; align-self: start; padding-top: 6px; }
.contents nav { display: flex; flex-direction: column; gap: 18px; }
.contents nav a { display: flex; gap: 13px; font-size: 14px; line-height: 1.5; color: var(--text-2); transition: color .15s; }
.contents nav a span { color: #A3AAB8; font-size: 12px; padding-top: 1px; font-variant-numeric: tabular-nums; }
.contents nav a:hover { color: var(--nd-blue); }
.contents nav a.active { color: var(--nd-blue); font-weight: 600; }
.contents nav a.active span { color: var(--nd-gold-text); }

.chapter { padding-bottom: 72px; margin-bottom: 72px; border-bottom: 1px solid var(--line); scroll-margin-top: 32px; }
.chapter-heading { margin-bottom: 8px; }
.chapter-number { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 600; letter-spacing: .12em; color: var(--nd-gold-text); }
.chapter h2 { margin: 0 0 16px; font-size: clamp(30px, 3vw, 40px); font-weight: 550; line-height: 1.2; letter-spacing: -1px; color: var(--ink); text-wrap: balance; }
.article p { font-size: 17px; line-height: 1.75; color: var(--muted); margin: 0 0 18px; }
.article p b { color: var(--ink); font-weight: 600; }
.chapter-heading > p { margin: 0; }
.subsection { margin-top: 44px; }
.subsection h3, .scope-note h3 { margin: 0 0 12px; font-size: 24px; font-weight: 550; line-height: 1.35; letter-spacing: -.4px; color: var(--ink); }
.chapter-note { margin-top: 28px !important; }
.math { white-space: nowrap; color: var(--ink); }
.math-block {
  margin: 4px 0 22px; padding: 18px 20px; border-radius: 12px; background: var(--surface);
  border-left: 3px solid var(--nd-gold);
  font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", Georgia, serif;
  font-size: 18px; line-height: 1.6; color: var(--ink); overflow-x: auto; white-space: nowrap;
}

/* ---------- Chart ---------- */
.chart-card { margin: 36px 0 0; padding: 24px 24px 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.chart-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink); }
.article .chart-sub { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.segmented button {
  min-height: 36px; padding: 6px 14px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.segmented button[aria-pressed="true"] { background: #fff; color: var(--nd-blue); box-shadow: 0 1px 3px rgba(12, 35, 64, .14); }

.bar-chart { position: relative; }
.bar-grid { position: absolute; top: 0; bottom: 26px; left: var(--label-w); right: 56px; pointer-events: none; }
.bar-grid span { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.bar-grid span::after {
  content: attr(data-v); position: absolute; top: calc(100% + 8px); left: 0; transform: translateX(-50%);
  font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.bar-rows { position: relative; display: flex; flex-direction: column; gap: 10px; padding-bottom: 26px; }
.bar-row { display: grid; grid-template-columns: var(--label-w) 1fr; align-items: center; min-height: 36px; cursor: default; }
.bar-label { font-size: 14px; color: var(--text); padding-right: 14px; }
.bar-row.is-fame .bar-label { font-weight: 700; color: var(--ink); }
.bar-track { position: relative; height: 22px; margin-right: 56px; }
.bar {
  position: absolute; left: 0; top: 0; height: 100%; width: 0;
  background: var(--bar-base); border-radius: 0 4px 4px 0;
  transition: width .5s cubic-bezier(.2, .7, .2, 1);
}
.bar-row.is-fame .bar { background: var(--bar-fame); }
.bar-value {
  position: absolute; top: 50%; transform: translate(8px, -50%); left: 0;
  font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: left .5s cubic-bezier(.2, .7, .2, 1);
}
.bar-row:hover .bar, .bar-row:focus-within .bar { filter: brightness(1.12); }
.chart-tip {
  position: absolute; z-index: 10; pointer-events: none; min-width: 190px;
  padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(12, 35, 64, .14); font-size: 13px; line-height: 1.5; color: var(--text);
  opacity: 0; transition: opacity .12s;
}
.chart-tip.is-on { opacity: 1; }
.chart-tip strong { display: block; margin-bottom: 4px; color: var(--ink); }
.chart-tip div { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.chart-tip div span:first-child { color: var(--text-2); }

/* ---------- Tabs + clips ---------- */
.compare { margin-top: 36px; }
.tab-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab-row button {
  min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text-2); font-size: 14px; font-weight: 550; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tab-row button:hover { color: var(--nd-blue); border-color: #C9D3E3; }
.tab-row button[aria-selected="true"] { color: var(--nd-blue); border-color: var(--nd-blue); background: var(--wash); }
.clip { width: 100%; height: auto; border-radius: 12px; background: var(--surface); cursor: pointer; }
.article .clip-caption, .clip-figure figcaption {
  margin: 12px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-2);
}
.clip-caption b { color: var(--ink); font-weight: 600; }
.clip-figure { margin: 24px 0 0; }

.real-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 620px; }
.real-pair figure { margin: 0; }
.real-pair figcaption { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 15px; font-weight: 600; color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 6px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-ok { color: var(--ok); background: #E8F3EC; }
.badge-fail { color: var(--fail); background: #FBEAE9; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 0; }
.stat { padding: 16px 18px; border-radius: 12px; background: var(--surface); }
.stat dt { font-size: 13px; line-height: 1.4; color: var(--text-2); }
.stat dd { margin: 8px 0 0; display: flex; flex-direction: column; gap: 2px; }
.stat-fame { font-size: 26px; font-weight: 650; color: var(--ink); letter-spacing: -.5px; }
.stat-fame::before { content: "FAME "; font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--nd-gold-text); }
.stat-base { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Scope, citation, footer ---------- */
.scope-note { margin-top: 56px; padding: 24px 24px 6px; border-radius: 16px; background: var(--surface); }
.article .scope-note p { font-size: 16px; }

.citation-block { scroll-margin-top: 32px; margin-bottom: 40px; }
.citation-block h2 { margin: 0 0 14px; font-size: 24px; font-weight: 550; color: var(--ink); letter-spacing: -.4px; }
.bibtex-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.article .bibtex-head p { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.copy-bibtex {
  min-height: 40px; padding: 8px 18px; border: 0; border-radius: 22px; cursor: pointer;
  background: #F1F3F7; color: var(--nd-blue); font-size: 14px; font-weight: 600;
}
.copy-bibtex:hover { background: var(--nd-sky); }
.bibtex {
  margin: 0; padding: 18px; overflow: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: 13px; line-height: 1.6; color: var(--ink);
}
.bibtex code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy-status { display: block; min-height: 20px; margin-top: 8px; font-size: 13px; color: var(--ok); }

.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 24px; padding: 28px 0 40px; border-top: 3px solid var(--nd-blue);
  font-size: 14px; color: var(--text-2);
}
.footer-inst { color: var(--nd-blue); font-weight: 600; }
.footer a { color: var(--nd-blue); font-weight: 600; }
.footer a:hover { color: var(--nd-gold-text); }

/* ---------- Responsive ---------- */
@media (max-width: 1050px) {
  .wide { width: calc(100% - 64px); }
  .article-layout { grid-template-columns: 165px minmax(0, 1fr); gap: 38px; margin: 72px 32px 0; padding: 0; }
  .contents nav a { font-size: 13px; }
}
@media (max-width: 760px) {
  .header { height: 70px; padding: 0 16px; }
  .lab-mark { gap: 10px; }
  .lab-mark-name { font-size: 22px; }
  .pill { min-height: 40px; padding: 8px 14px; font-size: 13px; }
  .intro { padding: 32px 16px 26px; }
  .intro h1 { font-size: 28px; letter-spacing: -.6px; line-height: 1.25; }
  .author-list { font-size: 15px; gap: 4px 14px; }
  .author-affiliations { font-size: 14px; }
  .wide { width: calc(100% - 32px); }
  .video-frame { border-radius: 12px; }
  .hero-play { bottom: 10px; gap: 8px; padding: 7px 14px 7px 10px; font-size: 13px; white-space: nowrap; }
  .hero-play svg { width: 18px; height: 18px; }
  .hero-play small { display: none; }
  .opening { margin-top: 32px; }
  .summary { font-size: 16px; }
  .article-layout { display: block; margin: 56px 16px 0; }
  .contents { display: none; }
  .chapter { padding-bottom: 52px; margin-bottom: 52px; }
  .chapter h2 { font-size: 29px; letter-spacing: -.6px; }
  .article p { font-size: 16px; line-height: 1.7; }
  .subsection h3, .scope-note h3 { font-size: 21px; }
  .math-block { font-size: 15px; padding: 14px; }
  .chart-card { padding: 18px 14px 14px; }
  .bar-track { margin-right: 48px; }
  .bar-grid { right: 48px; }
  .stat-row { grid-template-columns: 1fr; }
  .tab-row button { flex: 1 1 auto; font-size: 13px; padding: 10px 12px; }
  .scope-note { padding: 18px 16px 2px; }
}
@media (max-width: 480px) {
  .header-actions { gap: 6px; }
  .pill { padding: 8px 12px; font-size: 12.5px; }
  .pill-video { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
