/* DUALingo project page.
   Serif display type (Source Serif 4) echoes the paper and the Fig. 1 captions;
   Inter carries body text and UI. Role colours are the paper's: role a = Fox
   orange, role b = Feather green. */

:root {
  --ink: #1d1d1f;
  --ink-2: #3c3c43;
  --muted: #6b6b70;
  --line: #e7e6e2;
  --bg: #ffffff;
  --band: #f7f6f3;
  --card: #ffffff;

  --role-a: #f5a04a;
  --role-b: #8cc753;
  --role-a-ink: #b8630f;
  --role-b-ink: #4c8a1c;
  --role-a-soft: #fdf0e1;
  --role-b-soft: #eef7e6;

  --serif: "Source Serif 4", "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;

  --wide: 1120px;
  --text: 760px;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 20px rgb(0 0 0 / 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: var(--text); }
.wrap.xl { max-width: 1280px; }   /* benchmark section: two six-column tables side by side */

/* ---------- nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topnav.scrolled { border-bottom-color: var(--line); }
.topnav .wrap { display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { font: 700 18px var(--serif); text-decoration: none; letter-spacing: -0.01em; }
.topnav nav { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.topnav nav a {
  font-size: 14px; font-weight: 500; color: var(--muted);
  text-decoration: none; white-space: nowrap;
}
.topnav nav a:hover, .topnav nav a.active { color: var(--ink); }

/* ---------- header ---------- */
.hero { text-align: center; padding: 48px 0 20px; }
.hero h1 {
  font: 600 clamp(30px, 4.6vw, 52px)/1.12 var(--serif);
  letter-spacing: -0.015em; margin: 0 auto 10px; max-width: 980px;
}
.hero h1 .name-a { color: var(--role-a); }
.hero h1 .name-b { color: var(--role-b); }
.hero .subtitle {
  font: 400 clamp(19px, 2.2vw, 25px)/1.35 var(--serif);
  color: var(--ink-2); margin: 0 auto 22px; max-width: 900px; text-wrap: balance;
}
.authors { font-size: 17px; font-weight: 500; margin-bottom: 6px; }
.authors span { display: inline-block; margin: 0 9px; }
.authors a { text-decoration: none; border-bottom: 1px solid var(--line); }
.authors a:hover { border-bottom-color: var(--ink); }
.affils { font-size: 15px; color: var(--muted); }
.affils span { display: inline-block; margin: 0 8px; }
.notes { font-size: 13px; color: var(--muted); margin-top: 4px; }
.venue {
  display: inline-block; margin: 20px 0 6px; padding: 5px 14px;
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
  background: var(--band); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2);
}
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; text-decoration: none;
  font-size: 15px; font-weight: 600;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); background: #000; }
.btn.soon { background: #8e8e93; cursor: default; }
.btn.soon:hover { transform: none; box-shadow: none; background: #8e8e93; }
.btn i { font-size: 15px; }

/* ---------- teaser ---------- */
.teaser { padding: 18px 0 8px; }
.teaser img { width: 100%; height: auto; }
.tldr {
  max-width: 820px; margin: 18px auto 0; text-align: center;
  font: 400 18px/1.6 var(--serif); color: var(--ink-2);
}
.legend { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.a { background: var(--role-a); }
.dot.b { background: var(--role-b); }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  max-width: 900px; margin: 34px auto 0;
}
.stat {
  text-align: center; padding: 16px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.stat b { display: block; font: 600 30px/1.1 var(--serif); letter-spacing: -0.01em; }
.stat span { font-size: 13px; color: var(--muted); }

/* ---------- sections ---------- */
section.block { padding: 72px 0; }
section.block.band { background: var(--band); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
h2.sec {
  font: 600 32px/1.2 var(--serif); letter-spacing: -0.01em;
  text-align: center; margin: 0 0 10px;
}
.sec-lead { text-align: center; color: var(--muted); max-width: 720px; margin: 0 auto 32px; }
.abstract p { font-size: 17px; line-height: 1.8; color: var(--ink-2); text-align: justify; hyphens: auto; margin: 0; }
.abstract b { color: var(--ink); }

/* ---------- explorer ---------- */
/* scroll areas stay scrollable, without visible bars */
.task-list, .roles, .strip { scrollbar-width: none; }
.task-list::-webkit-scrollbar, .roles::-webkit-scrollbar, .strip::-webkit-scrollbar { display: none; }
.set-note { text-align: center; font-size: 13px; color: var(--muted); margin: -8px auto 18px; max-width: 760px; }
.tabs {
  display: flex; justify-content: center; gap: 4px; margin: 20px auto 22px;
  padding: 4px; width: fit-content; border-radius: 999px;
  background: #ecebe7;
}
.tabs button {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 18px; border-radius: 999px;
  font: 600 14px var(--sans); color: var(--muted);
}
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }

.explorer {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
}
.stage { position: relative; aspect-ratio: 1 / 1.04; background: radial-gradient(120% 90% at 50% 40%, #fff 55%, #f4f3f0 100%); }
.stage canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage .hint {
  position: absolute; left: 14px; bottom: 12px; font-size: 12px; color: var(--muted);
  display: flex; gap: 6px; align-items: center; pointer-events: none;
}
.stage .counter {
  position: absolute; left: 16px; top: 12px;
  font: 600 13px var(--sans); color: var(--muted); letter-spacing: .04em;
}
.stage .loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; color: var(--muted); background: rgb(255 255 255 / .6);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.stage.busy .loading { opacity: 1; }
/* touch screens: the stage scrolls the page until "Tap to rotate" */
.stage .touch-gate, .stage .touch-done {
  position: absolute; z-index: 2; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--ink-2); font: 600 13px var(--sans);
  padding: 7px 14px; box-shadow: 0 1px 6px rgba(0, 0, 0, .08);
}
.stage .touch-gate { left: 50%; bottom: 14px; transform: translateX(-50%); }
.stage .touch-done { right: 12px; top: 12px; }

/* the panel never sets the row height: the 3D stage does (height:0 + min-height:100%) */
.panel {
  padding: 18px 22px 12px; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; height: 0; min-height: 100%; overflow: hidden;
}
.panel-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.obj-name { font: 600 24px/1.2 var(--serif); margin: 0; }
.obj-meta { font-size: 13px; color: var(--muted); }
.obj-meta .chip { margin-right: 6px; }
.chip {
  display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--band); border: 1px solid var(--line); color: var(--ink-2);
}
.panel-body { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: 18px; flex: 1; min-height: 0; }
.panel-body .col { display: flex; flex-direction: column; min-height: 0; }
.panel h4 { font: 600 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.task-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; padding-right: 4px; }
.task-list button {
  text-align: left; border: 1px solid var(--line); background: #fff; cursor: pointer;
  border-radius: 10px; padding: 7px 11px; display: flex; flex-direction: column; gap: 1px;
  font: italic 400 15px/1.3 var(--serif); color: var(--ink-2); flex-shrink: 0;
}
.task-list button:hover { border-color: #cfcdc7; }
.task-list button.on { border-color: var(--ink); color: var(--ink); background: #fbfbfa; }
.task-list .fam { font: 500 11px var(--sans); color: var(--muted); font-style: normal; }

.roles { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.role { border-radius: 12px; padding: 8px 13px 9px; flex-shrink: 0; }
.role.a { background: var(--role-a-soft); }
.role.b { background: var(--role-b-soft); }
.role .who { display: flex; align-items: baseline; gap: 8px; }
.role .tag { font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
.role.a .tag, .role.a .verb { color: var(--role-a-ink); }
.role.b .tag, .role.b .verb { color: var(--role-b-ink); }
.role .verb { font: 600 20px/1.2 var(--serif); }
.role dl { display: grid; grid-template-columns: max-content 1fr; gap: 1px 12px; margin: 4px 0 0; font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.role dt { color: var(--muted); font-size: 11.5px; padding-top: 1px; }
.role dd { margin: 0; }
.panel .footnote { font-size: 11.5px; color: var(--muted); margin: 0; padding-top: 8px; }

.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 104px; gap: 10px;
  overflow-x: auto; padding: 18px 2px 10px; scroll-snap-type: x proximity;
}
.thumb {
  scroll-snap-align: start; position: relative;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 4px 4px 6px; cursor: pointer; text-align: center;
  transition: border-color .15s, transform .15s;
}
.thumb:hover { transform: translateY(-2px); }
.thumb.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.thumb img, .thumb .ph { width: 100%; aspect-ratio: 1; border-radius: 8px; }
.thumb .ph { background: var(--band); }
.thumb span { display: block; font-size: 11px; line-height: 1.25; color: var(--ink-2); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .num { position: absolute; top: 6px; left: 8px; font: 600 10px var(--sans); color: var(--muted); }

/* ---------- figures ---------- */
figure.fig { margin: 0; }
figure.fig img {
  width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
figure.fig figcaption {
  max-width: 860px; margin: 16px auto 0; text-align: center;
  font-size: 15px; line-height: 1.65; color: var(--ink-2);
}

/* ---------- videos ---------- */
.video-card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video-card video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; }
.video-card .cap { padding: 12px 16px 14px; }
.video-card .fam { font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.video-card .task { font: italic 400 18px/1.3 var(--serif); margin: 2px 0; }
.verbs { font: 400 15px var(--serif); }
.verbs .va { color: var(--role-a-ink); }
.verbs .vb { color: var(--role-b-ink); }
.verbs .sep { color: var(--muted); margin: 0 4px; }

/* ---------- dataset ---------- */
h3.sub { font: 600 20px/1.3 var(--serif); text-align: center; margin: 44px 0 14px; }
.families { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.family { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.family .fam-head { display: flex; justify-content: space-between; align-items: baseline; }
.family h3 { font: 600 19px var(--serif); margin: 0; }
.family .share { font: 600 22px var(--serif); color: var(--ink); }
.family .bar { height: 5px; border-radius: 3px; background: var(--band); margin: 8px 0 12px; overflow: hidden; }
.family .bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--role-a), var(--role-b)); }
.family p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.family p.eg { margin-top: 8px; font: italic 15px/1.45 var(--serif); color: var(--muted); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl-wrap.narrowtbl { max-width: 640px; margin: 0 auto; }
.tbl-wrap.midtbl { max-width: 760px; margin: 0 auto; }
.tbl-note.narrownote { max-width: 640px; margin-left: auto; margin-right: auto; }
.tbl-note.midnote { max-width: 760px; margin-left: auto; margin-right: auto; }
.sub-lead { text-align: center; color: var(--muted); max-width: 720px; margin: -6px auto 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 14px; text-align: center; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl thead th { font: 600 12px var(--sans); letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); vertical-align: bottom; }
.tbl .th-sub { font-weight: 500; text-transform: none; letter-spacing: 0; }
.tbl tbody tr + tr td { border-top: 1px solid #f0efeb; }
.tbl tr.grp td { border-top: 1px solid var(--line); }
.tbl td.y { color: var(--role-b-ink); font-weight: 600; }
.tbl td.n { color: #b5b4ae; }
.tbl tr.ours td { background: var(--role-b-soft); font-weight: 600; }
.tbl .src { margin-left: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.tbl tr.dual td { background: var(--role-b-soft); }
.tbl tr.dual td:first-child { font-weight: 600; }
.tbl-note { font-size: 13px; color: var(--muted); margin: 10px 2px 0; line-height: 1.55; }
.bench { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.bench h3.sub { margin-top: 0; }

/* ---------- placeholders ---------- */
.placeholder {
  border: 1.5px dashed #cfcdc7; border-radius: var(--radius);
  min-height: 220px; display: grid; place-items: center; text-align: center;
  color: var(--muted); font-size: 14px; padding: 24px; background: rgb(255 255 255 / .5);
}
.placeholder b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-3 .placeholder { min-height: 260px; }

/* ---------- bibtex ---------- */
.bib pre {
  margin: 0; padding: 22px 26px;
  background: #f8f8f6; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: 13.5px/1.7 "JetBrains Mono", ui-monospace, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

footer { padding: 40px 0 56px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .explorer { grid-template-columns: 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); height: auto; min-height: 0; }
  .stage { aspect-ratio: 1 / 0.8; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .families, .bench { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .bench { grid-template-columns: minmax(0, 1fr); }      /* two six-column tables do not fit side by side */
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 40px; }
  section.block { padding: 52px 0; }
  .panel-body { grid-template-columns: 1fr; }
  .topnav nav { gap: 16px; -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
                mask-image: linear-gradient(90deg, #000 82%, transparent); }
  .abstract p { text-align: left; }
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 8px 6px; }
  .tbl thead th { white-space: normal; }
  .tbl .src { display: block; margin-left: 0; }
}

/* ---------- thumbnail strip: click to open, drag to scroll ---------- */
.strip { cursor: grab; user-select: none; -webkit-user-select: none; }
.strip.dragging { cursor: grabbing; scroll-snap-type: none; }
.strip.dragging .thumb { pointer-events: none; }
.thumb img { pointer-events: none; -webkit-user-drag: none; user-select: none; }

/* pipeline walk-through video */
.video-fig video { display: block; width: 100%; max-width: 1000px; height: auto; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
