:root {
  --accent: #4338ca;          /* indigo */
  --accent-2: #0ea5e9;        /* sky    */
  --accent-soft: #eef2ff;
  --ink: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
}

html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -200px, #eef2ff 0%, rgba(238,242,255,0) 60%),
    #ffffff;
}

/* ---------- Header ---------- */
.head-hero {
  padding-top: 3.5rem;
  padding-bottom: 0.5rem;
}

.head-hero .hero-body { padding-bottom: 0.5rem; }

.publication-title {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  font-size: clamp(1.6rem, 4.6vw, 2.5rem) !important;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.2rem !important;
}

/* keep the title on a single line on tablet/desktop */
@media (min-width: 769px) {
  .publication-title { white-space: nowrap; }
}

.publication-authors {
  line-height: 1.9;
  margin: 0.4em 0 0.2em;
  font-weight: 500;
}
.author-block { display: inline-block; margin: 0 0.35em; }
.publication-authors a { color: var(--accent) !important; }
.publication-authors a:hover { text-decoration: underline; }

.publication-affiliations {
  color: var(--muted);
  line-height: 1.7;
}
.affiliation-block { display: inline-block; margin: 0 0.45em; }

.publication-note {
  color: var(--muted);
  margin-top: 0.3rem;
}

.publication-venue {
  color: var(--accent);
  font-weight: 700;
  margin-top: 0.7rem;
  letter-spacing: 0.02em;
}

/* ---------- Buttons ---------- */
.publication-links { margin-top: 1.6rem; }

.publication-links .button {
  background: var(--ink);
  color: #fff;
  border: none;
  font-weight: 600;
  padding-left: 1.2rem;
  padding-right: 1.2rem;
  margin: 0.3rem 0.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.publication-links .button:hover {
  transform: translateY(-2px);
  background: var(--accent);
  box-shadow: 0 8px 18px -8px rgba(67, 56, 202, 0.7);
}
.publication-links .is-disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Layout / typography ---------- */
.main-content { padding-top: 1.5rem; }

.main-content .content h2 {
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 2.6rem;
  margin-bottom: 1.1rem;
  text-align: center;
  font-size: 2rem;
}
.main-content .content h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin: 0.6rem auto 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.main-content .content h3 {
  font-weight: 700;
  margin-top: 2rem;
  color: var(--ink);
}

.content .has-text-justified { line-height: 1.75; font-size: 1.05rem; }

hr {
  background: var(--border);
  height: 1px;
  margin: 3rem 0;
}

/* TL;DR banner */
.tldr {
  max-width: 820px;
  margin: 0 auto 2rem;
  text-align: center;
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--ink);
  text-wrap: balance;
}
.tldr b { color: var(--accent); }

/* ---------- Figures ---------- */
.fig {
  margin: 1.5rem auto;
  text-align: center;
}
.fig img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.45);
  background: #fff;
}
.fig figcaption {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
.fig figcaption b { color: var(--ink); }

/* generic media block */
.media-block {
  width: 100%;
  max-width: 900px;
  margin: 1.25rem auto;
  display: block;
  border-radius: var(--radius);
}

/* ---------- Video placeholders ---------- */
.video-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 2px dashed #c7d2fe;
  background:
    repeating-linear-gradient(45deg, #f8faff, #f8faff 14px, #eef2ff 14px, #eef2ff 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  gap: 0.5rem;
}
.video-placeholder i { font-size: 2.4rem; opacity: 0.8; }
.video-placeholder span { font-weight: 600; letter-spacing: 0.01em; }
.video-placeholder small { color: var(--muted); font-weight: 500; }

/* ---------- Results carousel / grid ---------- */
.results-section { padding-left: 0; padding-right: 0; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1.25rem 0;
}
@media (max-width: 768px) { .results-grid { grid-template-columns: 1fr; } }

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: 0 6px 14px -10px rgba(15, 23, 42, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 26px -14px rgba(15, 23, 42, 0.4);
}
.result-card video { border-radius: 10px; aspect-ratio: 16 / 9; width: 100%; display: block; background: #000; }
.result-card .video-placeholder { border-radius: 10px; aspect-ratio: 16 / 9; }
.result-card .caption {
  margin-top: 0.6rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Embodiment generalization (full-width strips) ---------- */
.embod { margin: 1rem 0 0; }

.embod-note {
  font-size: 0.88rem;
  color: #94a3b8;
  font-style: italic;
  margin: 0 0 0.5rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--border);
}

.embod-group-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  margin-top: 2rem;
}
.embod-group-sub {
  color: var(--muted);
  margin: 0.35rem 0 0.9rem;
  font-size: 0.98rem;
}
.embod-group-sub a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(67, 56, 202, 0.35);
}
.embod-group-sub a:hover { border-bottom-color: var(--accent); }

.embod-example {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  margin: 0.9rem 0;
  box-shadow: 0 6px 16px -12px rgba(15, 23, 42, 0.4);
}
.embod-example video {
  width: 100%;
  display: block;
  border-radius: 10px;
  background: #000;
}
/* 3-column header aligned to the Mesh | Ours | GT panels of the strip */
.strip-labels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.1rem 0 0.5rem;
}
.strip-labels.is-2 { grid-template-columns: repeat(2, 1fr); }
.strip-labels span:nth-child(2) { color: var(--accent); }
/* Optional second line naming what the column actually conditions on. */
.strip-labels span {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}
.strip-labels small {
  font-weight: 500;
  font-size: 0.78em;
  color: #94a3b8;
}

/* bulma-carousel leaves `.slider` unclipped, so the neighbouring slides render in
   the page margins beside the container. Clip them; the navigation arrows and
   pagination sit inside this box and are unaffected. */
.results-carousel .slider { overflow: hidden; }

/* Comparison strips are 5.2:1. At a phone width each of the three panels would
   land around 120px, which is unreadable, so below the tablet breakpoint the
   strip keeps a usable width and scrolls horizontally instead. Labels and video
   share the scrolling box so the columns stay aligned while swiping. */
@media (max-width: 768px) {
  .embod-example {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .embod-example > .strip-labels,
  .embod-example > video { min-width: 600px; }
}

.teaser-video {
  width: 100%;
  display: block;
  margin: 1.2rem 0 0.5rem;
  border-radius: var(--radius);
  background: #000;
  aspect-ratio: 16 / 9;
  box-shadow: 0 10px 26px -18px rgba(15, 23, 42, 0.55);
}

.results-sub {
  margin: -0.4rem 0 0.9rem;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

/* ---------- Counterfactual 2x2 (one composited clip + HTML headers) ---------- */
/* The clip is a single 2x2 mp4, so the four panels can never drift apart. Row and
   column headers live in HTML around it rather than burnt into the video. */
.cf-fig {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.5rem;
  row-gap: 0.35rem;
  margin: 1rem 0 0.4rem;
}
.cf-collabels {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.cf-collabels span:nth-child(2) { color: var(--accent); }
.cf-rowlabels {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: 1fr 1fr;
}
.cf-rowlabels span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  place-self: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.cf-fig video {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  display: block;
  border-radius: 10px;
  background: #000;
  aspect-ratio: 1668 / 964;
}
.embod-cap {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- State–action gap figures (paired outline video + graph) ---------- */
.gap-block { margin: 1.25rem 0 1.75rem; }
.gap-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  margin: 0 0 0.6rem;
}
/* Overlay panel and its time-series graph sit side by side. Both are rendered at
   the same aspect ratio so the two cards are exactly the same height and their
   captions align. */
.gap-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  align-items: start;
}
.gap-row.is-3 { grid-template-columns: repeat(3, 1fr); }
/* Matches the breakpoint used for the carousels and the scrolling strips: below
   it three panels would be ~200px wide and unreadable. */
@media (max-width: 768px) { .gap-row, .gap-row.is-3 { grid-template-columns: 1fr; } }

/* Definition callout. Uses its own class rather than <blockquote> so Bulma's
   `.content blockquote` (higher specificity) cannot override it. */
.gap-def {
  margin: 0.9rem 0 0.85rem;
  padding: 0.85rem 1.1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(to right, var(--accent-soft) 0%, #ffffff 90%);
  font-size: 0.95rem;
  color: var(--ink);
}
.gap-def b { color: var(--accent); }
/* Bulma's `.content figure` sets 2em side margins and a 2em top margin on every
   figure but the first. Inside the grid that shrinks each card by 64px and drops
   cells 2-3 by 32px, so the row renders narrow and staggered. Reset at matching
   specificity. */
.content .gap-cell,
.content .gap-cell:not(:first-child),
.content .gap-cell:not(:last-child),
.gap-cell {
  margin: 0;
}
.gap-cell {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  box-shadow: 0 6px 14px -12px rgba(15, 23, 42, 0.35);
}
.gap-cell video {
  width: 100%;
  display: block;
  border-radius: 8px;
  background: #000;
  /* Pin the ratio so the row does not reflow when metadata loads (an unsized
     <video> defaults to 300x150). Rows whose clips have a different native ratio
     override --gap-ar inline, which avoids letterboxing inside the cell. */
  aspect-ratio: var(--gap-ar, 426 / 206);
  object-fit: contain;
}
.gap-cell figcaption {
  margin-top: 0.4rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}
.gap-cell.is-pivot figcaption { color: var(--accent); }
/* Sits directly under the video row and above the prose, so it needs a bottom
   margin — Bulma zeroes the top margin on the <p> that follows. */
.gap-cap {
  margin: 0.7rem 0 0.9rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.gap-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  aspect-ratio: 426 / 206;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.06);
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  padding: 0.4rem;
  word-break: break-all;
}
.gap-ph i { font-size: 1.3rem; opacity: 0.7; }

/* ---------- Key-insight blockquote ---------- */
blockquote {
  border-left: 4px solid var(--accent);
  background: linear-gradient(to right, var(--accent-soft) 0%, #ffffff 90%);
  padding: 1rem 1.4rem;
  margin: 1.4rem 0 0.5rem;
  border-radius: 0 10px 10px 0;
  font-style: normal;
  box-shadow: 0 2px 6px -4px rgba(0,0,0,0.12);
}
blockquote strong { color: var(--accent); font-weight: 700; }
blockquote + details { margin-top: 0; }

/* ---------- Citation block ---------- */
.content pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.footer { background: #f8fafc; border-top: 1px solid var(--border); color: var(--muted); }
.footer a { color: var(--accent); }
