/*********************************************
 * Part 2, anira: the visuals of the talk chapters (the hand-over cards, the
 * crowded host, the history). Loaded after exercise.css and uses its tokens.
 *********************************************/

/*********************************************
 * Hand-over: what real-time inference needs, solved the simple way in part 1;
 * one click checks every card and names anira below
 *********************************************/

html.tanh .needs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
  text-align: left;
}

html.tanh .need {
  position: relative;
  padding: var(--space-5);
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

html.tanh .need .card-icon {
  width: 40px;
  height: 40px;
  color: var(--fs-text-muted-color);
}

html.tanh .need .card-text {
  font-size: 0.66em;
}

/* The check in the corner of every card, once anira is named */
html.tanh .need::after {
  content: '✓';
  position: absolute;
  top: var(--space-4);
  right: var(--space-5);
  font-size: 0.9em;
  font-weight: 700;
  color: var(--mark-check);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

html.tanh .needs:has(.needs-anira.visible) .need {
  border-color: transparent;
  background: var(--tint-check);
}

html.tanh .needs:has(.needs-anira.visible) .need::after {
  opacity: 1;
}

html.tanh .needs-anira {
  grid-column: 1 / -1;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-main);
  background: var(--wash);
  font-size: 0.7em;
  color: var(--fs-text-muted-color);
}

html.tanh .needs-anira span {
  margin-right: var(--space-2);
  font-family: var(--fs-heading-font);
  font-weight: 600;
  font-size: 1.3em;
  color: var(--fs-heading-color);
}

/*********************************************
 * What anira is: two files in, anira in the middle, every engine and
 * device out
 *********************************************/

html.tanh .pitch {
  display: grid;
  /* The arrows take what is left, so anira sits midway between both sides */
  grid-template-columns: auto 1fr auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--space-4);
  row-gap: var(--space-5);
  margin-top: var(--space-7);
  text-align: center;
}

/* The three labels on one line above their columns */
html.tanh .pitch-label {
  grid-row: 1;
  font-family: var(--fs-heading-font);
  font-size: 0.75em;
  font-weight: 600;
  color: var(--fs-heading-color);
}

html.tanh .pitch-label.config { grid-column: 1; }
html.tanh .pitch-label.hub { grid-column: 3; }
html.tanh .pitch-label.targets { grid-column: 5; }

html.tanh .pitch-files { grid-row: 2; grid-column: 1; }
html.tanh .pitch-arrow.first { grid-row: 2; grid-column: 2; }
html.tanh .pitch-hub { grid-row: 2; grid-column: 3; }
html.tanh .pitch-arrow.second { grid-row: 2; grid-column: 4; }
html.tanh .pitch-targets { grid-row: 2; grid-column: 5; }

html.tanh .pitch-files {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

html.tanh .pitch-arrow {
  font-size: 1.6em;
  color: var(--fs-text-subtle-color);
}

html.tanh .pitch-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 240px;
  height: 240px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--tint-exercise);
}

html.tanh .reveal .pitch-mark img {
  width: 150px;
  height: 150px;
  margin: 0;
  object-fit: contain;
}

/* A C++ library: the hexagon as a badge on the mark */
html.tanh .pitch-mark .cpp-icon {
  position: absolute;
  right: -6px;
  bottom: 4px;
  width: 64px;
  height: 72px;
}

html.tanh .pitch-does {
  margin-top: var(--space-4);
  font-size: 0.5em;
  line-height: 1.4;
  color: var(--fs-text-muted-color);
}

/* What every binding is generated from */
html.tanh .pitch-abi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-5);
  font-family: var(--fs-code-font);
  font-size: 0.5em;
}

html.tanh .pitch-abi-bindings {
  display: flex;
  gap: var(--space-2);
}

html.tanh .pitch-abi span {
  padding: var(--space-1) var(--space-3);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-small);
}

html.tanh .pitch-abi span.core {
  border-color: transparent;
  background: var(--tint-exercise);
}

html.tanh .pitch-abi span.arrow {
  padding: 0;
  border: none;
  color: var(--fs-text-subtle-color);
}

html.tanh .pitch-targets {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

html.tanh .pitch-sublabel {
  margin-bottom: var(--space-3);
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fs-text-subtle-color);
}

html.tanh .pitch-engines {
  display: flex;
  justify-content: center;
  gap: var(--space-7);
}

html.tanh .pitch-engines .card-icon {
  display: block;
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-2);
}

/* Two by two, so the row stays as narrow as the engines above it */
html.tanh .pitch-hosts {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  gap: var(--space-3) var(--space-4);
}

html.tanh .pitch-hosts span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
  font-size: 0.5em;
}

html.tanh .pitch-hosts .card-icon {
  width: 28px;
  height: 28px;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal .pitch-hosts code {
  padding: 0;
  background: none;
}

html.tanh .reveal .pitch figure {
  margin: 0;
}

html.tanh .reveal .pitch-engines img {
  display: block;
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-2);
}

html.tanh .reveal .pitch figcaption {
  font-size: 0.5em;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal .pitch figcaption small {
  display: block;
  font-family: var(--fs-code-font);
  font-size: 0.8em;
  color: var(--fs-text-subtle-color);
}

/* Three devices drawn in lines, the platforms on their screens */
html.tanh .pitch-devices {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-7);
}

html.tanh .device-screen {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  box-sizing: border-box;
  margin: 0 auto var(--space-3);
  border: 4px solid var(--fs-text-muted-color);
}

html.tanh .reveal .device-screen img {
  width: 44px;
  height: 44px;
  margin: 0;
}

html.tanh .device.desktop .device-screen {
  width: 230px;
  height: 140px;
  margin-bottom: calc(var(--space-3) + 30px);
  border-radius: 10px;
}

/* The stand: a neck and a foot */
html.tanh .device.desktop .device-screen::before,
html.tanh .device.desktop .device-screen::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fs-text-muted-color);
}

html.tanh .device.desktop .device-screen::before {
  bottom: -26px;
  width: 8px;
  height: 22px;
}

html.tanh .device.desktop .device-screen::after {
  bottom: -32px;
  width: 90px;
  height: 6px;
  border-radius: 3px;
}

html.tanh .device.phone .device-screen {
  flex-direction: column;
  width: 96px;
  height: 170px;
  border-radius: 18px;
}

/* The earpiece */
html.tanh .device.phone .device-screen::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  width: 30px;
  height: 5px;
  border-radius: 3px;
  transform: translateX(-50%);
  background: var(--fs-text-muted-color);
}

html.tanh .device.browser .device-screen {
  width: 210px;
  height: 140px;
  padding-top: 26px;
  border-radius: 8px;
}

/* The title bar, with its three dots */
html.tanh .device.browser .device-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  border-bottom: 4px solid var(--fs-text-muted-color);
  background:
    radial-gradient(circle, var(--fs-text-muted-color) 4px, transparent 5px) 8px 50% / 18px 18px no-repeat,
    radial-gradient(circle, var(--fs-text-muted-color) 4px, transparent 5px) 28px 50% / 18px 18px no-repeat,
    radial-gradient(circle, var(--fs-text-muted-color) 4px, transparent 5px) 48px 50% / 18px 18px no-repeat;
}

/* A board with a pin header along each long side, its name on the silicon */
html.tanh .device.board .device-screen {
  width: 180px;
  height: 120px;
  border-radius: 6px;
}

html.tanh .device.board .device-screen::before,
html.tanh .device.board .device-screen::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  height: 8px;
  background: radial-gradient(circle, var(--fs-text-muted-color) 3px, transparent 3.5px) 0 50% / 14px 8px repeat-x;
}

html.tanh .device.board .device-screen::before { top: 8px; }
html.tanh .device.board .device-screen::after { bottom: 8px; }

html.tanh .device.board .device-screen span {
  padding: var(--space-1) var(--space-3);
  border: 3px solid var(--fs-text-muted-color);
  border-radius: 4px;
  font-family: var(--fs-heading-font);
  font-size: 0.55em;
  font-weight: 700;
}

html.tanh[data-theme="dark"] .reveal .pitch-engines img,
html.tanh[data-theme="dark"] .reveal .device-screen img,
html.tanh[data-theme="dark"] .reveal .pitch-mark img {
  filter: invert(1);
}

/*********************************************
 * In production: one card per shipping product
 *********************************************/

html.tanh .cards.shipped {
  align-items: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-8);
}

html.tanh .reveal .cards.shipped figure {
  flex: 1;
  margin: 0;
}

/* The products stand free, bottom-aligned, each in its own shape */
html.tanh .card-photo {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 380px;
}

html.tanh .reveal .card-photo img {
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: var(--radius-main);
  box-shadow: 0 var(--space-2) var(--space-6) var(--fs-shadow-color-light);
}

html.tanh .cards.shipped figcaption {
  margin-top: var(--space-5);
  font-family: var(--fs-heading-font);
  font-size: 0.85em;
  font-weight: 600;
  text-align: center;
  color: var(--fs-heading-color);
}

html.tanh .card-company {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.55em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fs-text-subtle-color);
}

/*********************************************
 * The crowded host: instances on the left, cores on the right
 *********************************************/

html.tanh .crowd {
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: auto auto;
  column-gap: var(--space-7);
  row-gap: var(--space-6);
  align-items: start;
  margin-top: var(--space-6);
}

html.tanh .crowd-plugins {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3) var(--space-5);
}

html.tanh .crowd-plugin {
  display: grid;
  grid-template-columns: 1fr 40px;
  align-items: center;
  column-gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--wash);
  font-size: 0.55em;
  text-align: left;
  opacity: 0;
}

html.tanh .crowd-plugin span {
  font-family: var(--fs-heading-font);
  font-weight: 600;
}

/* One worker thread per instance */
html.tanh .crowd-plugin i {
  height: 30px;
  border-radius: 4px;
  background: var(--mark-exercise);
}

/* Threads beyond the cores: the same chips, in the model tint */
html.tanh .crowd-plugin.over i {
  background: var(--mark-model);
}

html.tanh .crowd-cores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
}

html.tanh .crowd-cores span {
  grid-column: 1 / -1;
  font-family: var(--fs-heading-font);
  font-size: 0.55em;
  font-weight: 600;
}

html.tanh .crowd-cores b {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--wash);
}

html.tanh .crowd-count {
  grid-column: 1 / -1;
  font-size: 0.7em;
  color: var(--fs-text-muted-color);
  opacity: 0;
}

html.tanh .crowd-count strong {
  font-family: var(--fs-code-font);
  font-weight: 500;
  color: var(--ink);
}

/* Instances arrive one by one; the four cores fill with the first four, the rest wait */
html.tanh .reveal section.present .crowd-plugin {
  animation: crowd-in 0.4s var(--ease) calc(0.4s + var(--i) * 0.35s) both;
}

html.tanh .reveal section.present .crowd-cores b {
  animation: crowd-core 0.3s var(--ease) calc(0.5s + var(--i) * 0.175s) both;
}

html.tanh .reveal section.present .crowd-count {
  animation: run-appear 0.4s var(--ease) 4.2s both;
}

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

@keyframes crowd-core {
  to { background: var(--mark-exercise); }
}

/* anira v1: a plugin cannot fix it from inside, a static library can */
html.tanh .solutions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-7);
  text-align: left;
}

html.tanh .solution {
  padding: var(--space-4) var(--space-5);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
  font-size: 0.6em;
  color: var(--fs-text-muted-color);
}

html.tanh .solution.library {
  border-color: transparent;
  background: var(--tint-check);
  color: var(--ink);
}

html.tanh .solution span {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--fs-heading-font);
  font-size: 1.15em;
  font-weight: 600;
  color: var(--fs-heading-color);
}

/*********************************************
 * anira v2: audio and control data at their own rates, into one model
 *********************************************/

html.tanh .rates {
  display: grid;
  grid-template-columns: 220px 1fr 200px auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--space-5);
  row-gap: var(--space-6);
  margin-top: var(--space-8);
  text-align: left;
}

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

html.tanh .rates-rate {
  font-size: 0.5em;
  color: var(--fs-text-muted-color);
}

/* One tick per value: dense for audio, sparse for control data */
html.tanh .rates-track {
  height: 56px;
  border-bottom: 2px solid var(--fs-border-strong);
}

html.tanh .rates-track.audio {
  background: repeating-linear-gradient(90deg, var(--mark-exercise) 0 2px, transparent 2px 6px) bottom / 100% 70% no-repeat;
}

html.tanh .rates-track.control {
  background: repeating-linear-gradient(90deg, var(--mark-latent) 0 8px, transparent 8px 90px) bottom / 100% 70% no-repeat;
}

html.tanh .rates-model {
  grid-column: 4;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-main);
  background: var(--tint-model);
  font-family: var(--fs-heading-font);
  font-size: 0.6em;
  font-weight: 600;
}

html.tanh .rates-out {
  grid-column: 5;
  grid-row: 1 / 3;
  font-size: 0.6em;
  color: var(--fs-text-muted-color);
}

/*********************************************
 * anira on the web: the paper, with a QR code beside it
 *********************************************/

html.tanh .paper {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--space-9);
  margin-top: var(--space-7);
  text-align: left;
}

html.tanh .paper .qr-code {
  width: 420px;
  height: 420px;
}

html.tanh .paper .qr {
  text-align: center;
}

html.tanh .paper-kind {
  font-family: var(--fs-heading-font);
  font-size: 0.55em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fs-text-subtle-color);
}

html.tanh .paper-title {
  margin-top: var(--space-3);
  font-family: var(--fs-heading-font);
  font-size: 1em;
  font-weight: 600;
  line-height: 1.2;
  color: var(--fs-heading-color);
}

html.tanh .paper-points {
  margin-top: var(--space-4);
  font-size: 0.65em;
  color: var(--fs-text-muted-color);
}

/*********************************************
 * anira v3: one card per limit of v2, the v3 answer below it
 *********************************************/

html.tanh .limits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-8);
  text-align: left;
}

html.tanh .limit {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
}

html.tanh .limit .card-icon {
  width: 56px;
  height: 56px;
  color: var(--fs-text-muted-color);
}

html.tanh .limit-v2,
html.tanh .limit-v3 {
  font-size: 0.66em;
  line-height: 1.35;
  color: var(--fs-text-muted-color);
}

html.tanh .limit-v2 span,
html.tanh .limit-v3 > span {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--fs-code-font);
  font-size: 0.9em;
  font-weight: 700;
  color: var(--fs-text-subtle-color);
}

/* The answer fills the rest of the card, so all four line up */
html.tanh .limit-v3 {
  flex: 1;
  padding: var(--space-5) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--tint-check);
  color: var(--ink);
}

html.tanh .limit-v3 > span {
  color: var(--mark-check);
}

html.tanh .chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

html.tanh .chips b {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-small);
  background: var(--paper);
  font-family: var(--fs-heading-font);
  font-size: 1.05em;
  font-weight: 600;
}

html.tanh .chips b.core {
  background: var(--tint-exercise);
}

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

/*********************************************
 * anira v3: engines against accelerators, a dot per prebuilt package
 *********************************************/

html.tanh .engine-matrix {
  display: grid;
  grid-template-columns: 240px repeat(10, 1fr);
  align-items: center;
  margin-top: var(--space-7);
  font-size: 0.6em;
}

html.tanh .engine-matrix > div {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: var(--hairline) solid var(--fs-border);
}

html.tanh .engine-matrix .mx-col {
  font-family: var(--fs-heading-font);
  font-weight: 600;
  color: var(--fs-text-muted-color);
  border-bottom-color: var(--fs-border-strong);
}

html.tanh .engine-matrix .mx-corner {
  border-bottom-color: var(--fs-border-strong);
}

html.tanh .engine-matrix .mx-engine {
  justify-content: flex-start;
  font-family: var(--fs-heading-font);
  font-weight: 600;
  color: var(--ink);
}

html.tanh .engine-matrix .mx-yes::before {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--mark-check);
}

html.tanh .engine-matrix .mx-no::before {
  content: '';
  width: 8px;
  height: 2px;
  background: var(--fs-border-strong);
}

/*********************************************
 * Outlook: hardware, provider and engine, every path a combination
 *********************************************/

html.tanh .combos {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 300px);
  justify-content: space-between;
  margin-top: var(--space-6);
  text-align: left;
}

html.tanh .combos-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 0;
}

html.tanh .combos-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

html.tanh .combos-head {
  margin-bottom: var(--space-1);
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fs-text-subtle-color);
}

html.tanh .combos-node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--space-4);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-small);
  background: var(--fs-background-color);
  font-size: 0.5em;
}

html.tanh .combos-line {
  fill: none;
  stroke: var(--fs-border);
  stroke-width: 1.5;
}

html.tanh .combos-hot-line {
  fill: none;
  stroke: var(--mark-exercise);
  stroke-width: 3;
}

html.tanh .combos-q rect {
  fill: var(--ink);
}

html.tanh .combos-q text {
  fill: var(--paper);
  font-family: var(--fs-heading-font);
  font-size: 20px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
}

html.tanh .combos-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-5);
}

html.tanh .combos-audio {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-main);
  font-size: 0.55em;
}

html.tanh .combos-audio span {
  font-family: var(--fs-heading-font);
  font-weight: 600;
}

html.tanh .combos-audio b {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-small);
  font-family: var(--fs-heading-font);
}

html.tanh .combos-audio b.ok {
  background: var(--tint-check);
}

html.tanh .combos-audio b.open {
  background: var(--ink);
  color: var(--paper);
}

html.tanh .combos-invite {
  margin-top: var(--space-5);
  font-size: 0.6em;
  color: var(--fs-text-muted-color);
}

html.tanh .combos-audio em {
  font-style: normal;
  color: var(--fs-text-muted-color);
}

/*********************************************
 * Two kinds of thread: short real-time callbacks, long model runs
 *********************************************/

html.tanh .kinds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-top: var(--space-7);
  text-align: left;
}

html.tanh .kind {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-main);
}

html.tanh .kind.audio { background: var(--tint-exercise); }
html.tanh .kind.inference { background: var(--tint-model); }

html.tanh .kind-name {
  font-family: var(--fs-heading-font);
  font-size: 0.85em;
  font-weight: 600;
  color: var(--ink);
}

html.tanh .kind-role {
  font-size: 0.6em;
  color: var(--fs-text-muted-color);
}

html.tanh .kind-track {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
  height: 150px;
  margin-top: var(--space-3);
  padding: 0 var(--space-3);
  border-radius: var(--radius-small);
  background: var(--paper);
}

html.tanh .kind-row {
  position: relative;
  height: 30px;
}

/* Callbacks: a tick per deadline, a short bar of work at the start of each */
html.tanh .kind-row.callbacks {
  height: 56px;
  background:
    repeating-linear-gradient(90deg, var(--mark-exercise) 0 9px, transparent 9px 70px) left center / 100% 60% no-repeat,
    repeating-linear-gradient(90deg, transparent 0 68px, var(--fs-border-strong) 68px 70px);
}

html.tanh .kind-row i {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: var(--mark-model);
}

html.tanh .kind-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.45em;
  color: var(--fs-text-subtle-color);
}

html.tanh .kind-rules {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

html.tanh .kind-rules b {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-small);
  background: var(--paper);
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
}

/*********************************************
 * History: a line of releases
 *********************************************/

html.tanh .history {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  column-gap: var(--space-3);
  margin-top: var(--space-7);
  padding-top: 28px;
}

html.tanh .history::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--fs-border-strong);
}

html.tanh .history-item {
  position: relative;
  text-align: left;
}

html.tanh .history-item::before {
  content: "";
  position: absolute;
  top: -27px;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
}

html.tanh .history-year {
  font-family: var(--fs-code-font);
  font-size: 0.5em;
  color: var(--fs-text-muted-color);
}

html.tanh .history-name {
  font-family: var(--fs-heading-font);
  font-size: 0.65em;
  font-weight: 600;
  color: var(--ink);
}

html.tanh .history-text {
  font-size: 0.5em;
  color: var(--fs-text-muted-color);
}

/* Part 1 of the story: where we stood, the rest of the line only hinted */
html.tanh .history-item.current::before {
  background: var(--ink);
}

/* Not out yet: the release at the end of the line */
html.tanh .history-item.upcoming::before {
  border-style: dashed;
}

html.tanh .history-item.later {
  opacity: 0.25;
}

/* The question from the conversations after the talk */
html.tanh .history-ask {
  margin-top: var(--space-8);
  padding: var(--space-5) var(--space-6);
  border-left: 4px solid var(--mark-exercise);
  border-radius: 0 var(--radius-main) var(--radius-main) 0;
  background: var(--tint-exercise);
  font-family: var(--fs-heading-font);
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

html.tanh .history-ask span {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--fs-main-font);
  font-size: 0.6em;
  font-weight: 400;
  color: var(--fs-text-muted-color);
}

html.tanh .history-note {
  margin-top: var(--space-7);
  font-size: 0.5em;
  color: var(--fs-text-muted-color);
}

/* The lesson of the story, not a footnote */
html.tanh .history-note.lesson {
  margin-top: var(--space-6);
  font-size: 0.7em;
  color: var(--fs-heading-color);
}

@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .crowd-plugin,
  html.tanh .reveal section.present .crowd-cores b,
  html.tanh .reveal section.present .crowd-count {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
}

/*********************************************
 * The pool: instances on the left, one queue, the threads on the right
 *********************************************/

html.tanh .pool {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  column-gap: var(--space-7);
  align-items: center;
  margin-top: var(--space-6);
}

html.tanh .pool-instances,
html.tanh .pool-threads {
  display: grid;
  row-gap: var(--space-2);
}

html.tanh .pool-instance,
html.tanh .pool-thread {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--wash);
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  text-align: left;
}

html.tanh .pool-thread {
  background: var(--tint-exercise);
}

html.tanh .pool-queue {
  display: grid;
  justify-items: center;
  row-gap: var(--space-2);
}

html.tanh .pool-queue span {
  font-family: var(--fs-code-font);
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal section.present .pool-instance {
  animation:
    crowd-in 0.4s var(--ease) calc(0.3s + var(--i) * 0.2s) both,
    pool-send 3.2s linear calc(2.6s + var(--i) * 0.64s) infinite;
}

/* A thread fills while it runs a model, then is free again; the four are
   offset by a quarter cycle, so a free one is always there to take the next job */
html.tanh .pool-thread {
  background-image: linear-gradient(var(--mark-model), var(--mark-model));
  background-repeat: no-repeat;
  background-size: 0% 100%;
}

html.tanh .reveal section.present .pool-thread {
  animation:
    crowd-in 0.4s var(--ease) calc(1.6s + var(--i) * 0.2s) both,
    pool-busy 3.2s linear calc(2.6s + var(--i) * 0.8s) infinite;
}

/* Jobs come and go in the queue, oldest first */
html.tanh .reveal section.present .pool-queue .q-slot b {
  animation: pool-job 3.2s linear infinite;
}

html.tanh .reveal section.present .pool-queue .q-slot:nth-child(1) b { animation-delay: 2.6s; }
html.tanh .reveal section.present .pool-queue .q-slot:nth-child(2) b { animation-delay: 3.4s; }
html.tanh .reveal section.present .pool-queue .q-slot:nth-child(3) b { animation-delay: 4.2s; }
html.tanh .reveal section.present .pool-queue .q-slot:nth-child(4) b { animation-delay: 5.0s; }

@keyframes pool-send {
  0%, 12%, 100% { background-color: var(--wash); }
  4% { background-color: var(--tint-exercise); }
}

@keyframes pool-busy {
  0% { background-size: 0% 100%; }
  55% { background-size: 100% 100%; }
  56%, 100% { background-size: 0% 100%; }
}

@keyframes pool-job {
  0% { opacity: 0; }
  6%, 30% { opacity: 1; }
  36%, 100% { opacity: 0; }
}

/*********************************************
 * Waiting: a bar per policy, the pool's and the audio thread's
 *********************************************/

html.tanh .waits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-7);
  margin-top: var(--space-7);
  text-align: left;
}

html.tanh .wait-title {
  margin-bottom: var(--space-5);
  font-family: var(--fs-heading-font);
  font-size: 0.7em;
  font-weight: 600;
}

html.tanh .wait-row {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--space-5);
  row-gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-5);
  font-size: 0.6em;
}

html.tanh .wait-row code {
  grid-row: 1 / 3;
  font-size: 0.9em;
  white-space: nowrap;
}

html.tanh .wait-row small {
  color: var(--fs-text-muted-color);
}

html.tanh .wait-bar {
  display: flex;
  gap: 5px;
  height: 28px;
}

html.tanh .wait-bar i {
  height: 100%;
  border-radius: 3px;
  background: var(--mark-exercise);
}

/* Spin with backoff: tries that get sparser */
html.tanh .wait-bar.spin i { width: 10px; }
html.tanh .wait-bar.spin i:nth-child(n+5) { margin-left: 10px; }
html.tanh .wait-bar.spin i:nth-child(n+7) { margin-left: 30px; }
html.tanh .wait-bar.spin i:nth-child(8) { margin-left: 70px; }

/* Parked: one long pale bar */
html.tanh .wait-bar.block i { width: 60%; background: var(--wash); border: var(--hairline) solid var(--fs-border-strong); }

/* Never: one tick */
html.tanh .wait-bar.none i { width: 10px; }

/* A ratio: half the block */
html.tanh .wait-bar.ratio i { width: 45%; background: var(--mark-model); }

/* The pool's two policies: what each costs on the audio thread and on the pool */
html.tanh .policies {
  display: grid;
  grid-template-columns: 260px 300px 1fr 1fr;
  column-gap: var(--space-5);
  row-gap: var(--space-5);
  align-items: center;
  margin-top: var(--space-7);
  text-align: left;
}

html.tanh .policy-head {
  font-family: var(--fs-heading-font);
  font-size: 0.5em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fs-text-subtle-color);
}

html.tanh .policy-name {
  font-size: 0.7em;
}

html.tanh .policies .wait-bar {
  height: 36px;
}

html.tanh .policy-cell {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
  font-size: 0.6em;
}

html.tanh .policy-cell.ok { background: var(--tint-check); }
html.tanh .policy-cell.warn { background: var(--tint-model); }

html.tanh .policy-cell.ok::before { content: '✓  '; font-weight: 700; color: var(--mark-check); }
html.tanh .policy-cell.warn::before { content: '!  '; font-weight: 700; color: var(--ink); }

html.tanh .policy-advice {
  margin-top: var(--space-7);
  font-size: 0.6em;
  color: var(--fs-text-muted-color);
  text-align: left;
}

html.tanh .policy-advice span {
  font-family: var(--fs-heading-font);
  font-weight: 600;
  color: var(--fs-heading-color);
}

/*********************************************
 * Pipeline: audio in, a ring buffer, slots, the pool, a ring buffer, audio
 * out; animated by js/pipeline.js. Simplified, not to scale.
 *********************************************/

html.tanh .pipeline {
  display: grid;
  grid-template-columns: 170px 140px 250px 120px 1fr 110px 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--space-3);
  row-gap: var(--space-6);
  align-items: center;
  margin-top: var(--space-7);
  text-align: left;
  font-size: 0.55em;
}

html.tanh .pl-label {
  margin-bottom: var(--space-2);
  font-family: var(--fs-heading-font);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fs-text-subtle-color);
}

html.tanh .pl-in { grid-row: 1; grid-column: 1; }
html.tanh .pl-arrow.a1 { grid-row: 1; grid-column: 2; }
html.tanh .pl-ring.in { grid-row: 1; grid-column: 3; }
html.tanh .pl-arrow.a2 { grid-row: 1; grid-column: 4; }
html.tanh .pl-slots { grid-row: 1 / 3; grid-column: 5; }
html.tanh .pl-arrow.a3 { grid-row: 1 / 3; grid-column: 6; }
html.tanh .pl-threads { grid-row: 1 / 3; grid-column: 7; }
html.tanh .pl-out { grid-row: 2; grid-column: 1; }
html.tanh .pl-arrow.a4 { grid-row: 2; grid-column: 2; }
html.tanh .pl-ring.out { grid-row: 2; grid-column: 3; }
html.tanh .pl-arrow.a5 { grid-row: 2; grid-column: 4; }

/* An audio block: a waveform, lit when a callback moves it */
html.tanh .pl-audio {
  height: 80px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-main);
  background: var(--wash);
  transition: background-color 0.25s;
}

html.tanh .pl-wave {
  width: 110px;
  height: 40px;
  fill: none;
  stroke: var(--mark-exercise);
  stroke-width: 4;
  stroke-linecap: round;
}

html.tanh .pl-audio.on { background: var(--tint-exercise); }
html.tanh .pl-wave .flat { display: none; stroke: var(--fs-border-strong); }
html.tanh .pl-audio.silence .pl-wave .wave { display: none; }
html.tanh .pl-audio.silence .pl-wave .flat { display: inline; }

/* Ring buffers: segments that fill and empty */
html.tanh .pl-circle svg {
  display: block;
  width: 230px;
  height: 230px;
}

html.tanh .pl-seg {
  fill: none;
  stroke: var(--wash);
  stroke-width: 26;
  transition: stroke 0.25s;
}

html.tanh .pl-seg.full { stroke: var(--mark-exercise); }
html.tanh .pl-ring.out .pl-seg.full { stroke: var(--mark-check); }
/* The latency the output ring is primed with: silence, before the first result */
html.tanh .pl-ring.out .pl-seg.full.silent { stroke: var(--fs-text-subtle-color); }

/* Arrows: forward on top, back below */
html.tanh .pl-arrow {
  position: relative;
  height: 2px;
  background: var(--ink);
  margin: 0 var(--space-2);
}

html.tanh .pl-arrow::after {
  content: '';
  position: absolute;
  top: -7px;
  right: -2px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 14px solid var(--ink);
}

html.tanh .pl-arrow.back::after {
  right: auto;
  left: -2px;
  border-left: none;
  border-right: 14px solid var(--ink);
}

html.tanh .pl-arrow.both::before {
  content: '';
  position: absolute;
  top: -7px;
  left: -2px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 14px solid var(--ink);
}

html.tanh .pl-arrow span {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--fs-code-font);
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.25s;
}

html.tanh .pl-arrow span.on { background: var(--tint-exercise); }

/* The labels of the arrows back sit under their line */
html.tanh .pl-arrow.back span {
  bottom: auto;
  top: 12px;
}

/* The audio thread goes straight from the enqueue down to the dequeue */
html.tanh .pl-down {
  grid-row: 1 / 3;
  grid-column: 4;
  align-self: stretch;
  position: relative;
}

html.tanh .pl-down span {
  position: absolute;
  left: 50%;
  top: 27%;
  bottom: 27%;
  width: 0;
  border-left: 2px solid var(--ink);
  border-radius: 2px;
}

html.tanh .pl-down span::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -9px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 14px solid var(--ink);
}

/* The allowed wait beside the way down: a dashed box as long as the ratio
   allows, filled while the audio thread blocks */
html.tanh .pl-wait {
  position: absolute;
  left: calc(50% + 14px);
  top: 27%;
  width: 20px;
  height: calc(46% * var(--share));
  border: 2px dashed var(--ink);
  border-radius: 4px;
  overflow: hidden;
}

html.tanh .pl-wait-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  background: repeating-linear-gradient(135deg, var(--mark-model) 0 5px, var(--tint-model) 5px 10px);
}

html.tanh .pl-case {
  margin-top: var(--space-4);
  font-size: 0.6em;
}

html.tanh .pl-down span.on {
  border-left-color: var(--mark-exercise);
  box-shadow: -3px 0 0 var(--tint-exercise), 3px 0 0 var(--tint-exercise);
}

/* Slots: colour only */
html.tanh .pl-list {
  display: grid;
  gap: var(--space-2);
}

html.tanh .pl-slot {
  height: 56px;
  border-radius: var(--radius-small);
  transition: background-color 0.25s;
}

html.tanh .pl-slot.free { border: 2px dashed var(--fs-border); }
html.tanh .pl-slot.queued { background: var(--tint-exercise); border: 2px solid var(--mark-exercise); }
html.tanh .pl-slot.running { background: var(--mark-model); }
html.tanh .pl-slot.done { background: var(--mark-check); }

html.tanh .pl-legend {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
  color: var(--fs-text-muted-color);
}

html.tanh .pl-legend span::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border-radius: 3px;
}

html.tanh .pl-legend .queued::before { background: var(--tint-exercise); border: 2px solid var(--mark-exercise); }
html.tanh .pl-legend .running::before { background: var(--mark-model); }
html.tanh .pl-legend .done::before { background: var(--mark-check); }

/* Threads: a bar that fills while the model runs */
html.tanh .pl-thread {
  position: relative;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  border-radius: var(--radius-small);
  background: var(--wash);
  overflow: hidden;
  font-family: var(--fs-heading-font);
  font-weight: 600;
}

html.tanh .pl-thread span { position: relative; }

html.tanh .pl-thread-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--mark-model);
}

/*********************************************
 * A late block as zeros: a waveform with a gap, and the click at its edges
 *********************************************/

html.tanh .click {
  margin-top: var(--space-7);
}

html.tanh .click-labels {
  position: relative;
  height: 1.6em;
  font-size: 0.55em;
}

html.tanh .click-labels span {
  position: absolute;
  text-align: center;
  white-space: nowrap;
  font-family: var(--fs-code-font);
  color: var(--fs-text-muted-color);
}

html.tanh .click-wave {
  display: block;
  width: 100%;
  height: auto;
}

html.tanh .click-gap { fill: var(--wash); }
html.tanh .click-div { stroke: var(--fs-border); stroke-width: 1.5; stroke-dasharray: 4 6; }

html.tanh .click-line {
  fill: none;
  stroke: var(--mark-exercise);
  stroke-width: 3;
  stroke-linejoin: miter;
}

/* The two jumps: straight down to zero, straight back up */
html.tanh .click-jump {
  stroke: var(--ink);
  stroke-width: 7;
  stroke-linecap: square;
}

html.tanh .click-note {
  margin-top: var(--space-5);
  font-size: 0.65em;
}

/* A miss that shifts the audio: the late stretch, and where it belongs */
html.tanh .miss .click { margin-top: var(--space-3); }
html.tanh .miss pre { font-size: 0.5em; }
html.tanh .shift-band { fill: var(--mark-over); fill-opacity: 0.12; }
html.tanh .shift-line {
  fill: none;
  stroke: var(--mark-over);
  stroke-width: 3;
  stroke-linejoin: miter;
}
html.tanh .shift-ghost {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 6 8;
  stroke-opacity: 0.45;
}

/* The input under it: the samples never pushed, and the latency until they go missing */
html.tanh .click-labels .lane { left: 0; color: var(--ink); font-weight: 600; }
html.tanh .click.lost { margin-top: var(--space-2); }
html.tanh .lost-line { stroke-width: 4; }
html.tanh .lost-link { stroke: var(--mark-over); stroke-width: 2; stroke-dasharray: 6 6; }
html.tanh .lost-arrowhead { fill: var(--mark-over); }
html.tanh .lost-mark { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 4 6; }
html.tanh .callback-box { fill: none; stroke: var(--ink); stroke-width: 2.5; }
html.tanh .callback-note {
  margin-top: var(--space-1);
  font-size: 0.55em;
  color: var(--fs-text-muted-color);
}

/* anira: the missed block is filled by the policy, the rest stays in line */
html.tanh .fill-band { fill: var(--mark-model); fill-opacity: 0.16; }
html.tanh .fill-edge { stroke: var(--mark-model); stroke-width: 2; }
html.tanh .fill-line {
  fill: none;
  stroke: var(--mark-model);
  stroke-width: 4;
  stroke-linejoin: miter;
}
html.tanh .click-labels .fill-label { color: var(--ink); font-weight: 600; }

/* The four on_miss policies, one missed block each */
html.tanh .policies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-7);
  margin-top: var(--space-6);
}
html.tanh .policy-name {
  margin-bottom: var(--space-2);
  font-size: 0.55em;
  color: var(--fs-text-muted-color);
}
html.tanh .policy-name code { margin-right: var(--space-2); color: var(--ink); font-weight: 600; }
html.tanh .policy .click-line,
html.tanh .policy .fill-line,
html.tanh .policy .shift-ghost,
html.tanh .policy .fill-edge,
html.tanh .policy .click-div { vector-effect: non-scaling-stroke; }
html.tanh .click-note.fill b { background: var(--mark-model); color: var(--ink); }

html.tanh .click-note b {
  margin-right: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-small);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--fs-code-font);
}

/*********************************************
 * Three kinds of thread, and the calls on each
 *********************************************/

html.tanh .threads {
  display: grid;
  grid-template-columns: 110px 1fr;
  row-gap: var(--space-4);
  column-gap: var(--space-5);
  align-items: center;
  margin-top: var(--space-6);
}

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

html.tanh .threads-lane {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-small);
  background: var(--wash);
}

html.tanh .threads-lane span {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--paper);
  border: var(--hairline) solid var(--fs-border-strong);
  font-family: var(--fs-code-font);
  font-size: 0.6em;
}

html.tanh .threads-lane span.stage { background: var(--tint-exercise); border-color: transparent; }
html.tanh .threads-lane span.engine { background: var(--tint-model); border-color: transparent; }

/*********************************************
 * Architecture: rows of boxes, revealed as fragments
 *********************************************/

html.tanh .arch {
  display: grid;
  row-gap: var(--space-3);
  margin-top: var(--space-5);
}

html.tanh .arch-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  column-gap: var(--space-3);
}

html.tanh .arch-row.pipeline {
  grid-template-columns: 1fr 2fr 1fr;
  padding: var(--space-3);
  border: var(--hairline) dashed var(--fs-border-strong);
  border-radius: var(--radius-main);
}

html.tanh .arch-box {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
  background: var(--wash);
  font-size: 0.5em;
}

html.tanh .arch-box.handler { background: var(--tint-exercise); }
html.tanh .arch-box.stage { background: var(--tint-exercise); }
html.tanh .arch-box.inference { background: var(--tint-model); }
html.tanh .arch-box.context { background: var(--tint-latent); }
html.tanh .arch-box.engine { background: var(--paper); border: var(--hairline) solid var(--fs-border-strong); }

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

html.tanh .arch-box small {
  display: block;
  color: var(--fs-text-muted-color);
}

html.tanh .arch-box code { font-size: 0.9em; }

/*********************************************
 * Step 9 motivation: the line that goes, the line that comes
 *********************************************/

html.tanh .state-demo {
  display: grid;
  /* One row under the other, not the two columns of the stateless/stateful demo */
  grid-template-columns: 1fr;
  row-gap: var(--space-4);
  margin-top: var(--space-6);
  text-align: left;
}

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

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

html.tanh .state-row code {
  font-size: 0.5em;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-small);
}

html.tanh .state-row.was code { text-decoration: line-through; color: var(--fs-text-muted-color); }
html.tanh .state-row.is code { background: var(--tint-exercise); }

/* An arrow that is a copy until the fragment strikes it out */
html.tanh .card-arrow.strike {
  font-family: var(--fs-code-font);
  font-size: 0.45em;
  color: var(--fs-text-muted-color);
}

html.tanh .card-arrow.strike.visible { text-decoration: line-through; opacity: 0.4; }

@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .pool-instance,
  html.tanh .reveal section.present .pool-thread,
  html.tanh .reveal section.present .pool-queue .q-slot b {
    animation: none !important;
  }
}

/* The one-line answer under the latency sum */
html.tanh .lat-why {
  margin-top: var(--space-5);
  font-size: 0.55em;
  color: var(--fs-text-muted-color);
}

/* Under a table, centred like the table */
html.tanh table + .lat-why {
  text-align: center;
}

/*********************************************
 * The architecture overview and the stages, as SVG
 *********************************************/

html.tanh .ov,
html.tanh .st {
  width: 100%;
  height: auto;
  margin-top: var(--space-4);
  font-family: var(--fs-main-font);
}

html.tanh .ov { max-height: 720px; }
html.tanh .st { max-height: 640px; }

html.tanh .ov-thread { fill: var(--wash); }
html.tanh .ov-thread.audio { fill: var(--tint-exercise); }
html.tanh .ov-thread.pool { fill: var(--tint-model); }

html.tanh .ov-thread-label,
html.tanh .st-lane-label {
  font-family: var(--fs-heading-font);
  font-size: 20px;
  font-weight: 600;
  fill: var(--ink);
  text-anchor: middle;
}

html.tanh .st-lane-label { text-anchor: start; }

html.tanh .ov-row {
  font-family: var(--fs-code-font);
  font-size: 18px;
  fill: var(--fs-text-muted-color);
  text-anchor: middle;
}

html.tanh .ov-col-label {
  font-size: 19px;
  font-style: italic;
  fill: var(--fs-text-muted-color);
  text-anchor: middle;
}

html.tanh .ov-box {
  fill: var(--wash);
  stroke: var(--fs-border-strong);
  stroke-width: 1;
}

html.tanh .ov-box.context { fill: var(--tint-latent); }

html.tanh .ov-title {
  font-family: var(--fs-heading-font);
  font-size: 23px;
  font-weight: 600;
  fill: var(--ink);
  text-anchor: middle;
}

html.tanh .ov-sub {
  font-family: var(--fs-heading-font);
  font-size: 19px;
  font-weight: 600;
  fill: var(--ink);
  text-anchor: middle;
}

html.tanh .ov-sep { stroke: var(--fs-border-strong); stroke-width: 1; }

html.tanh .ov-pill {
  fill: var(--paper);
  stroke: var(--fs-border-strong);
  stroke-width: 1;
}

html.tanh .ov-pill.dim { fill: transparent; stroke-dasharray: 4 4; }
html.tanh .ov-pill.stage { fill: var(--tint-exercise); stroke: none; }
html.tanh .ov-pill.tensor { fill: var(--tint-latent); stroke: none; }
html.tanh .ov-pill.engine { fill: var(--tint-model); stroke: none; }

html.tanh .ov-pill-text {
  font-family: var(--fs-code-font);
  font-size: 15px;
  fill: var(--ink);
  text-anchor: middle;
}

html.tanh .ov-pill-text.small { font-size: 13px; }

html.tanh .ov-note.left { text-anchor: start; }
/* A note centred on its line: a halo in the page colour breaks the line behind it */
/* Where a line branches off another */
html.tanh .ov-junction { fill: var(--fs-text-muted-color); }
html.tanh .ov-title.on-line { paint-order: stroke; stroke: var(--wash); stroke-width: 18px; stroke-linejoin: round; }
html.tanh .ov-note.on-line { paint-order: stroke; stroke: var(--paper); stroke-width: 16px; stroke-linejoin: round; }

html.tanh .ov-note {
  font-size: 16px;
  font-style: italic;
  fill: var(--fs-text-muted-color);
  text-anchor: middle;
}

html.tanh .ov-flow {
  fill: none;
  stroke: var(--fs-text-muted-color);
  stroke-width: 1.5;
}

html.tanh .ov-flow.strong { stroke: var(--ink); stroke-width: 2; }
html.tanh .ov-flow.state { stroke: var(--mark-latent); stroke-width: 2; stroke-dasharray: 6 5; }
html.tanh .ov-arrowhead { fill: var(--ink); }

html.tanh .ov-ring {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-dasharray: 9 6;
}

html.tanh .ov-threadrow rect { fill: var(--paper); stroke: var(--mark-model); stroke-width: 1.5; }

html.tanh .ov-lens { fill: none; stroke: var(--ink); stroke-width: 2.5; }
html.tanh .ov-lens-ray { stroke: var(--fs-text-muted-color); stroke-width: 1; stroke-dasharray: 4 4; }
html.tanh .ov-lens-frame { fill: var(--paper); stroke: var(--fs-text-muted-color); stroke-width: 1; stroke-dasharray: 4 4; }

html.tanh .ov-slot { fill: var(--paper); stroke: var(--fs-border-strong); }
html.tanh .ov-slot.busy { fill: var(--tint-model); stroke: none; }

html.tanh .st-lane { fill: var(--wash); }
html.tanh .st-lane.audio { fill: color-mix(in srgb, var(--tint-exercise) 45%, var(--paper)); }
html.tanh .st-lane.pool { fill: color-mix(in srgb, var(--tint-model) 45%, var(--paper)); }

html.tanh .st-text {
  font-family: var(--fs-code-font);
  font-size: 18px;
  fill: var(--ink);
  text-anchor: middle;
}

html.tanh .st-text.strong { font-family: var(--fs-heading-font); font-weight: 600; font-size: 24px; }

html.tanh .st-caption {
  font-size: 17px;
  fill: var(--fs-text-muted-color);
  text-anchor: middle;
}

html.tanh .st-caption.left { text-anchor: start; }
/* A caption over a line: a halo in its lane's colour breaks the line behind the text */
html.tanh .st-caption.on-audio, html.tanh .st-caption.on-pool { paint-order: stroke; stroke-width: 18px; stroke-linejoin: round; }
html.tanh .st-caption.on-audio { stroke: color-mix(in srgb, var(--tint-exercise) 45%, var(--paper)); }
html.tanh .st-caption.on-pool { stroke: color-mix(in srgb, var(--tint-model) 45%, var(--paper)); }

/* Reveal fades fragments; the SVG groups follow */
html.tanh .ov g.fragment,
html.tanh .st g.fragment { transition: opacity 0.4s var(--ease); }

/* The map ({{MAP:…}}): the overview as a skeleton that the chapters fill row by row */
html.tanh .ov.map .map-row,
html.tanh .ov.map .map-abi { opacity: 0; transition: opacity 0.4s var(--ease); }

html.tanh .ov.map-show-create .map-row.create,
html.tanh .ov.map-show-prepare .map-row.prepare,
html.tanh .ov.map-show-process .map-row.process,
html.tanh .ov.map-abi .map-abi { opacity: 1; }

html.tanh .ov .map-band { fill: none; stroke: none; }

html.tanh .ov.map-focus-create .map-band.create,
html.tanh .ov.map-focus-prepare .map-band.prepare,
html.tanh .ov.map-focus-process .map-band.process {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-dasharray: 12 8;
}

html.tanh .ov .map-abi-line {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-dasharray: 10 6;
}

/* What prepare allocates, and the models the context pools */
html.tanh .ov.map-memory .mem { stroke: var(--mark-latent); stroke-width: 3; }

/*********************************************
 * Part 1 recap and anira answer: a band across the top names each half of
 * a pair, beige for how we did it, green for how anira does it
 *********************************************/

/* Above the content, so it takes no room from the slide */
html.tanh .reveal .slides section.recap::before,
html.tanh .reveal .slides section.answer::before {
  position: absolute;
  top: -56px;
  left: 0;
  right: 0;
  padding-bottom: var(--space-2);
  border-bottom: 6px solid;
  font-family: var(--fs-heading-font);
  font-size: 0.45em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
}

html.tanh .reveal .slides section.recap::before {
  content: 'By hand · how we did it in part 1';
  border-color: var(--mark-model);
  color: var(--fs-text-muted-color);
}

html.tanh .reveal .slides section.answer::before {
  content: 'With anira · how the library does it';
  border-color: var(--mark-check);
  color: var(--fs-text-muted-color);
}

/* Create: where a declaration takes effect, a second tag pinned top right,
   opposite the chapter tag: "→ prepare: the model loads" */
html.tanh .reveal .slides section .when {
  position: absolute;
  top: 0;
  right: 120px;  /* clear of the deck's controls in the top right corner */
  padding: var(--space-1) var(--space-3);
  border: var(--hairline) solid var(--fs-border-strong);
  border-radius: var(--radius-small);
  font-family: var(--fs-main-font);
  font-size: 0.45em;
  line-height: 1.4;
  color: var(--fs-text-muted-color);
}

html.tanh .reveal .slides section .when b {
  font-weight: 600;
  color: var(--mark-check);
}

/* Create's closing table: what was declared and what create did with it.
   Six rows of two lines, the key under its name, so a size down from the
   default table and the first column the widest */
html.tanh .reveal table.declared {
  margin: var(--space-4) auto 0;
  font-size: 0.72em;
}

html.tanh .reveal table.declared th,
html.tanh .reveal table.declared td {
  padding: 6px 16px;
}

html.tanh .reveal table.declared th:first-child,
html.tanh .reveal table.declared td:first-child {
  width: 36%;
}

html.tanh .reveal table.declared th:nth-child(2),
html.tanh .reveal table.declared td:nth-child(2) {
  width: 30%;
}

html.tanh .reveal table.declared td b {
  font-weight: 600;
  color: var(--mark-check);
}

/* Create's memory slide: who loads the weights and how many copies, part 1
   against anira with and without state. Three rows, the two counts centred */
html.tanh .reveal table.copies {
  margin: var(--space-4) auto 0;
  font-size: 0.72em;
}

html.tanh .reveal table.copies th,
html.tanh .reveal table.copies td {
  padding: 6px 16px;
}

html.tanh .reveal table.copies th:first-child,
html.tanh .reveal table.copies td:first-child {
  width: 24%;
}

html.tanh .reveal table.copies th:nth-child(n + 3),
html.tanh .reveal table.copies td:nth-child(n + 3) {
  text-align: center;
  white-space: nowrap;
}

html.tanh .reveal table.copies td b {
  font-weight: 600;
  color: var(--mark-check);
}

/*********************************************
 * Outlook: inline execution, three checks and two threads
 *********************************************/
html.tanh .inline-tree { margin-top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6); }
html.tanh .it-checks { display: flex; justify-content: center; gap: var(--space-5); }
html.tanh .it-check { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: var(--hairline) solid var(--fs-border-strong); border-radius: var(--radius-main); font-size: 0.5em; }
html.tanh .it-check b { display: block; font-weight: 600; }
html.tanh .it-check small { display: block; color: var(--fs-text-muted-color); font-size: 0.85em; }
html.tanh .it-box { display: inline-flex; align-items: center; justify-content: center; width: 1.6em; height: 1.6em; border-radius: var(--radius-small); background: var(--tint-check); font-weight: 700; }
html.tanh .it-branches { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
html.tanh .it-branch { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-main); background: var(--fs-surface-alt); }
html.tanh .it-branch.yes { outline: 2px solid var(--ink); }
html.tanh .it-label { font-size: 0.45em; color: var(--fs-text-muted-color); }
html.tanh .it-thread { font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.6em; }
html.tanh .it-sum { margin-top: var(--space-2); font-size: 0.85em; gap: var(--space-2); }

/* Outlook · zero copy: the data a second, with a copy and without */
html.tanh .zc { display: flex; flex-direction: column; gap: var(--space-6); margin-top: var(--space-7); }
html.tanh .zc-row { display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: var(--space-5); }
html.tanh .zc-label { font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.6em; }
html.tanh .zc-sum { margin-top: 0; justify-content: flex-start; font-size: 1.1em; }
html.tanh .it-example { text-align: center; font-size: 0.5em; color: var(--fs-text-muted-color); margin-bottom: calc(-1 * var(--space-4)); }

/* Prepare · real-time verdict: a load scale from 0 to 1.25 with three zones */
html.tanh .rtv { margin-top: var(--space-7); display: flex; flex-direction: column; gap: var(--space-7); }
html.tanh .rtv-scale { position: relative; display: grid; grid-template-columns: 60fr 20fr 20fr; height: 90px; border-radius: var(--radius-main); overflow: visible; }
html.tanh .rtv-zone { display: flex; flex-direction: column; justify-content: center; padding: 0 var(--space-4); font-size: 0.5em; }
html.tanh .rtv-zone b { font-weight: 600; }
html.tanh .rtv-zone small { color: var(--fs-text-muted-color); }
html.tanh .rtv-zone.ok { background: var(--tint-check); border-radius: var(--radius-main) 0 0 var(--radius-main); }
html.tanh .rtv-zone.marginal { background: var(--tint-model); }
html.tanh .rtv-zone.not { background: var(--fs-surface-alt); outline: 1px dashed var(--fs-border-strong); border-radius: 0 var(--radius-main) var(--radius-main) 0; }
html.tanh .rtv-mark { position: absolute; top: -14px; bottom: -14px; left: calc(var(--x) / 1.25 * 100%); width: 3px; background: var(--ink); }
html.tanh .rtv-mark span { position: absolute; top: 100%; left: 8px; margin-top: 6px; white-space: nowrap; font-size: 0.42em; line-height: 1.3; }
html.tanh .rtv-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-top: var(--space-6); }
html.tanh .rtv-actions > div { font-size: 0.5em; padding: var(--space-3) var(--space-4); border-left: 3px solid var(--fs-border-strong); }
html.tanh .rtv-actions b { display: block; font-weight: 600; }

/* A side remark in a framed box under a slide's content */
html.tanh .note-box { margin-top: var(--space-5); padding: var(--space-3) var(--space-5); border: 1px solid var(--fs-border-strong); border-radius: var(--radius-main); font-size: 0.7em; text-align: center; }

/* Step 9 · the six needs: declared by us, or handled by anira */
html.tanh .need-how { margin-top: var(--space-3); padding: var(--space-1) var(--space-3); border-radius: var(--radius-small); font-size: 0.66em; align-self: flex-start; }
html.tanh .reveal .need-how code { font-size: 0.9em; background: none; padding: 0; border: 0; box-shadow: none; }
html.tanh .need-how.decl { background: var(--tint-exercise); }
html.tanh .need-how.auto { background: var(--fs-surface-alt); color: var(--fs-text-muted-color); }
html.tanh .cards .card .need-how { font-size: 0.62em; margin-top: auto; }

/* Step 9 · the model file, with the keys explained beside it */
html.tanh .mj { display: flex; flex-direction: column; gap: var(--space-5); margin-top: var(--space-4); }
html.tanh .mj pre { margin: 0; width: 100%; }
html.tanh .mj-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-4); font-size: 0.5em; }
html.tanh .mj-keys > div { padding-left: var(--space-3); border-left: 3px solid var(--fs-border-strong); }
html.tanh .mj-keys b { display: block; }

/* The whole picture · four places in a plugin, two by two */
html.tanh .places { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-top: var(--space-5); }
html.tanh .place { border: 1px solid var(--fs-border); border-radius: var(--radius-main); padding: var(--space-3) var(--space-4); min-width: 0; }
html.tanh .place-head { font-size: 0.65em; margin-bottom: var(--space-2); }
html.tanh .reveal .place pre { margin: 0; width: 100%; font-size: 0.58em; box-shadow: none; }
html.tanh .reveal .place pre code { padding: var(--space-3); white-space: pre; overflow: hidden; }
html.tanh .place-text { font-size: 0.6em; color: var(--fs-text-muted-color); }

/* Process · offline: live and bounce callbacks against one inference */
html.tanh .offline-fig { display: block; width: 100%; margin-top: var(--space-6); }
html.tanh .offline-fig .cb { fill: var(--tint-model); }
html.tanh .offline-fig .cb.miss { fill: var(--mark-over, #c0543f); opacity: 0.75; }
html.tanh .offline-fig .inf { fill: var(--ink); }
html.tanh .offline-fig text { font-size: 26px; fill: var(--fs-text-color); }
html.tanh .offline-fig .lab { font-weight: 600; font-size: 30px; }
html.tanh .offline-fig .small { font-size: 22px; }
html.tanh .offline-fig .inv { fill: var(--paper); }
html.tanh .offline-fig .ok, html.tanh .offline-fig .bad { font-size: 24px; }
html.tanh .offline-fig .bad { fill: var(--mark-over, #c0543f); }

/* Bonus · the model figure from the introduction, its three parts framed */
html.tanh .mf.mf-split { width: 100%; height: auto; max-height: 740px; }
html.tanh .mf.mf-split .mf-title { font-size: 34px; }
html.tanh .mf .mf-zone rect { fill: var(--tint-latent); fill-opacity: 0.55; stroke: none; }
html.tanh .mf .mf-zone.z rect { fill: var(--tint-exercise); fill-opacity: 0.8; }
html.tanh .mf .mf-zone text { font-size: 34px; font-weight: 600; fill: var(--ink); font-family: var(--fs-heading-font); }

/* Bonus · the eight offsets of the listening example */
html.tanh .z-offsets { display: grid; grid-template-columns: repeat(8, 1fr); gap: var(--space-2); margin: var(--space-4) 0 var(--space-3); }
html.tanh .z-offsets span { display: flex; flex-direction: column; align-items: center; padding: var(--space-2); border-radius: var(--radius-small); background: var(--tint-latent); font-family: var(--fs-code-font); font-size: 0.55em; }
html.tanh .z-offsets b { font-family: var(--fs-heading-font); font-weight: 600; color: var(--fs-text-muted-color); }

/* Bonus · the latent bars (js/latent_bars.js) */
html.tanh .latent-live { margin-top: var(--space-6); }
html.tanh .lb-bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: var(--space-5); height: 520px; }
html.tanh .lb-col { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
html.tanh .lb-track { position: relative; flex: 1; width: 64px; border-radius: var(--radius-small); background: var(--fs-surface-alt); }
html.tanh .lb-zero { position: absolute; left: -8px; right: -8px; top: 50%; border-top: 2px solid var(--fs-border-strong); }
html.tanh .lb-bar, html.tanh .lb-ghost { position: absolute; left: 0; right: 0; border-radius: 4px; transition: top 60ms linear, height 60ms linear; }
html.tanh .lb-bar { background: var(--tint-latent); outline: 2px solid var(--ink); outline-offset: -2px; }
html.tanh .latent-live.is-offset .lb-bar { background: var(--tint-exercise); }
html.tanh .lb-ghost { display: none; background: var(--fs-text-subtle-color); opacity: 0.35; }
html.tanh .latent-live.is-offset .lb-ghost { display: block; }
html.tanh .lb-value { font-family: var(--fs-code-font); font-size: 0.5em; }
html.tanh .lb-name { font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.6em; }
html.tanh .lb-offset { font-family: var(--fs-code-font); font-size: 0.45em; color: var(--fs-text-muted-color); }
html.tanh .latent-live.is-offset .lb-offset { color: var(--ink); font-weight: 600; }
html.tanh .lb-controls { display: flex; align-items: center; gap: var(--space-5); margin-top: var(--space-5); }
html.tanh .lb-toggle { font: inherit; font-size: 0.55em; padding: var(--space-2) var(--space-5); border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
html.tanh .lb-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
html.tanh .lb-frame { font-size: 0.45em; color: var(--fs-text-muted-color); font-family: var(--fs-code-font); }

/* Bonus · the latent space as a map of sounds */
html.tanh .lat-map { display: block; width: 100%; max-height: 470px; margin-top: var(--space-3); }
html.tanh .lat-map .lm-a { stop-color: var(--tint-latent); stop-opacity: 0.35; }
html.tanh .lat-map .lm-b { stop-color: var(--tint-latent); stop-opacity: 1; }
html.tanh .lat-map .lm-c { stop-color: var(--tint-exercise); stop-opacity: 0.9; }
html.tanh .lat-map .lm-d { stop-color: var(--tint-exercise); stop-opacity: 0; }
html.tanh .lat-map .lm-over { mix-blend-mode: multiply; }
html.tanh .lat-map .lm-axis { font-size: 30px; font-weight: 600; fill: var(--ink); font-family: var(--fs-heading-font); }
html.tanh .lat-map .lm-path, html.tanh .lat-map .lm-path2 { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
html.tanh .lat-map .lm-path2 { stroke-dasharray: 2 0; }
html.tanh .lat-map .lm-dot { fill: var(--ink); }
html.tanh .lat-map .lm-dot2 { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
html.tanh .lat-map .lm-arrow { stroke: var(--ink); stroke-width: 4; stroke-dasharray: 10 8; marker-end: none; }
html.tanh .lat-map .lm-lab { font-size: 28px; fill: var(--ink); font-family: var(--fs-heading-font); }
html.tanh .lat-map .lm-note text { font-size: 28px; fill: var(--fs-text-muted-color); font-family: var(--fs-heading-font); }

/* Bonus · what 8 numbers can describe: a waveform against a description */
html.tanh .wd { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-5); align-items: center; margin-top: var(--space-6); }
html.tanh .wd-side { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-main); background: var(--fs-surface-alt); min-height: 380px; justify-content: center; }
html.tanh .wd-head { font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.72em; }
html.tanh .wd-foot { font-size: 0.6em; color: var(--fs-text-muted-color); }
html.tanh .wd-wave { width: 100%; height: 220px; }
html.tanh .wd-wave path { fill: none; stroke: var(--ink); stroke-width: 1.4; }
html.tanh .wd-arrow { font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.72em; color: var(--ink); }
html.tanh .wd-list { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
html.tanh .wd-list > div { padding: var(--space-4); border-radius: var(--radius-small); background: var(--tint-latent); font-size: 0.68em; }
html.tanh .wd-list b { display: block; font-weight: 600; }
html.tanh .wd-list small { color: var(--fs-text-muted-color); font-size: 0.85em; }
html.tanh .wd-z { font-family: var(--fs-code-font); font-size: 0.5em; color: var(--fs-text-muted-color); margin-top: var(--space-2); white-space: pre; }

/* Bonus · before and after the shift, as small wave players */
html.tanh .lm-players { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); margin-top: var(--space-3); }
html.tanh .lm-player-label { font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.55em; margin-bottom: var(--space-1); }
html.tanh .lm-player .wave-player { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--space-4); }
html.tanh .lm-player .wave-play { width: 72px; height: 72px; }
html.tanh .lm-player .wave-track canvas { height: 80px; }

/* Bonus · the offset first, the other ways beside it */
html.tanh .zw { display: grid; grid-template-columns: 1fr 1.6fr; gap: var(--space-6); margin-top: var(--space-7); align-items: stretch; }
html.tanh .zw-main { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6); border-radius: var(--radius-main); background: var(--tint-exercise); outline: 2px solid var(--ink); }
html.tanh .zw-tag { font-size: 0.45em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fs-text-muted-color); }
html.tanh .zw-name { font-family: var(--fs-heading-font); font-weight: 600; font-size: 1.1em; }
html.tanh .zw-main code { font-size: 0.75em; }
html.tanh .zw-text { font-size: 0.55em; color: var(--fs-text-muted-color); }
html.tanh .zw-head { font-size: 0.5em; color: var(--fs-text-muted-color); margin-bottom: var(--space-3); }
html.tanh .zw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
html.tanh .zw-grid > div { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); border-radius: var(--radius-main); background: var(--fs-surface-alt); font-size: 0.55em; }
html.tanh .zw-grid b { font-family: var(--fs-heading-font); font-size: 1.15em; }
html.tanh .zw-grid small { color: var(--fs-text-muted-color); }

/* Bonus · the forward model and its two halves */
html.tanh .split-files { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-6); }
html.tanh .sf-row { display: grid; grid-template-columns: 300px 1fr 60px 1fr 180px; align-items: center; gap: var(--space-4); }
html.tanh .sf-file { display: flex; justify-content: center; }
html.tanh .sf-io { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-main); background: var(--fs-surface-alt); font-family: var(--fs-code-font); font-size: 0.55em; }
html.tanh .sf-io span:last-child { color: var(--fs-text-muted-color); }
html.tanh .sf-io.z { background: var(--tint-exercise); outline: 2px solid var(--ink); outline-offset: -2px; }
html.tanh .sf-arrow { text-align: center; font-size: 0.8em; color: var(--fs-text-muted-color); }
html.tanh .sf-note { font-size: 0.5em; color: var(--fs-text-muted-color); }
html.tanh .sf-cut { align-self: center; font-size: 0.5em; color: var(--fs-text-muted-color); border-top: 2px dashed var(--fs-border-strong); width: 100%; text-align: center; padding-top: var(--space-2); }

/* Step 10 · the model without its encoder */
html.tanh .mf .mf-cover { fill: var(--paper); fill-opacity: 0.88; }
html.tanh .mf .mf-cover.full { fill-opacity: 1; }
html.tanh .mf .mf-gone { font-size: 34px; font-weight: 600; fill: var(--fs-text-subtle-color); font-family: var(--fs-heading-font); }
html.tanh .mf .mf-strike { stroke: var(--fs-text-muted-color); stroke-width: 3; }
html.tanh .mf .mf-src rect { fill: var(--tint-latent); stroke: var(--ink); stroke-width: 2; }
html.tanh .mf .mf-src.hand rect { fill: var(--tint-exercise); }
html.tanh .mf .mf-src text { font-size: 34px; font-weight: 600; fill: var(--ink); font-family: var(--fs-heading-font); }
html.tanh .mf .mf-into { fill: none; stroke: var(--ink); stroke-width: 3; stroke-dasharray: 8 6; }
html.tanh .mf .mf-zlab { font-size: 34px; font-weight: 600; fill: var(--ink); font-family: var(--fs-heading-font); }

/*********************************************
 * Step 9 · anira's report: one card per plan, as the plugin shows it, and the
 * verdict's thresholds
 *********************************************/

html.tanh .report {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-8);
  align-items: center;
  margin: var(--space-7) 0 var(--space-6);
}

html.tanh .report-card {
  padding: var(--space-6) var(--space-7);
  border-radius: var(--radius-main);
  background: var(--wash);
  font-size: 0.72em;
}

html.tanh .report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  font-size: 1.2em;
}

html.tanh .report-pill {
  display: inline-block;
  min-width: 7.5em;
  padding: 0.15em 0.8em;
  border-radius: 999px;
  color: var(--paper);
  font-size: 0.85em;
  font-weight: 600;
  text-align: center;
}
html.tanh .report-pill.ok { background: var(--mark-check); }
html.tanh .report-pill.marginal { background: var(--mark-model); }
html.tanh .report-pill.over { background: var(--mark-over); }

html.tanh .report-times {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-2);
}

html.tanh .report-line { margin-top: var(--space-2); opacity: 0.8; }
html.tanh .report-line b { opacity: 1; }

html.tanh .report-bar {
  position: relative;
  height: 12px;
  margin: var(--space-4) 0 var(--space-6);
  border-radius: 6px;
  background: var(--paper);
}

html.tanh .report-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px;
  background: var(--mark-check);
}

html.tanh .report-bar b {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--ink);
  opacity: 0.6;
}

html.tanh .report-bar b span {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8em;
  font-weight: 400;
  white-space: nowrap;
}

html.tanh .report-scale {
  display: grid;
  gap: var(--space-6);
  font-size: 0.66em;
}

html.tanh .report-scale div {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Two rows of cards, one in focus: the top row first, a .rows-focus fragment
   moves the focus to the bottom row. The slide's own section only, as for
   .integration-focus. */
html.tanh .rows-top,
html.tanh .rows-bottom {
  transition: opacity 0.4s var(--ease);
}

html.tanh .reveal section:not(:has(section)):has(.rows-focus:not(.visible)) .rows-bottom,
html.tanh .reveal section:not(:has(section)):has(.rows-focus.visible) .rows-top {
  opacity: 0.25;
}

/* Three keys instead of five, as on step 9's hard_host_blocks slide */
html.tanh .mj-keys.three { grid-template-columns: repeat(3, 1fr); font-size: 0.75em; }

/* Step 10 · foundation models: hand tracking below open source, the arrow between them */
html.tanh .cards.fm-grid { display: grid; grid-template-columns: 1fr 1fr; row-gap: var(--space-2); }
html.tanh .cards.fm-grid .card-arrow { grid-column: 2; justify-self: center; }
html.tanh .cards.fm-grid .card.accent { grid-column: 2; }

/* Step 10 · the forward model above the decoder, not needed here: faded */
html.tanh .sf-row.sf-dim { opacity: 0.35; }

/* Step 10 · the app's threads left to right, the hand-offs between them; anira's pool
   below, push_data down and pop_data up */
html.tanh .threads { display: grid; grid-template-columns: 1fr 240px 1fr 240px 1fr; grid-template-rows: auto auto auto; column-gap: var(--space-3); row-gap: var(--space-2); margin-top: var(--space-5); font-size: 0.85em; }
html.tanh .threads .card { padding: var(--space-4); gap: var(--space-2); }
html.tanh .th-hand { align-self: center; text-align: center; font-size: 1.3em; color: var(--ink); border-radius: var(--radius-small); }
html.tanh .th-hand small { display: block; font-size: 0.42em; white-space: nowrap; line-height: 1.4; color: var(--fs-text-muted-color); }
html.tanh .th-none { align-self: center; text-align: center; font-size: 0.55em; color: var(--fs-text-muted-color); }
html.tanh .th-pool { align-self: stretch; min-height: 110px; border-radius: var(--radius-main); background: var(--tint-exercise); }
html.tanh .th-pool-model { margin: var(--space-3); padding: var(--space-2) var(--space-3); border: var(--hairline) solid var(--fs-border-strong); border-radius: var(--radius-small); background: var(--fs-background-color, #fff); font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.8em; text-align: center; }
html.tanh .th-pool-name { align-self: center; text-align: center; font-family: var(--fs-heading-font); font-weight: 600; }
html.tanh .th-pool-model small, html.tanh .th-pool-name small { display: block; font-weight: 400; font-size: 0.75em; color: var(--fs-text-muted-color); }

/* Step 10 · only the arrows move: chevrons travel down for push_data, up for pop_data
   and right along the hand-offs, each at its thread's period (--p), slowed down alike */
html.tanh .th-flow-v, html.tanh .th-flow-h { display: block; background: var(--ink); -webkit-mask-size: 24px 24px; mask-size: 24px 24px; }
html.tanh .th-flow-v { order: 3; width: 24px; height: 64px; margin-bottom: calc(-1 * var(--space-2)); }
html.tanh .th-call.down .th-flow-v { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 8 L12 15 L19 8' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 8 L12 15 L19 8' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); -webkit-mask-repeat: repeat-y; mask-repeat: repeat-y; }
html.tanh .th-call.up .th-flow-v { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 16 L12 9 L19 16' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 16 L12 9 L19 16' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); -webkit-mask-repeat: repeat-y; mask-repeat: repeat-y; }
html.tanh .th-flow-h { width: 85%; height: 24px; margin: var(--space-3) auto 0; -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5 L15 12 L8 19' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5 L15 12 L8 19' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x; }
html.tanh .th-hand { position: relative; }
html.tanh .reveal section.present .th-call.down .th-flow-v { animation: th-move-down var(--p) linear infinite; }
html.tanh .reveal section.present .th-call.up .th-flow-v { animation: th-move-up var(--p) linear infinite; }
html.tanh .reveal section.present .th-flow-h { animation: th-move-right var(--p) linear infinite; }
@keyframes th-move-down { from { -webkit-mask-position: 0 0; mask-position: 0 0; } to { -webkit-mask-position: 0 24px; mask-position: 0 24px; } }
@keyframes th-move-up { from { -webkit-mask-position: 0 24px; mask-position: 0 24px; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
@keyframes th-move-right { from { -webkit-mask-position: 0 0; mask-position: 0 0; } to { -webkit-mask-position: 24px 0; mask-position: 24px 0; } }
@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .th-flow-v, html.tanh .reveal section.present .th-flow-h { animation: none; }
}

/* Step 10 · what goes into the pool and what comes back: an image and its prediction,
   8 latents and the audio */
html.tanh .th-calls { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); padding: var(--space-2) 0; }
html.tanh .th-call { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--space-2); border-radius: var(--radius-small); }
html.tanh .th-call-pic { height: 120px; width: 100%; display: flex; align-items: center; justify-content: center; }
html.tanh .th-call-pic svg { height: 100%; width: auto; max-width: 100%; }
html.tanh .th-call-name { font-family: var(--fs-code-font); font-size: 0.65em; }
html.tanh .th-call small { font-size: 0.55em; color: var(--fs-text-muted-color); }
html.tanh .th-cam-frame { fill: var(--fs-text-subtle-color); opacity: 0.3; }
html.tanh .th-pred-frame { fill: none; stroke: var(--fs-border-strong); stroke-width: 2; }
html.tanh .th-cam-hand polyline { fill: none; stroke: #b98b6e; stroke-width: 13; stroke-linecap: round; stroke-linejoin: round; }
html.tanh .th-cam-hand polygon { fill: #b98b6e; stroke: #b98b6e; stroke-width: 10; stroke-linejoin: round; }
html.tanh .th-cam-bones polyline { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
html.tanh .th-cam-dots circle { fill: var(--tint-exercise); stroke: var(--ink); stroke-width: 1.5; }
html.tanh .th-bar { fill: var(--ink); }
html.tanh .th-zero { stroke: var(--fs-border-strong); stroke-width: 1.5; }


/* Step 10 · the hand sways like live video, its prediction follows a moment later, and
   the audio scrolls by */
html.tanh .th-cam-hand, html.tanh .th-cam-pred { transform-box: view-box; transform-origin: 80px 110px; }
html.tanh .reveal section.present .th-cam-hand { animation: th-hand 3s ease-in-out infinite alternate; }
html.tanh .reveal section.present .th-cam-pred { animation: th-hand 3s ease-in-out infinite alternate; animation-delay: 0.24s; }
@keyframes th-hand {
  0% { transform: translate(-12px, 2px) rotate(-12deg); }
  50% { transform: translate(4px, -6px) rotate(2deg); }
  100% { transform: translate(12px, 0) rotate(12deg); }
}
html.tanh .th-clip { width: 100%; height: 100%; overflow: hidden; }
html.tanh .th-scroll { display: flex; width: 200%; height: 100%; }
html.tanh .th-call-pic .th-scroll svg { width: 50%; max-width: none; height: 100%; flex: none; }
html.tanh .reveal section.present .th-scroll { animation: th-scroll 3.7s linear infinite; }
@keyframes th-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  html.tanh .reveal section.present .th-cam-hand, html.tanh .reveal section.present .th-cam-pred,
  html.tanh .reveal section.present .th-scroll { animation: none; }
}

/* Step 10 · from the hands to the latent vector: each feature and the dimension it drives */
html.tanh .hm { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); margin-top: var(--space-5); }
html.tanh .hm-label { margin-bottom: var(--space-3); font-family: var(--fs-heading-font); font-weight: 600; font-size: 0.75em; color: var(--fs-text-muted-color); }
html.tanh .hm-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
html.tanh .hm-feat, html.tanh .hm-z { padding: var(--space-2) var(--space-4); border-radius: var(--radius-small); font-size: 0.7em; }
html.tanh .hm-feat { border: var(--hairline) solid var(--fs-border-strong); font-family: var(--fs-heading-font); font-weight: 600; }
html.tanh .hm-feat small { display: block; font-weight: 400; font-size: 0.8em; color: var(--fs-text-muted-color); }
html.tanh .hm-z { background: var(--tint-exercise); }
html.tanh .hm-z b { margin-right: var(--space-2); font-family: var(--fs-code-font); }
html.tanh .hm-arrow { color: var(--fs-text-subtle-color); }

/* Process · misses: the last note closer to the one above, so the slide clears the footer */
html.tanh .reveal section.miss .click-note + .cards-note { margin-top: var(--space-2); }

/* Step 10 · hand tracking: the webcam image and the hand it finds, inside their cards */
html.tanh .cards.ht .ht-pic { height: 110px; display: flex; align-items: center; justify-content: center; }
html.tanh .cards.ht .ht-pic svg { height: 100%; width: auto; }
html.tanh .cards.ht .card { justify-content: flex-end; }
html.tanh .ht-box { fill: none; stroke: var(--mark-over, #d24); stroke-width: 3; }
html.tanh .ht-tag { fill: var(--ink); }
html.tanh .ht-tag-text { fill: var(--paper); font-family: var(--fs-heading-font); font-size: 11px; font-weight: 600; text-anchor: middle; }
html.tanh .ht-bar-bg { fill: var(--fs-text-subtle-color); opacity: 0.25; }
html.tanh .ht-bar { fill: var(--ink); }

/* Step 10 · play: the button that shares the demo window, and the popup it opens over the deck */
html.tanh .live-share { margin-top: var(--space-4); padding: var(--space-3) var(--space-6); border: 0; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-family: var(--fs-heading-font); font-size: 0.8em; font-weight: 600; cursor: pointer; }
.live-share-overlay { position: fixed; inset: 3vh 3vw; z-index: 2000; display: flex; align-items: center; justify-content: center;
  background: #111; border-radius: 12px; box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5); }
.live-share-overlay video { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.live-share-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); color: #111; font-size: 28px; line-height: 44px; cursor: pointer; }
