/* Project page styles: warm monochrome canvas, editorial type, flat bordered surfaces. */

:root {
  --canvas: #FBFBFA;
  --surface: #FFFFFF;
  --surface-muted: #F7F6F3;
  --border: #EAEAEA;
  --axis: #CFCEC8;
  --text: #111111;
  --text-soft: #2F3437;
  --muted: #787774;
  --blue: #1F6C9F;
  --ochre: #956400;
  --green: #346538;
  --pale-yellow: #FBF3DB;
  --sans: 'Geist', 'SF Pro Display', 'Helvetica Neue', 'Switzer', sans-serif;
  --serif: 'Newsreader', 'Lyon Text', 'Playfair Display', 'Instrument Serif', serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --page-gutter: 24px;
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
}

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

h1,
h2,
p,
ul,
figure,
pre {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img,
video,
canvas {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Soft warm light spots behind the page */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(44% 38% at 18% 12%, rgba(149, 100, 0, 0.035), transparent 72%),
    radial-gradient(40% 36% at 86% 58%, rgba(159, 47, 45, 0.03), transparent 72%);
}

main,
.footer {
  position: relative;
  z-index: 1;
}

/* Layout */

.container {
  width: 100%;
  max-width: calc(1024px + 2 * var(--page-gutter));
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

.section {
  padding-top: 112px;
}

.section-title {
  margin-bottom: 28px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: box-shadow 200ms ease;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.caret {
  width: 12px;
  height: 12px;
  flex: none;
}

/* Hero */

.hero {
  padding-top: 24vh;
  padding-bottom: 5vh;
  text-align: center;
}

.title {
  max-width: 980px;
  margin-inline: auto;
  color: var(--text);
  font-family: var(--serif);
  font-size: clamp(28px, 3.7vw, 38px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 32px;
  margin-top: 32px;
  color: var(--text);
  font-size: 17px;
}

sup {
  font-size: 0.7em;
  line-height: 0;
}

.contribution {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 40px;
  margin-top: 24px;
  font-size: 15px;
}

.affiliations a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  text-decoration: none;
}

.affiliations a:hover span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.affiliations img {
  width: 30px;
  height: 30px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--text);
  border-radius: 6px;
  background: var(--text);
  color: #FFFFFF;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.button:hover {
  border-color: #333333;
  background: #333333;
}

.button:active {
  transform: scale(0.98);
}

.button-outline {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-outline:hover {
  border-color: var(--border);
  background: var(--surface-muted);
}

.button.is-disabled {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--muted);
  cursor: default;
}

.button.is-disabled:active {
  transform: none;
}

.button .caret {
  transition: transform 200ms ease;
}

.button[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

.tag {
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--pale-yellow);
  color: var(--ochre);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.abstract {
  max-width: 780px;
  margin: 28px auto 0;
  padding: 28px 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

.abstract.is-open {
  opacity: 1;
  transform: none;
}

.abstract p {
  font-size: 15.5px;
  line-height: 1.7;
}

/* Interactive demo */

.demo {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px;
  padding: 24px;
}

.viewer {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.viewer canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
}

.viewer canvas.is-dragging {
  cursor: grabbing;
}

.viewer canvas:focus-visible {
  outline-offset: -4px;
}

.viewer-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 200ms ease, transform 200ms ease;
}

.viewer-toggle:hover {
  background: var(--surface-muted);
}

.viewer-toggle:active {
  transform: scale(0.96);
}

.viewer-toggle svg {
  width: 14px;
  height: 14px;
}

.viewer-toggle .icon-play,
.viewer-toggle.is-paused .icon-pause {
  display: none;
}

.viewer-toggle.is-paused .icon-play {
  display: block;
}

.viewer-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.demo-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.select {
  display: flex;
  flex: 1 1 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  transition: border-color 200ms ease;
}

.select:hover {
  border-color: #D5D4CF;
}

.select:focus-within {
  border-color: var(--text);
}

.select-label {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--muted);
  white-space: nowrap;
}

.select-value {
  position: relative;
  display: flex;
  flex: 1;
}

.select select {
  width: 100%;
  padding: 8px 28px 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.select select:focus {
  outline: none;
}

.select .caret {
  position: absolute;
  top: 50%;
  right: 9px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

/* Plots: the canvases and the dashed now line share these measurements */

.plots {
  --plot-gutter: 44px;
  --plot-pad-right: 10px;
  --plot-now: 0.86;
  --plot-caption: 26px;
  --plot-xlabels: 22px;
  position: relative;
  display: grid;
  gap: 12px;
}

.plot figcaption {
  display: flex;
  align-items: baseline;
  gap: 10px;
  height: var(--plot-caption);
  font-size: 13px;
  line-height: var(--plot-caption);
  white-space: nowrap;
}

.plot-title {
  color: var(--trace, var(--text));
  font-weight: 500;
}

.plot-unit {
  color: var(--muted);
  font-size: 12px;
}

/* Leg checkboxes at the end of the first plot title: the line next to each name is how that leg is drawn in the plots */

.checks {
  display: flex;
  align-self: center;
  gap: 14px;
  margin-left: auto;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  cursor: pointer;
}

.check input {
  width: 14px;
  height: 14px;
  margin: 0;
  border: 1px solid var(--axis);
  border-radius: 3px;
  background: var(--surface) center / 10px no-repeat;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 200ms ease, border-color 200ms ease;
}

.check input:checked {
  border-color: var(--text);
  background-color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23FFFFFF'%3E%3Cpath d='M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E");
}

.check-line {
  width: 18px;
  border-top: 2px solid var(--muted);
}

.check-line.is-dashed {
  border-top-style: dashed;
}

.plot-canvas {
  position: relative;
  height: 122px;
}

.plot-canvas.has-time-axis {
  height: 144px;
}

.plot-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.now-line {
  position: absolute;
  top: var(--plot-caption);
  bottom: var(--plot-xlabels);
  left: calc(var(--plot-gutter) + (100% - var(--plot-gutter) - var(--plot-pad-right)) * var(--plot-now));
  border-left: 1px dashed rgba(17, 17, 17, 0.5);
  pointer-events: none;
}

/* Experiment */

.experiment {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 32px;
}

.experiment-main {
  min-width: 0;
}

.video-frame {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--text);
  aspect-ratio: 16 / 9;
}

.video-frame video {
  width: 100%;
  height: 100%;
}

/* Video timeline: the ticks mark where the treadmill speed changes */

.timeline {
  --thumb: 14px;
  --track: 4px;
  margin-top: 14px;
}

.timeline input {
  display: block;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.timeline input::-webkit-slider-runnable-track {
  height: var(--track);
  border-radius: 9999px;
  background: var(--axis);
}

.timeline input::-moz-range-track {
  height: var(--track);
  border-radius: 9999px;
  background: var(--axis);
}

.timeline input::-webkit-slider-thumb {
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2);
  border: 0;
  border-radius: 50%;
  background: var(--text);
  appearance: none;
  -webkit-appearance: none;
}

.timeline input::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: var(--text);
}

.timeline-ticks {
  position: relative;
  height: 24px;
  margin-inline: calc(var(--thumb) / 2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.timeline-ticks li {
  position: absolute;
  top: 0;
  left: calc(var(--at) * 100%);
  padding-top: 11px;
  transform: translateX(-50%);
}

.timeline-ticks li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  height: 6px;
  border-left: 1px solid var(--axis);
}

.timeline-ticks .timeline-unit {
  right: 0;
  left: auto;
  transform: none;
}

.timeline-ticks .timeline-unit::before {
  content: none;
}

.experiment-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.experiment-side .plots,
.experiment-side .plot {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.experiment-side .plot-canvas {
  flex: 1;
  height: auto;
  min-height: 220px;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 6px;
  padding-left: 44px;
  font-size: 13px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 20px;
  height: 2px;
}

.swatch-blue {
  background: var(--blue);
}

.swatch-ochre {
  background: var(--ochre);
}

/* Figures carousel */

.carousel {
  --slide-width: min(78vw, 800px);
  --slide-height: calc(var(--slide-width) * 0.72);
  --slide-gap: 24px;
  position: relative;
  overflow: hidden;
}

.carousel-track {
  position: relative;
  height: var(--slide-height);
}

.slide {
  position: absolute;
  top: 0;
  left: calc(50% - var(--slide-width) / 2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--slide-width);
  height: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  opacity: 0;
  transform: translateX(calc(var(--offset, 0) * (75% + var(--slide-gap)))) scale(0.5);
  transition: transform 600ms var(--ease), opacity 400ms ease;
}

.slide img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.slide.is-current {
  opacity: 1;
  transform: none;
}

.slide.is-neighbour {
  opacity: 0.4;
  cursor: pointer;
}

html:not(.js) .slide:first-child {
  opacity: 1;
  transform: none;
}

.carousel-button {
  position: absolute;
  top: calc(var(--slide-height) / 2 - 22px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 200ms ease, transform 200ms ease;
}

.carousel-button:hover {
  background: var(--surface-muted);
}

.carousel-button:active {
  transform: scale(0.96);
}

.carousel-button svg {
  width: 16px;
  height: 16px;
}

.carousel-prev {
  left: calc(50% - var(--slide-width) / 2 - 22px);
}

.carousel-next {
  right: calc(50% - var(--slide-width) / 2 - 22px);
}

.captions {
  display: grid;
  width: 100%;
  max-width: calc(760px + 2 * var(--page-gutter));
  margin: 24px auto 0;
  padding-inline: var(--page-gutter);
}

.caption {
  grid-area: 1 / 1;
  font-size: 14.5px;
  line-height: 1.65;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms;
}

.caption.is-current,
html:not(.js) .caption:first-child {
  opacity: 1;
  visibility: visible;
}

.caption-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* BibTeX */

.bibtex {
  padding: 24px 28px;
  overflow-x: auto;
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.7;
}

.bibtex code {
  font: inherit;
}

/* Footer */

.footer {
  width: calc(100% - 2 * var(--page-gutter));
  max-width: 1024px;
  margin: 112px auto 0;
  padding: 28px 0 64px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* Scroll entry */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms var(--ease), transform 600ms var(--ease), box-shadow 200ms ease;
    transition-delay: calc(var(--index, 0) * 80ms);
  }

  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .abstract,
  .slide,
  .caption {
    transition: none;
  }
}

/* Narrow screens */

@media (max-width: 900px) {
  .section {
    padding-top: 88px;
  }

  .hero {
    padding-top: 18vh;
  }

  .demo,
  .experiment {
    grid-template-columns: minmax(0, 1fr);
  }

  .viewer {
    order: -1;
    min-height: 0;
    height: min(120vw, 520px);
  }
}

@media (max-width: 560px) {
  :root {
    --page-gutter: 16px;
  }

  .demo {
    padding: 16px;
  }

  .plot figcaption.has-checks {
    flex-wrap: wrap;
    row-gap: 0;
    height: auto;
  }

  .checks {
    flex-basis: 100%;
    margin-left: 0;
  }

  .demo .now-line {
    top: calc(2 * var(--plot-caption));
  }

  .abstract {
    padding: 20px;
  }

  .slide {
    padding: 12px;
  }

  .carousel {
    --slide-width: 84vw;
  }

  .carousel-button {
    top: calc(var(--slide-height) / 2 - 18px);
    width: 36px;
    height: 36px;
  }

  .carousel-prev {
    left: calc(50% - var(--slide-width) / 2 - 14px);
  }

  .carousel-next {
    right: calc(50% - var(--slide-width) / 2 - 14px);
  }
}
