:root {
  --text: #1d1d1f;
  --muted: #5b616b;
  --bg: #ffffff;
  --alt: #f5f6f8;
  --line: #e3e5e9;
  --accent: #3d6db3;      /* Proposed (paper colour) */
  --norel: #c0392b;       /* No Relaxation */
  --sig: #e08a2e;         /* Signorini-Relaxed */
  --ppo: #cd4f2b;         /* PPO (Fig. 10) */
  --radius: 14px;
  --wide: 76rem;          /* page column: figures, captions, and the text between them */
  --text-w: 56rem;        /* abstract and section intros */
  --para-w: 64rem;        /* longest line of a paragraph or caption in the page column */
}

/* sizes are in rem, so the whole page scales up on wide screens */
html { font-size: 17px; scroll-behavior: smooth; scroll-padding-top: 3.4rem; }
@media (min-width: 1600px) { html { font-size: 18px; } }
@media (min-width: 2200px) { html { font-size: 20px; } }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
sub, sup { line-height: 0; }
.katex { font-size: 1.1em; }   /* inline math (KaTeX), sized to the x-height of Inter */

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
.wrap.wide { max-width: 112rem; }   /* video rows of the comparisons: nearly the full window */
.text { max-width: var(--text-w); margin-left: auto; margin-right: auto; }

/* ---------- top navigation ---------- */
nav.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap {
  display: flex; gap: 1.5rem; justify-content: center;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  padding-top: .65rem; padding-bottom: .65rem; font-size: .88rem; font-weight: 500;
}
nav.top .wrap::-webkit-scrollbar { display: none; }
nav.top a { color: var(--muted); }
nav.top a:hover { color: var(--text); text-decoration: none; }

/* ---------- hero ---------- */
header.hero { text-align: center; padding: 3.8rem 0 .5rem; }
.hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.5rem); line-height: 1.18; letter-spacing: -0.02em;
  margin: 0 auto; max-width: 62rem; font-weight: 700; text-wrap: balance;
}
.authors { font-size: 1.1rem; margin: 1.6rem 0 .1rem; }
.affil { color: var(--muted); font-size: .9rem; margin: 0; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.4rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.1rem; border-radius: 999px;
  background: var(--text); color: #fff; font-weight: 600; font-size: .9rem;
  transition: background 0.15s ease;
}
.btn:hover { background: #000; text-decoration: none; }
.btn svg { width: 1em; height: 1em; flex: none; }
.btn.disabled { background: #dfe2e6; color: #6b7078; cursor: default; }

/* ---------- teaser ---------- */
.teaser { position: relative; margin: 2.2rem auto 0; }   /* the full page column */
.teaser video { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); background: #111; }
/* training budget over the video's top-right corner; the attachment's own scene label sits top-left */
.teaser .badge {
  position: absolute; top: 1rem; right: 1rem; max-width: 55%; margin: 0; padding: .5rem .85rem;
  border-radius: 10px; background: rgba(12, 14, 18, .66); color: #fff;
  font-size: 1.08rem; font-weight: 600; line-height: 1.35; text-align: left;
}
.teaser .label { margin: .8rem auto 0; color: #2b2f36; font-size: 1.02rem; text-wrap: balance; }

/* ---------- sections ---------- */
section { padding: 4.4rem 0; }
section.alt { background: var(--alt); }
.kicker {
  display: block; text-align: center; color: var(--accent); font-weight: 600;
  font-size: .78rem; letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: .4rem;
}
h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -0.018em; line-height: 1.2; margin: 0 0 1.2rem; text-align: center; text-wrap: balance; }
.subtitle {   /* a line under a section title */
  max-width: var(--text-w); margin: -.55rem auto 1.4rem; text-align: center; text-wrap: balance;
  font-size: 1.24rem; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em; color: #3a3f47;
}
h3 { font-size: 1.4rem; letter-spacing: -0.01em; line-height: 1.3; margin: 3rem 0 .5rem; }
p { margin: 0 0 .85rem; }
p, figcaption { text-wrap: pretty; }   /* no one-word last lines where the browser supports it */
section p { max-width: var(--para-w); }
.lead { max-width: var(--text-w); margin: 0 auto 1rem; text-align: center; font-size: 1.08rem; color: #2b2f36; }
.abstract { text-align: justify; hyphens: auto; }

/* ---------- figures ---------- */
/* a figure spans the page column, with its caption left-aligned under it */
figure { margin: 1.2rem 0 0; }
figure a { display: block; }
figure img {
  width: 100%; height: auto; background: #fff;
  border-radius: 10px; border: 1px solid var(--line);
}
/* the paper's captions, kept verbatim: balanced lines (Chrome balances up to six), and at 62rem they also end on
   well-filled lines where balance is not supported */
figcaption {
  max-width: 62rem; margin: .7rem 0 0; font-size: .86rem; line-height: 1.55; color: var(--muted); text-wrap: balance;
}
figcaption b { color: var(--text); }

/* ---------- clips ---------- */
/* two clips per row; a .sync block shows the three methods side by side, with buttons for the pull or task */
.clips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.4rem; margin-top: 1.6rem; }
.clips.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem 1rem; margin-top: 1.2rem; }
.clip { margin: 0; }
.clip video { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #111; }
.clip figcaption { max-width: none; margin-top: .65rem; font-size: .88rem; text-wrap: pretty; }
.clip figcaption b { display: block; margin-bottom: .1rem; font-size: 1.02rem; }
.clip p { margin: .6rem 0 0; font-size: .86rem; line-height: 1.5; color: var(--muted); }
.clip .method { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; font-weight: 600; font-size: .95rem; color: var(--text); }
.clip .method i { width: .75rem; height: .75rem; border-radius: 50%; flex: none; }
.sync video { cursor: pointer; }
.seg { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.6rem; }
.seg button {
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); cursor: pointer;
  font: 500 .88rem "Inter", system-ui, sans-serif; padding: .42rem 1rem;
}
.seg button:hover { color: var(--text); border-color: #c4c8ce; }
.seg button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- bibtex ---------- */
.bib { position: relative; }
.bib pre {
  margin: 0; background: #12151a; color: #e7e9ec; border-radius: var(--radius);
  padding: 1.2rem 1.3rem; overflow-x: auto; font: .82rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.bib button {
  position: absolute; top: .7rem; right: .7rem; border: 0; border-radius: 8px; cursor: pointer;
  background: #2a2f37; color: #e7e9ec; font: 600 .78rem "Inter", system-ui, sans-serif; padding: .35rem .7rem;
}
.bib button:hover { background: #3a414c; }

@media (max-width: 900px) {
  nav.top .wrap { justify-content: flex-start; }
}
@media (max-width: 700px) {
  .clips, .clips.three { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  html { font-size: 16px; }
  .wrap { padding: 0 16px; }
  header.hero { padding-top: 2.5rem; }
  section { padding: 2.8rem 0; }
  .abstract, .lead { text-align: left; }
  .teaser .badge { top: .5rem; right: .5rem; padding: .3rem .55rem; border-radius: 7px; font-size: .74rem; }
}
