/* Part 5, plus the two slides that set up the reparameterization trick. */

.bp-body, .sample-body { flex-direction: column; align-items: stretch; }
.bp-steps, .sample-pair {
  width: min(1100px, 100%);
  margin: 0 auto;
}
.bp-steps { display: flex; flex-direction: column; gap: 12px; padding: 0; list-style: none; }
.bp-steps li, .sample-pair article {
  padding: 14px 18px;
  background: var(--bg-raised);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
}
.bp-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  font-family: var(--font-mono);
  font-weight: 700;
}
.bp-chain span:not(.bp-back) {
  padding: 8px 12px;
  border: 3px solid var(--line);
  background: var(--bg-raised);
}
.bp-back { flex-basis: 100%; text-align: center; color: var(--coral); }
.sample-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sample-pair h3 { color: var(--accent); }
@media (max-width: 760px) {
  .sample-pair { grid-template-columns: 1fr; }
  .history li { grid-template-columns: 1fr; }
}

.map-host {
  position: relative;
  flex: 0 0 auto;
}
.slide-caption {
  position: relative;
  z-index: 1;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--accent);
}

/* ================================================================ s11 core idea */

.s11-body {
  gap: calc(var(--gap) * 3);
}
.s11-map {
  --map-size: min(64vh, 680px);
}
.s11-side {
  flex: 0 1 520px;
  gap: var(--gap);
}
.s11-now {
  display: flex;
  gap: 22px;
}
.s11-now .cat-canvas {
  --cat-size: 200px;
}
.s11-row {
  display: flex;
  gap: 8px;
  min-height: 76px;
}
.s11-row .cat-canvas.small {
  --cat-size: 72px;
}
.s11-params {
  font-size: var(--fs-label);
  color: var(--text-soft);
}

/* ================================================================ s12 loss */

.s12-body {
  flex-direction: column;
  gap: var(--gap);
}
.loss-eq {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
}
.loss-tex .katex-display {
  margin: 0;
}
.loss-tex .mord.text,
.loss-tex .text {
  font-family: var(--font-head);
}
/* The ELBO with labelled braces: the equation of #s20 (moved from the KL dial). */
.callout.elbo {
  width: min(1080px, 100%);
  padding: 10px 18px;
}
.callout.elbo .elbo-tex {
  font-size: 26px;
  margin-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}
.callout.elbo p { margin: 0; font-size: var(--fs-small); line-height: 1.35; }
.callout.elbo .katex-display {
  margin: 0;
}
.eq-op {
  color: var(--text-soft);
}
.eq-term {
  padding: 2px 18px;
  border: 3px dashed currentColor;
  border-radius: 16px;
}
.eq-term.recon {
  color: var(--coral);
}
.eq-term.kl {
  color: var(--sky);
}
.gauss-wrap {
  width: min(860px, 100%);
  max-height: min(280px, 36vh);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
svg.gauss {
  display: block;
  width: auto;
  height: min(280px, 36vh);
  max-width: 100%;
  overflow: visible;
}
.g-axis {
  stroke: var(--line);
  stroke-width: 2;
}
.g-tick {
  fill: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 18px;
}
.g-prior {
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 3;
  stroke-dasharray: 8 7;
}
.g-prior-fill {
  fill: color-mix(in srgb, var(--text) 8%, transparent);
}
.g-label {
  fill: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 18px;
}
.g-q {
  fill: none;
  stroke: var(--lilac);
  stroke-width: 4;
}
.g-q-fill {
  fill: color-mix(in srgb, var(--lilac) 28%, transparent);
}
.g-handle {
  fill: var(--text);
  stroke: var(--lilac);
  stroke-width: 5;
  cursor: grab;
  outline: none;
}
.g-handle.peak {
  fill: var(--lilac);
  stroke: var(--text);
}
.g-handle:focus-visible {
  stroke: var(--sunflower);
}
.gauss-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gap) * 2);
  flex-wrap: wrap;
}
.gauss-params {
  font-size: var(--fs-small);
}

/* ================================================================ s13 KL dial */

.s13-body {
  gap: calc(var(--gap) * 3);
}
.s13-map {
  --map-size: min(66vh, 700px);
}
.s13-side {
  flex: 0 1 520px;
  gap: calc(var(--gap) * 1.6);
  align-items: stretch;
}
/* The tug of war: the knot leans towards whichever term wins (--pull from -1 to 1). */
.tug {
  --pull: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}
.tug-team {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--fs-small);
}
.tug-team.recon {
  color: var(--coral);
}
.tug-team.kl {
  color: var(--sky);
}
.tug-rope {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: repeating-linear-gradient(-45deg, #c9a46b 0 8px, #a07a42 8px 14px);
}
.tug-knot {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--pull) * 45%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--lilac);
  border: 3px solid var(--text);
  transform: translate(-50%, -50%);
  transition: left 700ms var(--ease);
}

/* ================================================================ s14 reparameterization */

.s14-body {
  flex-direction: column;
  gap: var(--gap);
}
.graph-wrap {
  width: min(1250px, 100%);
}
svg.rep-graph {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.g-node rect,
.g-node polygon {
  fill: var(--bg-raised);
  stroke: var(--line);
  stroke-width: 2.5;
}
.g-node text {
  fill: var(--text);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 24px;
}
.g-node.param rect {
  stroke: var(--lilac);
}
.g-node.loss rect {
  stroke: var(--coral);
}
.g-node.formula rect {
  stroke: var(--mint);
}
.g-node.formula text {
  font-family: var(--font-mono);
  font-size: 20px;
}
.g-edge {
  stroke: var(--text-soft);
  stroke-width: 2.5;
}
#rep-arrow path {
  fill: var(--text-soft);
}
.eps-edge {
  stroke: var(--mint);
  stroke-dasharray: 6 5;
}
.g-eps {
  fill: var(--mint);
  font-family: var(--font-mono);
  font-size: 18px;
}
.dice-body {
  fill: var(--text);
}
.dice-pip {
  fill: var(--bg);
}
.grad-particle {
  fill: var(--coral);
  filter: none;
  transition: opacity 300ms linear;
}
.grad-particle.stuck,
.grad-particle.arrived {
  opacity: 0;
}
.block-x {
  stroke: var(--coral);
  stroke-width: 9;
  stroke-linecap: round;
  fill: none;
}
.block-label {
  fill: var(--coral);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 22px;
}
svg.rep-graph[data-mode="naive"] .reparam-only,
svg.rep-graph[data-mode="reparam"] .naive-only {
  display: none;
}
.s14-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gap) * 2);
}
.s14-sliders {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 260px));
  gap: 6px 26px;
  align-items: end;
}
.s14-sliders .btn {
  justify-self: start;
}
.s14-out-fig .cat-canvas {
  --cat-size: 190px;
}
.s14-map {
  --map-size: 210px;
}
.s14-note {
  font-size: var(--fs-label);
  color: var(--text-soft);
}

/* ================================================================ s15 generating */

.s15-body {
  flex-wrap: wrap;
  min-width: 0;
  gap: calc(var(--gap) * 2);
}
.gen-grids {
  display: flex;
  flex: 1 1 480px;
  min-width: 0;
  justify-content: center;
  gap: calc(var(--gap) * 1.5);
}
.gen {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 460px;
}
.gen figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-height: 48px;
  margin: 0 0 10px;
  font-size: var(--fs-small);
  color: var(--text);
}
.gen figcaption strong {
  color: var(--accent);
  font-family: var(--font-head);
}
.gen-ae figcaption strong {
  color: var(--coral);
}
.gen .flip {
  font-size: var(--fs-label);
  gap: 8px;
}
.gen .flip .toggle-track {
  width: 64px;
  height: 32px;
}
.gen .flip .toggle-track::after {
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
}
.gen .flip .toggle input:checked + .toggle-track::after {
  transform: translateX(32px);
}
.gen-canvas {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  image-rendering: pixelated;
  border-radius: 12px;
  background: var(--bg-sunken);
  border: 2px solid var(--line);
}
.gen-vae .gen-canvas {
  border-color: var(--accent);
}
.s15-side {
  flex: 0 1 auto;
  max-width: 100%;
  gap: var(--gap);
}
.reroll {
  gap: 12px;
  font-size: var(--fs-body);
  padding: 12px 30px;
}
.reroll .dice {
  width: 30px;
  height: 30px;
}
.reroll .dice rect {
  fill: var(--bg);
}
.reroll .dice circle {
  fill: var(--accent);
}
.reroll.rolling .dice {
  animation: dice-roll 600ms var(--ease);
}
@keyframes dice-roll {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(200deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .reroll.rolling .dice {
    animation: none;
  }
}
.s15-map {
  --map-size: 270px;
}
.s15-pick-fig .cat-canvas.small {
  --cat-size: 110px;
}

/* ================================================================ s16 interpolation */

.s16-body {
  flex-direction: column;
  width: min(980px, 100%);
  min-width: 0;
  gap: var(--gap);
}
.s16-pickers {
  display: flex;
  gap: calc(var(--gap) * 2);
  flex-wrap: wrap;
  justify-content: center;
}
.ab-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ab {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}
.ab-picker .image-picker {
  --picker-cols: 8 !important;
  gap: 4px;
}
.ab-picker .cat-pick canvas {
  width: 46px;
  height: 46px;
}
.interp-rows {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  gap: 12px;
}
.interp-row {
  display: grid;
  grid-template-columns: minmax(72px, 110px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.row-label {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-small);
  text-align: right;
}
.interp-row[data-model="ae_128"] .row-label {
  color: var(--coral);
}
.interp-row[data-model="vae_128"] .row-label {
  color: var(--accent);
}
.strip-wrap {
  position: relative;
  min-width: 0;
  justify-self: start;
  width: min(760px, 100%);
}
.interp-strip {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border-radius: 8px;
}
.strip-marker {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 4px;
  border-radius: 2px;
  background: var(--stamp);
  box-shadow: 3px 0 0 var(--line);
  transform: translateX(-50%);
  transition: left 120ms linear;
}
.s16-live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  gap: calc(var(--gap) * 2);
}
.s16-live .cat-canvas {
  --cat-size: 200px;
}
.s16-live figure[data-model="ae_128"] .cat-canvas {
  border-color: var(--coral);
}
.s16-slider {
  width: min(380px, 100%);
}

/* ================================================================ 1366x768 and smaller laptops */

@media (max-height: 900px), (max-width: 1500px) {
  .s11-body,
  .s13-body {
    gap: calc(var(--gap) * 2);
  }
  .s11-map {
    --map-size: min(51vh, 450px);
  }
  .vae-pipe {
    font-size: 17px;
  }
  .pipe-box {
    padding: 3px 10px;
  }
  .s11-now .cat-canvas {
    --cat-size: 124px;
  }
  .s11-row .cat-canvas.small {
    --cat-size: 58px;
  }
  .loss-eq {
    font-size: 28px;
  }
  .gauss-wrap,
  svg.gauss {
    width: min(640px, 100%);
    height: min(210px, 28vh);
    max-height: min(210px, 28vh);
  }
  .s13-map {
    --map-size: min(62vh, 520px);
  }
  .graph-wrap {
    width: min(900px, 100%);
  }
  .s14-out-fig .cat-canvas {
    --cat-size: 140px;
  }
  .s14-map {
    --map-size: 190px;
  }
  .gen {
    max-width: 360px;
  }
  .gen-canvas {
    max-width: 360px;
  }
  .s15-map {
    --map-size: 210px;
  }
  .s15-pick-fig .cat-canvas.small {
    --cat-size: 84px;
  }
  .strip-wrap {
    width: min(600px, 100%);
  }
  .s16-live .cat-canvas {
    --cat-size: 150px;
  }
  .ab-picker .cat-pick canvas {
    width: 40px;
    height: 40px;
  }
}

/* ================================================================ phones (portrait) */

@media (max-width: 760px) {
  .s11-body,
  .s13-body,
  .s15-body {
    gap: var(--gap);
    align-items: center;
  }
  .s11-map,
  .s13-map {
    --map-size: 200px;
  }
  /* The ELBO callout sits under this map; keep the whole slide on a phone screen. */
  .s13-map {
    --map-size: min(68vw, 260px);
  }
  .s11-side,
  .s13-side {
    flex-basis: auto;
    width: 100%;
  }
  .s11-now .cat-canvas {
    --cat-size: 96px;
  }
  .s11-row {
    min-height: 0;
  }
  .s11-row .cat-canvas.small {
    --cat-size: 40px;
  }
  .loss-eq {
    font-size: 13px;
  }
  .eq-term {
    padding: 2px 10px;
    border-width: 2px;
  }
  .tug {
    grid-template-columns: 1fr 1fr;
  }
  .tug-rope {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .tug-team.kl {
    text-align: right;
  }
  .s14-body {
    gap: 8px;
  }
  svg.rep-graph {
    width: auto;
    max-width: 100%;
    max-height: 26vh;
    margin-inline: auto;
  }
  .s14-demo {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .s14-sliders {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .s14-out-fig .cat-canvas {
    --cat-size: 72px;
  }
  .s14-map {
    --map-size: 140px;
  }
  .s14-note {
    font-size: 12px;
  }
  .gen-grids {
    flex: 0 1 auto;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }
  .gen,
  .gen-canvas {
    max-width: 46vw;
  }
  .s15-map {
    --map-size: 108px;
  }
  .s15-pick-fig .cat-canvas.small {
    --cat-size: 64px;
  }
  .gauss-wrap,
  svg.gauss {
    height: min(180px, 24vh);
    max-height: min(180px, 24vh);
  }
  .s15-side {
    width: 100%;
  }
  .s16-pickers {
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }
  .ab-picker .cat-pick canvas {
    width: 30px;
    height: 30px;
  }
  .ab {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }
  .interp-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .row-label {
    text-align: left;
  }
  .interp-strip {
    width: 100%;
  }
  .s16-live {
    flex-wrap: wrap;
    gap: 14px;
  }
  .s16-live .cat-canvas {
    --cat-size: 120px;
  }
  .s16-slider {
    order: 3;
    width: 100%;
  }
}

/* s11's side panel is narrow: its picker wraps to two rows of four. */
.s11-picker .image-picker {
  --picker-cols: 4 !important;
}
.s11-picker .cat-pick canvas {
  width: 56px;
  height: 56px;
}
@media (max-width: 760px) {
  .s11-picker .image-picker {
    --picker-cols: 8 !important;
  }
  .s11-picker .cat-pick canvas {
    width: 34px;
    height: 34px;
  }
}

/* ================================================================ s17 probability in one minute */

.prob-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: calc(var(--gap) * 2);
}
svg.prob-stage {
  width: min(100%, calc((100dvh - 300px) * 640 / 600));
  justify-self: center;
  overflow: visible;
}
.prob-step { opacity: 0; transition: opacity var(--t-med) linear; }
.prob-step.on { opacity: 1; }
.prob-cell { fill: color-mix(in srgb, var(--lilac) calc(var(--t) * 100%), var(--bg-raised)); }
.prob-frame { fill: none; stroke: var(--line); stroke-width: 3; }
.prob-axis { font-family: var(--font-body); font-weight: 600; font-size: 18px; fill: var(--text-soft); }
.prob-name { font-family: "KaTeX_Math", var(--font-mono); font-style: italic; font-size: 30px; fill: var(--text); }
.prob-name.px { fill: var(--coral); }
.prob-name.pz { fill: var(--sky); }
.prob-px { fill: var(--coral); opacity: 0.85; }
.prob-pz { fill: var(--sky); opacity: 0.85; }
.prob-row, .prob-col { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-dasharray: 6 4; }
.prob-cond-x { fill: var(--sunflower); stroke: var(--line); stroke-width: 1; }
.prob-cond-z { fill: var(--mint); stroke: var(--line); stroke-width: 1; }
.prob-hit { fill: transparent; cursor: crosshair; touch-action: none; }
.prob-notes { display: flex; flex-direction: column; gap: 12px; font-size: var(--fs-small); }
.prob-notes p { margin: 0; opacity: 0.15; transition: opacity var(--t-med) linear; }
.prob-notes p.on { opacity: 1; }
.prob-notes .katex { font-size: 1.15em; }
.px-ink { color: var(--coral); }
.pz-ink { color: var(--sky); }
.prob-punch { padding: 12px 16px; border: 3px solid var(--line); background: var(--bg-raised); box-shadow: 4px 4px 0 var(--line); }
@media (max-width: 760px) {
  .prob-body { grid-template-columns: 1fr; }
  .prob-notes { font-size: 15px; }
}

/* ================================================================ s18 two worlds */

.worlds-body {
  flex-direction: column;
  align-items: center;
  gap: calc(var(--gap) * 0.6);
}
.worlds-stage {
  position: relative;
  width: min(1200px, 100%, calc((100dvh - 330px) * 1200 / 510));
}
svg.worlds-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.worlds-blob { fill: none; stroke: var(--coral); stroke-width: 5; }
.worlds-axis { stroke: var(--line); stroke-width: 1.5; opacity: 0.4; }
.worlds-hit { fill: transparent; cursor: crosshair; }
.worlds-arrow { fill: none; stroke-width: 5; stroke-linecap: round; }
.worlds-arrow.dec { stroke: var(--coral); }
.worlds-arrow.enc { stroke: var(--sky); }
.worlds-head { fill: var(--line); }
.worlds-step { opacity: 0; transition: opacity var(--t-med) linear; }
.worlds-step.on { opacity: 1; }
.worlds-dot { fill: var(--sunflower); stroke: var(--line); stroke-width: 3; }
.worlds-dot.enc { fill: var(--sky); }
.worlds-mark { fill: var(--sunflower); stroke: var(--line); stroke-width: 2; opacity: 0.8; }
.worlds-cloud { fill: color-mix(in srgb, var(--lilac) 45%, transparent); stroke: var(--lilac); stroke-width: 2; }
.worlds-mu { fill: var(--line); }
.worlds-label {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: 26px;
  pointer-events: none;
}
.worlds-label small { font-size: var(--fs-label); color: var(--text-soft); }
.worlds-label.px { color: var(--coral); }
.worlds-label.pz { color: var(--sky); }
.worlds-label.dec { color: var(--coral); font-size: 22px; }
.worlds-label.enc { color: var(--sky); font-size: 22px; }
.worlds-label .wl-plain { font-family: var(--font-head); font-weight: 700; }
.worlds-label[data-from] { opacity: 0; transition: opacity var(--t-med) linear; }
.worlds-label[data-from].on { opacity: 1; }
.worlds-cat {
  position: absolute;
  --cat-size: clamp(56px, 7vw, 96px);
  transform: translate(-50%, -50%);
  animation: worlds-pop var(--t-med) ease-out both;
}
@keyframes worlds-pop { from { transform: translate(-50%, -50%) scale(0.3); } to { transform: translate(-50%, -50%) scale(1); } }
.worlds-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
}
.worlds-hint { font-size: var(--fs-label); color: var(--text-soft); }
@media (max-width: 760px) {
  .worlds-label { font-size: 15px; }
  .worlds-label small { font-size: 11px; }
  .worlds-label.dec, .worlds-label.enc { font-size: 12px; }
  .worlds-label.dec small, .worlds-label.enc small { display: none; } /* the plain words are enough */
  .worlds-cat { --cat-size: 40px; }
}

/* ================================================================ s19 the VAE pipeline strip */

.vae-pipe {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  font-size: var(--fs-small);
}
.pipe-box {
  padding: 6px 12px;
  border: 3px solid currentColor;
  background: var(--bg-raised);
  white-space: nowrap;
}
.pipe-box b { color: var(--text); font-size: 0.85em; }
.pipe-pair { display: flex; gap: 6px; }
.pipe-box.mu, .pipe-box.sig { color: var(--sunflower); }
.pipe-box.gauss { color: var(--coral); }
.pipe-box.z { color: var(--sky); }
.pipe-op { font-size: 1.4em; }
.pipe-trap {
  padding: 8px 22px;
  color: var(--bg);
  background: var(--lilac);
  font-family: var(--font-head);
  font-weight: 700;
}
.pipe-trap.enc { clip-path: polygon(0 0, 100% 22%, 100% 78%, 0 100%); padding-right: 30px; }
.pipe-trap.dec { clip-path: polygon(0 22%, 100% 0, 100% 100%, 0 78%); padding-left: 30px; }
.vae-pipe.pulse .pipe-box.z { animation: pipe-pulse 500ms ease-out; }
@keyframes pipe-pulse { from { background: color-mix(in srgb, var(--sky) 35%, var(--bg-raised)); } }
@media (max-width: 760px) {
  .vae-pipe { font-size: 13px; gap: 6px; }
  .pipe-trap { padding: 6px 14px; }
}

.gen-note { margin: 0; max-width: 26ch; font-size: var(--fs-label); color: var(--text-soft); text-align: center; }

.interp-row[data-model="pixels"] .row-label { color: var(--text-soft); }

.interp-note { margin: 0; text-align: center; font-size: var(--fs-label); color: var(--text-soft); }

/* #s20 at laptop heights and 110-125% zoom: the ELBO shrinks before the formula bar is pushed off. */
@media (max-height: 900px), (max-width: 1500px) {
  .callout.elbo { padding: 6px 14px; }
  .callout.elbo .elbo-tex { font-size: 19px; }
  .callout.elbo p { font-size: 14px; }
  #s20 .gauss-wrap,
  #s20 svg.gauss { height: min(150px, 20vh); max-height: min(150px, 20vh); }
  #s20 .s12-body { gap: 8px; }
}
@media (max-height: 640px) {
  .callout.elbo .elbo-tex { font-size: 16px; }
  .callout.elbo p { display: none; }
}
@media (max-width: 760px) {
  .callout.elbo .elbo-tex { font-size: 11px; }
  .callout.elbo p { font-size: 12px; }
}
/* #s21: with the ELBO gone, the map takes the room. */
.s13-map { --map-size: min(72vh, 760px); }
@media (max-height: 900px), (max-width: 1500px) {
  .s13-map { --map-size: min(66vh, 560px); }
}
@media (max-width: 760px) {
  .s13-map { --map-size: min(84vw, 330px); }
}
/* #s25: the lead line sits under the title. */
.rep-lead { grid-column: 1 / -1; }
/* #s25 at 1366 zoomed to 125%: the lead line costs a row, so the graph gives it back. */
@media (max-height: 640px) and (min-width: 761px) {
  .graph-wrap { width: min(720px, 100%); }
  .s14-out-fig .cat-canvas { --cat-size: 110px; }
  .s14-map { --map-size: 150px; }
}

/* #s20: the plain sentence above the ELBO, and the short name note under it */
.callout.elbo p.loss-plain { margin: 0 0 4px; font-family: var(--font-head); font-weight: 700; font-size: var(--fs-body); color: var(--text); text-align: center; }
.callout.elbo p.elbo-note { font-size: var(--fs-label); color: var(--text-soft); text-align: center; }
/* #s21: KL spelled out, and what each β stop means */
.kl-full { margin: -6px 0 0; font-size: var(--fs-label); color: var(--text-soft); text-align: center; }
.beta-says { margin: 0; min-height: 1.4em; font-family: var(--font-head); font-weight: 700; font-size: var(--fs-body); color: var(--accent); text-align: center; }
@media (max-height: 900px), (max-width: 1500px) {
  .callout.elbo p.loss-plain { font-size: 19px; }
}
@media (max-width: 760px) {
  .callout.elbo p.loss-plain { font-size: 13px; }
  .callout.elbo p.elbo-note { font-size: 11px; }
}

/* #s25: symbol names in words under / over the μ and σ boxes */
.g-name { font-family: var(--font-mono); font-size: 17px; fill: var(--text-soft); }

/* #s26: one line under the plain AE grid */
.ae-gaps { margin: 6px 0 0; font-size: var(--fs-label); color: var(--text-soft); text-align: center; }
/* #s18: the plain world labels sit on one line, clear of the blob and the glow */
.worlds-label.px, .worlds-label.pz { translate: 0 -14px; }
.worlds-label.px small, .worlds-label.pz small { white-space: nowrap; }
@media (max-width: 760px) {
  .worlds-label.px, .worlds-label.pz { translate: 0 -6px; }
  .worlds-label.px small, .worlds-label.pz small { display: none; } /* no room beside a phone-sized blob */
}
