/* Project page. Black on white, the paper's link blue, and the three manner fills of the paper's figures.
   Sections alternate between white and a light grey band, each with a centred heading that states its point. */
:root {
  --ink: #141414;
  --soft: #555;
  --rule: #dedede;
  --link: #2b6cab;
  --grey: #f4f4f4;
  --mint: #dffedd;
  --lilac: #f6d8fc;
  --sky: #dbeafd;
  --plain: #e6e6e6;
  --gap: 10px;
  --small: 15px;
  --font: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --wide: 1200px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.f-helvetica { --font: "Helvetica Neue", Helvetica, Arial, sans-serif; }
body {
  margin: 0; background: #fff; color: var(--ink);
  font: 18px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--link); }
p { margin: 0 0 1em; }
sup { font-size: .68em; line-height: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button { font: inherit; }
button:focus-visible, a:focus-visible, .clip:focus-visible, summary:focus-visible, .pt:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---- title block ---- */
.top { text-align: center; padding: 56px 20px 0; }
h1 { font-size: 37px; line-height: 1.16; font-weight: 600; letter-spacing: -.02em; margin: 0 auto 22px; max-width: 1180px; text-wrap: balance; }
h1 .logo { width: 1.1em; height: 1.1em; vertical-align: -.2em; margin-left: .22em; }
h1 .nw { white-space: nowrap; }
.authors { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 26px; margin: 0 0 4px; }
.authors a { color: var(--ink); text-decoration: none; }
.authors a:hover { text-decoration: underline; }
.affil { font-size: var(--small); color: var(--soft); margin: 0 0 14px; }
.links { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 0; margin: 0; font-size: 17px; }
.links > * + * { margin-left: 16px; padding-left: 16px; border-left: 1px solid #c9c9c9; line-height: 1.1; }
.links .code { color: var(--soft); }   /* only "Code and data" is the link, the date is plain text */
.links .nw { white-space: nowrap; }

/* ---- sections ---- */
section { padding: 76px 20px; }
.band-g { background: var(--grey); }
/* the sections after the opener are numbered, a circled number left of each heading */
body { counter-reset: sec; }
section.num > h2::before { counter-increment: sec; content: counter(sec); display: inline-flex; align-items: center; justify-content: center;
  font-size: .7em; width: 1.95em; height: 1.95em; margin-right: .55em; vertical-align: .12em; border: 2px solid var(--ink); border-radius: 50%;
  font-weight: 600; letter-spacing: 0; line-height: 1; font-variant-numeric: tabular-nums; }
h2 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.012em; text-align: center; margin: 0 auto 14px; max-width: 820px; text-wrap: balance; }
h3 { font-size: 21px; line-height: 1.3; font-weight: 600; margin: 2em 0 .4em; }
.lede { text-align: center; max-width: 760px; margin: 0 auto 30px; text-wrap: pretty; }
.wide { max-width: var(--wide); margin: 0 auto; }
.note, .small { font-size: var(--small); }
.prompt { text-align: center; font: 15px/1.4 Menlo, Consolas, monospace; margin: 0 0 14px; }
.prompt.small { font-size: 14px; }
[data-view]:empty { min-height: 200px; }

/* ---- clips ---- */
.clip { position: relative; margin: 0; background: #000; border-radius: 3px; overflow: hidden; cursor: pointer; }
.clip video, .clip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.clip.fit { aspect-ratio: 832 / 480; }
.clip.fit video, .clip.fit img { object-fit: contain; }
.tag { position: absolute; left: 6px; top: 6px; font-size: 12.5px; line-height: 1.5; padding: 0 6px; border-radius: 2px; pointer-events: none; }
.tag.ref { background: rgba(0, 0, 0, .7); color: #fff; outline: 1px solid rgba(255, 255, 255, .85); }
.tag.gen { background: #fff; color: #000; }
figure.cell { margin: 0; }
figcaption { font-size: 14px; line-height: 1.3; margin: 5px 0 0; }
.mlabel::first-letter, figcaption::first-letter, .tabs button::first-letter, .rowhead span::first-letter { text-transform: uppercase; }
/* paused: a play button over each video, the usual sign that a click starts it again (it replaces a line of text
   under the grid, which shifted the layout) */
.group.paused .clip::after, .stage.paused .frame::after {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 2; width: clamp(30px, 14%, 58px); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: rgba(20, 20, 20, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M4 3v16l13-8z' fill='%23fff' stroke='%23fff' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat 56% 50% / 42% 42%;
}

/* manner bands, the row fills of the paper's figures */
.band { border-radius: 12px; padding: var(--gap); transition: background-color .35s; }
.mint { background: var(--mint); } .lilac { background: var(--lilac); } .sky { background: var(--sky); } .plain { background: var(--plain); }
.mlabel { margin: 0 0 8px; font-size: var(--small); line-height: 1.3; }

/* ---- the opener ---- */
#opener { padding-top: 34px; }
.idea { font-size: 22px; line-height: 1.4; text-align: center; max-width: 760px; margin: 0 auto 34px; text-wrap: balance; }
.idea .ln { display: block; text-wrap: balance; }   /* a sentence per line; a long one wraps evenly */
.idea-def { font-size: 26px; line-height: 1.35; max-width: 860px; }   /* the definition */
.idea-def + .idea-how { margin-top: -20px; font-size: 19px; max-width: 900px; }   /* what the method does, one line on a laptop */
/* "manner": underlined, its definition from the paper in a bubble on hover, focus or tap */
.def { position: relative; display: inline-block; }
.term { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: help;
        text-decoration: underline dotted 2px; text-underline-offset: 5px; }
.bubble { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 12px); width: max-content; max-width: min(340px, 88vw);
          transform: translate(calc(-50% + var(--dx, 0px)), -4px); padding: 10px 14px; background: #fff; color: var(--ink);
          border: 1px solid #cfcfcf; border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
          font-size: 16px; font-weight: 400; line-height: 1.4; text-align: left; text-wrap: pretty;
          opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .18s, transform .18s, visibility 0s .18s; }
.bubble::before { content: ""; position: absolute; left: calc(50% - var(--dx, 0px)); bottom: -6px; width: 10px; height: 10px; background: #fff;
                  border: solid #cfcfcf; border-width: 0 1px 1px 0; transform: translateX(-50%) rotate(45deg); }
.def.open .bubble { opacity: 1; visibility: visible; transform: translate(calc(-50% + var(--dx, 0px)), 0); transition: opacity .18s, transform .18s; }
.opener { max-width: 1320px; margin: 0 auto; }
.stage { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; transition: opacity .35s; }
.stage.swap .lane > * { opacity: 0; transition: opacity .24s; }      /* a later action: the contents crossfade, the lanes stay */
.stage .lane { border-radius: 12px; padding: var(--gap); transition: background-color .5s; }
.stage.one .lane { background-color: transparent; }
.stage .mlabel { transition: opacity .45s; font-size: 19px; font-weight: 500; text-align: center; }
.frame { position: relative; aspect-ratio: 832 / 480; background: #000; border-radius: 3px; overflow: hidden; cursor: pointer;
         transform-origin: 50% 0; transition: transform .75s cubic-bezier(.65, 0, .35, 1), opacity .4s; }
.frame video, .frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame .tag { transition: opacity .3s; }
.frame .one-tag { opacity: 0; background: #fff; color: #000; font-size: calc(12px / var(--s, 1)); }   /* hidden once split */
.stage.one .lane:last-child .one-tag { opacity: 1; }
.stage.one .gen-tag { opacity: 0; }
.refs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 8px; transition: opacity .45s; }
.stage.one .mlabel, .stage.one .refs { opacity: 0; }
.stage.snap .lane, .stage.snap .frame, .stage.snap .mlabel, .stage.snap .refs, .stage.snap .tag { transition: none !important; }
.refclip { aspect-ratio: 256 / 148; border-radius: 1px; }
.refclip video { position: absolute; inset: 0; opacity: 0; }
.refclip.on video { opacity: 1; }
.refclip.on { outline: 2px solid var(--ink); outline-offset: -2px; }
.under { text-align: center; font-size: var(--small); margin: 16px auto 0; max-width: 680px; transition: opacity .45s; }
.opener.merged .under { opacity: 0; }
.frame video { transition: opacity .2s; }
.stage.reset .frame video { opacity: .35; }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 24px; margin: 12px 0 0; }
.actions button, .tabs button, .ctl button, .textbtn {
  color: var(--link); background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 0; cursor: pointer; border-radius: 0;
}
.actions button:hover, .tabs button:hover, .ctl button:hover { border-bottom-color: var(--link); }
.actions button[aria-pressed="true"], .tabs button[aria-selected="true"], .ctl button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ---- rows: one manner per row, its label above n clips ---- */
.rows { display: grid; gap: 12px; }
.rowhead, .rclips { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: var(--gap); }
.rowhead { padding: 0 var(--gap); font-size: var(--small); line-height: 1.25; align-items: end; }
.rows figcaption { display: none; }                        /* column names sit in .rowhead, except on a phone */
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 26px; margin: 0 auto 16px; }

.xrows .rowhead, .xrows .rclips { grid-template-columns: var(--xcols); }
@media (min-width: 761px) { .xrows .rclips > :first-child, .xrows .rowhead > :first-child { margin-right: 12px; } }
.xrows .xover { margin-bottom: -6px; }
.xto { text-align: center; color: var(--soft); padding-bottom: 5px; border-bottom: 1px solid #c9c9c9; }

/* ---- the problem: columns are manners, rows are real / prompt only / ours ---- */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; max-width: 1000px; margin: 0 auto; align-items: start; }
.prow { grid-column: 1 / -1; margin: 6px 0 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.pdiv { grid-column: 1 / -1; width: 100%; margin: 16px 0 6px; border: 0; border-top: 1px solid #c9c9c9; }
.ptile { border-radius: 12px; padding: 8px; }
.pcap { margin: 7px 0 1px; text-align: center; font-size: 16px; font-weight: 500; line-height: 1.3; }
.pcap::first-letter { text-transform: uppercase; }

/* ---- stacked grids (comparison, transfer): the action above each ---- */
h4.stackhead { font-size: 19px; font-weight: 600; text-align: center; margin: 0 0 12px; }
* + h4.stackhead { margin-top: 48px; }

/* ---- discovered manners: a wall of pairs of square real clips ---- */
.wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px 30px; }
.wall .pair.more { display: none; }
.wall.all .pair.more { display: block; }
/* a lone pair on the last row of three sits in the middle column */
@media (min-width: 761px) { .wall.all .pair:last-child:nth-child(3n+1) { grid-column: 2; } }
.pairhead { display: flex; align-items: center; gap: 8px; margin: 0 0 7px; font-weight: 600; font-size: var(--small); }
.ptype { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-weight: 400; color: var(--soft); white-space: nowrap; }
.ptype img { width: 20px; height: 20px; }
h3.sub-h { text-align: center; margin: 72px auto 8px; }
#same .wall, [data-view="same"] .wall { margin-top: 4px; }
.pairclips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.textbtn { display: block; margin: 26px auto 0; font-size: var(--small); }
.textbtn:hover { border-bottom-color: var(--link); }

/* ---- method figure ---- */
.figwrap { overflow-x: auto; }
.figure { display: block; width: 100%; height: auto; }
.figwrap { min-height: 300px; }

/* ---- results: a table with a bar beside each score, ours first, real clips last ---- */
/* ---- the results table: one table at text width, the paper's groups as header rows, bars on a 0 to 1 track */
.bw { max-width: 700px; margin: 0 auto; }
.bw .note { max-width: none; text-wrap: pretty; }
table.bt { border-collapse: collapse; width: 100%; table-layout: fixed; margin: 0 auto; font-size: 15px; line-height: 1.3; font-variant-numeric: tabular-nums; border-bottom: 1.5px solid var(--ink); }
.bt th, .bt td { padding: 0; height: 30px; text-align: left; font-weight: 400; vertical-align: middle; }
.bt caption:not(.sr) { caption-side: top; text-align: left; font-weight: 600; padding: 0 0 8px; }
.bt thead tr:first-child > * { border-top: 1.5px solid var(--ink); }
.bt thead tr:last-child > * { border-bottom: 1px solid var(--ink); }
.bt thead th { font-weight: 600; height: 34px; }
.bt tbody th { padding-right: 14px; }
.bt a { color: var(--link); text-decoration: none; }
.bt a:hover { text-decoration: underline; }
.bt .gr th { color: var(--soft); height: 32px; padding-top: 6px; }
.bt tbody + tbody > tr:first-child > * { border-top: 1px solid var(--rule); }
.bt tbody.o > tr:first-child > *, .bt tbody.ref > tr:first-child > * { border-top: 1px solid var(--ink); }
.bt .ours th, .bt .ours .n, .bt b { font-weight: 600; }
.bt .f { text-align: right; }
/* a score and its bar on a track from 0 to 1 */
.bt .m { position: relative; white-space: nowrap; }
.bt .n { display: inline-block; width: var(--nw); }
.bt .b { display: inline-block; vertical-align: middle; width: var(--bw); height: 8px; background: #ececec; }
.bt .b i { display: block; height: 100%; width: calc(var(--v) * 100%); background: #a3a3a3; }
.bt .ours .b i { background: var(--ink); }

/* chance as a labelled hairline on both bars */
.bars { --nw: 40px; --bw: 132px; }
.bars .c-n { width: 39%; } .bars .c-m { width: 26.5%; } .bars .c-f { width: 8%; }
.bars thead tr:first-child th { height: 30px; padding-top: 4px; }
.bars .ax td { height: 20px; vertical-align: top; }
.bars .ch { position: absolute; top: 0; left: calc(var(--nw) + .11 * var(--bw) + 5px); font-size: 12.5px; line-height: 16px; color: var(--soft); }
.bars td.m::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--nw) + .11 * var(--bw)); border-left: 1px solid #6a6a6a; }
.note { color: var(--soft); max-width: 900px; margin: 14px auto 0; }
.bw .note + .note { margin-top: 6px; }
.grid-note { text-align: center; max-width: 700px; }
.rowhead .is-ours, figcaption.is-ours { font-weight: 700; }   /* our column in the results grid */

pre { margin: 0 auto 1.4em; padding: 14px 16px; background: var(--grey); border-radius: 4px; overflow-x: auto; font: 13.5px/1.5 Menlo, Consolas, monospace; }
/* the showcase video (YouTube), at the content width, then BibTeX in the same white band */
.yt { max-width: var(--wide); margin: 0 auto; aspect-ratio: 16 / 9; background: #000; border-radius: 3px; overflow: hidden; }
.yt iframe { display: block; width: 100%; height: 100%; border: 0; }
#video + #cite { padding-top: 0; }
#cite h3 { margin-top: 1.6em; text-align: center; }
#cite > :not(h2) { max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---- the corner control ---- */
.ctl { position: fixed; right: 14px; bottom: 14px; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 2px 12px;
       background: rgba(255, 255, 255, .94); border: 1px solid var(--rule); border-radius: 4px; font-size: 14px; }
.ctl .speed { display: flex; gap: 8px; }
.ctl { transition: opacity .2s; }
.ctl.away { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 760px) {
  .opener { display: flex; flex-direction: column; }
  .opener > .under { order: -1; margin: 0 auto 14px; }   /* the caption above the stacked videos */
  body { font-size: 16.5px; }
  .top { padding-top: 34px; }
  h1 { font-size: 28px; }
  .stage .mlabel { font-size: 17px; }
  h2 { font-size: 23px; }
  .idea { font-size: 18px; }
  .idea-def { font-size: 21px; }
  .idea-def + .idea-how { font-size: 17px; }
  section { padding: 52px 14px; }
  .lede { text-align: left; }
  .links .code { flex-basis: 100%; margin-left: 0; padding-left: 0; border-left: 0; }   /* its own line, no stray rule at the line start */
  .pgrid { gap: 6px; }
  .prow { font-size: var(--small); margin-top: 4px; }
  .pcap { font-size: 13px; margin-top: 5px; }
  .pgrid .tag { left: 3px; top: 3px; font-size: 10px; padding: 0 4px; }
  .pdiv { margin: 10px 0 2px; }
  .ptile { padding: 4px; border-radius: 8px; }
  .stage { grid-template-columns: 1fr; gap: 10px; }
  .band, .stage .lane { margin-inline: -14px; border-radius: 0; padding: 6px; }
  .rowhead { display: none; }
  .rows .mlabel { margin-bottom: 6px; }
  .rows:not(.wide) .rclips { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .rows:not(.wide) .rclips::-webkit-scrollbar { display: none; }
  .rows:not(.wide) .rclips > * { flex: 0 0 74%; scroll-snap-align: start; }
  .rows.wide .rclips { grid-template-columns: 1fr 1fr; gap: 6px; }
  .rows figcaption { display: block; margin-top: 3px; }
  .wall { grid-template-columns: 1fr; }
  .figure { min-width: 720px; }
  .figwrap { min-height: 0; }
  .tabs { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0 18px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; }
  .ctl { display: none; }                                  /* a tap on a clip pauses its grid */
  .figwrap .mf-narrow .mf-fallback { min-width: 720px; }    /* the static method figure scrolls sideways, as .figure does */
  .xrows .rclips > :first-child { grid-column: 1 / -1; }    /* transfer: the learnt-from clip on its own line, then two by two */
  pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  table.bt { font-size: 13.5px; }
  .bt tbody th { padding: 4px 8px 4px 0; }
  .bt th, .bt td { height: 32px; }
  .bars { --nw: 31px; --bw: 46px; }
  .bars .c-n { width: 36%; } .bars .c-m { width: 25%; } .bars .c-f { width: 14%; }
  .bars .ch { font-size: 11.5px; }
}
