:root {
  --ink: #2c3e50;
  --text: #333;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #f8f9fa;
  --program: #e74c3c;
  --program-dark: #c0392b;
  --program-soft: #fef2f2;
  --program-identity: #5b4bb7;
  --program-identity-soft: #faf9ff;
  --routing: #0f7899;
  --routing-soft: #eaf7fb;
  --direction: #d65f45;
  --direction-soft: #fff1ed;
  --success: #17875f;
  --warning: #a16207;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
  color: var(--text);
  background: #fff;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
}

h1, h2, h3, h4 { color: var(--ink); }
h1 { margin: 0; font-size: 2.4em; font-weight: 700; line-height: 1.16; letter-spacing: -0.01em; }
h2 { margin: 2.5em 0 1.2em; padding-bottom: 0.3em; border-bottom: 2px solid var(--program); color: #2c3e50; font-size: 1.6em; font-weight: 600; line-height: 1.3; }
h3 { margin: 1.8em 0 0.5em; color: #34495e; font-size: 1.3em; font-weight: 600; }
p, ul, ol { margin: 0 0 1em; font-size: 1.05em; }
p, li { text-align: justify; }
a { color: var(--program); font-weight: 500; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.top-back, .bottom-back { display: block; font-size: 0.95em; font-weight: 600; }
.top-back { margin-bottom: 22px; }
.bottom-back { margin-top: 50px; text-align: center; }

.paper-header { margin-bottom: 34px; text-align: left; }
.paper-header h1 { margin: 0 0 0.7em; color: #3f3f3a; font-size: 2.5em; }
.program-overview-header h1 { margin-bottom: 0; }
.paper-header .authors { margin: 0 0 0.45em; color: #333; font-size: 1.15em; line-height: 1.6; text-align: left; }
.paper-header .authors a { color: #333; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.paper-header .authors a:hover { color: var(--program); }
.paper-header .affil { margin: 0 0 1.15em; color: #777; font-size: 1em; text-align: left; }
.paper-links { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; text-align: left; }
.paper-links a, .button-link { color: #333; font-size: 1.05em; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.paper-links a:hover, .button-link:hover { color: var(--program); }

.program-banner {
  margin: 0 0 2.4em;
  padding: 1em 1.4em;
  border-left: 4px solid var(--program-identity);
  border-radius: 6px;
  background: var(--program-identity-soft);
}
.program-kicker { margin-bottom: 6px; color: var(--program-identity); font-size: 0.76em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.program-banner h2, .program-banner h3 { margin: 0 0 6px; padding: 0; border: 0; color: #34495e; font-size: 1.15em; }
.program-banner p { margin-bottom: 14px; font-size: 0.96em; text-align: left; }
.program-nav { display: flex; flex-wrap: wrap; gap: 7px 18px; }
.program-nav a {
  color: var(--program-identity);
  font-size: 0.88em;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.program-nav a[aria-current="page"] { font-weight: 700; text-decoration-thickness: 2px; }

.tldr {
  margin: 0 0 2.4em;
  padding: 1em 1.4em;
  border: 1px solid #f59e0b;
  border-left: 5px solid #f59e0b;
  border-radius: 6px;
  background: #fffbeb;
  font-size: 0.98em;
}
.tldr p { margin: 0; text-align: left; }
.tldr strong:first-child { color: #92400e; }

figure { margin: 2.5em 0; text-align: center; }
figcaption { max-width: 85%; margin: 0.8em auto 0; color: #7f8c8d; font-size: 0.9em; line-height: 1.5; }
.figure-image { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.figure-link { display: block; border-radius: 14px; }
.figure-link .figure-image { display: block; width: 100%; }
.figure-link:hover .figure-image, .figure-link:focus-visible .figure-image { border-color: var(--program); }
.fig-shell { padding: 26px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }

.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: 2em 0; }
.stat-tile { padding: 17px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: center; }
.stat-tile .num { color: #2c3e50; font-size: 2em; font-weight: 700; line-height: 1; }
.stat-tile .label { margin-top: 7px; color: var(--muted); font-size: 0.8em; line-height: 1.4; }

.insight-box, .solution-box { margin: 2em 0; padding: 22px 24px; border-radius: 10px; }
.insight-box { color: #fff; background: linear-gradient(135deg, var(--program) 0%, var(--program-dark) 100%); }
.solution-box { color: #fff; background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%); }
.quiet-note { margin: 2em 0; padding: 1em 1.4em; border-left: 4px solid #94a3b8; border-radius: 6px; background: var(--surface); color: #475569; font-size: 0.97em; }
.insight-box h3, .insight-box h4, .solution-box h3, .solution-box h4 { margin-top: 0; margin-bottom: 0.5em; color: #fff; font-size: 1.15em; }
.insight-box p, .solution-box p, .quiet-note p { margin-bottom: 0; text-align: left; }

.equation {
  margin: 1.4em 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 1.02em;
  font-weight: 600;
  text-align: center;
}

.flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; align-items: stretch; }
.flow-card { position: relative; min-height: 150px; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.flow-card .step { margin-bottom: 7px; color: var(--program); font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.flow-card h4 { margin: 0 0 7px; font-size: 1em; }
.flow-card p { margin: 0; color: var(--muted); font-size: 0.86em; line-height: 1.48; text-align: left; }

.toggle-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 20px; }
.toggle-row button {
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 24px;
  color: #475569;
  background: #fff;
  font-family: inherit;
  font-size: 0.84em;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.toggle-row button.active { border-color: #2c3e50; color: #fff; background: #2c3e50; }

.metric-bars { display: grid; gap: 10px; }
.metric-bar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr 58px; gap: 10px; align-items: center; }
.metric-bar .name { overflow: hidden; color: #475569; font-size: 0.8em; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 20px; overflow: hidden; border-radius: 999px; background: #e8edf2; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--routing), #4aaec4); transition: width 0.45s ease; }
.metric-bar .value { color: var(--ink); font-size: 0.8em; font-weight: 700; font-variant-numeric: tabular-nums; }

.contrast-chart { display: grid; gap: 14px; }
.contrast-guide { display: flex; justify-content: space-between; margin: 0 185px 10px 122px; color: var(--muted); font-size: 0.75em; }
.contrast-row { display: grid; grid-template-columns: 110px 1fr 185px; gap: 12px; align-items: center; }
.contrast-label { color: var(--ink); font-size: 0.84em; font-weight: 700; text-align: right; }
.contrast-axis { position: relative; height: 28px; border-radius: 5px; background: linear-gradient(90deg, #fff1ed 0 49.6%, #e2e8f0 49.6% 50.4%, #edf9f5 50.4% 100%); }
.contrast-marker { position: absolute; top: 4px; width: 20px; height: 20px; border: 3px solid #fff; border-radius: 50%; background: var(--program); box-shadow: 0 1px 5px rgba(15, 23, 42, 0.25); transform: translateX(-50%); }
.contrast-value { color: var(--muted); font-size: 0.78em; font-variant-numeric: tabular-nums; }

.program-hero { overflow: hidden; margin: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.program-hero img { display: block; width: 100%; }
.study-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 1.6em 0; }
.study-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: #fff; }
.study-card:hover { border-color: var(--program); text-decoration: none; }
.study-card img { display: block; width: 100%; height: 210px; padding: 12px; object-fit: contain; background: var(--surface); }
.study-card-body { display: flex; flex: 1; flex-direction: column; padding: 20px; }
.study-card .eyebrow { margin-bottom: 7px; color: var(--program); font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.study-card h3 { margin: 0 0 8px; font-size: 1.13em; line-height: 1.35; }
.study-card p { margin: 0; color: var(--muted); font-size: 0.9em; text-align: left; }
.study-card .cta { margin-top: auto; padding-top: 14px; color: var(--program-dark); font-size: 0.84em; font-weight: 700; }

.roadmap { position: relative; margin: 1.8em 0; padding-left: 24px; }
.roadmap::before { position: absolute; top: 7px; bottom: 8px; left: 7px; width: 2px; background: #fecaca; content: ""; }
.roadmap-item { position: relative; margin-bottom: 22px; padding-left: 18px; }
.roadmap-item::before { position: absolute; top: 7px; left: -22px; width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50%; background: var(--program); box-shadow: 0 0 0 2px #f2aaa2; content: ""; }
.roadmap-item.future::before { background: #fff; }
.roadmap-item h3 { margin: 0 0 4px; font-size: 1em; }
.roadmap-item p { margin: 0; color: var(--muted); font-size: 0.9em; text-align: left; }

.bibtex-block { margin: 1.2em 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.bibtex-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; color: var(--muted); background: #f1f5f9; font-size: 0.82em; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.bibtex-head button { padding: 4px 12px; border: 1px solid #cbd5e1; border-radius: 6px; color: #475569; background: #fff; font-family: inherit; font-size: 0.9em; font-weight: 700; line-height: 1.4; cursor: pointer; letter-spacing: 0; text-transform: none; }
.case-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; max-width: 760px; margin: 0 auto; }
.bibtex-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; color: #334155; background: #fbfbfa; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 0.84em; line-height: 1.55; text-align: left; white-space: pre; }

@media (max-width: 720px) {
  body { padding: 24px 16px 48px; }
  .paper-header h1 { font-size: 2.05em; }
  p, li { text-align: left; }
  .stat-strip, .flow-grid, .study-grid { grid-template-columns: 1fr; }
  .study-card img { height: 190px; }
  .metric-bar { grid-template-columns: 86px 1fr 50px; }
  .contrast-row { grid-template-columns: 82px 1fr; }
  .contrast-value { grid-column: 2; }
  .contrast-guide { margin: 0 0 10px 94px; }
  .case-grid { grid-template-columns: 1fr; }
  .case-grid > div:nth-child(2) { transform: rotate(90deg); }
  figcaption { max-width: 100%; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
