/* EgoEMG project page — "clinical signal laboratory" design system.
   Warm paper ground, ink typography, bilateral signal coding
   (blue = left hand, orange = right hand, everywhere), instrument-grade
   monospace data labels, hairline graticules. Fonts: Fraunces (display),
   IBM Plex Sans (body), IBM Plex Mono (data). */

:root {
  --paper: #f6f3ec;
  --paper-2: #fbf9f4;
  --ink: #191c20;
  --ink-2: #454c54;
  --ink-3: #7a828b;
  --line: rgba(25, 28, 32, 0.16);
  --line-soft: rgba(25, 28, 32, 0.09);
  --left: #1971c2;
  --right: #e8590c;
  --accent: #e8590c;
  --violet: #6741d9;
  --panel: #ffffff;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --shadow: 0 1px 2px rgba(25, 28, 32, 0.05), 0 8px 28px rgba(25, 28, 32, 0.09);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(25, 28, 32, 0.022) 31px 32px),
    var(--paper);
}

::selection { background: rgba(232, 89, 12, 0.22); }

section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px 24px 36px;
  scroll-margin-top: 72px;
}

h1, h2, h3 { line-height: 1.15; }

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 34px;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

h2 .no {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 2px 7px;
  transform: translateY(-4px);
}

h3 { font-size: 17px; font-weight: 600; margin: 26px 0 8px; }

p { color: var(--ink-2); }
.lead { font-size: 17.5px; }
.lead b, p b { color: var(--ink); }
.footnote { font-size: 13.5px; color: var(--ink-3); }

a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(232, 89, 12, 0.5); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(25, 28, 32, 0.055);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 0.5px 5px;
  color: var(--ink);
}

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 15px 18px;
  overflow-x: auto;
}

pre code { background: none; border: none; padding: 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }

/* ---------- nav ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 243, 236, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo { flex: none; }

.nav-links { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }

.nav-links a {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: 5px;
  text-decoration: none;
}

.nav-links a:hover { color: var(--ink); background: rgba(25, 28, 32, 0.06); }
.nav-links a.active { color: var(--accent); background: rgba(232, 89, 12, 0.08); }

.nav-gh {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  padding: 6px 12px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  text-decoration: none;
}

.nav-gh:hover { background: var(--ink); color: var(--paper); }

/* ---------- hero ---------- */

.hero { padding: 72px 24px 40px; text-align: center; max-width: none; }

.hero-inner { max-width: 1400px; margin: 0 auto; }

.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(54px, 7.5vw, 92px);
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--ink-2);
  max-width: 700px;
  margin: 14px auto 8px;
}

.hero-chips {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 26px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.hero-chips span { color: var(--ink-2); }
.hero-chips i { font-style: normal; color: var(--accent); }

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 860px;      /* same reading measure as the abstract lead */
  margin: 0 auto 40px;
}

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }

.btn-primary {
  color: var(--paper);
  background: var(--ink);
  box-shadow: 3px 3px 0 rgba(232, 89, 12, 0.85);
}

.btn-primary:hover { box-shadow: 4px 4px 0 rgba(232, 89, 12, 0.85); }

.btn-outline { color: var(--ink); border-color: var(--ink); background: var(--panel); }
.btn-outline:hover { background: var(--paper-2); }

.btn-segment {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  cursor: default;
}

.btn-segment code { border: none; background: none; color: #ffc9a3; font-weight: 500; }

.action-group { display: inline-flex; }

.action-group .btn-outline { border-radius: 6px 0 0 6px; border-right: none; }

.btn-ghost {
  color: var(--ink-3);
  border: 1px dashed var(--line);
  background: transparent;
  cursor: default;
}

/* load-in stagger */
.hero-inner > * {
  animation: rise 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hero-inner > *:nth-child(2) { animation-delay: 0.07s; }
.hero-inner > *:nth-child(3) { animation-delay: 0.14s; }
.hero-inner > *:nth-child(4) { animation-delay: 0.21s; }
.hero-inner > *:nth-child(5) { animation-delay: 0.28s; }
.hero-inner > *:nth-child(6) { animation-delay: 0.35s; }
.hero-inner > *:nth-child(7) { animation-delay: 0.42s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-inner > * { animation: none; }
}

/* ---------- hero multimodal layout ---------- */

.hero-multimodal {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(640px, 1.22fr);
  gap: 18px;
  align-items: stretch;
  text-align: left;
  margin: 0 auto 8px;
}

.hero-multimodal .hero-video { margin: 0; max-width: none; display: flex; flex-direction: column; justify-content: center; position: relative; }

.hero-video video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(25, 28, 32, 0.9);
  display: block;
  background: #000;
  flex: 1;
}

/* caption overlays the video (kept out of flow so both columns share
   one exact vertical centerline) */
.hero-video figcaption {
  position: absolute;
  left: 12px;
  top: 12px;
  margin: 0;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--paper);
  background: rgba(25, 28, 32, 0.72);
  border-radius: 5px;
  padding: 4px 10px;
}

.modality-strip { display: flex; flex-direction: column; min-height: 0; }

.modality-strip canvas {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 470px;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(25, 28, 32, 0.9);
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(25, 28, 32, 0.045) 23px 24px),
    var(--paper-2);
  cursor: crosshair;
  touch-action: none;
}

.modality-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1280px;
  margin: 16px auto 8px;
  padding: 0 2px;
}

.modality-controls input[type="range"] {
  flex: 1;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: var(--ink);
  outline: none;
  cursor: pointer;
}

.modality-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--accent);
  cursor: grab;
}

.modality-controls input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--accent);
  cursor: grab;
}

.modality-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 auto 14px;
}

.modality-legend .chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--panel);
}

.modality-time {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  min-width: 96px;
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hero-multimodal { grid-template-columns: 1fr; }
  .modality-strip canvas { min-height: 300px; }
}

/* ---------- abstract ---------- */

.lead { max-width: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.stat {
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  border-radius: 6px;
  padding: 14px 12px 12px;
  text-align: center;
  background: var(--panel);
}

.stat b {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.01em;
}

.stat span { display: block; color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.stat small { display: block; font-family: var(--mono); color: var(--ink-3); font-size: 11px; margin-top: 5px; line-height: 1.5; }

/* ---------- figures ---------- */

.fig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.fig { margin: 0 0 20px; }

.fig-img {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.fig-img img { width: 100%; height: auto; display: block; border-radius: 4px; }

.fig figcaption {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
  text-align: left;
}

.fig figcaption b { color: var(--ink-2); font-weight: 500; }

/* ---------- splits ---------- */

.splits-row {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 34px;
  align-items: center;
  margin-top: 24px;
}

.split-matrix-wrap { padding: 4px 0; }

.split-matrix {
  display: grid;
  grid-template-columns: 5fr 2fr;
  grid-template-rows: 4fr 2.4fr;
  gap: 4px;
  aspect-ratio: 4 / 3;
  padding: 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sm-cell {
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: rgba(25, 28, 32, 0.055);
}

.sm-gesture { background: rgba(25, 113, 194, 0.14); color: var(--left); }
.sm-user { background: rgba(232, 89, 12, 0.12); color: var(--right); }
.sm-both {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 3px 3px 0 rgba(232, 89, 12, 0.8);
}

.sm-axes {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.splits-defs h3 { margin-top: 0; }

.splits-defs dl { margin: 14px 0 14px; display: grid; gap: 10px; }

.splits-defs dl div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px dashed var(--line-soft);
  padding-bottom: 10px;
}

.splits-defs dt { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink); }
.splits-defs dl div:nth-child(1) dt { color: var(--left); }
.splits-defs dl div:nth-child(2) dt { color: var(--right); }
.splits-defs dl div:nth-child(3) dt { color: var(--ink); }
.splits-defs dd { margin: 0; color: var(--ink-2); font-size: 15px; }

@media (max-width: 860px) {
  .splits-row { grid-template-columns: 1fr; }
  .split-matrix-wrap { max-width: 340px; margin: 0 auto; }
}

/* ---------- method carousel ---------- */

.method-carousel {
  margin-top: 24px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 4px 4px 0 rgba(25, 28, 32, 0.9);
  overflow: hidden;
}

.mc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.mc-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.mc-tab {
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.mc-tab:hover { background: var(--paper-2); }

.mc-tab.active { background: var(--ink); color: var(--paper); }

.mc-nav { display: flex; align-items: center; gap: 10px; }

.mc-btn {
  font-family: var(--mono);
  font-size: 15px;
  width: 34px;
  height: 30px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.mc-btn:hover { background: var(--ink); color: var(--paper); }

.mc-btn:disabled { opacity: 0.3; cursor: default; }
.mc-btn:disabled:hover { background: var(--panel); color: var(--ink); }

.mc-count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
}

.mc-stage { padding: 18px 18px 6px; }

.mc-slide { display: none; margin: 0; }

.mc-slide.active { display: block; animation: mcIn 0.28s ease; }

@keyframes mcIn {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

.mc-slide .fig-img {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.mc-slide .fig-img img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

/* the vision baseline figure reads best two-thirds width */
.mc-slide[data-i="1"] .fig-img img {
  max-width: 66%;
  margin: 0 auto;
}

.mc-slide figcaption {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-3);
  padding: 12px 4px 12px;
}

.mc-slide figcaption b { color: var(--ink-2); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .mc-slide.active { animation: none; }
}

/* ---------- results ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table { border-collapse: collapse; width: 100%; min-width: 640px; }

th, td {
  text-align: left;
  padding: 11px 16px;
  font-size: 15px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  background: rgba(25, 28, 32, 0.035);
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(232, 89, 12, 0.05); }

td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
td b { font-family: var(--mono); font-size: 15.5px; }

/* ---------- gallery ---------- */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.video-card { margin: 0; }

.video-card video {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(25, 28, 32, 0.9);
  background: #000;
  display: block;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.video-card:hover video { transform: translateY(-3px); box-shadow: 5px 6px 0 rgba(25, 28, 32, 0.9); }

.video-card figcaption {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

/* ---------- callout / data ---------- */

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 8px;
  padding: 15px 18px;
  font-size: 15px;
  color: var(--ink-2);
  margin: 8px 0 10px;
}

.callout b { color: var(--ink); }

.cite-box { position: relative; margin-top: 18px; }
.cite-box pre { margin: 0; padding-right: 150px; }

.btn-copy {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 13px;
  font-size: 12.5px;
  border-radius: 5px;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-copy:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding: 30px 24px 44px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 80%);
  height: 14px;
  background:
    linear-gradient(90deg, transparent 0%, var(--left) 12%, transparent 30%,
      transparent 45%, var(--accent) 58%, transparent 75%, transparent 100%)
    no-repeat center / 100% 2px;
  opacity: 0.75;
}

.site-footer p { color: var(--ink-3); }
.site-footer p + p { margin-bottom: 0; }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  section { padding: 48px 18px 28px; }
  .nav-links { display: none; }
  .nav-gh { margin-left: auto; }
  .cite-box pre { padding-right: 18px; padding-bottom: 54px; }
  .btn-copy { top: auto; bottom: 12px; right: 12px; }
  h2 { font-size: 28px; }
}
