/*
 * The motion of the scenes in `components/scenes.js`, one clock per scene,
 * keyed on the scene's class as `svg()` writes it: `.ask`, `.keys`,
 * `.invite`, `.stranger`, `.glide`. Laid for every page that places a
 * scene, so the timings live once. A scene stands still under
 * `prefers-reduced-motion`, and its steps are a plain list beside it.
 */

/* A visit, slowly, 14s. Not symmetric: the will is the caller's first and
   the callee's after. Alice's half glides to her door and her red end
   stretches to the mirror; she steps in; the ask crosses to Bob's door and
   waits; only then does Bob's half glide to his door and his purple end
   stretch to meet hers, one booth between the doors; he steps in, the
   reply crosses back, both step out, the ends draw back, the halves glide
   home. */
.ask .a-slide-a {
  animation: a-slide-a 14s infinite;
}
.ask .a-slide-b {
  animation: a-slide-b 14s infinite;
}
.ask .a-slide-a .mirror {
  animation: a-hair-a 14s infinite;
}
.ask .a-slide-b .mirror {
  animation: a-hair-b 14s infinite;
}
.ask .a-merge .merge-a {
  animation: a-grow-a 14s infinite;
  transform: scaleX(0);
}
.ask .a-merge .merge-b {
  animation: a-grow-b 14s infinite;
  transform: scaleX(0);
}
.ask .a-merge .merge-m {
  animation: a-mirror 14s infinite;
  opacity: 0;
}
.ask .a-you {
  animation: a-you 14s infinite;
}
.ask .a-bob {
  animation: a-bob 14s infinite;
}
.ask .a-env {
  animation: a-env 14s infinite;
  opacity: 0;
}
.ask .a-rep {
  animation: a-rep 14s infinite;
  opacity: 0;
}
@keyframes a-slide-a {
  0%,
  8% {
    transform: rotate(0deg);
  }
  16%,
  88% {
    transform: rotate(40deg);
  }
  96%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes a-slide-b {
  0%,
  52% {
    transform: rotate(0deg);
  }
  58%,
  88% {
    transform: rotate(-40deg);
  }
  96%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes a-hair-a {
  0%,
  18% {
    opacity: 1;
  }
  22%,
  90% {
    opacity: 0;
  }
  94%,
  100% {
    opacity: 1;
  }
}
@keyframes a-hair-b {
  0%,
  60% {
    opacity: 1;
  }
  64%,
  90% {
    opacity: 0;
  }
  94%,
  100% {
    opacity: 1;
  }
}
@keyframes a-grow-a {
  0%,
  16% {
    transform: scaleX(0);
  }
  28%,
  86% {
    transform: scaleX(1);
  }
  92%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes a-grow-b {
  0%,
  58% {
    transform: scaleX(0);
  }
  66%,
  86% {
    transform: scaleX(1);
  }
  92%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes a-mirror {
  0%,
  65% {
    opacity: 0;
  }
  67%,
  86% {
    opacity: 1;
  }
  88%,
  100% {
    opacity: 0;
  }
}
@keyframes a-you {
  0%,
  30% {
    transform: translate(0, 0) scale(1);
  }
  38%,
  82% {
    transform: translate(91.5px, 0) scale(0.66);
  }
  88%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes a-bob {
  0%,
  66% {
    transform: translate(0, 0) scale(1);
  }
  72%,
  82% {
    transform: translate(-91.5px, 0) scale(0.66);
  }
  88%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes a-env {
  0%,
  40% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  41% {
    opacity: 1;
  }
  50%,
  66% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  68%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes a-rep {
  0%,
  74% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  75% {
    opacity: 1;
  }
  82% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  83%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}

/* The invitation, 18s: Bob's half appears, the card crosses by any
   channel, Alice's half appears, then the visit as above, the knock waits
   at Bob's door until he comes, the reply comes back, the first key dies,
   the booth draws apart and the halves glide home. */
.invite .i-booth-bob {
  animation: i-appear 18s infinite;
  opacity: 0;
}
.invite .i-card {
  animation: i-card 18s infinite;
  opacity: 0;
}
.invite .i-booth-alice {
  animation: i-appear-late 18s infinite;
  opacity: 0;
}
.invite .i-slide-a {
  animation: i-slide-a 18s infinite;
}
.invite .i-slide-b {
  animation: i-slide-b 18s infinite;
}
.invite .i-slide-a .mirror {
  animation: i-hair-a 18s infinite;
}
.invite .i-slide-b .mirror {
  animation: i-hair-b 18s infinite;
}
.invite .i-merge .merge-a {
  animation: i-grow-a 18s infinite;
  transform: scaleX(0);
}
.invite .i-merge .merge-b {
  animation: i-grow-b 18s infinite;
  transform: scaleX(0);
}
.invite .i-merge .merge-m {
  animation: i-mirror 18s infinite;
  opacity: 0;
}
.invite .i-you {
  animation: i-you 18s infinite;
}
.invite .i-bob {
  animation: i-bob 18s infinite;
}
.invite .i-knock {
  animation: i-knock 18s infinite;
  opacity: 0;
}
.invite .i-rep {
  animation: i-rep 18s infinite;
  opacity: 0;
}
.invite .i-dead {
  animation: i-dead 18s infinite;
  opacity: 0;
}
@keyframes i-appear {
  0% {
    opacity: 0;
  }
  5%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes i-card {
  0%,
  6% {
    transform: translate(150px, -30px) rotate(-8deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  22% {
    transform: translate(-150px, -50px) rotate(-8deg);
    opacity: 1;
  }
  26%,
  100% {
    transform: translate(-150px, -50px) rotate(-8deg);
    opacity: 0;
  }
}
@keyframes i-appear-late {
  0%,
  22% {
    opacity: 0;
  }
  26%,
  96% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes i-slide-a {
  0%,
  28% {
    transform: rotate(0deg);
  }
  34%,
  92% {
    transform: rotate(40deg);
  }
  99%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes i-slide-b {
  0%,
  60% {
    transform: rotate(0deg);
  }
  64%,
  92% {
    transform: rotate(-40deg);
  }
  99%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes i-hair-a {
  0%,
  36% {
    opacity: 1;
  }
  40%,
  93% {
    opacity: 0;
  }
  96%,
  100% {
    opacity: 1;
  }
}
@keyframes i-hair-b {
  0%,
  66% {
    opacity: 1;
  }
  70%,
  93% {
    opacity: 0;
  }
  96%,
  100% {
    opacity: 1;
  }
}
@keyframes i-grow-a {
  0%,
  34% {
    transform: scaleX(0);
  }
  42%,
  88% {
    transform: scaleX(1);
  }
  93%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes i-grow-b {
  0%,
  64% {
    transform: scaleX(0);
  }
  70%,
  88% {
    transform: scaleX(1);
  }
  93%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes i-mirror {
  0%,
  69% {
    opacity: 0;
  }
  71%,
  88% {
    opacity: 1;
  }
  90%,
  100% {
    opacity: 0;
  }
}
@keyframes i-you {
  0%,
  44% {
    transform: translate(0, 0) scale(1);
  }
  50%,
  84% {
    transform: translate(91.5px, 0) scale(0.66);
  }
  89%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes i-bob {
  0%,
  70% {
    transform: translate(0, 0) scale(1);
  }
  75%,
  84% {
    transform: translate(-91.5px, 0) scale(0.66);
  }
  89%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes i-knock {
  0%,
  52% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  53% {
    opacity: 1;
  }
  60%,
  70% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  72%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes i-rep {
  0%,
  76% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  77% {
    opacity: 1;
  }
  83% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  84%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes i-dead {
  0%,
  83% {
    opacity: 0;
  }
  86%,
  97% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* The story, 24s, four beats. The card crosses by any channel (0-20).
   The visit opens as in `invite`: Alice's half glides and stretches, she
   steps in, the knock crosses, Bob's half comes, he answers once and the
   first key dies (20-62). One ask crosses the booth and its reply comes
   back (62-80). The booth draws apart, and a stranger below the fold
   sends noise to Bob's door and gets the blank sheet (80-100). */
.story .st-booth-b {
  animation: st-appear 24s infinite;
  opacity: 0;
}
.story .st-card {
  animation: st-card 24s infinite;
  opacity: 0;
}
.story .st-booth-a {
  animation: st-appear-late 24s infinite;
  opacity: 0;
}
.story .st-slide-a {
  animation: st-slide-a 24s infinite;
}
.story .st-slide-b {
  animation: st-slide-b 24s infinite;
}
.story .st-slide-a .mirror {
  animation: st-hair-a 24s infinite;
}
.story .st-slide-b .mirror {
  animation: st-hair-b 24s infinite;
}
.story .st-merge .merge-a {
  animation: st-grow-a 24s infinite;
  transform: scaleX(0);
}
.story .st-merge .merge-b {
  animation: st-grow-b 24s infinite;
  transform: scaleX(0);
}
.story .st-merge .merge-m {
  animation: st-mirror 24s infinite;
  opacity: 0;
}
.story .st-you {
  animation: st-you 24s infinite;
}
.story .st-bob {
  animation: st-bob 24s infinite;
}
.story .st-knock {
  animation: st-knock 24s infinite;
  opacity: 0;
}
.story .st-rep1 {
  animation: st-rep1 24s infinite;
  opacity: 0;
}
.story .st-dead {
  animation: st-dead 24s infinite;
  opacity: 0;
}
.story .st-ask {
  animation: st-ask 24s infinite;
  opacity: 0;
}
.story .st-rep2 {
  animation: st-rep2 24s infinite;
  opacity: 0;
}
.story .st-outside {
  animation: st-outside 24s infinite;
  opacity: 0;
}
.story .st-noise {
  animation: st-noise 24s infinite;
  opacity: 0;
}
.story .st-sheet {
  animation: st-sheet 24s infinite;
  opacity: 0;
}
@keyframes st-appear {
  0% {
    opacity: 0;
  }
  3%,
  97% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes st-card {
  0%,
  3% {
    transform: translate(150px, -30px) rotate(-8deg);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  17% {
    transform: translate(-150px, -50px) rotate(-8deg);
    opacity: 1;
  }
  20%,
  100% {
    transform: translate(-150px, -50px) rotate(-8deg);
    opacity: 0;
  }
}
@keyframes st-appear-late {
  0%,
  17% {
    opacity: 0;
  }
  20%,
  97% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes st-slide-a {
  0%,
  20% {
    transform: rotate(0deg);
  }
  25%,
  84% {
    transform: rotate(40deg);
  }
  90%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes st-slide-b {
  0%,
  44% {
    transform: rotate(0deg);
  }
  47%,
  84% {
    transform: rotate(-40deg);
  }
  90%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes st-hair-a {
  0%,
  26% {
    opacity: 1;
  }
  29%,
  85% {
    opacity: 0;
  }
  88%,
  100% {
    opacity: 1;
  }
}
@keyframes st-hair-b {
  0%,
  47% {
    opacity: 1;
  }
  50%,
  85% {
    opacity: 0;
  }
  88%,
  100% {
    opacity: 1;
  }
}
@keyframes st-grow-a {
  0%,
  25% {
    transform: scaleX(0);
  }
  31%,
  80% {
    transform: scaleX(1);
  }
  84%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes st-grow-b {
  0%,
  47% {
    transform: scaleX(0);
  }
  52%,
  80% {
    transform: scaleX(1);
  }
  84%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes st-mirror {
  0%,
  51% {
    opacity: 0;
  }
  52%,
  80% {
    opacity: 1;
  }
  82%,
  100% {
    opacity: 0;
  }
}
@keyframes st-you {
  0%,
  32% {
    transform: translate(0, 0) scale(1);
  }
  36%,
  78% {
    transform: translate(91.5px, 0) scale(0.66);
  }
  82%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes st-bob {
  0%,
  52% {
    transform: translate(0, 0) scale(1);
  }
  55%,
  78% {
    transform: translate(-91.5px, 0) scale(0.66);
  }
  82%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes st-knock {
  0%,
  37% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  38% {
    opacity: 1;
  }
  44%,
  48% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  49%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes st-rep1 {
  0%,
  55% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  56% {
    opacity: 1;
  }
  61% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  62%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes st-dead {
  0%,
  55% {
    opacity: 0;
  }
  57%,
  97% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes st-ask {
  0%,
  63% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  64% {
    opacity: 1;
  }
  69% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  70%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes st-rep2 {
  0%,
  71% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  72% {
    opacity: 1;
  }
  77% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  78%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes st-outside {
  0%,
  80% {
    opacity: 0;
  }
  83%,
  97% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes st-noise {
  0%,
  84% {
    transform: translate(74px, 108px);
    opacity: 0;
  }
  85% {
    opacity: 1;
  }
  89% {
    transform: translate(56px, 24px);
    opacity: 1;
  }
  90%,
  100% {
    transform: translate(56px, 24px);
    opacity: 0;
  }
}
@keyframes st-sheet {
  0%,
  90% {
    transform: translate(56px, 24px);
    opacity: 0;
  }
  91% {
    opacity: 1;
  }
  95% {
    transform: translate(74px, 108px);
    opacity: 1;
  }
  97%,
  100% {
    transform: translate(74px, 108px);
    opacity: 0;
  }
}

/* The keys, 16s: Alice opens the booth, Bob comes when the first ask has
   arrived and stays for the three. As Bob answers each ask, his row takes
   the key it brought (44, 61, 78); from the second on, the oldest key is
   struck, since the ask signed by the key after it left it neither held
   nor vouched for. Alice's one key moves to the new seat as each reply
   arrives (50, 67, 84). */
.keys .k-slide-a {
  animation: k-slide-a 16s infinite;
}
.keys .k-slide-b {
  animation: k-slide-b 16s infinite;
}
.keys .k-slide-a .mirror {
  animation: k-hair-a 16s infinite;
}
.keys .k-slide-b .mirror {
  animation: k-hair-b 16s infinite;
}
.keys .k-merge .merge-a {
  animation: k-grow-a 16s infinite;
  transform: scaleX(0);
}
.keys .k-merge .merge-b {
  animation: k-grow-b 16s infinite;
  transform: scaleX(0);
}
.keys .k-merge .merge-m {
  animation: k-mirror 16s infinite;
  opacity: 0;
}
.keys .k-you {
  animation: k-you 16s infinite;
}
.keys .k-bob {
  animation: k-bob 16s infinite;
}
.keys .k-env {
  animation: k-env 16s infinite;
  opacity: 0;
}
.keys .k-rep {
  animation: k-rep 16s infinite;
  opacity: 0;
}
.keys .e1 {
  animation-name: k-env-1;
}
.keys .r1 {
  animation-name: k-rep-1;
}
.keys .e2 {
  animation-name: k-env-2;
}
.keys .r2 {
  animation-name: k-rep-2;
}
.keys .e3 {
  animation-name: k-env-3;
}
.keys .r3 {
  animation-name: k-rep-3;
}
.keys .k-held.k1 {
  animation: k-h1 16s infinite;
}
.keys .k-gone.k1 {
  animation: k-g1 16s infinite;
  opacity: 0;
}
.keys .k-held.k2 {
  animation: k-h2 16s infinite;
  opacity: 0;
}
.keys .k-gone.k2 {
  animation: k-g2 16s infinite;
  opacity: 0;
}
.keys .k-held.k3 {
  animation: k-h3 16s infinite;
  opacity: 0;
}
.keys .k-held.k4 {
  animation: k-h4 16s infinite;
  opacity: 0;
}
.keys .k-mine.k1 {
  animation: k-m1 16s infinite;
}
.keys .k-mine.k2 {
  animation: k-m2 16s infinite;
  opacity: 0;
}
.keys .k-mine.k3 {
  animation: k-m3 16s infinite;
  opacity: 0;
}
.keys .k-mine.k4 {
  animation: k-m4 16s infinite;
  opacity: 0;
}
@keyframes k-slide-a {
  0%,
  2% {
    transform: rotate(0deg);
  }
  8%,
  93% {
    transform: rotate(40deg);
  }
  100% {
    transform: rotate(0deg);
  }
}
@keyframes k-slide-b {
  0%,
  29% {
    transform: rotate(0deg);
  }
  33%,
  93% {
    transform: rotate(-40deg);
  }
  100% {
    transform: rotate(0deg);
  }
}
@keyframes k-hair-a {
  0%,
  9% {
    opacity: 1;
  }
  12%,
  94% {
    opacity: 0;
  }
  97%,
  100% {
    opacity: 1;
  }
}
@keyframes k-hair-b {
  0%,
  34% {
    opacity: 1;
  }
  37%,
  94% {
    opacity: 0;
  }
  97%,
  100% {
    opacity: 1;
  }
}
@keyframes k-grow-a {
  0%,
  8% {
    transform: scaleX(0);
  }
  16%,
  88% {
    transform: scaleX(1);
  }
  93%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes k-grow-b {
  0%,
  33% {
    transform: scaleX(0);
  }
  38%,
  88% {
    transform: scaleX(1);
  }
  93%,
  100% {
    transform: scaleX(0);
  }
}
@keyframes k-mirror {
  0%,
  37% {
    opacity: 0;
  }
  39%,
  88% {
    opacity: 1;
  }
  90%,
  100% {
    opacity: 0;
  }
}
@keyframes k-you {
  0%,
  16% {
    transform: translate(0, 0) scale(1);
  }
  20%,
  84% {
    transform: translate(91.5px, 0) scale(0.66);
  }
  88%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes k-bob {
  0%,
  38% {
    transform: translate(0, 0) scale(1);
  }
  42%,
  84% {
    transform: translate(-91.5px, 0) scale(0.66);
  }
  88%,
  100% {
    transform: translate(0, 0) scale(1);
  }
}
@keyframes k-env-1 {
  0%,
  22% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  23% {
    opacity: 1;
  }
  29%,
  38% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  40%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes k-rep-1 {
  0%,
  43% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  44% {
    opacity: 1;
  }
  50% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  51%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes k-env-2 {
  0%,
  52% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  53% {
    opacity: 1;
  }
  59% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  60%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes k-rep-2 {
  0%,
  60% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  61% {
    opacity: 1;
  }
  67% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  68%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes k-env-3 {
  0%,
  69% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  70% {
    opacity: 1;
  }
  76% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  77%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes k-rep-3 {
  0%,
  77% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  78% {
    opacity: 1;
  }
  84% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  85%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes k-h1 {
  0%,
  60% {
    opacity: 1;
  }
  61%,
  100% {
    opacity: 0;
  }
}
@keyframes k-g1 {
  0%,
  60% {
    opacity: 0;
  }
  61%,
  100% {
    opacity: 1;
  }
}
@keyframes k-h2 {
  0%,
  43% {
    opacity: 0;
  }
  44%,
  77% {
    opacity: 1;
  }
  78%,
  100% {
    opacity: 0;
  }
}
@keyframes k-g2 {
  0%,
  77% {
    opacity: 0;
  }
  78%,
  100% {
    opacity: 1;
  }
}
@keyframes k-h3 {
  0%,
  60% {
    opacity: 0;
  }
  61%,
  100% {
    opacity: 1;
  }
}
@keyframes k-h4 {
  0%,
  77% {
    opacity: 0;
  }
  78%,
  100% {
    opacity: 1;
  }
}
@keyframes k-m1 {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}
@keyframes k-m2 {
  0%,
  49% {
    opacity: 0;
  }
  50%,
  66% {
    opacity: 1;
  }
  67%,
  100% {
    opacity: 0;
  }
}
@keyframes k-m3 {
  0%,
  66% {
    opacity: 0;
  }
  67%,
  83% {
    opacity: 1;
  }
  84%,
  100% {
    opacity: 0;
  }
}
@keyframes k-m4 {
  0%,
  83% {
    opacity: 0;
  }
  84%,
  100% {
    opacity: 1;
  }
}

/* The stranger, 12s: three strangers in turn, one sheet each. */
.stranger .s-noise {
  animation: s-noise 12s infinite;
  opacity: 0;
}
.stranger .s-sheet {
  animation: s-sheet 4s infinite;
  opacity: 0;
}
.stranger .n2 {
  animation-delay: 4s;
}
.stranger .n3 {
  animation-delay: 8s;
}
@keyframes s-noise {
  0% {
    transform: translate(150px, 0);
    opacity: 0;
  }
  2% {
    opacity: 1;
  }
  13% {
    transform: translate(112px, 0);
    opacity: 1;
  }
  15%,
  100% {
    transform: translate(112px, 0);
    opacity: 0;
  }
}
@keyframes s-sheet {
  0%,
  45% {
    transform: translate(112px, 0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  85% {
    transform: translate(150px, 0);
    opacity: 1;
  }
  90%,
  100% {
    opacity: 0;
  }
}

/* Your room: the booths drift, one appears, one fades. */
.glide .g-booths {
  animation: glide 30s ease-in-out infinite alternate;
}
.glide .g-new {
  animation: g-new 20s infinite;
  opacity: 0;
}
.glide .g-gone {
  animation: g-gone 20s infinite;
}
@keyframes glide {
  from {
    transform: rotate(-14deg);
  }
  to {
    transform: rotate(14deg);
  }
}
@keyframes g-new {
  0%,
  35% {
    opacity: 0;
  }
  42%,
  100% {
    opacity: 1;
  }
}
@keyframes g-gone {
  0%,
  60% {
    opacity: 1;
  }
  68%,
  100% {
    opacity: 0;
  }
}

/* The steps beside a moving scene, lit in turn on the scene's clock: a
   `.qs-scene-steps` list whose `.qs-steps-<scene>` names the scene, one item per
   beat. The invitation has three beats: the card crosses, the knock
   crosses, the answer comes back and the first key dies. */
.qs-scene-steps.qs-steps-invite li {
  animation: 18s step-end infinite;
}
.qs-scene-steps.qs-steps-invite li:nth-child(1) {
  animation-name: i-step-1;
}
.qs-scene-steps.qs-steps-invite li:nth-child(2) {
  animation-name: i-step-2;
}
.qs-scene-steps.qs-steps-invite li:nth-child(3) {
  animation-name: i-step-3;
}
@keyframes i-step-1 {
  0% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
  30% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
}
@keyframes i-step-2 {
  0% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
  30% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
  74% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
}
@keyframes i-step-3 {
  0% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
  74% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
}

/* The carrier, 8s: an ask crosses the fold in kind 00, a reply comes back
   in kind 01, each naming itself under the fold while it travels. */
.carrier .c-env {
  animation: c-env 8s infinite;
  opacity: 0;
}
.carrier .c-rep {
  animation: c-rep 8s infinite;
  opacity: 0;
}
.carrier .c-kind0 {
  animation: c-kind0 8s infinite;
  opacity: 0;
}
.carrier .c-kind1 {
  animation: c-kind1 8s infinite;
  opacity: 0;
}
@keyframes c-env {
  0%,
  5% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  40% {
    transform: translate(42px, 0);
    opacity: 1;
  }
  44%,
  100% {
    transform: translate(42px, 0);
    opacity: 0;
  }
}
@keyframes c-rep {
  0%,
  52% {
    transform: translate(42px, 0);
    opacity: 0;
  }
  55% {
    opacity: 1;
  }
  88% {
    transform: translate(-42px, 0);
    opacity: 1;
  }
  92%,
  100% {
    transform: translate(-42px, 0);
    opacity: 0;
  }
}
@keyframes c-kind0 {
  0%,
  5% {
    opacity: 0;
  }
  8%,
  40% {
    opacity: 1;
  }
  44%,
  100% {
    opacity: 0;
  }
}
@keyframes c-kind1 {
  0%,
  52% {
    opacity: 0;
  }
  55%,
  88% {
    opacity: 1;
  }
  92%,
  100% {
    opacity: 0;
  }
}

/* The story's four beats: the card, the knock, the ask, the stranger. */
.qs-scene-steps.qs-steps-story li {
  animation: 24s step-end infinite;
}
.qs-scene-steps.qs-steps-story li:nth-child(1) {
  animation-name: st-step-1;
}
.qs-scene-steps.qs-steps-story li:nth-child(2) {
  animation-name: st-step-2;
}
.qs-scene-steps.qs-steps-story li:nth-child(3) {
  animation-name: st-step-3;
}
.qs-scene-steps.qs-steps-story li:nth-child(4) {
  animation-name: st-step-4;
}
@keyframes st-step-1 {
  0% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
  20% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
}
@keyframes st-step-2 {
  0% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
  20% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
  62% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
}
@keyframes st-step-3 {
  0% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
  62% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
  80% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
}
@keyframes st-step-4 {
  0% {
    color: var(--nv-color-fg-muted);
    border-color: var(--nv-color-border);
  }
  80% {
    color: var(--nv-color-fg);
    border-color: var(--nv-color-accent);
  }
}

/* A scene holds still while a reader points at it, and its steps with it,
   so one beat can be read as long as it takes. Letting go plays on from
   there, on the same clock. */
:is(.qs-scene, .qs-hero):has(.fig:hover) :is(.fig *, .qs-scene-steps li) {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .fig * {
    animation: none !important;
    opacity: 1 !important;
  }
  /* The keys stand still as the third answer leaves them. */
  .keys .k-mine:not(.k4),
  .keys .k-held.k1,
  .keys .k-held.k2 {
    opacity: 0 !important;
  }
  .qs-scene-steps li {
    animation: none !important;
    color: var(--nv-color-fg-body);
  }
}
