/* ==========================================================================
   Tactile vs. Wrist Camera — project page styles
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --text: #1f2328;
  --text-muted: #5b636e;
  --border: #e3e6ea;
  --accent: #14707a;          /* muted teal: links, highlights */
  --btn: #2a2f36;             /* dark buttons, Nerfies-style */
  --btn-hover: #444b55;

  /* Modality colors: use the same values in charts and video labels */
  --vision: #64748b;
  --vision-dark: #334155;
  --tactile: #dd6b20;
  --tactile-dark: #9c4312;

  --radius: 10px;
  --content: 1080px;
  --text-width: 760px;
  --nav-h: 52px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 650; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
img, video { display: block; max-width: 100%; }

.container { max-width: var(--content); margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: calc(var(--text-width) + 32px); }
.narrow-text { max-width: var(--text-width); margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.small { font-size: 0.9rem; color: var(--text-muted); }
.sub { margin-top: 2.2rem; }

.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
.lede { color: var(--text-muted); text-align: center; margin-bottom: 2.5rem; }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: var(--content); margin: 0 auto; padding: 0 16px;
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 650; color: var(--text); white-space: nowrap; font-size: 0.95rem; }
.topnav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.topnav ul::-webkit-scrollbar { display: none; }
.topnav ul a {
  display: block; padding: 6px 10px; border-radius: 6px;
  color: var(--text-muted); font-size: 0.9rem; white-space: nowrap;
}
.topnav ul a:hover { background: var(--bg-alt); text-decoration: none; color: var(--text); }
.topnav ul a.active { color: var(--accent); font-weight: 600; }
@media (max-width: 720px) { .brand { display: none; } .topnav-inner { justify-content: center; } }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 24px; }
.venue { color: var(--accent); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; margin-bottom: 0.8em; }
.authors { font-size: 1.1rem; margin: 1.2em 0 0.2em; }
.authors a { color: var(--text); border-bottom: 1px solid transparent; }
.authors a:hover { border-bottom-color: currentColor; text-decoration: none; }
.affiliations { color: var(--text-muted); margin-bottom: 0.6em; }
.affil-logo { display: inline-block; }
.affil-logo img { height: 52px; width: auto; margin: 0 auto; }

.link-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 1.6em 0 2.4em; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; border: 0;
  background: var(--btn); color: #fff; font: inherit; font-size: 0.95rem; font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.btn.small { padding: 5px 12px; font-size: 0.82rem; }

.hero-video { position: relative; margin: 0; }
.play-toggle {
  position: absolute; right: 12px; bottom: 12px;
  padding: 5px 12px; border-radius: 999px; border: 0;
  background: rgba(0, 0, 0, 0.55); color: #fff; font: inherit; font-size: 0.8rem; cursor: pointer;
}
.play-toggle:hover { background: rgba(0, 0, 0, 0.75); }
.media.is-missing ~ .play-toggle { display: none; }

.takeaway {
  max-width: var(--text-width); margin: 1.8em auto 0;
  text-align: center; font-size: 1.2rem; line-height: 1.5;
}

/* ---------- Media + placeholders ---------- */
.media {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  border-radius: var(--radius); overflow: hidden; background: #0f1114;
}
.media > video, .media > img { width: 100%; height: 100%; object-fit: cover; }
.media.photo { aspect-ratio: auto; background: #fff; }
.media.natural { aspect-ratio: auto; }
.media.natural > video { height: auto; object-fit: contain; }
.media.natural.is-missing { aspect-ratio: 16 / 9; }
.media.photo > img { height: auto; object-fit: contain; }
.media.photo.is-missing { aspect-ratio: 16 / 9; }
.media.figure-media { background: #fff; aspect-ratio: auto; min-height: 240px; }
.media.figure-media > img { object-fit: contain; height: auto; }

.media .ph { display: none; }
.media.is-missing { background: linear-gradient(160deg, #eef0f3, #e2e6eb); }
.media.is-missing > video, .media.is-missing > img { display: none; }
.media.is-missing .ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center;
  color: #7a838e;
}
.media.figure-media.is-missing { aspect-ratio: 16 / 7; }
.ph-icon {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.75); font-size: 1rem; color: #5b636e;
}
.ph-label { font-weight: 600; font-size: 0.95rem; color: #4a525c; }
.ph-path { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Key-finding stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 20px; text-align: center; background: #fff;
}
.stat-value { font-size: clamp(1.8rem, 3.4vw, 2.3rem); font-weight: 700; color: var(--tactile-dark); line-height: 1.1; }
.stat.vision .stat-value { color: var(--vision-dark); }
.stat-value .unit { font-size: 1rem; font-weight: 600; margin-left: 4px; color: var(--text-muted); }
.stat-task { font-weight: 600; margin-top: 6px; }
.stat-compare { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.stat-note { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin: 12px 0 64px; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: 1fr; } }

.abstract { text-align: justify; hyphens: auto; }

/* ---------- Cards ---------- */
.card-grid { display: grid; gap: 20px; }
.card-grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .card-grid.three { grid-template-columns: 1fr; } }
.card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; background: #fff;
}
.card p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.card-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 12px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.9rem;
}

.figure.setup-figure { max-width: 820px; margin: 0 auto 48px; }
.figure.setup-figure figcaption { text-align: center; }
.figure.gain-figure { max-width: 900px; margin: 0 auto 48px; }
.gain-figure .media { padding: 12px; }

/* ---------- Pipeline diagram ---------- */
.pipeline {
  margin: 0; display: flex; align-items: center; justify-content: center; gap: 0;
  --node-bg: #fff;
}
.pl-inputs { display: flex; flex-direction: column; gap: 14px; }
.pl-branch { display: flex; align-items: center; }
.pl-node {
  background: var(--node-bg); border: 1.5px solid var(--border); border-radius: 8px;
  padding: 10px 12px; text-align: center; min-width: 108px;
  display: flex; flex-direction: column; justify-content: center; font-size: 0.9rem;
}
.pl-node strong { font-weight: 600; }
.pl-node small { color: var(--text-muted); font-size: 0.75rem; line-height: 1.3; margin-top: 2px; }
.vision .pl-node { border-color: var(--vision); }
.vision .pl-node.input { background: #eef1f5; }
.tactile .pl-node { border-color: var(--tactile); }
.tactile .pl-node.input { background: #fdf1e8; }
.pl-node.policy { border-color: var(--accent); background: #e8f3f4; }
.pl-node.out { background: var(--btn); color: #fff; border-color: var(--btn); }

.pl-arrow { position: relative; width: 26px; height: 2px; background: #9aa3ad; flex: none; }
.pl-arrow::after {
  content: ""; position: absolute; right: -1px; top: -4px;
  border-left: 7px solid #9aa3ad; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.pl-arrow.merge { width: 30px; }

@media (max-width: 960px) {
  .pipeline { flex-direction: column; }
  .pl-inputs { flex-direction: row; gap: 12px; }
  .pl-branch { flex-direction: column; }
  .pl-arrow { width: 2px; height: 20px; }
  .pl-arrow::after { right: auto; top: auto; left: -4px; bottom: -1px; border-top: 7px solid #9aa3ad; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 0; }
  .pl-arrow.merge { width: 2px; }
  .pl-node { min-width: 0; width: 100%; max-width: 260px; }
  .pl-branch .pl-node { width: 100%; }
}

/* ---------- Tasks ---------- */
.task-feature {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center;
  margin-bottom: 48px;
}
.task-feature.reverse { grid-template-columns: 1fr 1.4fr; }
.task-feature.reverse .media { order: 2; }
.task-text p { color: var(--text-muted); }
@media (max-width: 820px) {
  .task-feature, .task-feature.reverse { grid-template-columns: 1fr; gap: 16px; }
  .task-feature.reverse .media { order: 0; }
}
.task-id {
  display: inline-block; font-family: var(--mono); font-size: 0.78rem; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; background: var(--bg-alt); border: 1px solid var(--border);
  color: var(--text-muted); vertical-align: middle; margin-right: 4px;
}
.task-text .task-id { margin-bottom: 10px; }
.tag {
  display: inline-block; font-size: 0.8rem; font-weight: 600; color: var(--accent);
  border: 1px solid currentColor; border-radius: 999px; padding: 2px 10px;
}
.task-small { margin-top: 16px; }
.task-small figure { margin: 0; }
.task-small figcaption { margin-top: 10px; font-weight: 600; }

/* ---------- Results ---------- */
.figure { margin: 0 0 32px; }
.figure figcaption { margin-top: 12px; font-size: 0.92rem; color: var(--text-muted); }
.results-split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.results-split .sub { margin-top: 0; }
@media (max-width: 820px) { .results-split { grid-template-columns: 1fr; } }

.conditions { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: #fff; border-radius: var(--radius); overflow: hidden; }
.conditions th, .conditions td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.conditions th { font-weight: 600; background: #eef0f3; }
.conditions td.on { color: var(--accent); font-weight: 600; }
.conditions td.off { color: var(--text-muted); }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.swatch.vision { background: var(--vision); }
.swatch.vision.dark { background: var(--vision-dark); }
.swatch.tactile { background: var(--tactile); }
.swatch.tactile.dark { background: var(--tactile-dark); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.results-table th, .results-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.results-table th { font-weight: 600; background: #eef0f3; }
.results-table tr:last-child td { border-bottom: 0; }
.results-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.results-table .rel { color: var(--text-muted); }
.results-table .delta { font-weight: 700; color: var(--tactile-dark); }
.results-table .delta.zero { color: var(--text-muted); font-weight: 600; }
.results-table tr.group td {
  background: var(--bg-alt); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-muted); padding: 6px 14px;
}
.results-table .task-id { margin-right: 8px; }
@media (max-width: 640px) { .results-table .rel { display: none; } .results-table th, .results-table td { padding: 9px 10px; } }

.findings { padding-left: 1.2em; }
.findings li { margin-bottom: 0.5em; }

/* ---------- Comparisons ---------- */
.compare { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 28px; }
.compare-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.compare-head h3 { margin: 0; }
.compare-head .condition { color: var(--text-muted); font-size: 0.9rem; }
.compare-head .sync-btn { margin-left: auto; }
.compare-pair { display: grid; grid-template-columns: 1fr; gap: 20px; }
.compare-pair figure { margin: 0; }
.compare-pair figcaption { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 720px) { .compare-head .sync-btn { margin-left: 0; } }
.pill { font-size: 0.82rem; font-weight: 600; color: #fff; padding: 3px 11px; border-radius: 999px; }
.pill.vision { background: var(--vision); }
.pill.tactile { background: var(--tactile); }
.outcome { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.outcome.success { color: #2f7d4f; }
.outcome.fail { color: #b23b3b; }
.compare-note { margin: 16px 0 0; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Hardware ---------- */
.hw-feature {
  display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 24px; align-items: center;
  margin-bottom: 40px;
}
.hw-photo { margin: 0; }
.hw-photo .media { aspect-ratio: 3 / 4; }
.hw-photo .media.cad { background: #fff; border: 1px solid var(--border); }
.hw-photo .media.cad > img { object-fit: contain; padding: 8%; }
.hw-photo figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); text-align: center; }
.hw-text p { color: var(--text-muted); }
@media (max-width: 820px) {
  .hw-feature { grid-template-columns: 1fr 1fr; }
  .hw-text { grid-column: 1 / -1; }
}

/* ---------- Citation ---------- */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0; padding: 18px; overflow-x: auto; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.55;
}
.copy-btn { position: absolute; top: 10px; right: 10px; }

.footer { padding: 32px 0; border-top: 1px solid var(--border); }
