:root {
  --bg: #fbfaf7;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --rule: #e6e3dc;
  --accent: #3a3f9c;
  --accent-soft: #eceefb;
  --code-bg: #f1efea;
  --max-w: 1100px;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }

h1, h2, h3 {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  line-height: 1.2;
  margin: 0 0 1.25rem;
}

h2 {
  font-size: 1.45rem;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

p { margin: 0 0 1em; }

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

code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ------- layout ------- */

header.hero,
main,
footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

header.hero {
  padding-top: 5.5rem;
  padding-bottom: 1rem;
  text-align: center;
}

main { padding-bottom: 4rem; }

footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

footer p { margin: 0.25em 0; }
footer .fine { color: #8a8a8a; font-size: 0.85rem; }

/* ------- hero ------- */

.venue {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.authors {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  font-size: 1.05rem;
}

.authors .author-link { font-weight: 500; }

.authors sup {
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

.affiliations {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.25rem 0 1.75rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  background: #111;
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid #111;
  transition: background 120ms ease, transform 120ms ease;
}

.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  border-bottom-color: var(--accent);
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 0.95em;
  display: inline-block;
  line-height: 1;
}

/* ------- video demos ------- */

.video-demos {
  margin-top: 2.25rem;
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 1.5rem;
  max-width: 1500px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.video-fig {
  margin: 0;
}

.video-fig video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: #000;
}

.video-fig figcaption {
  text-align: center;
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .video-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ------- figure rows (3-up SVG grids) ------- */

.fig-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin: 1.75rem 0 0.5rem;
}

.fig-row figure {
  margin: 0;
}

.fig-row figure figcaption {
  text-align: center;
}

.fig-caption-shared {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

.fig-row.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.fig-row.cols-2-center {
  grid-template-columns: repeat(2, 1fr);
  max-width: 66%;
  margin-left: auto;
  margin-right: auto;
}

/* ------- static figures ------- */

figure {
  margin: 1.75rem 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--rule);
}

html[data-theme="dark"] figure img {
  background: #1c1c20;
}

figcaption {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ------- sections ------- */

.tldr {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 2.5rem;
}
.tldr h2 {
  border: none;
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.tldr p { margin: 0; }

.contribs {
  padding-left: 1.25rem;
  margin: 0;
}
.contribs li {
  margin-bottom: 0.9rem;
  padding-left: 0.3rem;
}
.contribs li::marker { color: var(--accent); font-weight: 600; }

.muted-text { color: var(--muted); }

.fig-narrow { max-width: 420px; }

/* ------- results table ------- */

.results-table-wrap {
  margin: 1.75rem 0;
  overflow-x: auto;
}

.table-caption {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  font-variant-numeric: tabular-nums;
}

.results-table th,
.results-table td {
  padding: 0.65rem 1.1rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

.results-table th:first-child,
.results-table td:first-child {
  text-align: left;
}

.results-table thead tr {
  border-bottom: 2px solid var(--rule);
}

.results-table thead th {
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr:hover td {
  background: var(--accent-soft);
}

.results-table td.best {
  font-weight: 600;
  color: var(--accent);
}

.results-table .sem {
  font-size: 0.88em;
  color: var(--muted);
  font-weight: 400;
}

/* ------- bibtex ------- */

.bibtex-wrap {
  position: relative;
  margin-top: 0.75rem;
}

.bibtex-wrap pre {
  background: var(--code-bg);
  color: var(--text);
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 0;
}

.bibtex-wrap pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--rule);
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-family: inherit;
  border-radius: 5px;
  cursor: pointer;
  transition: background 120ms ease;
}
.copy-btn:hover { background: var(--accent-soft); }
.copy-btn.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ------- responsive ------- */

@media (max-width: 560px) {
  body { font-size: 16px; }
  header.hero { padding-top: 2.5rem; }
  .btn { padding: 0.5rem 0.85rem; font-size: 0.88rem; }
  .authors { gap: 0.75rem 1rem; font-size: 1rem; }
}

/* ------- theme toggle button ------- */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}

/* color-scheme lets light-dark() SVGs (draw.io) follow the page toggle */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

/* ------- dark theme ------- */

html[data-theme="dark"] {
  --bg: #131316;
  --text: #ececec;
  --muted: #a2a2a8;
  --rule: #2a2a30;
  --accent: #9aa2ff;
  --accent-soft: #1c1d2b;
  --code-bg: #222228;
}
html[data-theme="dark"] .btn { background: #ececec; color: #131316; border-color: #ececec; }
html[data-theme="dark"] .btn:hover { background: var(--accent); border-color: var(--accent); color: #0d0d12; }
html[data-theme="dark"] figure img { background: #1c1c20; border-color: #2a2a30; }
