/* Based on the Nerfies project-page template (CC BY-SA 4.0),
   with the full-screen hero video used by BeyondMimic. */

body {
  font-family: "Noto Sans", sans-serif;
  color: #363636;
}

.publication-title,
.section .title,
.row-label,
.clip-label {
  font-family: "Google Sans", "Noto Sans", sans-serif;
}

/* ---------- Hero with background video ---------- */
.hero.video-hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(420px, 60vw, 92vh);
  background: #111;
}
.video-hero .hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-hero .hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0.65));
}
.video-hero .hero-head,
.video-hero .hero-body {
  position: relative;
  z-index: 1;
}
.video-hero .hero-head a {
  color: rgba(255, 255, 255, 0.85);
  display: inline-block;
  padding: 1rem 1.5rem;
  font-size: 0.95rem;
}
.video-hero .hero-head a:hover {
  color: white;
}
.video-hero .publication-title,
.video-hero .publication-authors,
.video-hero .publication-venue {
  color: white;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.publication-title {
  font-weight: 600;
  line-height: 1.2;
}
.publication-authors {
  font-size: 1.25rem;
  margin-top: 1rem;
}
.publication-authors a {
  color: #8ec5ff !important;
}
.publication-venue {
  margin-top: 0.4rem;
  font-size: 1.05rem;
  opacity: 0.9;
}
.publication-links {
  margin-top: 1.5rem;
}
.link-block {
  display: inline-block;
  margin: 0.25rem;
}
.button.is-pending {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* ---------- Sections ---------- */
.section .title.is-3 {
  margin-bottom: 1rem;
}
.section-lead {
  max-width: 46rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}
.content.has-text-justified p {
  hyphens: auto;
}
.figure-img {
  width: 100%;
  border-radius: 6px;
}
figcaption {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

/* ---------- Videos ---------- */
video.clip {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #eee;
}
.clip-label {
  display: block;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.35rem;
}
.clip-grid {
  display: grid;
  gap: 1rem 0.9rem;
}
.clip-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.clip-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.clip-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.clip-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.clip-label small {
  display: block;
  font-weight: 400;
  color: #777;
}

/* Override matrix: a label column plus one column per gait */
.override-matrix {
  display: grid;
  grid-template-columns: 9.5rem repeat(3, 1fr);
  gap: 0.9rem;
  align-items: center;
}
.override-matrix .col-head {
  text-align: center;
  font-weight: 600;
  font-family: "Google Sans", "Noto Sans", sans-serif;
  font-size: 1.1rem;
}
.row-label {
  font-weight: 600;
  line-height: 1.3;
}
.row-label small {
  display: block;
  font-weight: 400;
  color: #777;
}
.subhead {
  font-family: "Google Sans", "Noto Sans", sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
}

/* ---------- Results ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.stat {
  background: #f5f7fa;
  border-radius: 10px;
  padding: 0.9rem 0.6rem;
  text-align: center;
}
.stat strong {
  display: block;
  font-size: 1.7rem;
  font-family: "Google Sans", "Noto Sans", sans-serif;
  color: #1a5fb4;
  line-height: 1.2;
}
.stat span {
  font-size: 0.85rem;
  color: #555;
}
.table-wrap {
  overflow-x: auto;
}
table.cot td.best {
  font-weight: 700;
}

.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
}
.video-embed iframe,
.video-embed .placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
}
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border: 1px dashed #bbb !important;
  color: #888;
}

pre.bibtex {
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.footer {
  padding: 2rem 1.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .clip-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .clip-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .clip-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .override-matrix { grid-template-columns: repeat(3, 1fr); }
  .override-matrix .corner { display: none; }
  .override-matrix .row-label {
    grid-column: 1 / -1;
    margin-top: 0.75rem;
  }
  .hero.video-hero { min-height: 70vh; }
}
@media (max-width: 480px) {
  .clip-grid.cols-2,
  .clip-grid.cols-3,
  .clip-grid.cols-4 { grid-template-columns: 1fr; }
  .clip-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
  .override-matrix .col-head { font-size: 0.85rem; }
  .publication-title.is-1 { font-size: 2rem; }
  .publication-authors { font-size: 1.1rem; }
}

/* ---------- Terrain-adaptive gaits page ---------- */
/* Gait colours, as in the paper's figures */
:root {
  --gait-ls-walk: #333333;
  --gait-ds-walk: #b3b3b3;
  --gait-amble: #0072bd;
  --gait-trot: #d95319;
  --gait-pace: #edb120;
  --gait-pronk: #77ac30;
  --gait-half-bound: #f267c5;
  --gait-bound: #7e2f8e;
  --gait-canter: #4dbeee;
  --gait-t-gallop: #a2142f;
  --gait-r-gallop: #1acc80;
}
.gait-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: "Google Sans", "Noto Sans", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.3rem;
}
.gait-label small {
  font-weight: 400;
  color: #777;
}
.gait-dot {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--gait);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

/* Stage 1: one grid per terrain, switched with tabs */
.terrain-tabs {
  margin-bottom: 1rem;
}
.terrain-tabs a {
  font-family: "Google Sans", "Noto Sans", sans-serif;
}
.terrain-grid[hidden] {
  display: none;
}
.info-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  aspect-ratio: 640 / 412;
  padding: 0.75rem;
  text-align: center;
  border-radius: 10px;
  background: #f5f7fa;
}
.info-cell strong {
  font-family: "Google Sans", "Noto Sans", sans-serif;
  font-size: 1.3rem;
}
.info-cell span {
  font-size: 0.85rem;
  color: #555;
}

.clip-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.strip-img {
  width: 100%;
  border-radius: 6px;
}
pre.code {
  white-space: pre-wrap;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .clip-grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .clip-grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
  .info-cell { aspect-ratio: auto; }
}
@media (max-width: 480px) {
  /* keep the 11 gaits two per row on phones */
  .terrain-grid.clip-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
/* equal columns even when the info cell's text is taller than its aspect ratio */
.terrain-grid.clip-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .terrain-grid.clip-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .terrain-grid.clip-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Playback speed and velocity controls */
.speed-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin: -0.25rem 0 1rem;
  font-size: 0.85rem;
  color: #666;
}
.speed-toggle .buttons {
  margin-bottom: 0;
}
.speed-toggle .buttons .button {
  margin-bottom: 0;
}
.velocity-tabs a {
  font-family: "Google Sans", "Noto Sans", sans-serif;
}

/* Stacked full-width strips (generalization: the same gaps, style overridden) */
.clip-stack {
  display: grid;
  gap: 0.75rem;
}
/* Rear legs over gaps: same grid as Stage 1 */
.terrain-grid-static.clip-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .terrain-grid-static.clip-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .terrain-grid-static.clip-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* v2: lighter shade over the hero video (the title keeps its text shadow) */
.video-hero .hero-shade {
  background: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.16) 45%, rgba(0, 0, 0, 0.5));
}
/* v2: the same gaps with the style overridden, stacked tightly as in the supplementary video */
.gap-stack { display: grid; gap: 4px; }
.stack-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.75rem; align-items: center; }
.stack-row video.clip { border-radius: 4px; }
.stack-label { font-family: "Google Sans", "Noto Sans", sans-serif; font-weight: 600; font-size: 0.95rem; line-height: 1.25; text-align: center; }
.stack-label small { display: block; font-weight: 400; color: #777; font-size: 0.8rem; }
@media (max-width: 600px) {
  .stack-row { grid-template-columns: 1fr; gap: 0.2rem; }
  .stack-label { text-align: center; }
}
/* v2: bipedal grids, one per mode and terrain (same layout as Stage 1) */
.biped-grid[hidden], .biped-terrain-tabs li[hidden] { display: none; }
.biped-grid.clip-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.biped-mode-tabs { margin-bottom: 0.5rem; }
@media (max-width: 900px) {
  .biped-grid.clip-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .biped-grid.clip-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
