/*********************************************
 * Exercise steps: the visuals shared by every step (Task pipeline, block
 * stream, buffers, thread lanes, Done) and the card animations per TODO.
 * Loaded after tanh.css and uses its tokens.
 *********************************************/

html.tanh {
  /* Deeper versions of the four tints, for marks that have to read on paper */
  --mark-model: #b9a582;
  --mark-exercise: #7fa592;
  --mark-check: #8d9f68;
  --mark-latent: #8b86b8;
}

/*********************************************
 * What's given: files that are new in this step
 *********************************************/

html.tanh .file.new {
  position: relative;
}

html.tanh .file.new::after {
  content: "new";
  position: absolute;
  top: -6px;
  right: calc(50% - 70px);
  padding: 1px var(--space-2);
  border-radius: var(--radius-small);
  background: var(--tint-exercise);
  font-family: var(--fs-heading-font);
  font-size: 0.4em;
  font-weight: 600;
}

/* Four files in a column: smaller icons, so the column fits */
html.tanh .given-column.many .file-icon {
  width: 72px;
  height: 89px;
}

/* Where a step brings new files, they lead: larger, and the files known from
   earlier steps step back. The files to edit keep their size. */
html.tanh .given:has(.file.new) .file.new .file-icon {
  width: 112px;
  height: 139px;
}

html.tanh .given:has(.file.new) .given-column.many .file.new .file-icon {
  width: 104px;
  height: 129px;
}

html.tanh .given:has(.file.new) .given-column:not(.exercise) .file:not(.new) .file-icon {
  width: 56px;
  height: 69px;
}

html.tanh .given:has(.file.new) .given-column:not(.exercise) .file:not(.new) .file-name {
  font-size: 0.4em;
  color: var(--fs-text-muted-color);
}

html.tanh .given:has(.file.new) .file.new .file-name {
  font-weight: 600;
}

html.tanh .given:has(.file.new) .file.new::after {
  right: calc(50% - 72px);
}

html.tanh .given-column.many {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  justify-items: center;
  row-gap: var(--space-4);
}

html.tanh .given-column.many .given-label,
html.tanh .given-column.many .given-folder {
  grid-column: 1 / -1;
}

/*********************************************
 * Task pipeline: one card per TODO, played in turn by task_run.js
 *********************************************/

html.tanh .run {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

html.tanh .run-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
  transition: border-color var(--duration) var(--ease);
}

html.tanh .run-step.is-current {
  border-color: var(--ink);
}

html.tanh .run-title {
  font-family: var(--fs-heading-font);
  font-weight: 600;
  font-size: 0.6em;
}

html.tanh .run-title span {
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  margin-right: var(--space-2);
  border-radius: 50%;
  background: var(--wash);
  font-size: 0.85em;
}

html.tanh .run-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  height: 140px;
  transition: opacity var(--duration) var(--ease);
}

/* A card waits, dimmed, until its turn */
html.tanh .run-step:not(.is-on) .run-visual {
  opacity: 0.35;
}

html.tanh .run-wave .waveform { height: 110px; }
html.tanh .run-wave .waveform-dividers { display: none; }
html.tanh .run-wave .waveform path { stroke-width: 2; }

/* The check: the result, not a step */
html.tanh .run-ok {
  position: absolute;
  right: 0;
  bottom: -16px;
  padding: 2px var(--space-3);
  border-radius: var(--radius-small);
  background: var(--tint-check);
  font-size: 0.42em;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

html.tanh .run.is-checked .run-ok {
  opacity: 1;
  transform: none;
}

html.tanh .run-file .file-icon { width: 64px; height: 79px; }
html.tanh .run-file .file-name { display: none; }

html.tanh .run-engine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

html.tanh .run-engine .cpp-icon { width: 64px; height: 72px; }

html.tanh .run small,
html.tanh .run-note {
  font-size: 0.42em;
  color: var(--fs-text-muted-color);
}

/* Load: the file goes into the engine, which takes it */
html.tanh .run-step.is-on .run-file { animation: run-load 1.2s var(--ease) both; }
html.tanh .run-step.is-on .run-engine { animation: run-pulse 0.5s var(--ease) 1s both; }

@keyframes run-load {
  to { transform: translateX(90px); opacity: 0; }
}

@keyframes run-pulse {
  50% { transform: scale(1.15); }
}

/* Cut into blocks: the boundaries appear one by one, the size stays a question */
html.tanh .run-cuts {
  position: absolute;
  inset: 10px 0;
}

html.tanh .run-cuts i {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 2px dashed var(--ink);
  opacity: 0;
}

html.tanh .run-cuts i:nth-child(1) { left: 25%; }
html.tanh .run-cuts i:nth-child(2) { left: 50%; }
html.tanh .run-cuts i:nth-child(3) { left: 75%; }

html.tanh .run-size {
  position: absolute;
  left: 12.5%;
  bottom: -14px;
  transform: translateX(-50%);
  font-family: var(--fs-code-font);
  font-size: 0.4em;
  white-space: nowrap;
  opacity: 0;
}

html.tanh .run-step.is-on .run-cuts i,
html.tanh .run-step.is-on .run-size { animation: run-appear 0.3s var(--ease) both; }
html.tanh .run-step.is-on .run-cuts i:nth-child(1) { animation-delay: 0.3s; }
html.tanh .run-step.is-on .run-cuts i:nth-child(2) { animation-delay: 0.8s; }
html.tanh .run-step.is-on .run-cuts i:nth-child(3) { animation-delay: 1.3s; }
html.tanh .run-step.is-on .run-size { animation-delay: 0.3s; }

@keyframes run-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Block by block: a window steps over four blocks, the output appears behind it */
html.tanh .run-target,
html.tanh .run-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
}

html.tanh .run-target .waveform path { stroke: var(--fs-border-strong); }

html.tanh .run-reveal { clip-path: inset(0 100% 0 0); }

html.tanh .run-window {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 25%;
  border-radius: var(--radius-small);
  background: var(--tint-exercise);
  mix-blend-mode: multiply;
  opacity: 0;
}

html.tanh .run-step.is-on .run-window { animation: run-window 3s steps(4, jump-none) both; }
html.tanh .run-step.is-on .run-reveal { animation: run-reveal 3s steps(4, end) both; }

@keyframes run-window {
  0% { left: 0; opacity: 1; }
  99% { opacity: 1; }
  100% { left: 75%; opacity: 0; }
}

@keyframes run-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/*********************************************
 * Solution for TODO 2 in step 1: "? samples" resolves to the model's block size
 *********************************************/

html.tanh .run-solved {
  height: 110px;
  margin-top: var(--space-5);
}

html.tanh .run-solved .run-cuts i,
html.tanh .run-solved .run-size {
  opacity: 1;
}

html.tanh .run-solved .run-size {
  display: grid;
  bottom: -26px;
  font-size: 0.5em;
}

html.tanh .run-solved .run-size span {
  grid-area: 1 / 1;
  text-align: center;
  white-space: nowrap;
}

html.tanh .run-solved .run-size .is { opacity: 0; font-weight: 600; }

html.tanh .reveal section.present .run-solved .was { animation: run-swap-out 0.5s var(--ease) 0.8s both; }
html.tanh .reveal section.present .run-solved .is { animation: run-swap-in 0.5s var(--ease) 0.8s both; }

@keyframes run-swap-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes run-swap-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/*********************************************
 * Block stream: host callbacks above, model blocks below ({{STREAM:…}})
 *********************************************/

html.tanh .stream {
  display: grid;
  grid-template-columns: 110px 1fr;
  grid-template-rows: 54px 54px;
  align-items: center;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  width: 100%;
}

html.tanh .stream-label {
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  line-height: 1.2;
  color: var(--fs-text-muted-color);
  text-align: right;
}

html.tanh .stream-label strong {
  font-size: 1.5em;
  color: var(--ink);
}

html.tanh .stream-host,
html.tanh .stream-model {
  position: relative;
  height: 100%;
}

html.tanh .stream-host {
  overflow: hidden;
}

html.tanh .stream-cells {
  position: absolute;
  inset: 0;
}

html.tanh .stream-cells i {
  box-sizing: border-box;
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px solid var(--paper);
  border-radius: 4px;
  background: var(--wash);
}

html.tanh .stream-lit i {
  background: var(--mark-exercise);
}

html.tanh .stream-lit i.fires {
  background: var(--ink);
}

html.tanh .stream-lit {
  clip-path: inset(0 100% 0 0);
}

html.tanh .reveal section.present .stream-lit {
  animation: stream-play var(--cycle) steps(var(--cells), end) infinite;
}

/* Plays a single time and holds the end, so it does not look like a stream starting over */
html.tanh .reveal section.present .streams.once .stream-lit {
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

@keyframes stream-play {
  0% { clip-path: inset(0 100% 0 0); }
  85%, 100% { clip-path: inset(0 0 0 0); }
}

html.tanh .stream-model b {
  box-sizing: border-box;
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 6px;
  background: var(--tint-model);
  font-family: var(--fs-code-font);
  font-size: 0.45em;
  font-weight: 500;
}

html.tanh .reveal section.present .stream-model b {
  animation: stream-fire var(--cycle) var(--ease) infinite;
}

@keyframes stream-fire {
  0% { background: var(--ink); color: var(--paper); }
  12% { background: var(--ink); color: var(--paper); }
  30%, 100% { background: var(--tint-model); color: var(--ink); }
}

html.tanh .streams {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-top: var(--space-6);
}

/* Several host sizes over one model row ({{STREAM:host=512,768,441|…}}): each row's buffer
   adaptation on the right, the model row static, since each host completes its blocks at
   another callback (the dark ones) */
html.tanh .stream.multi {
  grid-template-columns: 110px 1fr 150px;
}

html.tanh .stream-delta {
  display: flex;
  flex-direction: column;
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  line-height: 1.2;
  color: var(--fs-text-muted-color);
}

html.tanh .stream-delta strong {
  font-size: 1.5em;
  color: var(--ink);
}

html.tanh .reveal section.present .stream.multi .stream-model b {
  animation: none;
}

/*********************************************
 * Step 2 · ring buffers on both sides: the input fills in host-sized steps,
 * the model takes 2048 at once, the output drains in host-sized steps
 *********************************************/

html.tanh .pump {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-7);
}

html.tanh .pump-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
  font-family: var(--fs-heading-font);
  font-size: 0.6em;
  font-weight: 600;
  white-space: nowrap;
}

html.tanh .pump-node small {
  font-size: 0.7em;
  font-weight: 400;
  color: var(--fs-text-muted-color);
}

html.tanh .pump-node.model {
  background: var(--tint-model);
  border-color: transparent;
}

html.tanh .pump-arrow {
  flex: 0 0 28px;
  height: 2px;
  background: var(--fs-border-strong);
}

html.tanh .pump-buffer {
  position: relative;
  flex: 1;
  height: 64px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  overflow: hidden;
}

html.tanh .pump-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: var(--mark-exercise);
}

/* One model block: the model may run once the fill reaches it */
html.tanh .pump-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60%;
  border-left: 2px dashed var(--ink);
}

html.tanh .pump-buffer.out .pump-mark { display: none; }

html.tanh .reveal section.present .pump-buffer.in .pump-fill { animation: pump-in-512 8.4s infinite; }
html.tanh .reveal section.present .pump-buffer.out .pump-fill { animation: pump-out-512 8.4s infinite; }
html.tanh .reveal section.present .pump-node.model { animation: pump-run-512 8.4s var(--ease) infinite; }

/* 512 per call against a 2048 block (60 % of the bar): 4 calls per model block.
   12 units of 700 ms: 4 calls, the model runs for 2, 4 calls, the model runs for 2. */
@keyframes pump-in-512 {
  0% { width: 0; animation-timing-function: steps(4, end); }
  33.33% { width: 60%; animation-timing-function: step-end; }
  50% { width: 0; animation-timing-function: steps(4, end); }
  83.33%, 100% { width: 60%; animation-timing-function: step-end; }
}

@keyframes pump-run-512 {
  0%, 33.33%, 50%, 83.33%, 100% { background: var(--tint-model); color: var(--ink); }
  34.5%, 49%, 84.5%, 99% { background: var(--ink); color: var(--paper); }
}

@keyframes pump-out-512 {
  0% { width: 0; animation-timing-function: step-end; }
  41.67% { width: 60%; animation-timing-function: step-end; }
  50% { width: 60%; animation-timing-function: steps(4, end); }
  83.33% { width: 0; animation-timing-function: step-end; }
  91.67%, 100% { width: 60%; animation-timing-function: step-end; }
}

/* 480 per call against a 2048 block (60 % of the bar) */
@keyframes pump-in {
  0% { width: 0; }
  8% { width: 14%; }
  16% { width: 28%; }
  24% { width: 42%; }
  32% { width: 56%; }
  40% { width: 70%; }
  46% { width: 10%; }
  54% { width: 24%; }
  62% { width: 38%; }
  70% { width: 52%; }
  78% { width: 66%; }
  84%, 100% { width: 6%; }
}

@keyframes pump-run {
  0%, 40%, 50%, 78%, 88%, 100% { background: var(--tint-model); color: var(--ink); }
  42%, 47%, 80%, 85% { background: var(--ink); color: var(--paper); }
}

html.tanh .reveal section.present .pump-node.model small { color: inherit; }

/*********************************************
 * ring_buffer.h: push grows the filled range at the right, pop shrinks it at the left
 *********************************************/

html.tanh .ring {
  position: relative;
  height: 56px;
  margin: var(--space-7) 0 var(--space-5);
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
}

html.tanh .ring-slots {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(6.25% - 1px), var(--fs-border) calc(6.25% - 1px) 6.25%);
}

html.tanh .ring-fill {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 10%;
  width: 20%;
  border-radius: 4px;
  background: var(--mark-exercise);
}

html.tanh .ring-head {
  position: absolute;
  top: -34px;
  font-family: var(--fs-code-font);
  font-size: 0.42em;
  transform: translateX(-50%);
}

html.tanh .ring-head.pop { left: 10%; }
html.tanh .ring-head.push { left: 30%; }

html.tanh .reveal section.present .ring-fill { animation: ring-fill 6s steps(1, end) infinite; }
html.tanh .reveal section.present .ring-head.pop { animation: ring-pop 6s steps(1, end) infinite; }
html.tanh .reveal section.present .ring-head.push { animation: ring-push 6s steps(1, end) infinite; }

@keyframes ring-fill {
  0% { left: 10%; width: 20%; }
  15% { left: 10%; width: 40%; }
  30% { left: 30%; width: 20%; }
  45% { left: 30%; width: 45%; }
  60% { left: 55%; width: 20%; }
  75% { left: 55%; width: 35%; }
  90%, 100% { left: 75%; width: 15%; }
}

@keyframes ring-pop {
  0%, 15% { left: 10%; }
  30%, 45% { left: 30%; }
  60%, 75% { left: 55%; }
  90%, 100% { left: 75%; }
}

@keyframes ring-push {
  0% { left: 30%; }
  15%, 30% { left: 50%; }
  45%, 60% { left: 75%; }
  75% { left: 90%; }
  90%, 100% { left: 90%; }
}

/*********************************************
 * Step 2 Task cards
 *********************************************/

html.tanh .mini-buf {
  position: relative;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  overflow: hidden;
}

/* TODO 1: two buffers grow to a size that stays a question */
html.tanh .run-size-buffers {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

html.tanh .mini-buf.grow {
  width: 100%;
  transform: scaleX(0.3);
  transform-origin: left;
}

html.tanh .run-step.is-on .mini-buf.grow { animation: mini-grow 1.2s var(--ease) 0.2s both; }
html.tanh .run-step.is-on .mini-buf.grow + .mini-buf.grow { animation-delay: 0.5s; }
html.tanh .run-size-buffers .run-size { left: 50%; bottom: -12px; }
html.tanh .run-step.is-on .run-size-buffers .run-size { animation: run-appear 0.3s var(--ease) 1.4s both; }

@keyframes mini-grow {
  from { transform: scaleX(0.3); }
  to { transform: scaleX(1); }
}

/* TODO 2: 480 at a time; once a block is in, the model takes it */
html.tanh .mini-buf.pumping {
  flex: 1;
  height: 52px;
}

html.tanh .mini-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: var(--mark-exercise);
}

html.tanh .mini-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60%;
  border-left: 2px dashed var(--ink);
}

html.tanh .mini-model {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--tint-model);
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
}

html.tanh .run-step.is-on .mini-fill { animation: pump-in 3.2s steps(1, end) both; }
html.tanh .run-step.is-on .mini-model { animation: pump-run 3.2s var(--ease) both; }

/* TODO 3: silence first, then the model's output, call by call */
html.tanh .run-out .run-reveal {
  clip-path: inset(0 100% 0 0);
}

html.tanh .run-out .waveform {
  clip-path: inset(0 0 0 30%);
}

html.tanh .run-silence {
  position: absolute;
  left: 0;
  top: 50%;
  width: 30%;
  border-top: 2px solid var(--ink);
}

html.tanh .run-step.is-on .run-out .run-reveal { animation: run-reveal 2.6s steps(5, end) both; }

/*********************************************
 * Step 7 · two pictures of the delay. On the beat grid, a latency that wanders
 * never matches the number the host was told. Dry against wet, the wet path is
 * late and the dry path is delayed to meet it
 *********************************************/

html.tanh .align {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-top: var(--space-7);
}

html.tanh .align-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: var(--space-5);
}

html.tanh .align.beat-grid { gap: var(--space-5); }
html.tanh .align.beat-grid .align-row { grid-template-columns: 220px 1fr 170px; }

html.tanh .align-label {
  font-family: var(--fs-heading-font);
  font-size: 0.55em;
  font-weight: 600;
  text-align: right;
}

html.tanh .align-label small {
  display: block;
  font-size: 0.8em;
  font-weight: 400;
  opacity: 0.6;
}

html.tanh .align-track {
  position: relative;
  height: 110px;
  overflow: hidden;
  border-bottom: var(--hairline) solid var(--fs-border);
}

/* The beats: the rest of the session, which the host has already lined up */
html.tanh .align-beats {
  position: relative;
  height: 1.2em;
  font-size: 0.45em;
  opacity: 0.6;
}

html.tanh .align-beats span {
  position: absolute;
  transform: translateX(-50%);
}

html.tanh .align-beat {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--fs-border-strong);
}

html.tanh .align-hits {
  position: absolute;
  inset: 0;
}

html.tanh .align-hit {
  position: absolute;
  top: 12%;
  bottom: 12%;
  width: 10px;
  margin-left: -5px;
  border-radius: 2px;
  background: currentColor;
}

/* What the row comes to: stacked, one shown at a time */
html.tanh .align-readout {
  position: relative;
  height: 2.6em;
  font-family: var(--fs-heading-font);
  font-size: 0.55em;
  font-weight: 600;
}

html.tanh .align-readout small {
  display: block;
  font-size: 0.8em;
  font-weight: 400;
  opacity: 0.6;
}

html.tanh .align-readout > span {
  position: absolute;
  inset: 0;
  opacity: 0;
}

/* Shown without the animation, too */
html.tanh .align-readout > span.rest { opacity: 1; }

/* Beat grid: 512 samples late or early is a shift of 5 % here */
html.tanh .align-hits.wanders { transform: translateX(5%); }

html.tanh .reveal section.present .align-hits.wanders { animation: align-wander 4.5s steps(1, end) infinite; }
html.tanh .reveal section.present .align-readout > span.first { animation: align-first 4.5s steps(1, end) infinite; }
html.tanh .reveal section.present .align-readout > span.second { animation: align-second 4.5s steps(1, end) infinite; }
html.tanh .reveal section.present .align-readout > span.third { animation: align-third 4.5s steps(1, end) infinite; }

@keyframes align-wander {
  0% { transform: translateX(5%); }
  33.33% { transform: translateX(-5%); }
  66.67%, 100% { transform: translateX(15%); }
}

@keyframes align-first {
  0% { opacity: 1; }
  33.33%, 100% { opacity: 0; }
}

@keyframes align-second {
  0% { opacity: 0; }
  33.33% { opacity: 1; }
  66.67%, 100% { opacity: 0; }
}

@keyframes align-third {
  0% { opacity: 0; }
  66.67%, 100% { opacity: 1; }
}

/* Dry against wet: the dry wave is delayed to meet the wet one */
html.tanh .align-wave {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
}

html.tanh .align-wave .waveform { height: 100px; }
html.tanh .align-wave .waveform-dividers { display: none; }
html.tanh .align-wave.dry .waveform path { stroke: var(--mark-latent); stroke-width: 3; }
html.tanh .align-wave.wet .waveform path { stroke-width: 2.4; }

html.tanh .align-wave.wet.fixed { transform: translateX(18%); }

html.tanh .reveal section.present .align-wave.delayed { animation: align-meet 5s var(--ease) infinite; }

@keyframes align-meet {
  0%, 25% { transform: translateX(0); }
  55%, 90% { transform: translateX(18%); }
  100% { transform: translateX(0); }
}

/* The two parts of the latency, as pills */
html.tanh .lat-part {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--tint-model);
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  white-space: nowrap;
}

html.tanh .lat-part strong {
  font-family: var(--fs-code-font);
  font-size: 1.3em;
  font-weight: 500;
}

html.tanh .lat-part.total {
  background: var(--ink);
  color: var(--paper);
}

/* The term a slide is about */
html.tanh .lat-part.focus {
  background: var(--tint-exercise);
  outline: 2px solid var(--ink);
}

html.tanh .lat-sum {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-7);
  font-size: 1.3em;
}

/* The sum for several host blocks: the term boxes as the header, one row of numbers per
   host block below them, in the order of the stream rows above */
html.tanh .lat-grid {
  display: grid;
  grid-template-columns: repeat(8, auto);
  justify-content: center;
  justify-items: center;
  align-items: center;
  column-gap: var(--space-4);
  row-gap: var(--space-1);
  margin-top: var(--space-5);
  font-size: 1.3em;
}

html.tanh .lat-grid > strong {
  font-family: var(--fs-code-font);
  font-size: 0.65em;
  font-weight: 500;
  white-space: nowrap;
}

html.tanh .lat-grid > strong.total {
  font-weight: 700;
}

html.tanh .lat-host {
  justify-self: end;
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
  white-space: nowrap;
}

html.tanh .lat-host b {
  color: var(--ink);
}

/* The same sum without boxes: where a number comes from, written above it */
html.tanh .lat-add {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-7);
  margin: var(--space-8) 0 var(--space-7);
  font-family: var(--fs-heading-font);
}

html.tanh .lat-term {
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
}

html.tanh .lat-term span {
  font-size: 0.8em;
  font-weight: 600;
}

html.tanh .lat-term small {
  margin-top: var(--space-1);
  padding-bottom: var(--space-3);
  font-size: 0.65em;
  color: var(--fs-text-muted-color);
}

html.tanh .lat-term strong,
html.tanh .lat-op {
  font-size: 150px;
  line-height: 1.1;
}

html.tanh .lat-term strong {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

html.tanh .lat-term.total strong { font-weight: 700; }

/* Four terms and the code below them: the same sum, a little smaller */
html.tanh .lat-add.with-code {
  gap: var(--space-5);
  margin: var(--space-6) 0;
}

html.tanh .lat-add.with-code .lat-term strong,
html.tanh .lat-add.with-code .lat-op {
  font-size: 110px;
}

/* Equal columns keep the numbers evenly spaced; a longer label reaches over the signs */
html.tanh .lat-add.with-code .lat-term { width: 340px; }

html.tanh .lat-op {
  font-weight: 300;
  color: var(--fs-text-muted-color);
}

html.tanh .lat-plus {
  font-family: var(--fs-heading-font);
  font-size: 0.8em;
  color: var(--fs-text-muted-color);
}

/* Step 3, TODO 1: what the host gets back in each callback, one after the other */
html.tanh .run-callbacks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: start;
  gap: var(--space-2);
}

html.tanh .run-cb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-small);
  font-family: var(--fs-heading-font);
  font-size: 0.4em;
  white-space: nowrap;
}

html.tanh .run-cb span { color: var(--fs-text-muted-color); }
html.tanh .run-cb strong { font-weight: 600; }
html.tanh .run-cb.model { background: var(--tint-model); }

html.tanh .run-step.is-on .run-cb { animation: run-appear 0.3s var(--ease) both; }
html.tanh .run-step.is-on .run-cb:nth-child(1) { animation-delay: 0.2s; }
html.tanh .run-step.is-on .run-cb:nth-child(2) { animation-delay: 0.7s; }
html.tanh .run-step.is-on .run-cb:nth-child(3) { animation-delay: 1.2s; }
html.tanh .run-step.is-on .run-cb:nth-child(4) { animation-delay: 1.9s; }

html.tanh .run-callbacks .run-size { left: 50%; bottom: 0; font-size: 0.5em; }
html.tanh .run-step.is-on .run-callbacks .run-size { animation: run-appear 0.3s var(--ease) 2.6s both; }

/* A long program output in one block: small and tight, so all of it fits */
html.tanh .reveal .output-full pre {
  width: 100%;
  margin: 0;
}

html.tanh .reveal .output-full pre code {
  max-height: none;
  overflow: visible;
  padding: var(--space-3) var(--space-4);
  font-size: 19px;
  line-height: 1.3;
}

html.tanh .reveal .output-full.large pre code {
  font-size: 26px;
}

/* Task card 1: three blank parts arrive, what they are stays a question */
html.tanh .run-latency {
  gap: var(--space-3);
}

html.tanh .run-latency .lat-part { min-width: 96px; }
html.tanh .run-latency .lat-part,
html.tanh .run-latency .lat-plus { opacity: 0; white-space: nowrap; }

html.tanh .run-step.is-on .run-latency .lat-part,
html.tanh .run-step.is-on .run-latency .lat-plus { animation: lat-in 0.5s var(--ease) 0.3s both; }
html.tanh .run-step.is-on .run-latency > :nth-child(3),
html.tanh .run-step.is-on .run-latency > :nth-child(4) { animation-delay: 0.7s; }
html.tanh .run-step.is-on .run-latency > :nth-child(5),
html.tanh .run-step.is-on .run-latency > :nth-child(6) { animation-delay: 1.1s; }

@keyframes lat-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Task card 2: the dry wave slides back until it lines up with the wet one */
/* Room on the right for the 18 % shift */
html.tanh .run-delay .mix-wave { width: 82%; }
html.tanh .run-delay .mix-wave.wet { transform: translateX(18%); }
html.tanh .run-step.is-on .run-delay .mix-wave.dry { animation: delay-dry 2s var(--ease) 0.3s both; }
html.tanh .run-step.is-on .run-delay .mix-wave.wet { animation: none; }

@keyframes delay-dry {
  from { transform: none; }
  to { transform: translateX(18%); }
}

/* Task card 3: a fader crossfades the delayed dry into the wet */
html.tanh .mix-wave {
  position: absolute;
  inset: 0 0 24px 0;
  display: flex;
  align-items: center;
}

html.tanh .mix-wave.dry .waveform path { stroke: var(--mark-latent); stroke-width: 3; }
html.tanh .mix-wave.wet { opacity: 0.15; }

html.tanh .mix-fader {
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 6px;
  height: 4px;
  border-radius: 2px;
  background: var(--fs-border-strong);
}

html.tanh .mix-fader i {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

html.tanh .run-step.is-on .mix-wave.dry { animation: mix-dry 4.4s var(--ease) both; }
html.tanh .run-step.is-on .mix-wave.wet { animation: mix-wet 4.4s var(--ease) both; }
html.tanh .run-step.is-on .mix-fader i { animation: mix-knob 4.4s var(--ease) both; }

/* The knob sweeps to wet, back towards dry, and settles on a blend; both
 * waves follow it, so opacity is 1 - 0.85 × position for dry and the mirror for wet */
@keyframes mix-knob {
  0%, 10% { left: 0; }
  35% { left: 85%; }
  55% { left: 30%; }
  75% { left: 60%; }
  90%, 100% { left: 100%; }
}
@keyframes mix-dry {
  0%, 10% { opacity: 1; }
  35% { opacity: 0.28; }
  55% { opacity: 0.75; }
  75% { opacity: 0.49; }
  90%, 100% { opacity: 0.15; }
}
@keyframes mix-wet {
  0%, 10% { opacity: 0.15; }
  35% { opacity: 0.87; }
  55% { opacity: 0.4; }
  75% { opacity: 0.66; }
  90%, 100% { opacity: 1; }
}

/*********************************************
 * Step 6 · the threads on one time axis ({{THREADS}}): every row aligned on
 * the callbacks, a playhead sweeping over them
 *********************************************/

html.tanh .tline + .statement-points {
  margin-top: var(--space-9);
}

html.tanh .tline {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  column-gap: var(--space-5);
  margin-top: var(--space-7);
  --row-gap: 14px;
}

html.tanh .tline-labels,
html.tanh .tline-time {
  display: grid;
  grid-template-rows: 56px 50px 64px 70px 40px;
  row-gap: var(--row-gap);
}

html.tanh .tline-labels span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  white-space: nowrap;
}

html.tanh .tline-labels small {
  font-weight: 400;
  font-size: 0.8em;
  opacity: 0.7;
}

html.tanh .tline-time { position: relative; }

html.tanh .tline-row {
  display: grid;
  grid-template-columns: repeat(var(--callbacks), minmax(0, 1fr));
  column-gap: 6px;
}

html.tanh .tline-callback {
  border-radius: 4px;
  background: var(--mark-exercise);
}

html.tanh .tline-ring {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
}

/* The rings as stacks, one host block per row, the same size in both rings,
   filled from the bottom: the next block out is the lowest */
html.tanh .tline-ring {
  justify-self: center;
  flex-direction: column-reverse;
  width: 44px;
}

html.tanh .tline-ring b {
  flex: none;
  height: 8px;
  border-radius: 2px;
  background: var(--wash);
}

html.tanh .tline-ring b.in { background: var(--mark-exercise); }
html.tanh .tline-ring b.res { background: var(--mark-model); }
html.tanh .tline-ring b.pre { background: var(--wash); box-shadow: inset 0 0 0 1.5px var(--ink); }

html.tanh .tline-hear { border-radius: 4px; }
html.tanh .tline-hear.pre { background: var(--wash); box-shadow: inset 0 0 0 1.5px var(--ink); }
html.tanh .tline-hear.res { background: var(--mark-model); }

/* The worker: spinning the whole time, the model runs on top */
html.tanh .tline-worker {
  position: relative;
  border-radius: 4px;
  background: repeating-linear-gradient(135deg, var(--wash) 0 10px, transparent 10px 20px);
}

html.tanh .tline-worker span {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.42em;
  opacity: 0.75;
  white-space: nowrap;
}

html.tanh .tline-worker b {
  position: absolute;
  top: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  font-weight: 600;
  z-index: 1;
}

/* Ahead of the playhead the time is still to come: dimmed */
html.tanh .tline-mask {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: 0;
  right: 0;
  background: var(--paper);
  opacity: 0.8;
  transform-origin: right;
  z-index: 2;
}

html.tanh .tline-playhead {
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: 0;
  width: 3px;
  background: var(--ink);
  z-index: 3;
}

html.tanh .reveal section.present .tline-mask { animation: tline-mask 12s linear infinite; }
html.tanh .reveal section.present .tline-playhead { animation: tline-playhead 12s linear infinite; }

@keyframes tline-mask {
  0% { transform: scaleX(1); }
  92%, 100% { transform: scaleX(0); }
}
@keyframes tline-playhead {
  0% { left: 0; opacity: 1; }
  92% { left: 100%; opacity: 1; }
  96%, 100% { left: 100%; opacity: 0; }
}

/*********************************************
 * A ring buffer: a row of slots in a frame
 *********************************************/

html.tanh .q {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
}

html.tanh .q-slot {
  position: relative;
  width: 80px;
  height: 44px;
  border-radius: 4px;
  background: var(--wash);
}

/*********************************************
 * Step 6 · the flow, two lanes. Audio thread: a host block of 512 samples
 * each callback into m_input, one out of m_output, the prefill first. Worker:
 * spinning on try_pop, taking every block at once into the model block, the
 * model on a whole one, the result into m_output. The input keeps coming
 * while the model runs: that block waits in m_input. A callback a second: the
 * start with the prefill plays once, 5 s, then 20 s that loop forever.
 *********************************************/

html.tanh .flow {
  position: relative;
  height: 300px;
  margin: 70px 0 var(--space-6);
}

html.tanh .flow .q { position: absolute; gap: 8px; padding: 8px; }
html.tanh .flow .q-slot { width: 80px; height: 50px; }
html.tanh .flow .flow-in { top: 0; left: 220px; }
html.tanh .flow .flow-out { top: 0; left: 1120px; }
html.tanh .flow .flow-block { top: 190px; left: 420px; border-style: dashed; }

/* The callback's own buffer: one host block, no ring */
html.tanh .flow-host {
  position: absolute;
  top: 0;
  width: 96px;
  height: 66px;
  border: 2px solid var(--ink);
  border-radius: 4px;
}
html.tanh .flow-host.in { left: 0px; }
html.tanh .flow-host.out { left: 1620px; }

html.tanh .flow-model {
  position: absolute;
  top: 190px;
  left: 860px;
  width: 150px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  font-size: 0.6em;
}

html.tanh .flow-lane-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 154px;
  border-top: 1px dashed var(--ink);
  opacity: 0.3;
}

html.tanh .flow-name {
  position: absolute;
  font-size: 0.48em;
  opacity: 0.75;
  white-space: nowrap;
}

html.tanh .flow-lane {
  position: absolute;
  left: 0;
  font-size: 0.55em;
  font-weight: 600;
  white-space: nowrap;
}

html.tanh .flow-say {
  position: absolute;
  font-size: 0.5em;
  white-space: nowrap;
  opacity: 0;
}

html.tanh .flow-say.spin { opacity: 1; }

html.tanh .flow-spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.4em;
  vertical-align: -0.1em;
  border: 3px solid var(--ink);
  border-right-color: transparent;
  border-radius: 50%;
}

html.tanh .flow i {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 50px;
  border-radius: 4px;
  opacity: 0;
}
html.tanh .flow i.in { background: var(--mark-exercise); }
html.tanh .flow i.res { background: var(--mark-model); }
html.tanh .flow i.pre { background: var(--wash); border: 2px solid var(--ink); }


/* flow:begin, made by scripts/flow_keyframes.py slides/css/exercise.css: edit the script, not this */

@keyframes flow-in-0-a {
  0.00% { transform: translate(8px, 8px); opacity: 1; }
  6.60% { transform: translate(228px, 8px); opacity: 1; }
  10.00% { transform: translate(228px, 8px); opacity: 1; }
  16.60% { transform: translate(428px, 198px); opacity: 1; }
  78.00% { transform: translate(428px, 198px); opacity: 1; }
  84.00% { transform: translate(895px, 198px); opacity: 1; }
  86.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(855.4px, 189.5px); opacity: 0; }
}

@keyframes flow-in-0-b {
  0.00% { transform: translate(855.4px, 189.5px); opacity: 0; }
  74.90% { transform: translate(8px, 8px); opacity: 0; }
  75.00% { transform: translate(8px, 8px); opacity: 1; }
  76.65% { transform: translate(228px, 8px); opacity: 1; }
  79.25% { transform: translate(228px, 8px); opacity: 1; }
  80.90% { transform: translate(428px, 198px); opacity: 1; }
  94.50% { transform: translate(428px, 198px); opacity: 1; }
  96.00% { transform: translate(895px, 198px); opacity: 1; }
  96.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(855.4px, 189.5px); opacity: 0; }
}

@keyframes flow-in-1-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  19.60% { transform: translate(8px, 8px); opacity: 0; }
  20.00% { transform: translate(8px, 8px); opacity: 1; }
  26.60% { transform: translate(316px, 8px); opacity: 1; }
  30.00% { transform: translate(316px, 8px); opacity: 1; }
  36.60% { transform: translate(516px, 198px); opacity: 1; }
  78.00% { transform: translate(516px, 198px); opacity: 1; }
  84.00% { transform: translate(895px, 198px); opacity: 1; }
  86.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(857.8px, 190px); opacity: 0; }
}

@keyframes flow-in-1-b {
  0.00% { transform: translate(857.8px, 190px); opacity: 0; }
  79.90% { transform: translate(8px, 8px); opacity: 0; }
  80.00% { transform: translate(8px, 8px); opacity: 1; }
  81.65% { transform: translate(316px, 8px); opacity: 1; }
  82.50% { transform: translate(316px, 8px); opacity: 1; }
  84.15% { transform: translate(516px, 198px); opacity: 1; }
  94.50% { transform: translate(516px, 198px); opacity: 1; }
  96.00% { transform: translate(895px, 198px); opacity: 1; }
  96.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(857.8px, 190px); opacity: 0; }
}

@keyframes flow-in-2-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  39.60% { transform: translate(8px, 8px); opacity: 0; }
  40.00% { transform: translate(8px, 8px); opacity: 1; }
  46.60% { transform: translate(404px, 8px); opacity: 1; }
  50.00% { transform: translate(404px, 8px); opacity: 1; }
  56.60% { transform: translate(604px, 198px); opacity: 1; }
  78.00% { transform: translate(604px, 198px); opacity: 1; }
  84.00% { transform: translate(895px, 198px); opacity: 1; }
  86.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(859.9px, 190.5px); opacity: 0; }
}

@keyframes flow-in-2-b {
  0.00% { transform: translate(859.9px, 190.5px); opacity: 0; }
  84.90% { transform: translate(8px, 8px); opacity: 0; }
  85.00% { transform: translate(8px, 8px); opacity: 1; }
  86.65% { transform: translate(404px, 8px); opacity: 1; }
  87.50% { transform: translate(404px, 8px); opacity: 1; }
  89.15% { transform: translate(604px, 198px); opacity: 1; }
  94.50% { transform: translate(604px, 198px); opacity: 1; }
  96.00% { transform: translate(895px, 198px); opacity: 1; }
  96.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(859.9px, 190.5px); opacity: 0; }
}

@keyframes flow-in-3-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  59.60% { transform: translate(8px, 8px); opacity: 0; }
  60.00% { transform: translate(8px, 8px); opacity: 1; }
  66.60% { transform: translate(492px, 8px); opacity: 1; }
  70.00% { transform: translate(492px, 8px); opacity: 1; }
  76.60% { transform: translate(692px, 198px); opacity: 1; }
  78.00% { transform: translate(692px, 198px); opacity: 1; }
  84.00% { transform: translate(895px, 198px); opacity: 1; }
  86.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(861.8px, 190.9px); opacity: 0; }
}

@keyframes flow-in-3-b {
  0.00% { transform: translate(861.8px, 190.9px); opacity: 0; }
  89.90% { transform: translate(8px, 8px); opacity: 0; }
  90.00% { transform: translate(8px, 8px); opacity: 1; }
  91.65% { transform: translate(492px, 8px); opacity: 1; }
  92.50% { transform: translate(492px, 8px); opacity: 1; }
  94.15% { transform: translate(692px, 198px); opacity: 1; }
  94.50% { transform: translate(692px, 198px); opacity: 1; }
  96.00% { transform: translate(895px, 198px); opacity: 1; }
  96.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(861.8px, 190.9px); opacity: 0; }
}

@keyframes flow-in-4-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  79.60% { transform: translate(8px, 8px); opacity: 0; }
  80.00% { transform: translate(8px, 8px); opacity: 1; }
  86.60% { transform: translate(228px, 8px); opacity: 1; }
  97.00% { transform: translate(228px, 8px); opacity: 1; }
  100.00% { transform: translate(318.9px, 94.4px); opacity: 1; }
}

@keyframes flow-in-4-b {
  0.00% { transform: translate(318.9px, 94.4px); opacity: 1; }
  0.90% { transform: translate(428px, 198px); opacity: 1; }
  14.50% { transform: translate(428px, 198px); opacity: 1; }
  16.00% { transform: translate(895px, 198px); opacity: 1; }
  16.50% { transform: translate(895px, 198px); opacity: 0; }
  94.90% { transform: translate(8px, 8px); opacity: 0; }
  95.00% { transform: translate(8px, 8px); opacity: 1; }
  96.65% { transform: translate(228px, 8px); opacity: 1; }
  99.25% { transform: translate(228px, 8px); opacity: 1; }
  100.00% { transform: translate(318.9px, 94.4px); opacity: 1; }
}

@keyframes flow-in-5-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  99.60% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 1; }
}

@keyframes flow-in-5-b {
  0.00% { transform: translate(8px, 8px); opacity: 1; }
  1.65% { transform: translate(316px, 8px); opacity: 1; }
  2.50% { transform: translate(316px, 8px); opacity: 1; }
  4.15% { transform: translate(516px, 198px); opacity: 1; }
  14.50% { transform: translate(516px, 198px); opacity: 1; }
  16.00% { transform: translate(895px, 198px); opacity: 1; }
  16.50% { transform: translate(895px, 198px); opacity: 0; }
  99.90% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 1; }
}

@keyframes flow-in-6-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-6-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  4.90% { transform: translate(8px, 8px); opacity: 0; }
  5.00% { transform: translate(8px, 8px); opacity: 1; }
  6.65% { transform: translate(404px, 8px); opacity: 1; }
  7.50% { transform: translate(404px, 8px); opacity: 1; }
  9.15% { transform: translate(604px, 198px); opacity: 1; }
  14.50% { transform: translate(604px, 198px); opacity: 1; }
  16.00% { transform: translate(895px, 198px); opacity: 1; }
  16.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(57.2px, 18.5px); opacity: 0; }
}

@keyframes flow-in-7-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-7-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  9.90% { transform: translate(8px, 8px); opacity: 0; }
  10.00% { transform: translate(8px, 8px); opacity: 1; }
  11.65% { transform: translate(492px, 8px); opacity: 1; }
  12.50% { transform: translate(492px, 8px); opacity: 1; }
  14.15% { transform: translate(692px, 198px); opacity: 1; }
  14.50% { transform: translate(692px, 198px); opacity: 1; }
  16.00% { transform: translate(895px, 198px); opacity: 1; }
  16.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(102px, 28.1px); opacity: 0; }
}

@keyframes flow-in-8-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-8-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  14.90% { transform: translate(8px, 8px); opacity: 0; }
  15.00% { transform: translate(8px, 8px); opacity: 1; }
  16.65% { transform: translate(228px, 8px); opacity: 1; }
  19.25% { transform: translate(228px, 8px); opacity: 1; }
  20.90% { transform: translate(428px, 198px); opacity: 1; }
  34.50% { transform: translate(428px, 198px); opacity: 1; }
  36.00% { transform: translate(895px, 198px); opacity: 1; }
  36.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(176.6px, 44.1px); opacity: 0; }
}

@keyframes flow-in-9-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-9-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  19.90% { transform: translate(8px, 8px); opacity: 0; }
  20.00% { transform: translate(8px, 8px); opacity: 1; }
  21.65% { transform: translate(316px, 8px); opacity: 1; }
  22.50% { transform: translate(316px, 8px); opacity: 1; }
  24.15% { transform: translate(516px, 198px); opacity: 1; }
  34.50% { transform: translate(516px, 198px); opacity: 1; }
  36.00% { transform: translate(895px, 198px); opacity: 1; }
  36.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(219.6px, 53.3px); opacity: 0; }
}

@keyframes flow-in-10-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-10-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  24.90% { transform: translate(8px, 8px); opacity: 0; }
  25.00% { transform: translate(8px, 8px); opacity: 1; }
  26.65% { transform: translate(404px, 8px); opacity: 1; }
  27.50% { transform: translate(404px, 8px); opacity: 1; }
  29.15% { transform: translate(604px, 198px); opacity: 1; }
  34.50% { transform: translate(604px, 198px); opacity: 1; }
  36.00% { transform: translate(895px, 198px); opacity: 1; }
  36.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(257.8px, 61.5px); opacity: 0; }
}

@keyframes flow-in-11-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-11-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  29.90% { transform: translate(8px, 8px); opacity: 0; }
  30.00% { transform: translate(8px, 8px); opacity: 1; }
  31.65% { transform: translate(492px, 8px); opacity: 1; }
  32.50% { transform: translate(492px, 8px); opacity: 1; }
  34.15% { transform: translate(692px, 198px); opacity: 1; }
  34.50% { transform: translate(692px, 198px); opacity: 1; }
  36.00% { transform: translate(895px, 198px); opacity: 1; }
  36.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(292px, 68.8px); opacity: 0; }
}

@keyframes flow-in-12-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-12-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  34.90% { transform: translate(8px, 8px); opacity: 0; }
  35.00% { transform: translate(8px, 8px); opacity: 1; }
  36.65% { transform: translate(228px, 8px); opacity: 1; }
  39.25% { transform: translate(228px, 8px); opacity: 1; }
  40.90% { transform: translate(428px, 198px); opacity: 1; }
  54.50% { transform: translate(428px, 198px); opacity: 1; }
  56.00% { transform: translate(895px, 198px); opacity: 1; }
  56.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(402.9px, 92.6px); opacity: 0; }
}

@keyframes flow-in-13-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-13-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  39.90% { transform: translate(8px, 8px); opacity: 0; }
  40.00% { transform: translate(8px, 8px); opacity: 1; }
  41.65% { transform: translate(316px, 8px); opacity: 1; }
  42.50% { transform: translate(316px, 8px); opacity: 1; }
  44.15% { transform: translate(516px, 198px); opacity: 1; }
  54.50% { transform: translate(516px, 198px); opacity: 1; }
  56.00% { transform: translate(895px, 198px); opacity: 1; }
  56.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(432.4px, 98.9px); opacity: 0; }
}

@keyframes flow-in-14-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-14-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  44.90% { transform: translate(8px, 8px); opacity: 0; }
  45.00% { transform: translate(8px, 8px); opacity: 1; }
  46.65% { transform: translate(404px, 8px); opacity: 1; }
  47.50% { transform: translate(404px, 8px); opacity: 1; }
  49.15% { transform: translate(604px, 198px); opacity: 1; }
  54.50% { transform: translate(604px, 198px); opacity: 1; }
  56.00% { transform: translate(895px, 198px); opacity: 1; }
  56.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(458.5px, 104.5px); opacity: 0; }
}

@keyframes flow-in-15-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-15-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  49.90% { transform: translate(8px, 8px); opacity: 0; }
  50.00% { transform: translate(8px, 8px); opacity: 1; }
  51.65% { transform: translate(492px, 8px); opacity: 1; }
  52.50% { transform: translate(492px, 8px); opacity: 1; }
  54.15% { transform: translate(692px, 198px); opacity: 1; }
  54.50% { transform: translate(692px, 198px); opacity: 1; }
  56.00% { transform: translate(895px, 198px); opacity: 1; }
  56.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(481.9px, 109.5px); opacity: 0; }
}

@keyframes flow-in-16-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-16-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  54.90% { transform: translate(8px, 8px); opacity: 0; }
  55.00% { transform: translate(8px, 8px); opacity: 1; }
  56.65% { transform: translate(228px, 8px); opacity: 1; }
  59.25% { transform: translate(228px, 8px); opacity: 1; }
  60.90% { transform: translate(428px, 198px); opacity: 1; }
  74.50% { transform: translate(428px, 198px); opacity: 1; }
  76.00% { transform: translate(895px, 198px); opacity: 1; }
  76.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(629.1px, 141px); opacity: 0; }
}

@keyframes flow-in-17-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-17-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  59.90% { transform: translate(8px, 8px); opacity: 0; }
  60.00% { transform: translate(8px, 8px); opacity: 1; }
  61.65% { transform: translate(316px, 8px); opacity: 1; }
  62.50% { transform: translate(316px, 8px); opacity: 1; }
  64.15% { transform: translate(516px, 198px); opacity: 1; }
  74.50% { transform: translate(516px, 198px); opacity: 1; }
  76.00% { transform: translate(895px, 198px); opacity: 1; }
  76.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(645.1px, 144.5px); opacity: 0; }
}

@keyframes flow-in-18-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-18-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  64.90% { transform: translate(8px, 8px); opacity: 0; }
  65.00% { transform: translate(8px, 8px); opacity: 1; }
  66.65% { transform: translate(404px, 8px); opacity: 1; }
  67.50% { transform: translate(404px, 8px); opacity: 1; }
  69.15% { transform: translate(604px, 198px); opacity: 1; }
  74.50% { transform: translate(604px, 198px); opacity: 1; }
  76.00% { transform: translate(895px, 198px); opacity: 1; }
  76.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(659.2px, 147.5px); opacity: 0; }
}

@keyframes flow-in-19-a {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  100.00% { transform: translate(8px, 8px); opacity: 0; }
}

@keyframes flow-in-19-b {
  0.00% { transform: translate(8px, 8px); opacity: 0; }
  69.90% { transform: translate(8px, 8px); opacity: 0; }
  70.00% { transform: translate(8px, 8px); opacity: 1; }
  71.65% { transform: translate(492px, 8px); opacity: 1; }
  72.50% { transform: translate(492px, 8px); opacity: 1; }
  74.15% { transform: translate(692px, 198px); opacity: 1; }
  74.50% { transform: translate(692px, 198px); opacity: 1; }
  76.00% { transform: translate(895px, 198px); opacity: 1; }
  76.50% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(671.8px, 150.2px); opacity: 0; }
}

@keyframes flow-pre-0-a {
  0.00% { transform: translate(1128px, 8px); opacity: 1; }
  6.60% { transform: translate(1628px, 8px); opacity: 1; }
  13.40% { transform: translate(1628px, 8px); opacity: 1; }
  16.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1628px, 8px); opacity: 0; }
}

@keyframes flow-pre-1-a {
  0.00% { transform: translate(1216px, 8px); opacity: 1; }
  20.00% { transform: translate(1216px, 8px); opacity: 1; }
  26.60% { transform: translate(1628px, 8px); opacity: 1; }
  33.40% { transform: translate(1628px, 8px); opacity: 1; }
  36.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1628px, 8px); opacity: 0; }
}

@keyframes flow-pre-2-a {
  0.00% { transform: translate(1304px, 8px); opacity: 1; }
  40.00% { transform: translate(1304px, 8px); opacity: 1; }
  46.60% { transform: translate(1628px, 8px); opacity: 1; }
  53.40% { transform: translate(1628px, 8px); opacity: 1; }
  56.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1628px, 8px); opacity: 0; }
}

@keyframes flow-pre-3-a {
  0.00% { transform: translate(1392px, 8px); opacity: 1; }
  60.00% { transform: translate(1392px, 8px); opacity: 1; }
  66.60% { transform: translate(1628px, 8px); opacity: 1; }
  73.40% { transform: translate(1628px, 8px); opacity: 1; }
  76.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1628px, 8px); opacity: 0; }
}

@keyframes flow-pre-4-a {
  0.00% { transform: translate(1480px, 8px); opacity: 1; }
  80.00% { transform: translate(1480px, 8px); opacity: 1; }
  86.60% { transform: translate(1628px, 8px); opacity: 1; }
  93.40% { transform: translate(1628px, 8px); opacity: 1; }
  96.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1628px, 8px); opacity: 0; }
}

@keyframes flow-res-0-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  91.60% { transform: translate(895px, 198px); opacity: 0; }
  92.00% { transform: translate(895px, 198px); opacity: 1; }
  97.00% { transform: translate(1128px, 8px); opacity: 1; }
  100.00% { transform: translate(1128px, 8px); opacity: 1; }
}

@keyframes flow-res-0-b {
  0.00% { transform: translate(1128px, 8px); opacity: 1; }
  1.65% { transform: translate(1628px, 8px); opacity: 1; }
  3.35% { transform: translate(1628px, 8px); opacity: 1; }
  4.00% { transform: translate(1628px, 8px); opacity: 0; }
  97.90% { transform: translate(895px, 198px); opacity: 0; }
  98.00% { transform: translate(895px, 198px); opacity: 1; }
  99.25% { transform: translate(1128px, 8px); opacity: 1; }
  100.00% { transform: translate(1128px, 8px); opacity: 1; }
}

@keyframes flow-res-1-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  91.60% { transform: translate(895px, 198px); opacity: 0; }
  92.00% { transform: translate(895px, 198px); opacity: 1; }
  97.00% { transform: translate(1216px, 8px); opacity: 1; }
  100.00% { transform: translate(1216px, 8px); opacity: 1; }
}

@keyframes flow-res-1-b {
  0.00% { transform: translate(1216px, 8px); opacity: 1; }
  5.00% { transform: translate(1216px, 8px); opacity: 1; }
  6.65% { transform: translate(1628px, 8px); opacity: 1; }
  8.35% { transform: translate(1628px, 8px); opacity: 1; }
  9.00% { transform: translate(1628px, 8px); opacity: 0; }
  97.90% { transform: translate(895px, 198px); opacity: 0; }
  98.00% { transform: translate(895px, 198px); opacity: 1; }
  99.25% { transform: translate(1216px, 8px); opacity: 1; }
  100.00% { transform: translate(1216px, 8px); opacity: 1; }
}

@keyframes flow-res-2-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  91.60% { transform: translate(895px, 198px); opacity: 0; }
  92.00% { transform: translate(895px, 198px); opacity: 1; }
  97.00% { transform: translate(1304px, 8px); opacity: 1; }
  100.00% { transform: translate(1304px, 8px); opacity: 1; }
}

@keyframes flow-res-2-b {
  0.00% { transform: translate(1304px, 8px); opacity: 1; }
  10.00% { transform: translate(1304px, 8px); opacity: 1; }
  11.65% { transform: translate(1628px, 8px); opacity: 1; }
  13.35% { transform: translate(1628px, 8px); opacity: 1; }
  14.00% { transform: translate(1628px, 8px); opacity: 0; }
  97.90% { transform: translate(895px, 198px); opacity: 0; }
  98.00% { transform: translate(895px, 198px); opacity: 1; }
  99.25% { transform: translate(1304px, 8px); opacity: 1; }
  100.00% { transform: translate(1304px, 8px); opacity: 1; }
}

@keyframes flow-res-3-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  91.60% { transform: translate(895px, 198px); opacity: 0; }
  92.00% { transform: translate(895px, 198px); opacity: 1; }
  97.00% { transform: translate(1392px, 8px); opacity: 1; }
  100.00% { transform: translate(1392px, 8px); opacity: 1; }
}

@keyframes flow-res-3-b {
  0.00% { transform: translate(1392px, 8px); opacity: 1; }
  15.00% { transform: translate(1392px, 8px); opacity: 1; }
  16.65% { transform: translate(1628px, 8px); opacity: 1; }
  18.35% { transform: translate(1628px, 8px); opacity: 1; }
  19.00% { transform: translate(1628px, 8px); opacity: 0; }
  97.90% { transform: translate(895px, 198px); opacity: 0; }
  98.00% { transform: translate(895px, 198px); opacity: 1; }
  99.25% { transform: translate(1392px, 8px); opacity: 1; }
  100.00% { transform: translate(1392px, 8px); opacity: 1; }
}

@keyframes flow-res-4-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-4-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  17.90% { transform: translate(895px, 198px); opacity: 0; }
  18.00% { transform: translate(895px, 198px); opacity: 1; }
  19.25% { transform: translate(1480px, 8px); opacity: 1; }
  20.00% { transform: translate(1480px, 8px); opacity: 1; }
  21.65% { transform: translate(1628px, 8px); opacity: 1; }
  23.35% { transform: translate(1628px, 8px); opacity: 1; }
  24.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1034.7px, 161.8px); opacity: 0; }
}

@keyframes flow-res-5-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-5-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  17.90% { transform: translate(895px, 198px); opacity: 0; }
  18.00% { transform: translate(895px, 198px); opacity: 1; }
  19.25% { transform: translate(1128px, 8px); opacity: 1; }
  25.00% { transform: translate(1128px, 8px); opacity: 1; }
  26.65% { transform: translate(1628px, 8px); opacity: 1; }
  28.35% { transform: translate(1628px, 8px); opacity: 1; }
  29.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1042.6px, 159.7px); opacity: 0; }
}

@keyframes flow-res-6-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-6-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  17.90% { transform: translate(895px, 198px); opacity: 0; }
  18.00% { transform: translate(895px, 198px); opacity: 1; }
  19.25% { transform: translate(1216px, 8px); opacity: 1; }
  30.00% { transform: translate(1216px, 8px); opacity: 1; }
  31.65% { transform: translate(1628px, 8px); opacity: 1; }
  33.35% { transform: translate(1628px, 8px); opacity: 1; }
  34.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1051.4px, 157.5px); opacity: 0; }
}

@keyframes flow-res-7-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-7-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  17.90% { transform: translate(895px, 198px); opacity: 0; }
  18.00% { transform: translate(895px, 198px); opacity: 1; }
  19.25% { transform: translate(1304px, 8px); opacity: 1; }
  35.00% { transform: translate(1304px, 8px); opacity: 1; }
  36.65% { transform: translate(1628px, 8px); opacity: 1; }
  38.35% { transform: translate(1628px, 8px); opacity: 1; }
  39.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1061.3px, 154.9px); opacity: 0; }
}

@keyframes flow-res-8-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-8-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  37.90% { transform: translate(895px, 198px); opacity: 0; }
  38.00% { transform: translate(895px, 198px); opacity: 1; }
  39.25% { transform: translate(1392px, 8px); opacity: 1; }
  40.00% { transform: translate(1392px, 8px); opacity: 1; }
  41.65% { transform: translate(1628px, 8px); opacity: 1; }
  43.35% { transform: translate(1628px, 8px); opacity: 1; }
  44.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1190.9px, 121.3px); opacity: 0; }
}

@keyframes flow-res-9-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-9-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  37.90% { transform: translate(895px, 198px); opacity: 0; }
  38.00% { transform: translate(895px, 198px); opacity: 1; }
  39.25% { transform: translate(1480px, 8px); opacity: 1; }
  45.00% { transform: translate(1480px, 8px); opacity: 1; }
  46.65% { transform: translate(1628px, 8px); opacity: 1; }
  48.35% { transform: translate(1628px, 8px); opacity: 1; }
  49.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1207.5px, 117px); opacity: 0; }
}

@keyframes flow-res-10-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-10-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  37.90% { transform: translate(895px, 198px); opacity: 0; }
  38.00% { transform: translate(895px, 198px); opacity: 1; }
  39.25% { transform: translate(1128px, 8px); opacity: 1; }
  50.00% { transform: translate(1128px, 8px); opacity: 1; }
  51.65% { transform: translate(1628px, 8px); opacity: 1; }
  53.35% { transform: translate(1628px, 8px); opacity: 1; }
  54.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1226.1px, 112.2px); opacity: 0; }
}

@keyframes flow-res-11-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-11-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  37.90% { transform: translate(895px, 198px); opacity: 0; }
  38.00% { transform: translate(895px, 198px); opacity: 1; }
  39.25% { transform: translate(1216px, 8px); opacity: 1; }
  55.00% { transform: translate(1216px, 8px); opacity: 1; }
  56.65% { transform: translate(1628px, 8px); opacity: 1; }
  58.35% { transform: translate(1628px, 8px); opacity: 1; }
  59.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1247.1px, 106.7px); opacity: 0; }
}

@keyframes flow-res-12-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-12-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  57.90% { transform: translate(895px, 198px); opacity: 0; }
  58.00% { transform: translate(895px, 198px); opacity: 1; }
  59.25% { transform: translate(1304px, 8px); opacity: 1; }
  60.00% { transform: translate(1304px, 8px); opacity: 1; }
  61.65% { transform: translate(1628px, 8px); opacity: 1; }
  63.35% { transform: translate(1628px, 8px); opacity: 1; }
  64.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1347px, 80.8px); opacity: 0; }
}

@keyframes flow-res-13-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-13-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  57.90% { transform: translate(895px, 198px); opacity: 0; }
  58.00% { transform: translate(895px, 198px); opacity: 1; }
  59.25% { transform: translate(1392px, 8px); opacity: 1; }
  65.00% { transform: translate(1392px, 8px); opacity: 1; }
  66.65% { transform: translate(1628px, 8px); opacity: 1; }
  68.35% { transform: translate(1628px, 8px); opacity: 1; }
  69.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1372.4px, 74.3px); opacity: 0; }
}

@keyframes flow-res-14-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-14-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  57.90% { transform: translate(895px, 198px); opacity: 0; }
  58.00% { transform: translate(895px, 198px); opacity: 1; }
  59.25% { transform: translate(1480px, 8px); opacity: 1; }
  70.00% { transform: translate(1480px, 8px); opacity: 1; }
  71.65% { transform: translate(1628px, 8px); opacity: 1; }
  73.35% { transform: translate(1628px, 8px); opacity: 1; }
  74.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1400.8px, 66.9px); opacity: 0; }
}

@keyframes flow-res-15-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-15-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  57.90% { transform: translate(895px, 198px); opacity: 0; }
  58.00% { transform: translate(895px, 198px); opacity: 1; }
  59.25% { transform: translate(1128px, 8px); opacity: 1; }
  75.00% { transform: translate(1128px, 8px); opacity: 1; }
  76.65% { transform: translate(1628px, 8px); opacity: 1; }
  78.35% { transform: translate(1628px, 8px); opacity: 1; }
  79.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1432.9px, 58.6px); opacity: 0; }
}

@keyframes flow-res-16-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-16-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  77.90% { transform: translate(895px, 198px); opacity: 0; }
  78.00% { transform: translate(895px, 198px); opacity: 1; }
  79.25% { transform: translate(1216px, 8px); opacity: 1; }
  80.00% { transform: translate(1216px, 8px); opacity: 1; }
  81.65% { transform: translate(1628px, 8px); opacity: 1; }
  83.35% { transform: translate(1628px, 8px); opacity: 1; }
  84.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1503.1px, 40.4px); opacity: 0; }
}

@keyframes flow-res-17-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-17-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  77.90% { transform: translate(895px, 198px); opacity: 0; }
  78.00% { transform: translate(895px, 198px); opacity: 1; }
  79.25% { transform: translate(1304px, 8px); opacity: 1; }
  85.00% { transform: translate(1304px, 8px); opacity: 1; }
  86.65% { transform: translate(1628px, 8px); opacity: 1; }
  88.35% { transform: translate(1628px, 8px); opacity: 1; }
  89.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1537.3px, 31.5px); opacity: 0; }
}

@keyframes flow-res-18-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-18-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  77.90% { transform: translate(895px, 198px); opacity: 0; }
  78.00% { transform: translate(895px, 198px); opacity: 1; }
  79.25% { transform: translate(1392px, 8px); opacity: 1; }
  90.00% { transform: translate(1392px, 8px); opacity: 1; }
  91.65% { transform: translate(1628px, 8px); opacity: 1; }
  93.35% { transform: translate(1628px, 8px); opacity: 1; }
  94.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1575.6px, 21.6px); opacity: 0; }
}

@keyframes flow-res-19-a {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  100.00% { transform: translate(895px, 198px); opacity: 0; }
}

@keyframes flow-res-19-b {
  0.00% { transform: translate(895px, 198px); opacity: 0; }
  77.90% { transform: translate(895px, 198px); opacity: 0; }
  78.00% { transform: translate(895px, 198px); opacity: 1; }
  79.25% { transform: translate(1480px, 8px); opacity: 1; }
  95.00% { transform: translate(1480px, 8px); opacity: 1; }
  96.65% { transform: translate(1628px, 8px); opacity: 1; }
  98.35% { transform: translate(1628px, 8px); opacity: 1; }
  99.00% { transform: translate(1628px, 8px); opacity: 0; }
  100.00% { transform: translate(1618.7px, 10.4px); opacity: 0; }
}

@keyframes flow-model-a {
  0.00% { background: transparent; }
  77.60% { background: transparent; }
  78.00% { background: var(--mark-model); }
  92.00% { background: var(--mark-model); }
  92.40% { background: transparent; }
  100.00% { background: transparent; }
}

@keyframes flow-model-b {
  0.00% { background: transparent; }
  14.40% { background: transparent; }
  14.50% { background: var(--mark-model); }
  18.00% { background: var(--mark-model); }
  18.10% { background: transparent; }
  34.40% { background: transparent; }
  34.50% { background: var(--mark-model); }
  38.00% { background: var(--mark-model); }
  38.10% { background: transparent; }
  54.40% { background: transparent; }
  54.50% { background: var(--mark-model); }
  58.00% { background: var(--mark-model); }
  58.10% { background: transparent; }
  74.40% { background: transparent; }
  74.50% { background: var(--mark-model); }
  78.00% { background: var(--mark-model); }
  78.10% { background: transparent; }
  94.40% { background: transparent; }
  94.50% { background: var(--mark-model); }
  98.00% { background: var(--mark-model); }
  98.10% { background: transparent; }
  100.00% { background: transparent; }
}

@keyframes flow-push-say-a {
  0.00% { opacity: 0; }
  91.60% { opacity: 0; }
  92.00% { opacity: 1; }
  100.00% { opacity: 1; }
}

@keyframes flow-push-say-b {
  0.00% { opacity: 1; }
  2.00% { opacity: 1; }
  2.10% { opacity: 0; }
  17.90% { opacity: 0; }
  18.00% { opacity: 1; }
  22.00% { opacity: 1; }
  22.10% { opacity: 0; }
  37.90% { opacity: 0; }
  38.00% { opacity: 1; }
  42.00% { opacity: 1; }
  42.10% { opacity: 0; }
  57.90% { opacity: 0; }
  58.00% { opacity: 1; }
  62.00% { opacity: 1; }
  62.10% { opacity: 0; }
  77.90% { opacity: 0; }
  78.00% { opacity: 1; }
  82.00% { opacity: 1; }
  82.10% { opacity: 0; }
  97.90% { opacity: 0; }
  98.00% { opacity: 1; }
  100.00% { opacity: 1; }
}

@keyframes flow-tick {
  0% { box-shadow: 0 0 0 6px var(--mark-check); }
  30%, 100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes flow-blink {
  0% { opacity: 1; }
  100% { opacity: 0.25; }
}

@keyframes flow-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

html.tanh .reveal section.present .flow i:nth-of-type(1) { animation: flow-in-0-a 5s linear 1, flow-in-0-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(2) { animation: flow-in-1-a 5s linear 1, flow-in-1-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(3) { animation: flow-in-2-a 5s linear 1, flow-in-2-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(4) { animation: flow-in-3-a 5s linear 1, flow-in-3-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(5) { animation: flow-in-4-a 5s linear 1, flow-in-4-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(6) { animation: flow-in-5-a 5s linear 1, flow-in-5-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(7) { animation: flow-in-6-a 5s linear 1, flow-in-6-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(8) { animation: flow-in-7-a 5s linear 1, flow-in-7-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(9) { animation: flow-in-8-a 5s linear 1, flow-in-8-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(10) { animation: flow-in-9-a 5s linear 1, flow-in-9-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(11) { animation: flow-in-10-a 5s linear 1, flow-in-10-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(12) { animation: flow-in-11-a 5s linear 1, flow-in-11-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(13) { animation: flow-in-12-a 5s linear 1, flow-in-12-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(14) { animation: flow-in-13-a 5s linear 1, flow-in-13-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(15) { animation: flow-in-14-a 5s linear 1, flow-in-14-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(16) { animation: flow-in-15-a 5s linear 1, flow-in-15-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(17) { animation: flow-in-16-a 5s linear 1, flow-in-16-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(18) { animation: flow-in-17-a 5s linear 1, flow-in-17-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(19) { animation: flow-in-18-a 5s linear 1, flow-in-18-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(20) { animation: flow-in-19-a 5s linear 1, flow-in-19-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(21) { animation: flow-pre-0-a 5s linear 1 forwards; }
html.tanh .reveal section.present .flow i:nth-of-type(22) { animation: flow-pre-1-a 5s linear 1 forwards; }
html.tanh .reveal section.present .flow i:nth-of-type(23) { animation: flow-pre-2-a 5s linear 1 forwards; }
html.tanh .reveal section.present .flow i:nth-of-type(24) { animation: flow-pre-3-a 5s linear 1 forwards; }
html.tanh .reveal section.present .flow i:nth-of-type(25) { animation: flow-pre-4-a 5s linear 1 forwards; }
html.tanh .reveal section.present .flow i:nth-of-type(26) { animation: flow-res-0-a 5s linear 1, flow-res-0-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(27) { animation: flow-res-1-a 5s linear 1, flow-res-1-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(28) { animation: flow-res-2-a 5s linear 1, flow-res-2-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(29) { animation: flow-res-3-a 5s linear 1, flow-res-3-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(30) { animation: flow-res-4-a 5s linear 1, flow-res-4-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(31) { animation: flow-res-5-a 5s linear 1, flow-res-5-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(32) { animation: flow-res-6-a 5s linear 1, flow-res-6-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(33) { animation: flow-res-7-a 5s linear 1, flow-res-7-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(34) { animation: flow-res-8-a 5s linear 1, flow-res-8-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(35) { animation: flow-res-9-a 5s linear 1, flow-res-9-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(36) { animation: flow-res-10-a 5s linear 1, flow-res-10-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(37) { animation: flow-res-11-a 5s linear 1, flow-res-11-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(38) { animation: flow-res-12-a 5s linear 1, flow-res-12-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(39) { animation: flow-res-13-a 5s linear 1, flow-res-13-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(40) { animation: flow-res-14-a 5s linear 1, flow-res-14-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(41) { animation: flow-res-15-a 5s linear 1, flow-res-15-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(42) { animation: flow-res-16-a 5s linear 1, flow-res-16-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(43) { animation: flow-res-17-a 5s linear 1, flow-res-17-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(44) { animation: flow-res-18-a 5s linear 1, flow-res-18-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow i:nth-of-type(45) { animation: flow-res-19-a 5s linear 1, flow-res-19-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow-host { animation: flow-tick 1s linear infinite; }
html.tanh .reveal section.present .flow-model { animation: flow-model-a 5s linear 1, flow-model-b 20s linear 5s infinite; }
html.tanh .reveal section.present .flow-say.spin .blink { display: inline-block; animation: flow-blink 0.35s steps(2) infinite; }
html.tanh .reveal section.present .flow-spinner { animation: flow-rotate 0.6s linear infinite; }
html.tanh .reveal section.present .flow-say.push { animation: flow-push-say-a 5s linear 1, flow-push-say-b 20s linear 5s infinite; }
/* flow:end */

/*********************************************
 * Step 6 Task cards
 *********************************************/

html.tanh .q.small { gap: 4px; padding: 4px; }
html.tanh .q.small .q-slot { width: 44px; height: 38px; }

html.tanh .q-slot b {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--mark-exercise);
  opacity: 0;
}

/* TODO 1: both queues and the worker come up */
html.tanh .run-setup {
  flex-direction: column;
  gap: var(--space-3);
}

html.tanh .q.appear { opacity: 0; }
html.tanh .run-step.is-on .q.appear { animation: lat-in 0.5s var(--ease) 0.2s both; }
html.tanh .run-step.is-on .q.appear + .q.appear { animation-delay: 0.6s; }

html.tanh .setup-thread {
  width: 70%;
  padding-top: var(--space-1);
  border-top: 3px solid var(--ink);
  font-family: var(--fs-code-font);
  font-size: 0.4em;
  text-align: center;
  transform: scaleX(0);
}

html.tanh .run-step.is-on .setup-thread { animation: mini-grow-center 0.8s var(--ease) 1.2s both; }

@keyframes mini-grow-center {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* TODO 2: blocks go into the queue, nothing is allocated */
html.tanh .run-audio { flex-direction: column; gap: var(--space-3); }
html.tanh .run-step.is-on .run-audio .q-slot b { animation: run-appear 0.25s var(--ease) both; }
html.tanh .run-step.is-on .run-audio .q-slot:nth-child(1) b { animation-delay: 0.4s; }
html.tanh .run-step.is-on .run-audio .q-slot:nth-child(2) b { animation-delay: 1.1s; }
html.tanh .run-step.is-on .run-audio .q-slot:nth-child(3) b { animation-delay: 1.8s; }

/* TODO 3: take a block, run the model, hand it back */
html.tanh .run-worker { gap: var(--space-3); }
html.tanh .run-worker .q.one:not(.out) .q-slot b { opacity: 1; }
html.tanh .run-step.is-on .run-worker .q.one:not(.out) .q-slot b { animation: run-gone 0.3s var(--ease) 0.3s both; }
html.tanh .run-step.is-on .run-worker .mini-model { animation: pump-run 2s var(--ease) 0.2s both; }
html.tanh .run-step.is-on .run-worker .q.out .q-slot b { animation: run-appear 0.3s var(--ease) 1.8s both; }

@keyframes run-gone {
  to { opacity: 0; }
}

/*********************************************
 * Step 3 · the deadline: one bar per callback against the budget line; 31 do
 * almost nothing, the 32nd runs the model and overshoots
 *********************************************/

html.tanh .deadline {
  position: relative;
  height: 285px;
  margin-top: var(--space-10);
}

html.tanh .deadline-bars {
  position: absolute;
  inset: 0 0 40px 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-bottom: 2px solid var(--ink);
}

html.tanh .deadline-bars i {
  position: relative;
  flex: 1;
  height: 5%;
  border-radius: 3px 3px 0 0;
  background: var(--mark-exercise);
  transform: scaleY(0);
  transform-origin: bottom;
}

/* Threshold at 25.4 % of the height, so the slow call, factor 3.7, reaches the top */
html.tanh .deadline-bars i.runs {
  height: 94%;
  background: var(--ink);
}

html.tanh .deadline-bars i.runs span {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--fs-heading-font);
  font-size: 0.6em;
  font-weight: 600;
  white-space: nowrap;
}

html.tanh .reveal section.present .deadline.visible .deadline-bars i {
  animation: deadline-bar 12s var(--ease) infinite;
  animation-delay: calc(var(--i) * 0.3s);
}

@keyframes deadline-bar {
  0% { transform: scaleY(0); }
  6%, 80% { transform: scaleY(1); }
  90%, 100% { transform: scaleY(0); }
}

html.tanh .deadline-budget {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(40px + (100% - 40px) * 0.254);
  border-top: 2px dashed var(--ink);
}

html.tanh .deadline-budget span {
  position: absolute;
  top: -34px;
  left: 0;
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
}

html.tanh .deadline-axis {
  position: absolute;
  bottom: 0;
  left: 0;
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
}

/* Average against the one callback */
html.tanh .meters {
  display: grid;
  gap: var(--space-7);
  margin-top: var(--space-7);
}

/* Room on the right for the overshoot */
html.tanh .meter {
  width: 65%;
}

html.tanh .meter-bar {
  position: relative;
  height: 72px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
}

html.tanh .meter-bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--load);
  background: var(--mark-exercise);
  transform: scaleX(0);
  transform-origin: left;
}

html.tanh .meter.over .meter-bar i { background: var(--ink); }

/* The overshoot past the end of the bar */
html.tanh .meter.over .meter-bar::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 100%;
  width: 0;
  background: repeating-linear-gradient(90deg, var(--ink) 0 10px, transparent 10px 18px);
}

html.tanh .reveal section.present .meter-bar i { animation: meter-fill 1s var(--ease) 0.3s both; }
html.tanh .reveal section.present .meter.over .meter-bar i { animation-delay: 1s; }
html.tanh .reveal section.present .meter.over .meter-bar::after { animation: meter-over 1s var(--ease) 2s both; }

@keyframes meter-fill { to { transform: scaleX(1); } }
@keyframes meter-over { to { width: 34%; } }

html.tanh .meter-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--space-3);
  font-size: 0.55em;
  color: var(--fs-text-muted-color);
}

html.tanh .meter-label strong {
  font-family: var(--fs-heading-font);
  font-size: 2em;
  color: var(--ink);
}

/*********************************************
 * Step 3 · the deadline, worked out: block size ÷ sample rate
 *********************************************/

html.tanh .budget-tables {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  column-gap: var(--space-10);
}

html.tanh .budget-question {
  margin-bottom: var(--space-3);
  font-size: 0.6em;
  color: var(--fs-text-muted-color);
}

html.tanh .budget-question strong {
  display: block;
  font-family: var(--fs-heading-font);
  font-size: 1.4em;
  font-weight: 600;
  color: var(--ink);
}

html.tanh .reveal table.budget-table {
  margin: 0;
  border-collapse: collapse;
  font-family: var(--fs-heading-font);
  font-size: 0.8em;
  font-weight: 600;
}

html.tanh .reveal table.budget-table th,
html.tanh .reveal table.budget-table td {
  padding: var(--space-2) var(--space-4);
  border: 0;
  border-bottom: 1px solid var(--wash);
  text-align: left;
  white-space: nowrap;
}

html.tanh .reveal table.budget-table th {
  border-bottom: 2px solid var(--ink);
  background: none;
  font-size: 0.7em;
  font-weight: 400;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal table.budget-table small {
  font-size: 0.7em;
  font-weight: 400;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal table.budget-table td.result {
  background: var(--tint-exercise);
}

html.tanh .reveal table.budget-table td.result.over {
  background: var(--mark-over);
  color: var(--paper);
}

html.tanh .reveal table.budget-table.factor th:nth-child(3),
html.tanh .reveal table.budget-table.factor td.result {
  text-align: center;
}

html.tanh .reveal table.budget-table td.meaning {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--fs-text-muted-color);
}

@keyframes budget-in { from { opacity: 0; transform: translateY(8px); } }

/* The label sits on the last bar, so it hangs to the left instead of centring */
html.tanh .deadline-bars i.runs span {
  top: auto;                              /* anchor from the bottom, so a second line grows upward */
  bottom: calc(100% + var(--space-2));
  left: auto;
  right: 0;
  transform: none;
  text-align: right;
  line-height: 1.15;
  font-style: normal;
}

/* Two labels: the three that wait, the one that runs */
html.tanh .deadline-axis {
  right: 0;
  display: flex;
  justify-content: space-between;
}

html.tanh .deadline-axis span:last-child { color: var(--ink); }

/* Step 3 · meters: the division behind each number, and how far past the deadline */
html.tanh .meter-calc {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--fs-code-font);
  font-size: 0.85em;
  color: var(--ink);
}

html.tanh .meter-late {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 100%;
  width: 34%;
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
}

html.tanh .reveal section.present .meter-calc { animation: budget-in 0.5s var(--ease) 0.6s both; }
html.tanh .reveal section.present .meter.over .meter-calc { animation-delay: 1.3s; }
html.tanh .reveal section.present .meter-late { animation: meter-late 0.5s var(--ease) 2.6s both; }

@keyframes meter-late { to { opacity: 1; } }

/*********************************************
 * Step 3 · the warm-up: one bar per call against the two thresholds
 *********************************************/

html.tanh .warmup {
  position: relative;
  height: 500px;
  --axis: 50px;
  --margin: 230px;
}

html.tanh .warmup-bars {
  position: absolute;
  inset: 0 var(--margin) var(--axis) 0;
  display: flex;
  align-items: flex-end;
  gap: var(--space-5);
  border-bottom: 2px solid var(--ink);
}

html.tanh .warmup-bars i {
  position: relative;
  flex: 1;
  height: var(--h);
  border-radius: 3px 3px 0 0;
  background: var(--mark-exercise);
  font-style: normal;
}

html.tanh .warmup-bars i.warm {
  background: var(--ink);
}

html.tanh .warmup-bars span,
html.tanh .warmup-bars em {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  font-style: normal;
  white-space: nowrap;
}

html.tanh .warmup-bars span {
  bottom: calc(100% + var(--space-1));
  font-weight: 600;
}

html.tanh .warmup-bars em {
  top: calc(100% + var(--space-2));
  color: var(--fs-text-muted-color);
}

html.tanh .reveal section.present .warmup-bars i {
  animation: warmup-bar 0.5s var(--ease) both;
  animation-delay: calc(var(--i) * 0.08s);
}

@keyframes warmup-bar { from { opacity: 0; transform: translateY(8px); } }

/* Behind the bars; the label sits in the margin to the right of them */
html.tanh .warmup-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--axis) + (100% - var(--axis)) * var(--at));
  border-top: 2px dashed var(--ink);
}

html.tanh .warmup-line span {
  position: absolute;
  right: 0;
  bottom: var(--space-1);
  width: calc(var(--margin) - var(--space-4));
  font-size: 0.45em;
  line-height: 1.2;
  color: var(--fs-text-muted-color);
}

html.tanh .warmup-note {
  position: absolute;
  left: 0;
  right: 0;
  /* In the free band between the bars' labels and the model block's line */
  bottom: calc(var(--axis) + (100% - var(--axis)) * 0.33);
  text-align: center;
  font-family: var(--fs-heading-font);
  font-size: 0.6em;
  font-weight: 600;
}

html.tanh .warmup-axis {
  position: absolute;
  bottom: 0;
  right: var(--margin);
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
  transform: translateX(calc(100% + var(--space-3)));
}

/*********************************************
 * Done: a check mark draws itself, then confetti from congrats.js
 *********************************************/

html.tanh .congrats {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: var(--space-6);
}

html.tanh .congrats svg {
  width: 220px;
  height: 220px;
  overflow: visible;
}

html.tanh .congrats circle,
html.tanh .congrats path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html.tanh .congrats circle { stroke-dasharray: 327; stroke-dashoffset: 327; }
html.tanh .congrats path { stroke-width: 7; stroke-dasharray: 80; stroke-dashoffset: 80; }

html.tanh .reveal section.present .congrats circle { animation: congrats-draw 0.6s var(--ease) 0.1s forwards; }
html.tanh .reveal section.present .congrats path { animation: congrats-draw 0.35s var(--ease) 0.55s forwards; }
html.tanh .reveal section.present .congrats svg { animation: congrats-pop 0.4s var(--ease) 0.85s; }

@keyframes congrats-draw { to { stroke-dashoffset: 0; } }
@keyframes congrats-pop { 50% { transform: scale(1.08); } }

html.tanh .congrats .confetti {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 9px;
  border-radius: 2px;
  pointer-events: none;
}

/*********************************************
 * Reduced motion: every animation jumps to its end state
 *********************************************/

@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .run *,
  html.tanh .reveal section.present .run-solved *,
  html.tanh .reveal section.present .stream *,
  html.tanh .reveal section.present .align *,
  html.tanh .reveal section.present .deadline *,
  html.tanh .reveal section.present .warmup *,
  html.tanh .reveal section.present .meters *,
  html.tanh .reveal section.present .flow *,
  html.tanh .reveal section.present .tline *,
  html.tanh .reveal section.present .congrats * {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
}

/*********************************************
 * Step 4 · the engine trade-off: weight falls, your work rises, from high
 * level to low level; bars grow in turn when the slide is shown
 *********************************************/

html.tanh .tradeoff {
  position: relative;
  display: grid;
  grid-template-columns: 300px 1fr 1fr;
  align-items: center;
  column-gap: var(--space-6);
  row-gap: var(--space-5);
  margin-top: var(--space-6);
  padding-left: 190px;
}

html.tanh .tradeoff.ships {
  grid-template-columns: 300px 1fr;
  padding-left: 0;
}

/* The engine classes under the size bars (create chapter) */
html.tanh .reveal .tradeoff.ships + pre {
  margin-top: var(--space-9);
}

/* Step 8: one engine, one worker per channel */
html.tanh .per-channel {
  display: grid;
  grid-template-columns: 200px 1fr auto 1fr;
  align-items: center;
  column-gap: var(--space-4);
  row-gap: var(--space-5);
  margin-top: var(--space-9);
}

html.tanh .per-channel b {
  grid-column: 1;
  font-family: var(--fs-heading-font);
  font-weight: 600;
  font-size: 0.7em;
}

html.tanh .per-channel span {
  padding: var(--space-5);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
  font-size: 0.7em;
  text-align: center;
}

html.tanh .per-channel i {
  font-style: normal;
  color: var(--fs-text-subtle-color);
}

/* Step 8 · the break: a mug, its steam rising while the slide is up */
html.tanh .break-mug {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: var(--space-5);
}

html.tanh .break-mug .card-icon {
  display: block;
  width: 240px;
  height: 240px;
  stroke-width: 1.2;
  color: var(--ink);
  transform: translateX(5px);  /* The drawing sits left of its box */
}

html.tanh .break-back {
  margin-top: var(--space-8);
  padding: var(--space-3) var(--space-7);
  border-radius: var(--radius-main);
  background: var(--tint-exercise);
  font-family: var(--fs-heading-font);
  font-size: 2.2em;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

/* The break's countdown: the task timer, large, inside the "back in" box */
html.tanh .break-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

html.tanh .break-countdown .break-label {
  font-size: 0.5em;
  font-weight: 500;
  color: var(--fs-text-subtle-color);
}

html.tanh .break-countdown .task-timer {
  position: static;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 1.3em;
  line-height: 1;
  color: var(--ink);
}

html.tanh .break-countdown .task-timer::after {
  margin-top: var(--space-2);
  font-size: 0.25em;
}

html.tanh .break-countdown .task-timer.done {
  color: #c62828;
}

html.tanh .break-countdown .task-timer.done::after {
  content: 'time · double-click to reset';
  color: var(--fs-text-subtle-color);
}

html.tanh .break-mug .steam {
  stroke: var(--fs-text-muted-color);
}

html.tanh .reveal section.present .break-mug .steam {
  animation: break-steam 2.4s ease-in-out infinite;
}

@keyframes break-steam {
  0%   { transform: translateY(1px); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: translateY(-2px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .break-mug .steam { animation: none; }
}

html.tanh .reveal .slides section > p.ships-note {
  margin-top: calc(var(--space-9) * 3);
}

html.tanh .tradeoff-axis {
  position: absolute;
  top: 60px;
  bottom: 0;
  left: 150px;
  width: 2px;
  background: var(--ink);
}

html.tanh .tradeoff-axis::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: -7px;
  border: 8px solid transparent;
  border-top: 12px solid var(--ink);
  border-bottom: none;
}

html.tanh .tradeoff-axis span {
  position: absolute;
  right: 16px;
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
  white-space: nowrap;
}

html.tanh .tradeoff-axis span:first-child { top: -4px; }
html.tanh .tradeoff-axis span:last-child { bottom: 0; }

html.tanh .tradeoff-head {
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  color: var(--fs-text-muted-color);
}

html.tanh .tradeoff-name {
  display: flex;
  flex-direction: column;
  font-family: var(--fs-heading-font);
  font-size: 0.65em;
  font-weight: 600;
}

html.tanh .tradeoff-name small {
  font-family: var(--fs-body-font, inherit);
  font-size: 0.65em;
  font-weight: 400;
  color: var(--fs-text-muted-color);
}

html.tanh .tradeoff-bar {
  position: relative;
  height: 48px;
}

html.tanh .tradeoff-bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: max(var(--v), 6px);
  border-radius: var(--radius-small);
  background: var(--tint-model);
  transform-origin: left;
}

html.tanh .tradeoff-bar.weight::before { background: var(--ink); }
html.tanh .tradeoff-bar.work::before { background: var(--mark-exercise); }

html.tanh .tradeoff-bar span {
  position: absolute;
  top: 50%;
  left: calc(max(var(--v), 6px) + var(--space-3));
  transform: translateY(-50%);
  font-family: var(--fs-code-font);
  font-size: 0.45em;
  white-space: nowrap;
}

/* The label sits inside a long bar */
html.tanh .tradeoff-bar.weight[style*="--v:100%"] span {
  left: auto;
  right: var(--space-3);
  color: var(--paper);
}

html.tanh .reveal section.present .tradeoff-bar::before {
  animation: tradeoff-grow 0.8s var(--ease) backwards;
  animation-delay: calc(0.3s + var(--i) * 0.35s);
}

html.tanh .reveal section.present .tradeoff-bar.work::before {
  animation-delay: calc(1.8s + var(--i) * 0.35s);
}

html.tanh .reveal section.present .tradeoff-bar span {
  animation: tradeoff-fade 0.3s var(--ease) backwards;
  animation-delay: calc(0.9s + var(--i) * 0.35s);
}

/* Butterfly: weight grows to the left of a centre line, your work to the
   right, so the two read as one diagonal */
html.tanh .tradeoff.butterfly {
  column-gap: 0;
}

html.tanh .tradeoff.butterfly .tradeoff-name {
  padding-right: var(--space-6);
}

html.tanh .tradeoff.butterfly .tradeoff-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 0 var(--space-3);
}

html.tanh .tradeoff.butterfly .tradeoff-head.weight {
  justify-content: flex-end;
}

html.tanh .tradeoff.butterfly .tradeoff-head small {
  order: -1;
  font-family: var(--fs-body-font, inherit);
  font-weight: 400;
  font-size: 0.8em;
}

html.tanh .tradeoff.butterfly .tradeoff-bar.weight::before {
  left: auto;
  right: 0;
  transform-origin: right;
}

html.tanh .tradeoff.butterfly .tradeoff-bar.weight span {
  left: auto;
  right: calc(max(var(--v), 6px) + var(--space-3));
}

html.tanh .tradeoff.butterfly .tradeoff-bar.weight[style*="--v:100%"] span {
  right: auto;
  left: var(--space-3);
}

/* The centre line, unbroken across the row gaps */
html.tanh .tradeoff.butterfly .tradeoff-bar.work::after {
  content: "";
  position: absolute;
  top: calc(var(--space-5) / -2);
  bottom: calc(var(--space-5) / -2);
  left: -1px;
  width: 2px;
  background: var(--ink);
}

html.tanh .tradeoff.butterfly .tradeoff-bar.work span {
  font-family: var(--fs-body-font, inherit);
  font-size: 0.5em;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal section.present .tradeoff.butterfly .tradeoff-bar.work span {
  animation-delay: calc(2.4s + var(--i) * 0.35s);
}

/* One row of the butterfly, on top of the LibTorch and hand-written slides:
   which end of the trade-off we are at */
html.tanh .tradeoff.butterfly.mini {
  grid-template-columns: 1fr 1fr;
  padding-left: 0;
  margin-top: var(--space-5);
}

/* What an engine gives you, and what it costs: a check, then a cross */
html.tanh .cards.getpay .card {
  flex-basis: 0;
}

html.tanh .cards.getpay ul.checks {
  margin: 0;
  font-size: 0.6em;
}

html.tanh .cards.getpay ul.checks li + li {
  margin-top: var(--space-3);
}

html.tanh .reveal .cards.getpay ul.costs li::before {
  content: '✗';
  color: var(--mark-over);
}

/* Step 5 · what we tried against the engine's allocations, and why it fails */
html.tanh .attempts {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: var(--space-7);
}

html.tanh .attempt {
  display: grid;
  grid-template-columns: 1.4em 420px 1fr;
  align-items: baseline;
  padding-bottom: var(--space-4);
  border-bottom: var(--hairline) solid var(--fs-border-strong);
}

html.tanh .attempt::before {
  content: '✗';
  color: var(--mark-over);
  font-weight: bold;
}

html.tanh .attempt b {
  font-family: var(--fs-heading-font);
  font-weight: 600;
}

html.tanh .attempt span {
  font-size: 0.8em;
  color: var(--fs-text-muted-color);
}

/* Step 5 · the teaser: where the model goes is step 6's answer */
html.tanh .big-question {
  margin-top: var(--space-7);
  text-align: center;
  font-family: var(--fs-heading-font);
  font-size: 6em;
  font-weight: 700;
  line-height: 1;
  color: var(--fs-text-muted-color);
}

/* Visible by default; the animation only adds the way in, so a browser that
   skips it still shows the chart */
@keyframes tradeoff-grow { from { transform: scaleX(0); } }
@keyframes tradeoff-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .tradeoff-bar::before,
  html.tanh .reveal section.present .tradeoff-bar span {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
}

/* Over budget: the one red on the slides */
html.tanh { --mark-over: #c0503a; }
html.tanh[data-theme="dark"] { --mark-over: #e0705a; }

html.tanh .meter.over .meter-bar i { background: var(--ink); }

html.tanh .meter.over .meter-bar::after {
  background: repeating-linear-gradient(90deg, var(--mark-over) 0 10px, transparent 10px 18px);
}

/* Optional: the "3.7 ms too late" label and the 375 % number in the same red */
html.tanh .meter.over .meter-late,
html.tanh .meter.over .meter-label strong { color: var(--mark-over); }

html.tanh .deadline-bars i.runs { background: var(--mark-over); }
/* Introduction · teaser: one canvas per variant, drawn by js/teaser.js */
html.tanh .teaser {
  margin-top: var(--space-6);
}

html.tanh .teaser canvas {
  display: block;
  width: 100%;
  height: 680px;
}


/* Bonus: latent space figures */
html.tanh .lat-fig { display: block; width: 100%; max-height: 520px; margin: 0.6em auto 0; }
html.tanh .lat-fig .frame { fill: none; stroke: var(--fs-border); stroke-width: 2; }
html.tanh .lat-fig .pt { fill: var(--fs-highlight-background); }
html.tanh .lat-fig .blob { fill: var(--tint-latent); fill-opacity: 0.75; stroke: none; }
html.tanh .lat-fig .prior { fill: none; stroke: var(--fs-text-muted-color); stroke-width: 2; stroke-dasharray: 8 8; }
html.tanh .lat-fig .gap { fill: var(--fs-text-muted-color); font-size: 64px; font-weight: 700; text-anchor: middle; }
html.tanh .lat-fig .kept { fill: var(--fs-highlight-background); }
html.tanh .lat-fig .dropped { fill: var(--fs-text-subtle-color); opacity: 0.5; }
html.tanh .lat-fig .axis { stroke: var(--fs-border); stroke-width: 2; }
html.tanh .lat-fig text { fill: var(--fs-text-color); font-size: 26px; text-anchor: middle; }
html.tanh .lat-fig .dim { font-size: 22px; fill: var(--fs-text-muted-color); }
html.tanh .lat-fig .muted { fill: var(--fs-text-muted-color); }
html.tanh .lat-fig .small { font-size: 22px; }

/* A build path under the commands: a little smaller, so it stays on one line */
html.tanh .reveal .slides section p.path-note {
  font-size: 0.85em;
  white-space: nowrap;
}

/* Two points at the width of three, centered */
html.tanh .statement-points.centered-two {
  grid-template-columns: repeat(2, calc((100% - 2 * var(--space-7)) / 3));
  justify-content: center;
}

/* A side note pinned to the slide's lower left corner, above the footer */
html.tanh .reveal .slides section .cards-note.corner-note {
  position: absolute;
  left: 0;
  bottom: 60px;
  max-width: 60%;
  margin: 0;
  text-align: left;
}

/* Step 6: the host stream when the worker is late, without and with debt */
html.tanh .debt-fig { display: block; width: 100%; max-height: 480px; margin: var(--space-6) auto 0; }
html.tanh .debt-fig .cell { fill: var(--tint-exercise); }
html.tanh .debt-fig .cell.shifted { fill: var(--tint-model); stroke: var(--fs-text-muted-color); stroke-width: 2; stroke-dasharray: 6 5; }
html.tanh .debt-fig .zero { fill: none; stroke: var(--fs-text-subtle-color); stroke-width: 2; stroke-dasharray: 6 5; }
html.tanh .debt-fig text { fill: var(--fs-text-color); font-family: var(--fs-heading-font); }
html.tanh .debt-fig .num { font-size: 32px; font-weight: 600; text-anchor: middle; }
html.tanh .debt-fig .row { font-size: 28px; font-weight: 600; text-anchor: end; }
html.tanh .debt-fig .row.sub { font-size: 26px; font-weight: 400; fill: var(--fs-text-muted-color); }
html.tanh .debt-fig .note { font-size: 26px; fill: var(--fs-text-muted-color); }

/* Step 3, TODO 1: the ring buffers' fill level, callback by callback */
html.tanh .reveal table.budget-table.fill-table { margin-top: var(--space-4); }
html.tanh .reveal table.budget-table.fill-table td:not(:last-child),
html.tanh .reveal table.budget-table.fill-table th:not(:last-child) { text-align: center; }
html.tanh .reveal table.budget-table.fill-table td:last-child { color: var(--fs-text-muted-color); font-weight: 400; }
html.tanh .reveal table.budget-table.fill-table td[colspan] { text-align: left; }
html.tanh .reveal table.budget-table.fill-table td,
html.tanh .reveal table.budget-table.fill-table th { padding-top: var(--space-1); padding-bottom: var(--space-1); }

/* Step 6: who calls what on each ring buffer, one writer per row and one reader */
html.tanh .reveal table.budget-table.rb-table { margin: var(--space-8) 0 var(--space-8); }
html.tanh .reveal table.budget-table.rb-table th,
html.tanh .reveal table.budget-table.rb-table td { padding: var(--space-5) var(--space-8) var(--space-5) var(--space-4); }
html.tanh .reveal table.budget-table.rb-table th { font-size: 0.85em; padding-bottom: var(--space-3); }
html.tanh .reveal table.budget-table.rb-table th small { font-size: 0.9em; margin-left: var(--space-2); }
html.tanh .reveal table.budget-table.rb-table td small { margin-left: var(--space-2); }
/* Outlook · the step 4 deadline twice: host block 512 (too late) and 2048 (fits) */
html.tanh .deadline-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8, 48px); }
html.tanh .deadline-pair .deadline { margin-top: var(--space-8, 48px); }
html.tanh .deadline.fits .deadline-bars i.runs { background: var(--ink); }
html.tanh .deadline.fits .deadline-bars i.runs span { right: auto; left: 0; text-align: left; }

/* A blank of an exercise file, in a code block (js/todo_marks.js) */
html.tanh .reveal pre code .todo-mark {
  background: var(--tint-exercise);
  outline: 2px solid var(--ink);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}

/* What the participant filled in, on a solution slide (js/solution_marks.js) */
/* One mark can be several spans (one per highlight.js token): only its two ends
   are rounded, and the spread shadow pads it without moving the code's columns */
html.tanh .reveal pre code .solution-mark {
  background: var(--tint-check);
  box-shadow: 0 0 0 3px var(--tint-check);
  font-weight: 600;
}
html.tanh .reveal pre code .solution-start { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
html.tanh .reveal pre code .solution-end { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

/* Task cards: which file a TODO is in, under its title */
html.tanh .run-where { font-size: 0.6em; color: var(--fs-text-color); margin: 0 0 var(--space-3); }
html.tanh .run-where code { font-size: 0.95em; }
