:root {
  --cardinal: #9F1C1F;
  --cardinal-dark: #7A1517;
  --cardinal-light: #F4E6E7;
  --cardinal-mid: #D8A6A7;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --paper: #ffffff;
  --bg: #fbfaf9;
  --line: #e7e2df;
  --radius: 10px;
  --maxw: 980px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cardinal); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

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

/* NAV */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 249, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--cardinal);
  font-size: 1.05rem;
}
.nav-links {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0; padding: 0;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
}
.nav-links a:hover { color: var(--cardinal); text-decoration: none; }

/* HERO */
.hero {
  padding: 64px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  line-height: 1.15;
}
.hero h1 .brand { color: var(--cardinal); }
.authors {
  font-size: 1.08rem;
  margin: 0 0 6px;
  color: var(--ink);
}
.authors sup { color: var(--cardinal); font-weight: 700; }
.affil {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0 0 26px;
}
.badge-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1.5px solid var(--cardinal);
  color: var(--cardinal);
  background: var(--paper);
  transition: all 0.15s ease;
}
.badge:hover { background: var(--cardinal); color: #fff; text-decoration: none; }
.badge.soon {
  border-color: var(--line);
  color: #9a9a9a;
  cursor: default;
  background: #f2f0ee;
}
.badge.soon:hover { background: #f2f0ee; color: #9a9a9a; }

/* SECTIONS */
section {
  padding: 46px 0;
  border-top: 1px solid var(--line);
}
section:first-of-type { border-top: none; }
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--cardinal);
  margin: 0 0 10px;
}
h2.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}
h3.sub-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 30px 0 12px;
}
p { color: var(--ink-soft); }
p.lead {
  font-size: 1.05rem;
  color: var(--ink);
}

.abstract-box {
  background: var(--cardinal-light);
  border: 1px solid var(--cardinal-mid);
  border-radius: var(--radius);
  padding: 26px 30px;
  color: var(--ink);
  font-size: 0.98rem;
}

.tldr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
}
.tldr-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.tldr-card .icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
  display: block;
}
.tldr-card h4 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}
.tldr-card p { font-size: 0.88rem; margin: 0; }

/* FIGURES */
figure {
  margin: 0 0 2px;
  text-align: center;
}
figure img {
  max-width: 100%;
  width: 100%;
  height: auto;
}
figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 2px;
  text-align: left;
  padding: 0 4px;
}
figcaption b { color: var(--ink); }

h2.section-title + figure,
h3.sub-title + figure { margin-top: -12px; }

.figure-medium img { height: 760px; width: auto; max-width: 100%; }
.figure-small img { max-height: 520px; width: auto; }

/* Interactive diagram */
.diagram-stage {
  position: relative;
  width: 100%;
  max-width: 564px;
  height: auto;
  aspect-ratio: 176 / 237;
  margin: 0 auto;
}
.diagram-svg-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.diagram-svg-host > svg {
  display: block;
  width: 100%;
  height: 100%;
}
/* SVG's default transform-box (view-box) is applied inconsistently across
   browsers once elements carry a clip-path, which is what caused the
   keyframe cache photos to render at the wrong position/size on some
   mobile browsers - anchor every JS-animated element to its own geometry
   instead */
.diagram-svg-host [data-cell-id] {
  transform-box: fill-box;
}
.diagram-video-slot {
  position: absolute;
  left: 4.86%;
  top: 57.36%;
  width: 29.92%;
  height: 16.03%;
  border-radius: 6px;
  border: 2px solid #000;
  overflow: hidden;
  background: #14181c;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.diagram-video-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@keyframes unimem-border-flash {
  0%, 100% { border-color: #000; }
  50% { border-color: #cc0000; }
}
@keyframes unimem-tip-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

.figure-wide {
  width: 70vw;
  max-width: 1300px;
  margin-left: 50%;
  transform: translateX(-50%);
}
.figure-wide img { width: 100%; max-width: 100%; }
.figure-wide figcaption {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.two-col-figs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* TABLES */
.table-wrap {
  overflow-x: auto;
  margin: 18px 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  background: var(--paper);
}
thead th {
  background: var(--cardinal);
  color: #fff;
  text-align: center;
  padding: 12px 10px;
  font-weight: 700;
  white-space: nowrap;
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 10px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}
tbody td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.avg-row td {
  font-weight: 800;
  color: var(--ink);
  background: var(--cardinal-light);
}
td.best { color: var(--cardinal); font-weight: 800; }
.table-note {
  font-size: 0.78rem;
  color: #8a8a8a;
  margin: 8px 2px 0;
}

/* TASK CARDS w/ video tabs */
.task-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 22px;
}
.task-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.task-card-head h4 {
  margin: 0;
  font-size: 1.05rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--cardinal-dark);
}
.task-prompt {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0 0 16px;
  font-style: italic;
}
.tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tab-btn {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.tab-btn:hover { border-color: var(--cardinal-mid); color: var(--cardinal-dark); }
.tab-btn.active {
  background: var(--cardinal);
  border-color: var(--cardinal);
  color: #fff;
}
.tab-btn .rate {
  opacity: 0.75;
  font-weight: 500;
  margin-left: 4px;
}

.video-slot {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1.5px dashed var(--cardinal-mid);
  background: repeating-linear-gradient(135deg, #fdf7f7, #fdf7f7 10px, #fbeeee 10px, #fbeeee 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--cardinal-dark);
  text-align: center;
  padding: 20px;
}
.video-slot .vs-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.video-slot .vs-sub {
  font-size: 0.8rem;
  color: #b06a6c;
}
.video-slot .vs-icon { font-size: 1.6rem; opacity: 0.6; }

.video-slot.has-video {
  display: block;
  aspect-ratio: auto;
  border: 1px solid var(--line);
  background: #0b0b0c;
  padding: 0;
  overflow: hidden;
}
.video-slot .vs-caption {
  padding: 9px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.video-slot .vs-videos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #0b0b0c;
}
.video-slot .vs-video-item {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  background: #000;
}
.video-slot .vs-video-item.vs-video-sim {
  width: min(100%, 420px);
  height: auto;
}

.analysis {
  margin-top: 14px;
  font-size: 0.87rem;
  border-left: 3px solid var(--cardinal-mid);
  padding-left: 14px;
  color: var(--ink-soft);
}
.analysis b { color: var(--ink); }

/* LEGEND */
.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 4px 0 24px;
}
.legend span b { color: var(--ink); }

/* CONTRIBUTIONS LIST */
.contrib-list {
  margin: 18px 0;
  padding: 0;
  list-style: none;
}
.contrib-list li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.contrib-list li:last-child { border-bottom: none; }
.contrib-num {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--cardinal);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* LIMITATIONS */
.limit-list { padding-left: 20px; }
.limit-list li { margin-bottom: 10px; color: var(--ink-soft); }

/* BIBTEX */
.bibtex-box {
  background: #1e1e1e;
  color: #d8d8d8;
  border-radius: var(--radius);
  padding: 22px 24px;
  font-size: 0.82rem;
  overflow-x: auto;
  position: relative;
  white-space: pre;
}
.copy-btn {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--cardinal);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.copy-btn:hover { background: var(--cardinal-dark); }

/* FOOTER */
footer {
  padding: 34px 0 60px;
  text-align: center;
  color: #9a9a9a;
  font-size: 0.82rem;
}
footer a { color: #9a9a9a; text-decoration: underline; }

@media (max-width: 720px) {
  .hero h1 { font-size: 1.7rem; }
  .tldr-grid { grid-template-columns: 1fr; }
  .two-col-figs { grid-template-columns: 1fr; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.8rem; }
  table { font-size: 0.78rem; }
}
