/* ===== Meta-Ctrl project page ===== */
:root {
  --ink:    #1c1b18;
  --muted:  #6e6a61;
  --rule:   #e6e3da;
  --accent: #8a2f2c;
  --bg:     #fdfdfb;
  --soft:   #f6f4ee;
  --serif:  "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --sans:   -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono:   ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- masthead ---------- */
.masthead {
  max-width: 880px;
  margin: 0 auto;
  padding: 72px 24px 8px;
  text-align: center;
}
.masthead h1 {
  font-size: 33px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -.01em;
  margin: 0 auto 26px;
  max-width: 780px;
}
.authors { font-size: 16.5px; margin: 0 0 4px; line-height: 1.75; }
.authors a { color: var(--ink); }
.authors a:hover { color: var(--accent); }
.authors sup { font-size: 11px; color: var(--muted); }
.affil { color: var(--muted); font-size: 15px; margin: 0 0 4px; line-height: 1.7; }
.affil sup { font-size: 10.5px; }
.eqcontrib { font-size: 13.5px; color: var(--muted); margin: 0 0 26px; }

.links { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.btn {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  border: 1px solid #d5d1c6;
  border-radius: 6px;
  padding: 7px 16px;
  background: transparent;
}
.btn:hover { background: var(--soft); text-decoration: none; }

/* ---------- layout ---------- */
section { max-width: 760px; margin: 0 auto; padding: 26px 24px 6px; }
h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 26px 0 14px;
}
p { margin: 0 0 16px; }
b, strong { font-weight: 600; }
.small { font-family: var(--sans); font-size: 13.5px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: .84em; }

/* wide elements break out of the text column */
.bleed, .table-wrap.bleed, figure.bleed {
  width: min(960px, calc(100vw - 48px));
  margin-left: 50%;
  transform: translateX(-50%);
}

/* ---------- figures & video ---------- */
figure { margin: 26px 0 22px; }
figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
}
figcaption {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 10px;
}
figcaption b { color: var(--ink); font-weight: 600; }

.hero-video { max-width: 880px; margin: 40px auto 0; padding: 0 24px; }
.hero-video video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
}
.hero-video figcaption { text-align: center; }

/* ---------- equations ---------- */
mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 2px 0; }

/* ---------- tables (booktabs style) ---------- */
.table-wrap { overflow-x: auto; margin: 6px 0 10px; }
table {
  border-collapse: collapse;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.45;
}
caption {
  caption-side: top;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding: 0 0 10px;
  line-height: 1.5;
}
caption b { color: var(--ink); font-weight: 600; }
th, td { padding: 5px 12px; text-align: center; white-space: nowrap; border: 0; }
th:first-child, td:first-child { text-align: left; }
thead tr:first-child th { border-top: 2px solid var(--ink); padding-top: 8px; }
thead tr:last-child th { border-bottom: 1px solid var(--ink); padding-bottom: 7px; }
thead th { font-weight: 600; }
tbody tr:first-child td { padding-top: 8px; }
tbody tr:last-child td { border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.group-row td {
  font-style: italic;
  color: var(--muted);
  text-align: left;
  padding-top: 11px;
}
.row-ours td { font-weight: 600; background: var(--soft); }
td.best { font-weight: 700; }
.tnote {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 26px;
}
.tnote b { color: var(--ink); }

/* ---------- bibtex ---------- */
.bibtex-wrap { position: relative; margin: 4px 0 8px; }
.bibtex pre {
  background: var(--soft);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid #d5d1c6;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
}
.copy-btn:hover { color: var(--ink); background: var(--soft); }

/* ---------- footer ---------- */
footer {
  max-width: 760px;
  margin: 40px auto 0;
  padding: 22px 24px 48px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .masthead { padding-top: 48px; }
  .masthead h1 { font-size: 26px; }
  h2 { font-size: 21px; }
  .hero-video { margin-top: 28px; }
}
