/* Part 6: s17 blur, s18 extensions, s19 comparison, s20 wrap-up, s21 questions. */

/* ================================================================ s17 blur */

.s17-body {
  gap: calc(var(--gap) * 3);
}
.s17-left,
.s17-right {
  flex: 0 1 auto;
}
.s17-pair {
  display: flex;
  gap: 28px;
}
.s17-pair .cat-canvas,
.s17-avg {
  --cat-size: 260px;
}
.loupe-host {
  position: relative;
}
.loupe-host .cat-canvas {
  cursor: zoom-in;
}
/* A round magnifier over the spot being inspected; both images show the same spot. */
.loupe {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 4px solid var(--sunflower);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  image-rendering: pixelated;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast) linear;
}
.loupe.on {
  opacity: 1;
}
.s17-picker .image-picker {
  --picker-cols: 8 !important;
  gap: 6px;
}
.s17-picker .cat-pick canvas {
  width: 48px;
  height: 48px;
}
.s17-title {
  color: var(--accent);
}
.s17-avg-row {
  display: flex;
  align-items: center;
  gap: 24px;
}
.s17-strip {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
  min-width: 140px;
}
.s17-strip .cat-canvas.small {
  --cat-size: 64px;
  border-width: 2px;
}
.s17-slider {
  width: min(460px, 100%);
}

/* ================================================================ s18 extensions */

.s18-body {
  flex-direction: column;
  align-items: stretch;
  gap: var(--gap);
}
.s18-top {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--gap);
}
.card.ext p {
  font-size: var(--fs-small);
}
.card.ext .btn {
  align-self: flex-start;
}
.tag {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 0;
  border: 2px solid var(--line);
  color: var(--text-soft);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  vertical-align: middle;
}
.vq-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.vq-codebook {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  border-radius: 8px;
  border: 2px solid var(--line);
}
.vq-mosaic.cat-canvas.small {
  --cat-size: 96px;
}
.vq-row .arrow {
  color: var(--text-soft);
  font-size: 26px;
}

.sd-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.sd-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-size: var(--fs-label);
  transition: border-color var(--t-med) linear, box-shadow var(--t-med) linear;
}
.sd-node.lit {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--accent);
}
.sd-node .soft {
  color: var(--text-soft);
}
.sd-node.steps {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 230px;
}
.sd-node.steps .soft {
  flex-basis: 100%;
  text-align: center;
}
.sd-box {
  display: block;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--sky), var(--lilac), var(--coral));
}
.sd-box.big {
  width: 96px;
  height: 96px;
}
.sd-box.small {
  width: 34px;
  height: 34px;
  background: repeating-linear-gradient(45deg, var(--lilac) 0 4px, var(--sky) 4px 8px);
}
.sd-step {
  width: 60px;
  height: 60px;
  image-rendering: pixelated;
  border-radius: 6px;
}
.sd-arrow {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-label);
  color: var(--text-soft);
  white-space: nowrap;
}
.sd-final.cat-canvas.small,
.sd-tiny .cat-canvas.small {
  --cat-size: 72px;
}
.sd-tiny {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: var(--fs-label);
  color: var(--text-soft);
}
.sd-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 30px;
}
.sd-caption {
  text-align: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--accent);
}

/* ================================================================ s19 comparison */

.s19-body {
  flex-direction: column;
  gap: calc(var(--gap) * 1.2);
}
.s19-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--gap) * 2.5);
}
.cmp-table {
  border-collapse: separate;
  border-spacing: 6px;
  font-size: var(--fs-small);
}
.cmp-table thead th {
  font-family: var(--font-head);
  color: var(--accent);
  padding: 2px 8px;
}
.cmp-row {
  border: 0;
  background: none;
  padding: 4px 10px 4px 0;
  text-align: right;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.cmp-cell {
  position: relative;
  width: 100%;
  min-width: 150px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 2px dashed var(--line);
  background: var(--bg-sunken);
  cursor: pointer;
  font-size: inherit;
}
.cmp-q {
  color: var(--text-soft);
  font-family: var(--font-head);
  font-weight: 700;
}
.cmp-a {
  display: none;
}
.cmp-cell.revealed {
  border-style: solid;
  cursor: default;
  animation: stamp-in 260ms var(--ease);
}
.cmp-cell.revealed .cmp-q {
  display: none;
}
.cmp-cell.revealed .cmp-a {
  display: inline;
}
.cmp-cell.revealed.good {
  border-color: var(--mint);
  background: color-mix(in srgb, var(--mint) 14%, var(--bg-sunken));
}
.cmp-cell.revealed.bad {
  border-color: var(--coral);
  background: color-mix(in srgb, var(--coral) 14%, var(--bg-sunken));
}
.trilemma {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
svg.tri {
  width: 380px;
  height: auto;
  overflow: visible;
}
.tri-fill {
  fill: color-mix(in srgb, var(--accent) 8%, transparent);
}
.tri-edge {
  stroke: var(--line);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke var(--t-med) linear;
}
.tri-edge.on {
  stroke: var(--accent);
  stroke-width: 7;
}
.tri-corner circle {
  fill: var(--bg-raised);
  stroke: var(--line);
  stroke-width: 3;
  transition: fill var(--t-med) linear;
}
.tri-corner.on circle {
  fill: var(--accent);
  stroke: var(--text);
}
.tri-corner text {
  fill: var(--text-soft);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 32px; /* SVG units: about 21-25px on screen */
}
.tri-corner.on .tri-name { fill: var(--accent); }
.tri-who {
  fill: var(--text);
  font-family: var(--font-body);
  font-size: 27px;
  font-weight: 700;
}
.gary-caption { max-width: 42ch; }

.gary {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 26px;
}
.gary-mascot {
  position: relative;
  width: 110px;
}
.gary-mascot .mascot {
  width: 100%;
}
.gary-mascot .sticker {
  position: absolute;
  left: 50%;
  bottom: -10px;
  translate: -50% 0;
  white-space: nowrap;
  font-size: 17px;
  padding: 4px 10px;
}
.gary-grid {
  display: block;
  width: 170px;
  image-rendering: pixelated;
  border-radius: 10px;
  border: 2px solid var(--coral);
}
.gary-grid-fig.vae .gary-grid {
  border-color: var(--mint);
}
.gary-caption {
  flex-basis: 100%;
  text-align: center;
  font-size: var(--fs-small);
  color: var(--text-soft);
}

/* ================================================================ s20 wrap-up */

.s20-body {
  flex-direction: column;
  gap: calc(var(--gap) * 1.5);
}
.wrap-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 1.1);
  width: min(1200px, 100%);
}
.wrap-row {
  display: grid;
  grid-template-columns: 7.2ch minmax(0, 0.9fr) minmax(0, 1.8fr);
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
}
.wrap-year {
  font-weight: 700;
  color: var(--text-soft);
}
.wrap-model {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--fs-h3);
  color: var(--accent);
}
.wrap-row[data-step="3"] .wrap-model {
  color: var(--lilac);
}
.wrap-arrow {
  font-size: var(--fs-h3);
  color: var(--text-soft);
}
.wrap-result {
  font-size: var(--fs-body);
}
.wrap-mascot .mascot {
  width: 100%;
}
.wrap-cnn {
  font-size: var(--fs-small);
  color: var(--text-soft);
}
/* Hidden until revealed (only while the slide is stepping through its rows). */
.s20-body [data-step] {
  transition: opacity var(--t-med) linear, transform var(--t-med) var(--ease);
}
.s20-body [data-step]:not(.shown) {
  opacity: 0;
  transform: translateY(14px);
}
.wrap-dots {
  display: flex;
  gap: 8px;
}
.wrap-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.wrap-dots span.on {
  background: var(--accent);
}

/* ================================================================ s22 questions */

#s32 .slide-head h2 {
  /* The big "Questions?" below is the title; keep the heading for structure only. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.float-cats {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.float-cat {
  position: absolute;
  bottom: -140px;
  width: var(--size, 80px);
  height: var(--size, 80px);
  image-rendering: pixelated;
  border-radius: 14px;
  opacity: 0.32;
  animation: float-up linear infinite;
  animation-play-state: paused;
}
.float-cats.running .float-cat {
  animation-play-state: running;
}
@keyframes float-up {
  from { transform: translate(0, 0) rotate(-4deg); }
  to { transform: translate(var(--drift, 0px), calc(-100vh - 200px)) rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) {
  .float-cat {
    animation: none;
    display: none;
  }
}
.s21-body {
  flex-direction: column;
  gap: calc(var(--gap) * 1.5);
}
.s21-hero {
  display: flex;
  align-items: center;
  gap: calc(var(--gap) * 2);
}
.s21-mascot .mascot {
  width: min(30vh, 260px);
}
.s21-big {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: calc(var(--fs-h1) * 1.3);
  line-height: 1;
}
.credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 26px;
  position: relative; /* above the floating cats, which used to show through the text */
  z-index: 1;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
  background: var(--bg-raised);
  font-size: var(--fs-label);
  color: var(--text-soft);
  text-align: center;
}
.credits a {
  color: var(--sky);
}

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

@media (max-height: 900px), (max-width: 1500px) {
  .s17-pair .cat-canvas,
  .s17-avg {
    --cat-size: 190px;
  }
  .s17-picker .cat-pick canvas {
    width: 40px;
    height: 40px;
  }
  .s17-strip .cat-canvas.small {
    --cat-size: 50px;
  }
  .sd-box.big {
    width: 64px;
    height: 64px;
  }
  .card.ext {
    padding: 14px 20px;
    gap: 8px;
  }
  .sd-node {
    padding: 4px 10px;
    gap: 3px;
  }
  .sd-final.cat-canvas.small,
  .sd-tiny .cat-canvas.small {
    --cat-size: 60px;
  }
  .sd-step {
    width: 48px;
    height: 48px;
  }
  .vq-codebook,
  .vq-mosaic.cat-canvas.small {
    width: 80px;
    height: 80px;
    --cat-size: 80px;
  }
  .cmp-table {
    font-size: var(--fs-label);
  }
  .cmp-cell {
    min-width: 130px;
    min-height: 34px;
    padding: 4px 10px;
  }
  svg.tri {
    width: 320px;
  }
  .gary-grid {
    width: 140px;
  }
  .gary-mascot {
    width: 90px;
  }
  .wrap-row {
    padding: 6px 14px;
    grid-template-columns: 6.2ch minmax(0, 0.7fr) minmax(0, 2fr);
    gap: 8px 12px;
  }
  .wrap-result {
    font-size: 20px;
    line-height: 1.3;
  }
  .wrap-model {
    font-size: 22px;
  }
}

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

@media (max-width: 760px) {
  .s17-body {
    gap: calc(var(--gap) * 1.5);
    align-items: center;
  }
  .s17-pair {
    gap: 12px;
    justify-content: center;
  }
  .s17-pair .cat-canvas {
    --cat-size: 150px;
  }
  .s17-avg {
    --cat-size: 150px;
  }
  .s17-picker .cat-pick canvas {
    width: 34px;
    height: 34px;
  }
  .s17-picker .image-picker {
    gap: 4px;
  }
  .loupe {
    width: 100px;
    height: 100px;
  }
  .s17-strip .cat-canvas.small {
    --cat-size: 40px;
  }
  .s18-top {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
  .card.ext {
    padding: 8px 10px;
  }
  .vq-row {
    gap: 6px;
  }
  .vq-codebook,
  .vq-mosaic.cat-canvas.small {
    width: 52px;
    height: 52px;
    --cat-size: 52px;
  }
  .sd-flow {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    justify-content: center;
    gap: 4px 6px;
  }
  .sd-arrow {
    display: none;
  }
  .sd-node {
    padding: 2px;
    gap: 2px;
  }
  .sd-node .mono {
    font-size: 10px;
  }
  .sd-box.big {
    width: 40px;
    height: 40px;
  }
  .sd-foot {
    flex-direction: row;
    gap: 6px;
  }
  .sd-caption {
    font-size: 13px;
  }
  .s19-top {
    flex-direction: row;
    flex-wrap: wrap; /* the triangle drops below the table, big enough to read */
    justify-content: center;
    align-items: flex-start;
    gap: 8px;
  }
  .cmp-table {
    font-size: 13px;
    border-spacing: 3px;
  }
  .cmp-table thead th {
    font-size: 14px;
  }
  .cmp-row {
    font-size: 12px;
    padding-right: 4px;
  }
  .cmp-cell {
    min-width: 0;
    min-height: 30px;
    padding: 2px 6px;
  }
  .gary-mascot {
    display: none;
  }
  .gary {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
  }
  .gary-grid {
    width: 84px;
  }
  .gary-caption {
    flex: 1 1 100%;
    max-width: 36ch;
    font-size: 13px;
  }
  svg.tri {
    width: 240px;
  }
  .sd-step {
    width: 36px;
    height: 36px;
  }
  .sd-final.cat-canvas.small,
  .sd-tiny .cat-canvas.small {
    --cat-size: 48px;
  }
  .wrap-row {
    grid-template-columns: 5.2ch minmax(0, 0.8fr) minmax(0, 1.4fr);
    gap: 4px 8px;
    padding: 6px 8px;
  }
  .wrap-arrow {
    display: none;
  }
  .wrap-model {
    font-size: 16px; /* "Autoencoder" fits its column */
  }
  .wrap-result {
    grid-column: auto;
    font-size: 15px;
  }
  .wrap-mascot {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .s21-hero {
    flex-direction: column;
    gap: 6px;
  }
  .s21-mascot .mascot {
    width: 150px;
  }
  .s21-big {
    font-size: 54px;
  }
  .credits {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* s30 with real models: VAE | GAN | diffusion samples side by side */
.gary.trio { gap: 14px 22px; align-items: flex-end; }
.trio-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trio-fig figcaption { display: flex; flex-direction: column; align-items: center; font-size: var(--fs-label); line-height: 1.2; }
.trio-fig figcaption strong { font-family: var(--font-head); font-size: var(--fs-small); color: var(--accent); }
.trio-fig figcaption span { color: var(--text-soft); }
.trio-grid { width: 190px; height: auto; image-rendering: pixelated; border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--line); background: var(--bg-raised); }
@media (max-height: 900px), (max-width: 1500px) { .trio-grid { width: 150px; } }
@media (max-width: 760px) { .trio-grid { width: 104px; } }

.s17-more { order: 99; grid-column: 1 / -1; text-align: center; font-size: var(--fs-label); color: var(--text-soft); white-space: nowrap; }
.trio-side { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 30ch; }
.trio-side .gary-caption { margin: 0; font-size: var(--fs-label); }

/* #s29 variants: four boxes in a 2x2 grid, a title and a line or two each */
.var-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: calc(var(--gap) * 1.2);
  width: min(1400px, 100%);
  margin-inline: auto;
}
.var-grid .card.ext { gap: 10px; justify-content: flex-start; }
.var-grid .card.ext p { margin: 0; line-height: 1.4; }
.var-row { display: flex; align-items: center; gap: 18px; }
.var-row > p { flex: 1 1 auto; }
.sd-strip { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sd-strip .sd-step { width: 56px; height: 56px; image-rendering: pixelated; border: 2px solid var(--line); }
.sd-strip .arrow { color: var(--text-soft); font-size: 22px; }
.sd-strip .sd-final.cat-canvas.small { --cat-size: 72px; }
@media (max-height: 900px), (max-width: 1500px) {
  .var-grid .card.ext { padding: 14px 18px; }
  .var-grid .card.ext h3 { font-size: 22px; }
  .vq-codebook { width: 72px; height: 72px; }
  .vq-mosaic.cat-canvas.small { --cat-size: 72px; }
  .sd-strip .sd-step { width: 44px; height: 44px; }
  .sd-strip .sd-final.cat-canvas.small { --cat-size: 60px; }
}
@media (max-width: 760px) {
  .var-grid { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 10px; }
  .var-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .var-grid .card.ext p { font-size: 14px; }
  .sd-strip .sd-step { width: 40px; height: 40px; }
}

/* #s32: the references under the credits */
.credits .refs-head { margin-top: 6px; font-family: var(--font-head); font-weight: 700; color: var(--accent); }
