/* JointHand project page. Bulma (CDN) for layout; everything specific lives here. */
:root {
  --ink: #1d1f23;
  --ink-2: #4a4f57;
  --ink-3: #7a808a;
  --rule: #e4e6ea;
  --panel: #f6f6f4;
  --card: #ffffff;
  --ours: #d64034;      /* JointHand contact  (214, 64, 52) */
  --haco: #e68c1e;      /* HACO contact       (230, 140, 30) */
  --gt: #1e9646;        /* ground truth       (30, 150, 70) */
  --miss: #4682e6;      /* false negative     (70, 130, 230) */
  --base: #9aa0a8;      /* published baselines */
  --accent: #2b59c3;
}

body {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #fff;
}

.publication-title, .title, .subtitle, .button, .tag, .chip, .seg button {
  font-family: 'Google Sans', 'Noto Sans', sans-serif;
}
.publication-title { line-height: 1.2; }
.publication-authors { margin-top: 0.4rem; color: var(--ink-2); }
.publication-authors a { color: var(--accent) !important; }
.publication-authors .author-block { display: inline-block; margin: 0 0.25rem; }
.publication-venue { color: var(--ink-3); font-size: 1.05rem; }
.publication-links { margin-top: 1rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.publication-links .button.is-dark { background: #363636; }
.publication-links .button .icon { margin-right: 0.15rem; }
.todo-link { opacity: 0.55; }

.section { padding: 2.5rem 1rem; }
.section + .section { border-top: 1px solid var(--rule); }
.section-lead { color: var(--ink-2); max-width: 46rem; margin: 0 auto 1.5rem; text-align: center; }
.title.is-3 { margin-bottom: 1rem !important; }

/* teaser */
.teaser video { width: 100%; border-radius: 8px; background: #000; display: block; }
.teaser .legend-row { display: flex; justify-content: space-around; font-size: 0.85rem; color: var(--ink-3); margin-top: 0.35rem; }
.teaser .subtitle { margin-top: 1rem; }
.hl { color: var(--ours); font-weight: 600; }

/* --- explorer ------------------------------------------------------------------- */
.explorer { background: var(--panel); border-radius: 12px; padding: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; align-items: center; }
.chip {
  border: 1px solid var(--rule); background: var(--card); color: var(--ink-2); border-radius: 999px;
  padding: 0.2rem 0.75rem; font-size: 0.85rem; cursor: pointer; line-height: 1.6;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.3rem; vertical-align: 0.05rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 0.4rem; max-height: 196px; overflow-y: auto; padding: 2px; }
.thumb { position: relative; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: #ddd; aspect-ratio: 1; padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(43, 89, 195, 0.25); }
.thumb .badge { position: absolute; left: 3px; bottom: 3px; font-size: 0.62rem; padding: 0 0.3rem; border-radius: 3px; background: rgba(0, 0, 0, 0.62); color: #fff; }
.thumb .dot { position: absolute; right: 4px; top: 4px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; }
.v-ours_wins { background: var(--ours); }
.v-tie { background: #8a8f98; }
.v-haco_wins { background: var(--haco); }
.v-wild { background: var(--accent); }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; margin-top: 0.9rem; }
.stage-card { background: var(--card); border-radius: 10px; padding: 0.6rem; position: relative; min-width: 0; }
.stage-card h4 { font-family: 'Google Sans', sans-serif; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 0.4rem; display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.stage-card h4 small { color: var(--ink-3); font-weight: 400; font-size: 0.78rem; }
#overlay { width: 100%; height: auto; display: block; border-radius: 6px; background: #eee; }
#viewer3d { width: 100%; aspect-ratio: 1; border-radius: 6px; background: var(--panel); display: block; cursor: grab; touch-action: none; }
#viewer3d:active { cursor: grabbing; }
.hint { position: absolute; right: 0.9rem; bottom: 0.8rem; font-size: 0.72rem; color: var(--ink-3); pointer-events: none; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; padding: 0.3rem 0.65rem; font-size: 0.82rem; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--rule); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button:disabled { color: #c3c6cb; cursor: not-allowed; }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem 1.2rem; margin-top: 0.9rem; align-items: end; }
.ctl label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-2); margin-bottom: 0.15rem; }
.ctl label output { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.ctl input[type=range] { width: 100%; accent-color: var(--ink); }
.ctl .seg { width: 100%; }
.ctl .seg button { flex: 1 1 auto; }

.canon { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 0.35rem 0.5rem; align-items: center; margin-top: 0.9rem; background: var(--card); border-radius: 10px; padding: 0.6rem; }
.canon .colhead { font-family: 'Google Sans', sans-serif; font-size: 0.85rem; text-align: center; color: var(--ink-2); }
.canon .rowhead { font-size: 0.75rem; color: var(--ink-3); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.canon canvas { width: 100%; height: auto; display: block; }
.canon .score { text-align: center; font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; min-height: 1.2rem; }
.swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; vertical-align: -0.05rem; margin-right: 0.25rem; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.6rem; margin-top: 0.9rem; }
.metric-card { background: var(--card); border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.85rem; }
.metric-card .k { color: var(--ink-3); font-size: 0.75rem; }
.bar { height: 8px; border-radius: 4px; background: var(--rule); position: relative; overflow: hidden; margin: 0.15rem 0 0.35rem; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; transition: width 0.15s; }
.legend { font-size: 0.78rem; color: var(--ink-3); margin-top: 0.6rem; line-height: 1.7; }
.note { font-size: 0.78rem; color: var(--ink-3); margin-top: 0.5rem; }
.hands-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* --- videos --------------------------------------------------------------------- */
.video-main { width: 100%; border-radius: 8px; background: #000; display: block; }
.video-caption { font-size: 0.9rem; color: var(--ink-2); margin: 0.4rem 0 0.8rem; min-height: 1.4rem; }
.video-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
.video-thumb { border: 2px solid transparent; border-radius: 6px; padding: 0; overflow: hidden; background: #000; cursor: pointer; text-align: left; position: relative; }
.video-thumb img { width: 100%; aspect-ratio: 16 / 5; object-fit: cover; object-position: left; display: block; opacity: 0.92; }
.video-thumb span { position: absolute; left: 4px; bottom: 4px; font-size: 0.68rem; background: rgba(0, 0, 0, 0.65); color: #fff; padding: 0 0.35rem; border-radius: 3px; }
.video-thumb[aria-current="true"] { border-color: var(--accent); }
.video-legend { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; font-size: 0.8rem; color: var(--ink-3); text-align: center; margin-top: 0.25rem; }

/* --- method --------------------------------------------------------------------- */
.method-fig { width: 100%; height: auto; display: block; }
.method-fig text { font-family: 'Google Sans', 'Noto Sans', sans-serif; }
.method-points { max-width: 46rem; margin: 1rem auto 0; color: var(--ink-2); }
.method-points li { margin-bottom: 0.4rem; }

/* --- results charts ------------------------------------------------------------- */
.chart-wrap { background: var(--panel); border-radius: 12px; padding: 1rem; }
.chart-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin-bottom: 0.6rem; }
.chart-toolbar .lbl { font-size: 0.8rem; color: var(--ink-3); }
#results-chart, #persample-chart { width: 100%; height: auto; display: block; }
#results-chart text, #persample-chart text { font-family: 'Noto Sans', sans-serif; }
.tooltip { position: fixed; pointer-events: none; background: rgba(29, 31, 35, 0.94); color: #fff; font-size: 0.78rem; padding: 0.35rem 0.55rem; border-radius: 6px; z-index: 50; display: none; max-width: 260px; line-height: 1.45; }
.wtl { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 0.4rem 0; font-size: 0.75rem; color: #fff; }
.wtl div { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; transition: flex-basis 0.2s; }
.persample-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }

/* --- live demo ------------------------------------------------------------------ */
.demo-frame { width: 100%; height: 1000px; border: 0; border-radius: 10px; background: var(--panel); }
.demo-placeholder { background: var(--panel); border-radius: 12px; padding: 2rem 1rem; text-align: center; }

pre.bibtex { background: var(--panel); border-radius: 8px; font-size: 0.82rem; position: relative; white-space: pre-wrap; }
.copy-btn { position: absolute; right: 0.5rem; top: 0.5rem; }
.footer { padding: 2rem 1.5rem 3rem; background: #fafafa; font-size: 0.85rem; }

.wide-fig { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media screen and (max-width: 768px) {
  .wide-fig > svg { min-width: 640px; }
  .stage { grid-template-columns: 1fr; }
  .persample-grid { grid-template-columns: 1fr; }
  .publication-title { font-size: 1.9rem !important; }
  .demo-frame { height: 1400px; }
  .video-legend { font-size: 0.68rem; }
}
