/* ==========================================================================
   RawMo project page: brand tokens and page components.
   The shared components (layout, nav, hero, section heads, figures, tabs,
   chip pickers, tables, disclosures, key points, lightbox, BibTeX, footer)
   are in family.css, which this file follows. The video cards, switchers and
   clip strips follow the MotionMaestro page.
   The accent is the paper's colour for RawMo: #46AAC5, the colour of RawMo
   in Fig. 1 (label and marker). The logo uses it as is; text uses deeper
   shades of the same hue (oklch h 219) at a readable contrast; highlighted
   rows keep the tint of the paper's RawMo table rows (BlueGreen!10, which
   PDF viewers show as #E7F7F7).
   The paper's colour language for motion stays: orange = given condition,
   blue = generated motion (Fig. 4 and the demo videos).
   ========================================================================== */

/* ---------- 1. Brand tokens ---------------------------------------------- */
:root {
  --accent: #3BA0BB;           /* the paper's RawMo colour #46AAC5 at 3:1 on white: rules, borders, icons, large text */
  --accent-text: #01758D;      /* small text and white-on fills (5.3:1 on white, 4.85:1 on the tint) */
  --accent-strong: #035C70;    /* hover (7.6:1) */
  --accent-soft: #E7F7F7;      /* tinted fills: the paper's RawMo rows (BlueGreen!10) */
  --accent-line: #A5DBEC;      /* tinted borders */
  --logo-k: 1;                 /* hero logo height factor: the wordmark has the GeoSET wordmark's cap height */

  /* the paper's motion colours: orange RGB(226,113,29) = given condition, blue RGB(91,130,184) = generated */
  --cond: #E2711D;
  --cond-ink: #A9520F;
  --cond-50: #FDF2E9;
  --cond-100: #F8DCC4;
  --gen: #5B82B8;
  --gen-ink: #3F6498;
  --gen-50: #EEF4FC;
  --gen-100: #D0DFF6;
}

.hl-cond { color: var(--cond-ink); font-weight: 600; }
.hl-gen { color: var(--gen-ink); font-weight: 600; }

/* ---------- 2. Hero ------------------------------------------------------ */
/* phones: three authors keep one line */
@media (max-width: 480px) { .hero-authors { column-gap: 14px; } }

/* section leads: balanced lines */
.section-head .lead { text-wrap: balance; }

/* ---------- 3. Headline gallery (nine-task clips + dataset strip) -------- */
.hero-gallery .carousel-nav { margin: 16px 0 0; }
.thumbs--hero .thumb { flex-basis: 164px; }
.thumbs--hero .thumb span b { display: block; }   /* dataset name above the one-line clip name */
@media (max-width: 640px) { .thumbs--hero .thumb { flex-basis: 148px; } }
.vcard--hero .vcard-head { border-bottom: 0; border-top: 1px solid var(--border); }
.section--headline .note { margin-top: 12px; }

/* ---------- 4. Colour legend chips, "given" text ------------------------- */
.legend { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 7px; border-radius: var(--radius-pill);
  font-size: .82rem; font-weight: 600; line-height: 1.2; border: 1px solid;
  white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; flex: none; }
.chip--cond { background: var(--cond-50); border-color: var(--cond-100); color: var(--cond-ink); }
.chip--cond svg { color: var(--cond); }
.chip--gen { background: var(--gen-50); border-color: var(--gen-100); color: var(--gen-ink); }
.chip--gen svg { color: var(--gen); }
@media (max-width: 640px) {
  .chip { font-size: .76rem; gap: 4px; padding: 3px 9px 3px 5px; }
  .chip svg { width: 14px; height: 14px; }
}
.given { color: var(--cond-ink); font-size: .95rem; font-weight: 500; }
.given::before { content: "given: "; font-style: italic; opacity: .85; }

/* ---------- 5. Notes under a gallery ------------------------------------- */
.note {
  margin: 16px auto 0; max-width: 112ch; text-align: center;
  font-size: .875rem; line-height: 1.55; color: var(--muted);
}

/* ---------- 6. Video card ------------------------------------------------ */
.vcard {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.vcard + .vcard { margin-top: 22px; }
.vcard-head { padding: 11px 16px; border-bottom: 1px solid var(--border); }
/* the text prompt is burned into every clip; the HTML copy is for narrow screens, where that text is small */
@media (min-width: 900px) { .vcard-head { display: none; } }
.vcard-prompt {
  margin: 0; padding-left: 12px;
  border-left: 3px solid var(--cond);
  font-size: 1rem; line-height: 1.5; color: var(--ink);
}
.vcard-prompt::before { content: "\201C"; }
.vcard-prompt::after { content: "\201D"; }

.vcard-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #fff;
  cursor: zoom-in;
}
.vcard-media video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: transparent;
}
/* spinner while a clip buffers */
.vcard-media::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 3px solid rgba(28, 39, 56, .14); border-top-color: var(--accent);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.vcard.is-loading .vcard-media::after { opacity: 1; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* big play button: shown when the viewer paused or reduced motion is on */
.vcard-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 68px; height: 68px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: rgba(28, 39, 56, .74); color: #fff;
  box-shadow: 0 8px 24px rgba(28, 39, 56, .3);
  transition: background-color .15s, transform .15s;
}
.vcard-play svg { width: 28px; height: 28px; margin-left: 3px; }
.vcard-play:hover { background: var(--ink); transform: translate(-50%, -50%) scale(1.05); }
.vcard.is-held:not(.is-playing) .vcard-play { display: flex; }

.vcard-bar {
  display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap;
  padding: 7px 10px 7px 16px;
  border-top: 1px solid var(--border);
}
.vcard-caption { flex: 1 1 260px; min-width: 0; margin: 0; font-size: .875rem; line-height: 1.45; color: var(--muted); }
.vcard-caption strong { color: var(--ink); font-weight: 600; }
.vcard-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.vcard-bar .legend { flex: none; }

.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border-radius: var(--radius-pill);
  font-size: .8438rem; font-weight: 600; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.tool-btn svg { width: 16px; height: 16px; flex: none; }
.tool-btn:hover { background: var(--bg-sunken); color: var(--ink); }
.tool-btn .i-pause { display: none; }
.vcard.is-playing .tool-btn .i-pause { display: block; }
.vcard.is-playing .tool-btn .i-play { display: none; }

.speed {
  display: inline-flex; padding: 2px; gap: 2px;
  border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg);
}
.speed button {
  height: 26px; min-width: 38px; padding: 0 8px; border-radius: var(--radius-pill);
  font: 600 .78rem/1 var(--font-mono); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.speed button:hover { color: var(--ink); }
.speed button[aria-pressed="true"] { background: var(--ink); color: #fff; }

@media (max-width: 640px) {
  .vcard-head { padding: 10px 12px; }
  .vcard-prompt { font-size: .95rem; }
  .vcard-bar { padding: 6px 6px 6px 12px; }
  .vcard-caption { flex-basis: 100%; order: 2; padding: 2px 4px 4px 0; font-size: .85rem; }
  .vcard-tools { margin-left: 0; width: 100%; }
  .vcard-tools [data-action="expand"] { margin-left: auto; }
  .vcard-bar .legend { order: 3; padding-bottom: 4px; }
  .tool-btn .lbl-optional { display: none; }
}

/* ---------- 7. Switchers: task picker, dataset rows, clip strips ---------- */
/* horizontal scroller with edge fades (thumbnail strips; fade classes set by main.js) */
.hscroll {
  position: relative;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.hscroll::-webkit-scrollbar { display: none; }

/* task picker: a 3 x 3 grid of chips on wide screens, one scrolling row on phones (family.css) */
.task-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); justify-content: center; }
@media (max-width: 720px) { .task-tabs { display: flex; justify-content: flex-start; } }
.panel-intro { margin: 0 0 14px; text-align: center; font-size: .95rem; }
.panel-intro .pnote { display: block; margin-top: 2px; font-size: .875rem; color: var(--muted); }
/* wide screens: the "given" line is burned into each clip; only a clip note stays */
@media (min-width: 900px) {
  .panel-intro .given { display: none; }
  .panel-intro:not(:has(.pnote)) { display: none; }
}

.switchbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px; margin-bottom: 22px;
}
.switchbar--center { justify-content: center; }
/* comparison: Example 1 / Example 2 under the task picker, one clip at a time */
.switchbar--ex { margin-bottom: 14px; }

/* clip / figure strip: prev, thumbnails, next */
.carousel-nav { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 14px; }
.carousel-nav .thumbs { flex: 0 1 auto; min-width: 0; }
.thumbs { display: flex; gap: 10px; padding: 3px; scroll-padding-inline: 3px; }
.thumb {
  flex: 0 0 196px;
  display: flex; flex-direction: column; gap: 6px;
  padding: 5px 5px 7px; border-radius: var(--radius); text-align: left;
  background: var(--bg); border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s;
  scroll-snap-align: start;
}
.thumb:hover { border-color: var(--border-strong); }
.thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-s); background: var(--bg-sunken); }
.thumb span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: 0 3px; font-size: .8rem; line-height: 1.35; color: var(--muted); font-weight: 500;
}
.thumb span b { color: var(--ink); font-weight: 700; margin-right: 2px; }
.thumb[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.thumbs--fig .thumb { flex-basis: 148px; }
.thumbs--fig .thumb img { aspect-ratio: 16 / 9; object-fit: contain; background: #fff; border: 1px solid var(--border); }
@media (max-width: 640px) {
  .carousel-nav .carousel-btn { display: none; }
  .thumb { flex: 0 0 148px; }
  .thumbs--fig .thumb { flex-basis: 150px; }
}

/* ---------- 8. Video lightbox (family lightbox chrome) ------------------- */
.lightbox--video .lb-stage video {
  margin: auto; width: min(100%, calc((100dvh - 150px) * 16 / 9)); height: auto; aspect-ratio: 16 / 9;
  background: #fff; border-radius: 6px;
}
.lightbox .speed { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .2); }
.lightbox .speed button { height: 30px; color: rgba(255, 255, 255, .75); }
.lightbox .speed button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.lightbox--video .lb-caption { text-align: center; }
.lb-hint { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  .lightbox--video .lb-hint { display: block; margin: 0 auto 12px; padding: 0 16px; font-size: .8rem; color: rgba(255, 255, 255, .6); text-align: center; }
}

/* ---------- 11. Figures and tables --------------------------------------- */
.figure--narrow .figure-media { max-width: 700px; margin-inline: auto; }
.figure--mid .figure-media { max-width: 780px; margin-inline: auto; }
.figure + .figure { margin-top: clamp(28px, 3.5vw, 40px); }
.results .sd { display: inline-block; margin-left: 3px; font-size: .74em; font-weight: 500; color: var(--faint); letter-spacing: 0; }   /* inline-block: the underline of a second-best value stays off the deviation, as in the paper */
.results td.best .sd { font-weight: 500; }
.results td.hl { background: var(--accent-soft); }
.results th.is-ours { background: var(--accent-soft); color: var(--accent-text); }
.results sub, .results sup, .table-figure figcaption sub { font-size: .72em; line-height: 0; }
.results .col-venue { white-space: nowrap; }
.results--text td:not(.col-method) { white-space: normal; }
.table-figure--wide .table-meta, .table-figure--wide .table-frame { max-width: none; }
.table-figure + .table-figure, .figure + .table-figure, .table-figure + .figure { margin-top: clamp(28px, 3.5vw, 40px); }
@media (max-width: 820px) { .results :is(th, td) { padding-inline: 9px; } }

/* ---------- 9. Touch input ----------------------------------------------- */
@media (pointer: coarse) {
  .vcard-tools .tool-btn, .speed button { min-height: 40px; }
  .speed button { min-width: 44px; }
  .vcard-tools .tool-btn { min-width: 44px; justify-content: center; }
}

/* ---------- 10. Print ---------------------------------------------------- */
@media print {
  .topnav, .vcard-bar, .vcard-play, .copy-btn, .carousel-nav .carousel-btn, .skip-link { display: none !important; }
  .section { padding-block: 24px; }
}
