/* GraphSteer project page.
 * Palette taken from the paper: cvprblue links, the "ours" table row tint (#E8F0FA),
 * the three entity colours of the figures (dog / bench / kite) and the orange of the
 * trained Graph Scorer Module. Serif headings echo the paper itself. */
:root {
  --bg: #faf8f3;          /* warm paper */
  --bg-alt: #f2efe7;
  --surface: #ffffff;
  --text: #1d2027;
  --text-2: #4a4f5a;
  --muted: #80848d;
  --line: #e3ded3;
  --accent: #2c6aab;      /* cvprblue, a touch deeper for text contrast */
  --accent-soft: #e8f0fa; /* \oursrow */
  --c1: #a3164f;          /* subject (dog) */
  --c2: #2e5ea8;          /* object (bench) */
  --c3: #9a6400;          /* object (kite) */
  --trained: #d4772a;     /* Graph Scorer Module box */
  --trained-soft: #fcefe2;
  --good: #2f7d4a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 32, 16, .05), 0 6px 18px rgba(40, 32, 16, .05);
  --maxw: 1120px;
  --serif: "Source Serif 4", "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --bg-alt: #171a1f;
    --surface: #1c1f25;
    --text: #ecebe6;
    --text-2: #b6b8bf;
    --muted: #82868f;
    --line: #2c2f37;
    --accent: #7eaee6;
    --accent-soft: #1a2533;
    --c1: #e2689a;
    --c2: #7eaee6;
    --c3: #d9a441;
    --trained: #e89a4c;
    --trained-soft: #2a2119;
    --good: #5cbf7c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-soft); }

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

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 19px; color: var(--text); display: flex; align-items: center; gap: 9px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 16px; }
.nav-links { display: flex; gap: 24px; font-size: 14px; }
.nav-links a { color: var(--text-2); }
.nav-links a:hover { color: var(--text); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 76px 0 44px; text-align: center; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 55% 60% at 50% 42%, var(--bg) 35%, transparent 100%); }
.hero-graph { width: 100%; height: 100%; opacity: .55; }
.hero-graph line { stroke: var(--muted); stroke-width: 1.2; stroke-opacity: .55; }
.hero-graph text { font-family: var(--serif); font-style: italic; font-size: 15px; fill: var(--muted); }
.hero-graph .lbl { font-style: normal; font-weight: 600; font-size: 16px; }
.hero-graph .g1 { fill: var(--c1); } .hero-graph .g2 { fill: var(--c2); } .hero-graph .g3 { fill: var(--c3); }
.hero-graph .arrow { fill: var(--muted); fill-opacity: .55; }
.hero-inner { position: relative; }

.venue {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 22px;
}
.venue::before, .venue::after { content: ""; width: 28px; height: 1px; background: var(--line); }
.title { font-family: var(--serif); font-size: clamp(34px, 5.2vw, 58px); line-height: 1.08; letter-spacing: -.015em; font-weight: 600; margin: 0 auto 26px; max-width: 920px; }
.title .name { color: var(--accent); font-weight: 700; }
.title .colon { color: var(--muted); font-weight: 400; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 24px; font-size: 18px; font-weight: 500; }
.authors sup { color: var(--muted); margin-left: 1px; }
.affils { color: var(--text-2); font-size: 15px; margin-top: 4px; }
.affils sup { color: var(--muted); }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 30px 0 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  background: var(--text); color: var(--bg); border: 1px solid var(--text);
  font-weight: 500; font-size: 15px;
  transition: transform .15s, background .15s, color .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; }
.btn .tag { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; border: 1px solid currentColor; padding: 0 6px; border-radius: 4px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--text-2); }
.btn.soon { background: transparent; color: var(--muted); border: 1px dashed var(--line); cursor: default; }
.btn.soon:hover { transform: none; }
.btn-ax b { color: #b31b1b; font-weight: 700; }
.btn.soon .btn-ax b { color: inherit; }

.tldr { max-width: 760px; margin: 0 auto; color: var(--text-2); font-size: 18px; }
.tldr b { color: var(--text); }
.hl { color: var(--text); font-weight: 600; background: linear-gradient(transparent 60%, var(--accent-soft) 60%); }

/* ---------- sections ---------- */
.section { padding: 76px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.teaser-section { padding-top: 6px; }
.section-title { font-family: var(--serif); font-size: clamp(27px, 3.2vw, 38px); letter-spacing: -.01em; font-weight: 600; margin: 0 0 14px; display: flex; align-items: baseline; gap: 14px; }
.kicker { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--accent); }
.lead { color: var(--text-2); max-width: 820px; margin: 0 0 30px; font-size: 18px; }
.lead.small { font-size: 16px; margin-bottom: 18px; }
.abstract { color: var(--text-2); text-align: justify; hyphens: auto; font-family: var(--serif); font-size: 18.5px; line-height: 1.7; }
.abstract b { color: var(--text); }
.fineprint { color: var(--muted); font-size: 13.5px; margin-top: 14px; }
.sub { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 48px 0 14px; }

/* ---------- duo player ---------- */
.duo { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.prompt-line { display: flex; align-items: flex-start; gap: 12px; margin: 2px 4px 14px; }
.prompt-line p { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.45; }
.backbone {
  flex-shrink: 0; font-family: var(--mono); font-size: 12px;
  padding: 3px 9px; border-radius: 6px; background: var(--bg-alt); color: var(--text-2); border: 1px solid var(--line);
  margin-top: 3px;
}
.e { font-weight: 700; }
.e1 { color: var(--c1); } .e2 { color: var(--c2); } .e3 { color: var(--c3); }
.rel { color: var(--accent); font-weight: 600; }
.prompt-line em { font-style: normal; color: var(--accent); font-weight: 600; }

.duo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.player { margin: 0; position: relative; }
.screen { position: relative; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: var(--ar, 3/2); }
.screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease; }
.screen img.on { opacity: 1; }
.screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
.player figcaption {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 6px;
  background: rgba(20, 20, 20, .6); color: #fff;
}
.player.ours .screen { box-shadow: 0 0 0 3px var(--c2); }
.player.ours figcaption { background: var(--c2); }
.controls { display: flex; align-items: center; gap: 14px; margin: 14px 4px 2px; }
.play { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; flex-shrink: 0; background: var(--surface); color: var(--text); display: grid; place-items: center; }
.play:hover { border-color: var(--text-2); }
.play svg { width: 13px; height: 13px; }
.scrub { flex: 1; display: flex; gap: 6px; }
.scrub button { flex: 1; height: 5px; border-radius: 3px; border: 0; padding: 0; cursor: pointer; background: var(--line); position: relative; overflow: hidden; }
.scrub button.done { background: var(--text-2); }
.scrub button.cur::after { content: ""; position: absolute; inset: 0; background: var(--text-2); transform-origin: left; animation: fill var(--dur, 900ms) linear forwards; }
.duo.paused .scrub button.cur::after { animation: none; transform: scaleX(1); }
.scrub .vbar i { position: absolute; inset: 0; background: var(--text-2); transform-origin: left; transform: scaleX(0); }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.frame-label { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }
.note { color: var(--text-2); font-size: 15px; margin: 12px 4px 0; }
.note:empty { display: none; }

.gallery-tabs, .cmp-prompts, .cmp-methods { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 14px; padding: 6px 13px; border-radius: 8px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s; display: inline-flex; align-items: center; gap: 8px;
}
.chip:hover { color: var(--text); border-color: var(--text-2); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .thumb { width: 28px; height: 18px; border-radius: 3px; object-fit: cover; }
.chip small { font-family: var(--mono); font-size: 11px; opacity: .7; }
.cmp-methods .chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ---------- method ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 40px; }
.step { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--step, var(--text)); border-radius: var(--radius); padding: 20px 22px 22px; display: flex; flex-direction: column; }
.step.frozen { --step: var(--c2); }
.step.trained { --step: var(--trained); }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step h3 { margin: 8px 0 6px; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.step p { margin: 0 0 16px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.step-num { font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--step, var(--text)); }
.badge { font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 5px; background: var(--bg-alt); color: var(--text-2); }
.step.frozen .badge { background: var(--accent-soft); color: var(--c2); }
.step.trained .badge { background: var(--trained-soft); color: var(--trained); }
.mini-graph, .axis-bars, .eq { margin-top: auto; }
.mini-graph svg { width: 100%; height: auto; }
.mini-graph .edge { stroke: var(--text-2); stroke-width: 1.6; }
.mini-graph .arrow { fill: var(--text-2); }
.mini-graph .elabel { font-family: var(--serif); font-size: 14px; font-style: italic; fill: var(--text-2); text-anchor: middle; }
.mini-graph .nlabel { font-family: var(--serif); font-size: 15px; font-weight: 600; text-anchor: middle; }
.mini-graph .n1 { fill: var(--c1); } .mini-graph .n2 { fill: var(--c2); } .mini-graph .n3 { fill: var(--c3); }
.c1 { fill: var(--c1); } .c2 { fill: var(--c2); } .c3 { fill: var(--c3); }

.axis-bars { display: grid; gap: 9px; }
.axis { display: grid; grid-template-columns: 78px 1fr 64px; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.axis em { font-family: var(--serif); font-style: italic; font-size: 14px; }
.bar { height: 10px; border-radius: 3px; background: var(--bg-alt); overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--trained); transform-origin: left; transform: scaleX(0); transition: transform 1.1s cubic-bezier(.2,.8,.2,1); }
.bar.muted i { background: var(--muted); }
.in-view .bar i, .in-view .hbar i, .in-view .wbar i { transform: scaleX(1); }

.eq { font-size: 16px; text-align: center; padding: 4px 12px; border-radius: 8px; background: var(--bg-alt); color: var(--text); border: 1px solid var(--line); overflow-x: auto; }
.eq .katex-display { margin: .6em 0; }
.katex { font-size: 1.05em; }

.figure { margin: 0; }
.figure img { border-radius: 8px; background: #fff; border: 1px solid var(--line); padding: 10px; width: 100%; }
.figure figcaption { color: var(--muted); font-size: 14px; margin-top: 10px; line-height: 1.55; }
.figure figcaption b { color: var(--text-2); }
.zoomable img { cursor: zoom-in; transition: border-color .15s; }
.zoomable img:hover { border-color: var(--muted); }

.split { display: grid; grid-template-columns: 1fr 1.6fr; gap: 36px; align-items: center; margin-top: 56px; }
.split-text h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; margin: 0 0 10px; }
.split-text p { color: var(--text-2); font-size: 16px; }
.split.pref { grid-template-columns: 1.2fr 1fr; }
.narrowfig img { max-width: 480px; margin: 0 auto; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 56px; }
.card { border-top: 1px solid var(--text); padding: 16px 2px 0; }
.card-ico { height: 30px; }
.card-ico svg { height: 26px; width: auto; }
.card h4 { margin: 4px 0 4px; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.card p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }

/* ---------- comparison ---------- */
.cmp-methods { margin-bottom: 18px; }
details.more { margin-top: 26px; }
details.more summary { cursor: pointer; font-weight: 500; color: var(--accent); font-size: 15px; }
details.more .figure { margin-top: 16px; }
details.more .figure img { max-width: 820px; margin: 0 auto; }

/* ---------- results ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--text); border-bottom: 1px solid var(--line); }
.stat { padding: 18px 20px 20px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat-label { font-size: 13.5px; color: var(--text-2); }
.stat-val { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 0; font-family: var(--serif); }
.stat-val s { color: var(--muted); font-size: 19px; text-decoration-thickness: 1px; }
.stat-val .to { color: var(--muted); }
.stat-val b { font-size: 40px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; border-top: 1.5px solid var(--text); border-bottom: 1.5px solid var(--text); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 14px; text-align: left; white-space: nowrap; }
.tbl th { font-weight: 600; color: var(--text); border-bottom: 1px solid var(--text-2); font-size: 14px; }
.tbl td { border-bottom: 1px solid var(--line); color: var(--text-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.grp td { font-style: italic; font-family: var(--serif); font-size: 15px; color: var(--text); padding-top: 12px; }
.tbl tr.ours td { background: var(--accent-soft); color: var(--text); }
.tbl tr.ours td:first-child { font-weight: 600; color: var(--accent); }
.barcol { width: 40%; }
.hbar, .wbar { height: 8px; border-radius: 2px; background: var(--bg-alt); overflow: hidden; }
.hbar i, .wbar i { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--muted); opacity: .6; transform-origin: left; transform: scaleX(0); transition: transform 1.1s cubic-bezier(.2,.8,.2,1); }
.tbl tr.ours .hbar i { background: var(--accent); opacity: 1; }

.winrates { display: grid; gap: 10px; margin: 18px 0 4px; }
.wr { display: grid; grid-template-columns: 112px 1fr 52px; gap: 12px; align-items: center; font-size: 14px; color: var(--text-2); }
.wr b { color: var(--text); font-variant-numeric: tabular-nums; }
.wbar { height: 12px; position: relative; overflow: visible; }
.wbar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--text-2); }
.wbar i { background: var(--good); opacity: .85; }

/* ---------- bibtex ---------- */
.bib { position: relative; }
.bib pre { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; color: var(--text); }
.copy { position: absolute; top: 12px; right: 12px; border: 1px solid var(--line); background: var(--bg-alt); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.copy:hover { color: var(--text); border-color: var(--text-2); }

.footer { padding: 40px 0 56px; text-align: center; font-size: 14px; color: var(--text-2); }
.footer p { margin: 4px 0; }
.muted { color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(12, 12, 14, .9); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 6px; background: #fff; padding: 8px; }
.lightbox button { position: absolute; top: 14px; right: 18px; font-size: 34px; line-height: 1; background: none; border: 0; color: #fff; cursor: pointer; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .steps { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split, .split.pref { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .nav-links { display: none; }
  .hero { padding-top: 44px; }
  .section { padding: 52px 0; }
  .duo { padding: 12px; }
  .duo-grid { grid-template-columns: 1fr; gap: 10px; }
  .prompt-line { flex-direction: column; gap: 6px; }
  .cards, .stats { grid-template-columns: 1fr; }
  .stat { border-left: 0; padding-left: 0; }
  .stat + .stat { border-top: 1px solid var(--line); }
  .stat-val b { font-size: 34px; }
  .abstract { text-align: left; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .bar i, .hbar i, .wbar i { transform: none; }
}
