/* =====================================================================
"Stage": dark sections carry the media, light sections carry the reading.
Each section sets its tone (.dark, .tone-white, .tone-mist) and the tokens
below follow it, so components never hard-code a background.
Order: tokens, base and shared blocks, nav, hero, media (panels, tags,
players, the two-method player), interactive 3D, then the sections in page
order (01 Overview to Citation; the tables, shared by 02 and 04, after 02),
then the breakpoints.
===================================================================== */
:root {
  --night: #07070b;
  --night-2: #111118;
  --night-3: #1a1a23;
  --mist: #f5f5f7;
  --ink: #0b0b10;
  /* headings, bold */
  --text: #2a2a33;
  /* body */
  --lead: #5c5c68;
  /* section leads: gray, key phrases in ink */
  --muted: #74747f;
  /* captions, notes, labels */
  --line: #e2e2e8;
  --card: #fff;
  /* surface one step off the section background */
  --chip: #fff;
  --chip-line: #d9d9e1;
  --on-ink: #fff;
  --accent: #e0157a;
  /* "ours" and world space */
  --accent-soft: rgba(224, 21, 122, .07);
  --accent-hover: rgba(224, 21, 122, .13);
  --row-hover: rgba(10, 10, 20, .04);
  --drift: #f59e0b;
  /* the error in the explainer, never "ours" */
  --grad: linear-gradient(95deg, #ff2e88 0%, #b14cff 52%, #2fd2ff 100%);
  /* stage lights: key title words, big numbers */
  --grad-bar: linear-gradient(180deg, #ff2e88, #b14cff);
  --emdb: #b4b4c0;
  /* layout */
  --page: 1200px;
  --page-wide: 1400px;
  --prose: 860px;
  --nav: 56px;
  /* vertical rhythm: section padding, gap between blocks, head to content */
  --sec-y: 76px;
  --block: 60px;
  --head: 32px;
  --r-lg: 28px;
  --r: 18px;
  --r-sm: 12px;
  --shadow-media: 0 30px 70px -24px rgba(10, 10, 20, .35);
  --media-bg: #0e0f12;
  /* behind every video and canvas, in every tone */
  /* type */
  --display: "Inter Tight", "Inter", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --small: 14px;
  --tiny: 12px;
}

.tone-white {
  background: #fff;
  --card: var(--mist);
}

.tone-mist {
  background: var(--mist);
  --card: #fff;
}

.dark {
  background: var(--night);
  color-scheme: dark;
  --ink: #fff;
  --text: #d6d6e0;
  --lead: #a2a2b0;
  --muted: #8b8b99;
  --line: rgba(255, 255, 255, .1);
  --card: var(--night-2);
  --chip: rgba(255, 255, 255, .06);
  --chip-line: rgba(255, 255, 255, .14);
  --on-ink: #0b0b10;
  --accent: #ff4d9d;
  --accent-soft: rgba(255, 77, 157, .13);
  --accent-hover: rgba(255, 77, 157, .22);
  --row-hover: rgba(255, 255, 255, .05);
  --shadow-media: 0 40px 100px -30px rgba(255, 46, 136, .25);
}

/* ============================== BASE ============================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav) + 12px);
  background: var(--night);
}

body {
  margin: 0;
  background: #fff;
  font: 17px/1.6 var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

section {
  color: var(--text);
}

/* recompute per tone */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display);
  color: var(--ink);
}

p {
  margin: 0 0 1em;
}

b,
strong {
  color: var(--ink);
  font-weight: 600;
}

sup {
  line-height: 0;
}

p,
figcaption,
li {
  text-wrap: pretty;
}

.nobr {
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: calc(var(--page) + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.container.wide {
  max-width: calc(var(--page-wide) + 48px);
}

section {
  position: relative;
  padding: var(--sec-y) 0;
}

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* section head: numbered kicker, a big two-line claim, a gray lead */
.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font: 500 13px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.kicker b {
  display: inline-grid;
  place-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  letter-spacing: .02em;
}

h2.title {
  max-width: 16em;
  margin: 0 0 16px;
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.lead {
  max-width: var(--prose);
  margin: 0 0 var(--head);
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--lead);
}

/* the container's full width (03's lead at two lines, 05's at one, at desktop width) */
.lead.full {
  max-width: none;
}

/* a title with no lead under it (02, 04): the next block keeps the lead's gap */
.reveal:has(> .title:last-child) + * {
  margin-top: var(--head);
}

.lead p:last-child {
  margin: 0;
}

.lead b {
  font-weight: 600;
}

.eyebrow {
  display: block;
  margin: 0 0 14px;
  font: 500 var(--tiny)/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

h3.sub {
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.022em;
}

.note,
figcaption {
  margin: 14px 0 0;
  font-size: var(--small);
  line-height: 1.55;
  color: var(--muted);
}

.note b,
figcaption b {
  font-weight: 600;
}

/* a clip's camera numbers in a note (the before/after) */
.pill {
  display: inline-block;
  margin: 4px 4px 0 0;
  padding: 1px 8px;
  border-radius: 99px;
  font: 500 11.5px/1.6 var(--mono);
  color: var(--accent);
  background: var(--accent-soft);
}

#ba-stats+.note {
  margin-top: 4px;
}

.block {
  margin-top: var(--block);
}

/* surfaces */
.card {
  margin: 0;
  padding: 26px;
  border-radius: var(--r-lg);
  background: var(--card);
}

.dark .card {
  border: 1px solid var(--line);
}

.card+.card,
.card+.note+.card {
  margin-top: 16px;
}

.card>.eyebrow:first-child {
  margin-bottom: 18px;
}

.chip {
  padding: 6px 14px;
  font: 500 var(--small) var(--sans);
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--chip-line);
  border-radius: 99px;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}

.chip:hover {
  border-color: var(--muted);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  background: var(--chip);
  border: 1px solid var(--chip-line);
  border-radius: 99px;
}

.seg .chip {
  border-color: transparent;
  background: transparent;
}

.seg .chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-ink);
}

/* spec row: big figures over short labels, ruled like a spec sheet */
.specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 var(--head);
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.specs li {
  padding: 20px 28px 0 0;
}

.specs li+li {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.specs .num {
  display: inline-block;
  padding: 0 .05em .06em 0;
  font: 700 clamp(2rem, 3.8vw, 3rem)/1 var(--display);
  letter-spacing: -.035em;
}

.specs .num small {
  font-size: .5em;
  letter-spacing: -.02em;
}

.specs .lbl {
  display: block;
  max-width: 30ch;
  text-wrap: balance;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

/* compact: the row folded under a part-head paragraph, so the figures come down a size */
.specs.compact {
  margin: 20px 0 0;
}

.specs.compact li {
  padding: 16px 20px 0 0;
}

.specs.compact li+li {
  padding-left: 20px;
}

.specs.compact .num {
  font-size: clamp(1.6rem, 2.4vw, 2rem);
}

.specs.compact .lbl {
  margin-top: 8px;
  font-size: 14px;
}

/* a card with a second part under a rule (02: the dataset table, then its charts) */
.card-part {
  margin: 22px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

/* scroll reveal (JS only, never for reduced motion) */
.js .reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1s cubic-bezier(.2, .7, .2, 1), transform 1s cubic-bezier(.2, .7, .2, 1);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* =============================== NAV ============================== */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav);
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}

#nav.solid {
  background: rgba(12, 12, 16, .74);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-color: rgba(255, 255, 255, .08);
}

.nav-links {
  display: flex;
  gap: 2px;
  max-width: 100%;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links a {
  flex: none;
  padding: 7px 13px;
  border-radius: 99px;
  font: 500 13.5px var(--sans);
  color: rgba(255, 255, 255, .66);
  transition: color .18s, background .18s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, .1);
  text-decoration: none;
}

.nav-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
}

.nav-progress span {
  display: block;
  height: 100%;
  background: var(--grad);
  transform-origin: left;
  transform: scaleX(0);
}

/* ============================== HERO ============================== */
/* a tilted wall of our clips behind the title, dimmed, with drifting stage lights */
.hero {
  display: flex;
  align-items: center;
  min-height: min(100svh, 1000px);
  padding: calc(var(--nav) + 56px) 0 64px;
  overflow: hidden;
  isolation: isolate;
}

.hero-wall {
  position: absolute;
  inset: -18% -12%;
  z-index: -3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 16px;
  transform: rotate(-7deg);
  opacity: .6;
}

.hero-wall .tile {
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, #1a1023, #0d1420);
}

.hero-wall video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% center;
  filter: saturate(1.25);
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(70% 60% at 50% 48%, rgba(7, 7, 11, .62), rgba(7, 7, 11, .9) 80%),
    linear-gradient(180deg, rgba(7, 7, 11, .5) 0%, transparent 30%, transparent 70%, var(--night) 100%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .6;
  background: radial-gradient(38% 32% at 18% 18%, rgba(255, 46, 136, .5), transparent 70%),
    radial-gradient(34% 30% at 84% 16%, rgba(47, 210, 255, .38), transparent 70%),
    radial-gradient(30% 28% at 55% 96%, rgba(177, 76, 255, .4), transparent 70%);
  animation: lights 16s ease-in-out infinite alternate;
}

@keyframes lights {
  to {
    transform: translate3d(3%, -2%, 0) rotate(5deg);
  }
}

.hero-inner {
  text-align: center;
}

/* three lines: the lit phrase on its own */
@media (min-width: 900px) {
  .hero h1 .grad {
    display: block;
    width: fit-content;
    margin: 0 auto;
  }
}

.hero h1 {
  max-width: 1180px;
  margin: 24px auto 20px;
  font-size: clamp(2.5rem, 5.6vw, 4.9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.035em;
  text-wrap: balance;
  color: #fff;
}

.hero h1+.links,
.authors+.links {
  margin-top: 36px;
}

/* names, then affiliations, centred under the title; each name or affiliation never breaks */
.authors p {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 26px;
  margin: 0;
}

.authors span {
  white-space: nowrap;
}

.authors .names {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  font-weight: 600;
  color: #fff;
}

.authors .names a {
  color: inherit;
  text-decoration: underline 1px transparent;
  text-underline-offset: 4px;
  transition: text-decoration-color .2s;
}

.authors .names a:hover {
  text-decoration-color: var(--accent);
}

.authors .affils {
  margin-top: 10px;
  font-size: var(--small);
  color: var(--muted);
}

.authors sup {
  margin-left: 1px;
  font-size: .7em;
  color: var(--muted);
}

.authors .affils sup {
  margin-right: 3px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  height: 50px;
  padding: 0 26px;
  border-radius: 99px;
  font: 600 16px var(--sans);
  transition: transform .18s, background .18s, opacity .18s;
}

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

.btn svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}

.btn.primary {
  background: #fff;
  color: #0b0b10;
}

.btn.ghost {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: .55;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 1000px;
  margin: 44px auto 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.hero-stats li {
  padding: 20px 12px 0;
}

.hero-stats li+li {
  border-left: 1px solid rgba(255, 255, 255, .12);
}

.hero-stats b {
  display: block;
  font: 700 clamp(1.8rem, 3vw, 2.5rem)/1 var(--display);
  letter-spacing: -.03em;
  color: #fff;
}

.hero-stats li>span {
  display: block;
  margin-top: 12px;
  font: 500 11.5px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8f8fa0;
  text-wrap: balance;
}

/* meters under hero stats, positions in the stat's own units over --max: a gradient fill (K-Pop or ours), gray ticks
   for the comparisons, a white tick for a target. Ratio's track runs past 1 so 1 reads as the target, not the maximum */
/* a cell with a meter stacks it at the cell's foot, so meters line up whatever the label length */
.hero-stats li:has(.stat-meter) {
  display: flex;
  flex-direction: column;
}

.hero-stats li>span:has(+ .stat-meter) {
  margin-bottom: 16px;
}

.hero-stats .stat-meter {
  position: relative;
  display: block;
  flex: none;
  width: 150px;
  height: 3px;
  margin: auto auto 22px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .14);
}

.stat-meter i {
  position: absolute;
  top: 0;
  height: 100%;
}

.stat-meter .fill {
  left: 0;
  width: calc(var(--fill) / var(--max) * 100%);
  border-radius: 2px;
  background: var(--grad);
  transform-origin: left;
  animation: meter-grow 1.4s cubic-bezier(.25, 1, .5, 1) both;
}

.stat-meter .tick {
  top: -4px;
  left: calc(var(--at) / var(--max) * 100%);
  width: 2px;
  height: 11px;
  margin-left: -1px;
  border-radius: 1px;
  background: #8f8fa0;
}

.stat-meter .tick.goal {
  background: #fff;
}

.stat-meter em {
  position: absolute;
  top: 10px;
  left: calc(var(--at) / var(--max) * 100%);
  transform: translateX(-50%);
  font: 500 10.5px/1 var(--mono);
  font-style: normal;
  letter-spacing: .04em;
  white-space: nowrap;
  color: #8f8fa0;
}

.stat-meter em.goal {
  color: #fff;
}

/* which way the stat improves (or, for speed, what the direction means), from one end of the track */
.stat-meter em.dir {
  left: 0;
  transform: none;
}

.stat-meter em.dir.end {
  left: auto;
  right: 0;
}

@keyframes meter-grow {
  from {
    transform: scaleX(0);
  }
}

/* lower is better: the fill starts full and shrinks back to the value from the right */
.stat-meter.shrink .fill {
  animation-name: meter-shrink;
}

@keyframes meter-shrink {
  from {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stat-meter .fill {
    animation: none;
  }
}

/* research-use line under the stats, over the hero wall (the first footage on the page) */
.disclaimer {
  max-width: 1000px;
  margin: 30px auto 0;
  font-size: 13px;
  line-height: 1.6;
  color: #8f8fa0;
  text-wrap: balance;
}

.disclaimer b {
  font-weight: 600;
  color: #c9c9d4;
}

/* ============================== MEDIA ============================= */
.panel {
  position: relative;
  margin: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--media-bg);
  box-shadow: var(--shadow-media);
  min-width: 0;
}

.panel video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto 16 / 9;
  background: var(--media-bg);
}

video {
  pointer-events: none;
}

/* a canvas laid over its box; fitCanvas (common.js) matches its buffer to this size */
canvas.fill {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

video::-webkit-media-controls {
  display: none !important;
}

.tag {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  pointer-events: none;
  padding: 5px 12px;
  border-radius: 99px;
  font: 600 13px/1.2 var(--sans);
  color: #fff;
  background: rgba(12, 12, 16, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tag.accent {
  background: var(--accent);
}

.tag.right {
  left: calc(64% + 12px);
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 12px;
  aspect-ratio: var(--ar, 16 / 9);
  text-align: center;
  font-size: var(--tiny);
  color: #c9c9d4;
  background: #15151d;
  border-radius: var(--r);
}

.placeholder code {
  word-break: break-all;
}

.panel .placeholder {
  border-radius: 0;
}

.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 3px;
  background: rgba(255, 255, 255, .18);
  pointer-events: none;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--grad);
  transform-origin: left;
  transform: scaleX(0);
}

/* the progress line is also a scrubber: it thickens on hover, and a taller invisible strip makes it easy to grab */
.bar.scrub {
  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
  transition: height .15s;
}

.bar.scrub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
}

.bar.scrub:hover,
.bar.scrub.dragging {
  height: 8px;
}

/* the playhead knob, so the line reads as something to pull; kept inside the player's corners at both ends */
.bar .knob {
  position: absolute;
  bottom: 0;
  left: calc(7px + var(--p, 0) * (100% - 14px));
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 46, 136, .55), 0 1px 4px rgba(0, 0, 0, .45);
  pointer-events: none;
  transition: width .15s, height .15s, margin .15s;
}

.bar.scrub:hover .knob,
.bar.scrub.dragging .knob {
  width: 14px;
  height: 14px;
  margin-left: -7px;
}

/* key over a two-half player: one cell per half of the clip, split where the clip splits */
.readkey {
  display: grid;
  grid-template-columns: 64fr 36fr;
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--lead);
}

.readkey div {
  padding: 14px 24px 0 0;
  border-top: 2px solid var(--ink);
}

.readkey div+div {
  padding-left: 24px;
  border-top-color: var(--accent);
}

.readkey b {
  display: block;
  margin-bottom: 4px;
  font: 700 18px/1.3 var(--display);
  letter-spacing: -.01em;
  color: var(--ink);
}

.readkey strong {
  color: var(--ink);
}

/* the teaser video, straight out of the hero, at page width; its first frame shows through the video until it plays */
#demo {
  padding: 16px 0 var(--sec-y);
}

.teaser-fig {
  max-width: var(--page);
  margin: 0 auto;
}

#teaser {
  aspect-ratio: 16 / 9;
  background: var(--media-bg) url("../videos/teaser/teaser.jpg") center / cover;
}

#teaser video {
  background: transparent;
}

/* thumbnail strip: switches sequences in a player */
.thumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 16px auto 0;
  padding: 14px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.thumb {
  position: relative;
  flex: 0 0 auto;
  height: clamp(54px, 5.6vw, 76px);
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  background: #1a1a23;
  transition: transform .18s, box-shadow .18s;
}

.thumb::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  z-index: 2;
  width: 24px;
  height: 2px;
  border-radius: 99px;
  background: #fff;
  transform: translateX(-50%) scaleX(0);
  transition: transform .18s;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left;
  pointer-events: none;
}

.thumb img {
  filter: brightness(.7) saturate(.8);
  transition: filter .18s;
}

.thumb .num {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  font: 700 15px var(--sans);
  color: #fff;
}

.thumb.empty {
  background: var(--grad);
}

.thumb:hover,
.thumb.active {
  z-index: 3;
  transform: translateY(-2px) scale(1.14);
  box-shadow: 0 0 0 2px var(--accent), 0 12px 26px rgba(0, 0, 0, .3);
}

.thumbs:has(.thumb:hover) .thumb.active:not(:hover) {
  transform: none;
  box-shadow: none;
}

.thumb:hover img,
.thumb.active img {
  filter: none;
}

.thumb.active::after {
  transform: translateX(-50%) scaleX(1);
}

.thumb:focus-visible,
.cmp:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* two-method player: a canvas drawn from one stacked clip, with a divider over the reprojection (left of --split)
   and the world view right of it. The <video> sits under the canvas. */
.cmp {
  --split: 64%;
  --x: 32%;
  position: relative;
  aspect-ratio: 25 / 9;
  overflow: hidden;
  border-radius: var(--r);
  background: var(--media-bg);
  box-shadow: var(--shadow-media);
  cursor: ew-resize;
  user-select: none;
  touch-action: pan-y;
}

.cmp .layer {
  position: absolute;
  inset: 0;
  margin: 0;
}

.cmp > canvas {
  z-index: 1;  /* over the <video> it draws from */
}

.cmp .tag {
  top: 14px;
  left: 14px;
  padding: 6px 14px;
  font-size: 15px;
}

.cmp .tag.ours {
  left: auto;
  right: calc(100% - var(--split) + 14px);
}

.cmp .tag.right {
  left: calc(var(--split) + 14px);
  font-size: 14px;
}

.cmp .tag i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 6px 0 0;
  border-radius: 50%;
  vertical-align: -1px;
}

.cmp .tag i+b,
.cmp .tag b+i {
  margin-left: 12px;
}

.cmp .tag b {
  color: #fff;
  font-weight: 600;
}

.cmp .dot-ours {
  background: conic-gradient(#d1495b, #e8b04b, #7fb069, #2a9d8f, #3d8fd1, #6c63c7, #d1495b);
}

/* the performer colours */
.cmp .dot-base {
  background: #8a8f98;
}

/* the ghost colour */

.cmp video,
.cmp .placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--x);
  z-index: 3;
  width: 2px;
  margin-left: -1px;
  pointer-events: none;
  background: #fff;
  box-shadow: 0 0 14px rgba(0, 0, 0, .4);
}

.divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(12, 12, 16, .5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;  /* the knob and the strip below grab the divider */
  cursor: ew-resize;
}

.divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8px;
  width: 18px;
  pointer-events: auto;
  cursor: ew-resize;
}

.divider svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  margin-top: 18px;
}

.playback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.verdict {
  margin: 22px 0 0;
  font: 500 clamp(1rem, 1.4vw, 1.15rem)/1.45 var(--sans);
  color: var(--ink);
}

.verdict b {
  font-weight: 700;
}

.verdict+.note {
  margin-top: 6px;
}

/* ========================= INTERACTIVE 3D ========================= */
/* a 3D panel over part of a player (.split: right of --split; .quarter: the bottom-right quarter); until its clip
   has loaded only the badge and the loading chip show, over the video */
.world3d {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  right: 0;
  z-index: 1;
  pointer-events: none;
  cursor: grab;
  touch-action: none;
  container: w3d / inline-size;
}

.world3d > canvas,
.world3d .w3d-zoom {
  opacity: 0;
  transition: opacity .3s;
}

.world3d.ready > canvas,
.world3d.ready .w3d-zoom {
  opacity: 1;
}

.world3d.off {
  display: none;
}

.world3d.quarter {
  top: 50%;
  left: 50%;
}

/* on a phone the 3D is its own panel under the player, opened by .w3d-open */
.world3d.phone {
  position: relative;
  top: 0;
  left: 0;
  margin-top: 12px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r);
  background: #f6f7f9;
}

.world3d.phone.quarter {
  aspect-ratio: 4 / 3;
}

.w3d-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 16px;
  border: 0;
  border-radius: 99px;
  font: 600 15px/1.2 var(--sans);
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.w3d-open[aria-expanded="true"] {
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.w3d-open.failed {
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35);
}

.w3d-open svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.world3d.ready {
  pointer-events: auto;
}

.world3d:active {
  cursor: grabbing;
}

.w3d-hint {
  position: absolute;
  right: 12px;
  bottom: 20px;
  padding: 4px 11px;
  border: 0;
  border-radius: 99px;
  font: 500 12px/1.3 var(--sans);
  color: #fff;
  background: rgba(12, 12, 16, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  z-index: 1;
}

.w3d-badge {
  position: absolute;
  left: 12px;
  bottom: 20px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 8px;
  border: 1.5px solid var(--accent);
  border-radius: 99px;
  font: 600 12px/1.3 var(--mono);
  letter-spacing: .02em;
  color: #fff;
  background: rgba(12, 12, 16, .7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

@container w3d (max-width: 440px) {
  .w3d-more {
    display: none;
  }
}

.w3d-badge svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.w3d-zoom {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(12, 12, 16, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.w3d-zoom button {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  font: 500 18px/1 var(--sans);
  color: #fff;
  background: none;
  cursor: pointer;
}

.w3d-zoom button + button {
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.w3d-zoom button:hover {
  background: rgba(255, 255, 255, .14);
}

/* loading: the chip fills left to right with the share downloaded */
.w3d-hint.loading {
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, rgba(224, 21, 122, .75) var(--p, 0%), rgba(12, 12, 16, .7) var(--p, 0%));
}

/* the first time the 3D is ready, the hint lights up in the accent and settles */
.world3d.flash .w3d-hint {
  transform-origin: right bottom;
  animation: w3d-flash 2.4s ease-out;
}

@keyframes w3d-flash {
  0%, 45% {
    background: var(--accent);
    transform: scale(1.12);
  }
  100% {
    background: rgba(12, 12, 16, .55);
    transform: none;
  }
}

/* a lost context: the canvas and its controls hide, the video shows under a message and a restart */
.w3d-lost {
  display: none;
}

.world3d.lost > canvas,
.world3d.lost .w3d-zoom,
.world3d.lost .w3d-hint {
  visibility: hidden;
}

.world3d.lost .w3d-lost {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 14px 18px;
  transform: translate(-50%, -50%);
  font: 500 13px/1.35 var(--sans);
  text-align: center;
  color: #fff;
  background: rgba(12, 12, 16, .82);
  border-radius: 14px;
  pointer-events: auto;
}

.w3d-lost p {
  margin: 0;
}

.w3d-lost button {
  padding: 6px 14px;
  border: 0;
  border-radius: 99px;
  font: 600 13px/1.2 var(--sans);
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.w3d-hint.reset {
  pointer-events: auto;
  cursor: pointer;
  background: rgba(12, 12, 16, .78);
}

/* ============================ OVERVIEW ============================ */
/* the abstract as three labelled columns: problem, diagnosis, correction */
.abstract {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  margin: 0 0 var(--head);
}

.abstract article {
  padding-top: 22px;
  border-top: 2px solid transparent;
  border-image: var(--grad) 1;
}

.abstract h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.012em;
}

.abstract h3 span {
  font: 500 var(--tiny) var(--mono);
  letter-spacing: .1em;
  color: var(--accent);
}

.abstract p {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.65;
}


/* ========================== STRESS TEST ========================== */
/* a part of the test (02) or of its results (04): eyebrow, big count and its noun, beside the explanation */
.part-head {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  /* sized to the widest big number */
  gap: 44px;
  align-items: end;
  margin-bottom: 24px;
}

.bignum {
  display: inline-block;
  padding: 0 .07em .04em 0;
  font: 800 clamp(3.75rem, 7.2vw, 6rem)/.82 var(--display);
  letter-spacing: -.05em;
}

.part-head h3 {
  margin: 12px 0 0;
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--ink);
}

.part-head p {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--lead);
}

.part-head .eyebrow {
  margin-bottom: 14px;
}

/* the dataset charts under the table, kept low to save height */
.profile .chart-plot {
  height: 110px;
}

.profile .chart-key {
  margin-bottom: 14px;
}

/* dataset charts: K-Pop columns against EMDB; columns grow in on reveal */
.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 44px;
}

.chart h4 {
  margin: 0 0 6px;
  font: 600 15px var(--sans);
  color: var(--ink);
}

.chart-key {
  display: flex;
  gap: 20px;
  margin-bottom: 22px;
  font-size: var(--small);
  color: var(--muted);
}

.chart-key i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 3px;
  background: var(--grad-bar);
  vertical-align: -1px;
}

.chart-key i.emdb {
  background: var(--emdb);
}

.chart-plot {
  position: relative;
  display: flex;
  gap: 2px;
  height: 200px;
  padding-top: 22px;
  border-bottom: 1px solid var(--line);
}

.chart-plot .slot {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.chart-plot .col {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: 4px 4px 1px 1px;
  background: var(--grad-bar);
  transform-origin: bottom;
}

.chart-plot .col.emdb {
  background: var(--emdb);
}

.js .charts:not(.in) .col {
  transform: scaleY(0);
}

.js .charts .col {
  transition: transform .8s cubic-bezier(.2, .8, .2, 1);
}

.chart-plot b,
.chart-plot .mark span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-bottom: 3px;
  font: 500 var(--tiny)/1.2 var(--sans);
  color: var(--muted);
  white-space: nowrap;
}

.chart-plot .mark {
  position: absolute;
  z-index: 1;
  top: 22px;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: repeating-linear-gradient(var(--muted) 0 5px, transparent 5px 9px);
}

/* EMDB keeps one focal length per camera */
.chart-axis {
  position: relative;
  height: 26px;
  font: var(--tiny) var(--sans);
  color: var(--muted);
}

.chart-axis span {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
}

.chart-axis.slots {
  display: flex;
  gap: 2px;
}

.chart-axis.slots span {
  position: static;
  flex: 1;
  text-align: center;
  transform: none;
}

/* ============================= TABLES ============================= */
.table-wrap {
  overflow-x: auto;
}

.bench {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.bench th,
.bench td {
  padding: 7px 14px;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

.bench th:first-child,
.bench td:first-child,
.bench .left {
  text-align: left;
}

.bench thead th {
  font: 600 12px/1.3 var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  vertical-align: bottom;
}

.bench th .unit {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.bench th.span {
  padding-bottom: 6px;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
}

.bench th.span.world {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.bench tbody td {
  border-bottom: 1px solid var(--line);
  transition: background-color .15s;
}

.bench tbody tr:not(.group):hover td:not(.hl) {
  background: var(--row-hover);
}

.bench tbody tr:hover td.hl,
.bench tbody tr.hl:hover td {
  background: var(--accent-hover);
}

.bench tbody tr:last-child td {
  border-bottom: 0;
}

.bench .left {
  color: var(--muted);
}

.bench td.best {
  font-weight: 700;
  color: var(--ink);
}

.bench td.second {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.bench .hl,
.bench tr.hl td {
  background: var(--accent-soft);
  color: var(--accent);
}

.bench tr.hl td {
  border-bottom-color: transparent;
}

.bench tr.hl td:first-child {
  font-weight: 700;
  border-radius: 8px 0 0 8px;
  box-shadow: inset 3px 0 0 var(--accent);
}

.bench tr.hl td:last-child {
  border-radius: 0 8px 8px 0;
}

.bench tr.hl td.best {
  color: var(--accent);
}

.bench thead th.hl {
  color: var(--accent);
  border-radius: 10px 10px 0 0;
}

.bench .group td {
  padding-top: 16px;
  text-align: left;
  font: 600 13px var(--sans);
  letter-spacing: .02em;
  color: var(--ink);
}

.bench .sub td:first-child {
  padding-left: 30px;
  color: var(--muted);
}

/* ============================= METHOD ============================= */
.explain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  margin-top: 8px;
}

/* the text sets the row's height; the card and its caption fill it, so both columns start and end together */
.explain>div>:last-child {
  margin-bottom: 0;
}

.eqbox {
  margin: .8rem 0 1.6rem;
  padding: 26px 22px;
  overflow-x: auto;
  text-align: center;
  background: var(--card);
  border-radius: var(--r);
}

.eqbox math {
  font-size: 1.35rem;
  color: var(--ink);
  font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", math;
}

.viz {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.viz-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -30px rgba(10, 10, 20, .3);
}

.viz-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 320px;
}

.viz canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 35%, #fff, #f1f2f6 80%);
}

.viz-stage .seg {
  position: absolute;
  top: 10px;
  right: 12px;
}

.viz-stage .seg .chip {
  padding: 3px 11px;
  font-size: var(--tiny);
}

.viz-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 12px 16px 6px;
  border-top: 1px solid var(--line);
  font-size: var(--small);
}

.viz-bar label {
  align-self: flex-start;
  line-height: 16px;
  font-weight: 600;
  color: var(--ink);
}

/* s slider with ticks at 0 and 1; --f is the position along the track, the thumb centre running from 8 px to
   100% - 8 px */
.viz-track {
  flex: 1 1 calc(100% - 30px);
}

.viz-track input {
  display: block;
  width: 100%;
  margin: 0;
  accent-color: var(--ink);
}

.viz-scale {
  position: relative;
  height: 14px;
  margin-top: 3px;
  font: 11px/14px var(--sans);
  color: var(--muted);
  white-space: nowrap;
}

.viz-scale>* {
  position: absolute;
  left: calc(8px + (100% - 16px) * var(--f));
}

.viz-scale span {
  transform: translateX(-50%);
}

.viz-scale i {
  top: -4px;
  height: 5px;
  border-left: 1px solid var(--muted);
}

.viz-scale i.one {
  top: -5px;
  height: 7px;
  border-color: var(--ink);
}

.viz-scale .bad {
  color: #a3a8b0;
}

.viz-says {
  min-height: calc(2 * 1.5 * var(--small));
  margin: 0;
  padding: 0 16px 12px;
  font-size: var(--small);
  line-height: 1.5;
  color: var(--ink);
}

.viz-bar output {
  min-width: 150px;
  font: 12.5px var(--mono);
  color: var(--ink);
}

.legend {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: var(--tiny);
  color: var(--muted);
  pointer-events: none;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}

.legend .l-cam {
  border-radius: 2px;
  background: var(--ink);
}

.legend .l-mark {
  border: 1.5px solid var(--ink);
}

.legend .l-grid {
  margin-left: auto;
}

.legend .l-drift {
  background: var(--drift);
}

/* a dark stage inside a light section, holding a player */
.stage {
  position: relative;
  margin-top: var(--block);
  padding: 32px 32px 26px;
  overflow: hidden;
  isolation: isolate;
  color: var(--text);
  border-radius: 36px;
  box-shadow: 0 40px 90px -40px rgba(10, 10, 20, .55);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(50% 40% at 12% 0%, rgba(255, 46, 136, .2), transparent 70%), radial-gradient(40% 35% at 92% 6%, rgba(47, 210, 255, .14), transparent 70%);
}

.stage h3.sub {
  margin-bottom: 10px;
}

/* the before/after's heading sits over its readkey */
#before-after h3.sub {
  margin-bottom: 20px;
}


/* ============================= RESULTS ============================ */
/* a block's paragraph under its h3.sub */
.sublead {
  margin: 0 0 20px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--lead);
  text-wrap: pretty;
}

/* stills under a table: a column per method, a row per moment; the Ours column is tinted like the table's Ours row.
   Below 760 px the grid keeps its size and scrolls sideways inside the card */
.rf-wrap {
  overflow-x: auto;
}

.rf-grid {
  --cols: 5;
  --cell: 4 / 3;
  display: grid;
  grid-template-columns: auto repeat(var(--cols), minmax(0, 1fr));
  gap: 8px;
  min-width: 700px;
  padding: 0 6px 6px 0;
}

.rf-band {
  grid-column: 6;
  grid-row: 1 / span 3;
  margin: 0 -6px -6px;
  border-radius: 12px;
  background: var(--accent-soft);
  box-shadow: inset 0 3px 0 var(--accent);
}

.rf-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  font-size: var(--small);
  font-weight: 600;
  color: var(--ink);
  border-radius: 10px 10px 0 0;
}

.rf-head span {
  font: 500 var(--tiny)/1 var(--mono);
  color: var(--muted);
}

/* the band holds column 6, so the Ours cells are placed on it explicitly */
.rf-head.ours {
  grid-area: 1 / 6;
  color: var(--accent);
}

.rf-grid .ours-start {
  grid-area: 2 / 6;
}

.rf-grid .ours-end {
  grid-area: 3 / 6;
}

.rf-head.ours span {
  color: var(--accent);
}

.rf-row {
  align-self: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font: 500 var(--tiny)/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.rf-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--cell);
  border-radius: 8px;
}

/* camera rolls: a row per camera, its stills close together and the rows set apart, times over the columns */
.rf-grid.rolls {
  --cols: 4;
  --cell: 16 / 9;
  gap: 14px 6px;
  padding: 0;
}

.rf-grid.rolls .rf-head {
  align-self: end;
  padding: 0;
}

/* time over the columns instead of timestamps: a gradient arrow with a numbered dot centred on each column */
.rf-time {
  grid-column: 2 / span var(--cols);
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  height: 26px;
}

.rf-time::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 6px;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--grad);
}

.rf-time::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  margin-top: -6px;
  border: 6px solid transparent;
  border-right: 0;
  border-left: 9px solid #2fd2ff;
}

.rf-time span {
  position: relative;
  justify-self: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font: 600 12px/22px var(--mono);
  text-align: center;
  color: #fff;
  background: var(--ink);
}

/* 01: one clip at three moments, the camera's path beside them; straight on the page so the light renders read as
   tiles. Every cell is 256:90, a 16:9 still and a square zoom beside it 6 units apart (the world view is rendered
   that wide) */
.overview-fig {
  margin: 0;
}

.overview-fig .rf-grid {
  --cols: 3;
  --cell: 256 / 90;
  grid-template-columns: minmax(0, 1fr) auto repeat(var(--cols), minmax(0, 1fr));
  min-width: 820px;
  /* room for the last zoom's ring and shadow, which .rf-wrap would clip */
  padding: 0 10px 8px 0;
}

/* the map spans every row and takes no height of its own, so the rows set it */
.ov-map {
  grid-column: 1;
  grid-row: 1 / span 4;
  position: relative;
  margin-right: 12px;
}

.ov-map .eyebrow {
  position: absolute;
  top: 6px;
  left: 0;
  margin: 0;
}

/* --k (set by overview_figure.py) scales marks and type on a tall map, which is drawn smaller */
.ov-map svg {
  --k: 1;
  position: absolute;
  top: 34px;
  left: 0;
  width: 100%;
  height: calc(100% - 34px);
  overflow: hidden;
}

/* the floor, coloured like the world-space renders' checkerboard, fading out in a circle that fits the panel */
.ov-map svg.floor {
  -webkit-mask-image: radial-gradient(circle closest-side, #000 60%, transparent);
  mask-image: radial-gradient(circle closest-side, #000 60%, transparent);
}

.ov-map .tile {
  fill: #f2f3f6;
}

.ov-map .tile.dark {
  fill: #e7e9ee;
}

.ov-map .path,
.ov-map .walk {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ov-map .path {
  stroke: #b8336a;
  stroke-width: calc(2.2px * var(--k));
}

/* each performer's path over the clip, in their colour (stroke and fill come from the markup) */
.ov-map .walk {
  stroke-width: calc(1.1px * var(--k));
  opacity: .85;
}

/* the ghosts' paths in gray, under ours, as in the world-space row */
.ov-map .walk.drift {
  stroke: #8a8f98;
  opacity: .7;
}

.ov-map .who.drift {
  fill: #8a8f98;
}

.ov-map .lbl {
  font: 500 calc(8.5px * var(--k)) var(--mono);
  letter-spacing: .05em;
  text-anchor: middle;
  fill: var(--muted);
}

.ov-map .at circle {
  fill: var(--ink);
}

.ov-map .at text {
  fill: #fff;
  font: 600 calc(7px * var(--k)) var(--mono);
  text-anchor: middle;
}

/* the time arrow starts after the map */
.overview-fig .rf-time {
  grid-column: 3 / span var(--cols);
}

/* a 2D cell: the still (160 of 256), an outline on one performer's legs, lines to the zoom (166 to 256) */
.ov-cell {
  position: relative;
  aspect-ratio: var(--cell);
}

.rf-grid .ov-cell img {
  position: absolute;
  top: 0;
  left: 0;
  width: 62.5%;
  height: 100%;
  aspect-ratio: auto;
}

/* framed like a loupe, white like the outline and lines, so it reads as a zoom and not another still */
.rf-grid .ov-cell .ov-zoom {
  left: auto;
  right: 0;
  width: 35.16%;
  outline: 3px solid #fff;
  outline-offset: -3px;
  box-shadow: 0 0 0 1.5px var(--ink), 0 4px 12px rgba(0, 0, 0, .28);
}

.ov-src {
  position: absolute;
  left: calc(var(--x) * .625);
  top: var(--y);
  width: calc(var(--w) * .625);
  height: var(--h);
  border: 1.5px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}

.ov-link {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ov-link line {
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, .6));
}

.ratio-fig {
  margin-top: 20px;
}

/* a table with its side note to the right; the note comes first in the source so it leads on phones */
.table-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 32px;
  align-items: start;
}

.table-side .card {
  padding: 22px;
}

.table-side .bench th,
.table-side .bench td {
  padding-left: 10px;
  padding-right: 10px;
}

.table-side .aside {
  order: 2;
  margin: 0;
  padding-top: 22px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--lead);
}

/* =========================== APPLICATIONS ========================= */
/* the reshoot figure at page width */
.quad-fig {
  max-width: var(--page);
  margin: 0 auto;
}

/* the reshoot: one 2x2 video with hairlines between the quarters; the 3D panel replaces the last quarter's tag */
.panel.quad::before,
.panel.quad::after {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: var(--media-bg);
}

.panel.quad::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
}

.panel.quad::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  margin-top: -1px;
}

.tag.q-right {
  left: calc(50% + 12px);
}

.tag.q-low {
  top: calc(50% + 12px);
}

.panel.quad:has(.world3d.ready) .tag.q-right.q-low {
  display: none;
}

/* ============================ CITATION ============================ */
.bib {
  position: relative;
  max-width: var(--prose);
  margin: 0 auto;
}

#citation .kicker {
  justify-content: center;
}

.bib pre {
  margin: 0;
  padding: 28px 30px;
  overflow-x: auto;
  background: var(--card);
  border-radius: var(--r-lg);
  font: var(--small)/1.6 var(--mono);
  color: var(--ink);
}

.bib .chip {
  position: absolute;
  top: 16px;
  right: 16px;
}

@media (max-width: 1150px) {
  .table-side {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .table-side .aside {
    order: 0;
    padding-top: 0;
  }
}

@media (max-width: 1000px) {
  .explain {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  /* one column: the explainer keeps its own shape */
  .viz-stage {
    flex: none;
    aspect-ratio: 5 / 4;
    min-height: 0;
  }

  .abstract {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .part-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  :root {
    --sec-y: 52px;
    --block: 44px;
    --head: 26px;
  }

  /* before/after: each half is too narrow for the full tags */
  .cmp .tag {
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .cmp .tag.ours {
    right: calc(100% - var(--split) + 8px);
  }

  .cmp .tag-more {
    display: none;
  }

  /* small one-line tags on the reshoot's narrow quarters */
  .panel.quad .tag {
    left: 6px;
    top: 6px;
    padding: 2px 7px;
    font-size: 10px;
    white-space: nowrap;
  }

  .panel.quad .tag.q-right {
    left: calc(50% + 6px);
  }

  .panel.quad .tag.q-low {
    top: calc(50% + 6px);
  }

  .container {
    padding: 0 16px;
  }

  .hero {
    min-height: 0;
    padding-top: calc(var(--nav) + 56px);
  }

  .hero-wall {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-wall .tile:nth-child(n + 5) {
    display: none;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 40px;
  }

  .hero-stats li:nth-child(3) {
    border-left: 0;
  }

  .hero-stats li:nth-child(n + 3) {
    border-top: 1px solid rgba(255, 255, 255, .12);
    margin-top: 24px;
  }

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

  .specs li,
  .specs li+li {
    padding: 22px 0;
    border-left: 0;
  }

  .specs li+li {
    border-top: 1px solid var(--line);
  }

  /* compact rows stay three across, a size down */
  .specs.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .specs.compact li,
  .specs.compact li+li {
    padding: 14px 10px 0 0;
    border-top: 0;
  }

  .specs.compact li+li {
    padding-left: 10px;
    border-left: 1px solid var(--line);
  }

  .specs.compact .num {
    font-size: 1.25rem;
    white-space: nowrap;
  }

  .specs.compact .lbl {
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.4;
  }

  .card {
    padding: 20px;
  }

  .charts {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .readkey {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .readkey div+div {
    padding-left: 0;
  }

  .cmp .tag {
    top: 8px;
    left: 8px;
    padding: 3px 9px;
    font-size: 12px;
  }

  .cmp .tag.ours {
    right: calc(100% - var(--split) + 8px);
  }

  .cmp .tag.right {
    display: none;
  }

  /* the world panel is too narrow for the key; the note under the player says it */
  .thumbs {
    padding: 14px 16px;
  }

  .stage {
    padding: 26px 16px 20px;
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .js .charts:not(.in) .col {
    transform: none;
  }

  .hero::before {
    animation: none;
  }

  .btn,
  .thumb,
  .chip {
    transition: none;
  }
}
