/* Shared by the five published clustering decks and their handouts. */
:root {
  --plot-blue: #78acf9;
  --plot-orange: #ffab73;
  --plot-green: #55dfc8;
}
math { font-family: "Cambria Math", "STIX Two Math", math; }
.gaussian-density { color: #8ab9ff; }
.clustering-handout .gaussian-density { color: #225e99; }
.reveal .slides > section.clustering-slide {
  text-align: left;
  box-sizing: border-box;
  height: 100%;
  padding: 56px 72px;
}
.reveal .lesson-heading { display: grid; gap: 14px; }
.reveal .lesson-heading > .kicker { position: static; margin: 0; }
.reveal .clustering-slide > .slide-body {
  position: static;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 23px;
  min-height: 0;
  height: 100%;
  padding: 0;
}
.reveal .clustering-slide h2 {
  font-size: 53px;
  line-height: 1.13;
  letter-spacing: -.022em;
  margin: 0;
  max-width: 1510px;
}
.reveal .clustering-slide .lesson-lead {
  color: #dce5f2;
  font-size: 33px;
  line-height: 1.44;
  max-width: 1490px;
  margin: 0;
}
.reveal .clustering-slide .lesson-note {
  margin: 0;
  padding: 24px 32px;
  font-size: 26px;
  line-height: 1.5;
  border-left: 4px solid #4bd7c6;
  border-radius: 0 12px 12px 0;
  background: #142a2e;
  color: #c0d1e4;
}
.reveal .clustering-slide.story-slide .lesson-note { margin-top: 6px; }
.reveal .theory-slide .lesson-formula, .reveal .proof-panel .lesson-formula {
  font-size: 36px;
  padding: 29px 36px;
  background: #151e2b;
  border: 1px solid #32445a;
  border-radius: 14px;
}
.lesson-formula { display: flex; justify-content: center; }
.lesson-formula math { flex: 0 0 auto; margin: 0; }
.lesson-formula.with-label {
  flex-direction: column;
  align-items: safe center;
  gap: .26em;
}
.lesson-formula.with-bayes-context {
  position: relative;
  flex-direction: column;
  align-items: safe center;
}
.bayes-context {
  align-self: flex-end;
  display: grid;
  justify-items: end;
  gap: .12em;
  color: #aab9cf;
  font-size: .58em;
}
.bayes-context span { font: 600 .78em/1.3 "Segoe UI", Arial, sans-serif; }
.bayes-active { color: #8ab9ff; }
.reveal .bayes-context {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 30px;
}
.clustering-handout .bayes-context { margin-bottom: .35em; color: #586e83; font-size: .82em; }
.clustering-handout .bayes-active { color: #225e99; }
.formula-label {
  align-self: flex-end;
  color: #a9f1e0;
  font: 600 .65em/1.35 "Segoe UI", Arial, sans-serif;
  text-align: right;
}
.clustering-handout .formula-label { color: #006d67; font-size: .79em; }
.lesson-formula.bayes-translation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-items: stretch;
  background: #151e2b;
}
.bayes-translation > div {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: .45em;
  justify-items: center;
  align-items: center;
  min-width: 0;
  padding: .2em .5em;
}
.bayes-translation > div + div { border-inline-start: 1px solid #3c5269; }
.bayes-translation span {
  color: #a9f1e0;
  font: 650 .65em/1.35 "Segoe UI", Arial, sans-serif;
}
.clustering-handout .bayes-translation { background: #edf5f3; }
.clustering-handout .bayes-translation > div + div { border-color: #bed2d2; }
.clustering-handout .bayes-translation span { color: #006d67; font-size: .79em; }
@media (max-width: 1050px) {
  .clustering-handout .bayes-translation { grid-template-columns: minmax(0, 1fr); gap: .55em; }
  .clustering-handout .bayes-translation > div + div {
    border-inline-start: 0;
    border-top: 1px solid #bed2d2;
    padding-top: .55em;
  }
}
@media (max-width: 390px) {
  .clustering-handout .lesson-formula.bayes-translation { font-size: 17px; padding-inline: 10px; }
}
.lesson-formula mtd[columnalign="left"] { text-align: left; }
.lesson-formula mtd[columnalign="right"] { text-align: right; }
.lesson-formula mtable > mtr > mtd { padding-block: .08em; }
:is(#posterior, #chapter-posterior) .lesson-formula > math mtable > mtr + mtr > mtd {
  padding-block-start: .38em;
}
.reveal #posterior .lesson-formula.with-bayes-context { padding-block: 46px; }
.reveal #posterior .formula-label {
  position: absolute;
  inset-block-end: 22px;
  inset-inline-end: 36px;
}
.lesson-formula math > mrow > mtable > mtr > mtd { math-style: normal; }
.lesson-formula mtd[columnalign="right"] + mtd[columnalign="left"] { padding-inline-start: 0; }
.reveal .clustering-slide.lab-slide > .slide-body { gap: 17px; }
.reveal .clustering-slide.lab-slide .lesson-heading { gap: 10px; }
.reveal .clustering-slide.lab-slide h2 { font-size: 43px; }
.reveal .clustering-slide.lab-slide .lesson-lead { font-size: 27px; }
.reveal .clustering-slide.lab-slide .rg-widget { margin-top: 1px; }
.reveal .clustering-slide.lab-slide .rg-graphic { height: 495px; }
.reveal .clustering-slide.lab-slide .rg-bottom { font-size: 16px; }
.reveal .lesson-list {
  display: grid;
  gap: 25px;
  padding: 0;
  margin: 18px 0 0 1.2em;
  font-size: 39px;
  line-height: 1.4;
}
.lesson-list li::marker { color: #55dfc8; font-weight: 700; }
.reveal .lesson-steps {
  display: grid;
  gap: 12px;
  margin: 0 0 0 1.3em;
  font-size: 32px;
  line-height: 1.4;
}
.reveal .lesson-steps li::marker { color: #55dfc8; font-weight: 650; }
.reveal .part-topics.part-topics-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* On wide screens the fixed PDF button sits above the scaled slide label. */
@media screen and (min-aspect-ratio: 17/10) {
  .reveal .part-cover > .kicker {
    top: max(22px, calc(36px / var(--slide-scale, 1)));
  }
}
[data-clustering-deck] .lesson-tag {
  max-width: max(0px, calc(50vw - 132px));
}
.lesson-links { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.lesson-links a {
  display: flex;
  flex-direction: column;
  gap: .5em;
  min-width: 0;
  min-height: 6em;
  padding: 1em;
  border: 1px solid #3c6276;
  border-radius: 12px;
  background: #142238;
  color: #eef4ff;
  text-decoration: none;
}
.lesson-links a:hover { background: #1e3746; border-color: #55dfc8; }
.lesson-links span { font-size: .73em; text-transform: uppercase; letter-spacing: .045em; color: #77dfd0; }
.reveal .lesson-links { font-size: 31px; margin-top: 18px; }
[data-clustering-deck] > .course-home-button {
  position: fixed;
  z-index: 20;
  top: 12px;
  right: 12px;
  padding: 8px 13px;
  border: 1px solid #435970;
  border-radius: 7px;
  background: #142234;
  color: #a4e8dd;
  text-decoration: none;
  font: 600 14px/1.4 "Segoe UI", Arial, sans-serif;
}
[data-clustering-deck] > .course-home-button:hover { border-color: #55dfc8; }

.lesson-example {
  --example-text: #edf4fb;
  --example-muted: #bccde1;
  --example-edge: #3a5065;
  --example-surface: #101c2b;
  color: var(--example-text);
  background: var(--example-surface);
  border: 1px solid var(--example-edge);
  border-radius: 14px;
  font: 24px/1.4 "Segoe UI", Arial, sans-serif;
}
.example-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55em;
  padding: .7em 1em;
  border-bottom: 1px solid var(--example-edge);
}
.example-toolbar label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55em;
  min-width: 0;
  max-width: 100%;
}
.example-toolbar button, .example-toolbar select, .handout-lab button {
  font: inherit;
  color: inherit;
  padding: .26em .61em;
  background: var(--example-surface, #fff);
  border: 1px solid var(--example-edge, #9fb3b9);
  border-radius: 6px;
}
.example-toolbar button, .handout-lab button { cursor: pointer; }
.example-toolbar select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.example-toolbar button:disabled { opacity: .45; cursor: default; }
.example-toolbar input { accent-color: #3cceba; width: 9em; }
.example-toolbar output { min-width: 2.1em; font-variant-numeric: tabular-nums; }
.example-panel { padding: 1.15em 1.3em; }
.example-panel.with-visual {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0,1fr) minmax(0,1.25fr);
  gap: 1.2em;
}
.example-panel[hidden] { display: none; }
.example-copy > h3, .reveal .example-copy > h3 {
  color: var(--plot-green);
  font: 650 1.25em/1.25 "Segoe UI", Arial, sans-serif;
  margin: 0 0 .38em;
}
.example-copy > p, .reveal .example-copy > p {
  color: var(--example-muted);
  font-size: 1em;
  line-height: 1.4;
  margin: 0;
}
.example-panel.proof-panel { grid-template-columns: minmax(0,.7fr) minmax(0,1.3fr); }
.reveal .proof-panel .lesson-formula { font-size: 29px; padding: 22px 16px; }
.weighted-reference {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--example-edge);
}
.weighted-reference > div {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--example-edge);
  border-radius: 8px;
  text-align: center;
}
.weighted-reference h3, .reveal .weighted-reference h3 {
  margin: 0;
  color: var(--plot-green);
  font: 650 .85em/1.3 "Segoe UI", Arial, sans-serif;
}
.weighted-reference .lesson-formula { align-items: center; padding: 5px 0; font-size: 29px; }
.weighted-results, .reveal .weighted-results {
  display: grid;
  gap: .34em;
  margin: .55em 0 0;
  font-variant-numeric: tabular-nums;
}
.weighted-results > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .05em .55em;
  padding: .22em .55em;
  border-left: 3px solid var(--gmm-color);
  background: var(--example-surface);
}
.weighted-results dt { color: var(--gmm-color); font-weight: 650; }
.weighted-results dd, .reveal .weighted-results dd { margin: 0; }
.weighted-results .weighted-legend {
  grid-column: 1 / -1;
  color: var(--example-muted);
  font-size: .75em;
}
[data-example="weighted"] .example-panel.with-visual {
  grid-template-columns: minmax(0, .64fr) minmax(0, 1.36fr);
  padding-block: .6em;
}
.clustering-handout .weighted-reference .lesson-formula { padding: 5px 0; font-size: 19px; }
@media (max-width: 1150px) {
  .clustering-handout [data-example="weighted"] .example-panel.with-visual { grid-template-columns: 1fr; }
}
@media (max-width: 1030px) {
  .clustering-handout .weighted-reference { grid-template-columns: 1fr; }
}
.example-plot { display: block; width: 100%; max-height: 335px; }
.example-plot text { fill: var(--example-text); text-anchor: middle; font: 21px "Segoe UI", Arial, sans-serif; }
.example-plot .plot-axis { stroke: var(--example-edge); fill: none; stroke-width: 2px; }
.example-plot .dot-0 { fill: var(--plot-blue); }
.example-plot .dot-1 { fill: var(--plot-orange); }
.example-plot .dot-2 { fill: var(--plot-green); }
.example-plot [class^="curve-"] { fill: none; stroke-width: 3.5px; }
.example-plot .curve-0 { stroke: var(--plot-blue); }
.example-plot .curve-1 { stroke: var(--plot-orange); }
.example-plot .curve-2 { stroke: var(--plot-green); }
.weighted-gaussian .weighted-area { fill: var(--plot-green); fill-opacity: .18; }
.weighted-gaussian .weighted-gridline { stroke: var(--example-edge); opacity: .48; }
.weighted-gaussian .weighted-mean {
  fill: none;
  stroke: var(--plot-blue);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}
.weighted-gaussian .weighted-spread { fill: none; stroke: var(--plot-orange); stroke-width: 2; }
.weighted-gaussian .weighted-observation { fill: var(--example-text); }
.weighted-gaussian .weighted-axis-title { font-size: 20px; text-anchor: start; }
.weighted-gaussian .weighted-axis-label, .weighted-gaussian .weighted-y-tick { font-size: 18px; }
.weighted-gaussian .weighted-y-tick { text-anchor: end; }
.weighted-gaussian .weighted-membership { font-size: 17px; fill: var(--example-muted); }
.weighted-gaussian .weighted-spread-label {
  font-size: 18px;
  fill: var(--plot-orange);
  stroke: var(--example-surface);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke;
}
@media (max-width: 650px) {
  .clustering-handout .weighted-gaussian text { font-size: 22px; }
}

.example-plot .guide { stroke: var(--example-muted); stroke-width: 2px; stroke-dasharray: 7 5; }
.density-plot text.density-label { font-size: 19px; }
.density-plot text.density-label[text-anchor="start"] { text-anchor: start; }
.density-plot .curve-0, .density-plot .curve-1 { stroke-dasharray: 8 6; }
.density-plot .curve-2 { stroke-width: 5px; }
.gaussian-equation-demo {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: 18px;
}
.gaussian-equation-demo .lesson-formula.with-label > math { margin-block: auto; }
.gaussian-density-demo, .reveal .gaussian-density-demo {
  margin: 0;
  padding: .5em .75em;
}
.gaussian-density-demo figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .3em .6em;
  flex-wrap: wrap;
  font-size: .87em;
}
.gaussian-density-demo figcaption output { color: var(--plot-blue); font-weight: 700; }
.gaussian-density-demo .density-mini { max-height: 270px; }
.density-mini .density-mini-gridline { stroke: var(--example-edge); opacity: .65; }
.density-mini .density-mini-title { text-anchor: start; font-size: 19px; }
.density-mini .density-mini-y { text-anchor: end; font-size: 17px; }
.density-mini .density-mini-x { font-size: 17px; }
.density-mini .density-mini-curve { fill: none; stroke: var(--example-muted); stroke-width: 3px; }
.density-mini .density-mini-guide { fill: none; stroke: var(--plot-blue); stroke-width: 1.7px; stroke-dasharray: 5 4; }
.density-mini .density-mini-point { fill: var(--plot-blue); }
.gaussian-density-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .3em .9em;
}
.gaussian-density-controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  min-width: 0;
  font-size: .81em;
}
.gaussian-density-controls input {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  accent-color: var(--plot-blue);
}
.gaussian-density-demo output { font-variant-numeric: tabular-nums; }
.gaussian-density-demo > p, .reveal .gaussian-density-demo > p {
  margin: .45em 0 0;
  color: var(--example-muted);
  font-size: .73em;
}
@media (max-width: 1150px) {
  .clustering-handout .gaussian-equation-demo { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media print {
  .gaussian-equation-demo { break-inside: avoid; }
  .gaussian-density-controls input { display: none; }
}

.gmm-blue { --gmm-color: var(--plot-blue); }
.gmm-orange { --gmm-color: var(--plot-orange); }
.gmm-green { --gmm-color: var(--plot-green); }
.gmm-neutral { --gmm-color: var(--example-text); }
.gmm-demo .gmm-toolbar { justify-content: space-between; }
.gmm-toolbar p, .reveal .gmm-toolbar p { margin: 0; color: var(--example-muted); font-size: .84em; }
.gmm-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 195px), 1fr));
  gap: 8px 24px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--example-edge);
}
.gmm-controls label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  align-items: center;
  font-size: .87em;
}
.gmm-controls label span { color: var(--gmm-color); }
.gmm-controls output { font-variant-numeric: tabular-nums; }
.gmm-controls input {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  accent-color: var(--gmm-color);
}
.gmm-panel { padding: 14px 24px; }
[data-gmm-demo="posterior"] .gmm-panel {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 22px;
}
.gmm-panel figure, .reveal .gmm-panel figure { width: 100%; min-width: 0; margin: 0; }
.gmm-panel .density-plot { height: 325px; max-height: none; }
.reveal [data-gmm-demo="density"] .density-plot { height: 350px; }
.gmm-legend, .reveal .gmm-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 19px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: .73em;
}
.gmm-legend li::before {
  content: "";
  display: inline-block;
  width: 1.1em;
  margin-right: .38em;
  vertical-align: .23em;
  border-top: 2px dashed var(--gmm-color);
}
.gmm-legend .gmm-green::before { border-top-style: solid; }
.gmm-panel .gmm-calculation { display: grid; gap: .45em; min-width: 0; }
.gmm-calculation-step {
  border: 1px solid var(--example-edge);
  border-radius: 8px;
  padding: .38em .6em;
  background: var(--example-surface);
}
.gmm-calculation-step h3, .reveal .gmm-calculation-step h3 {
  margin: 0;
  color: var(--gmm-color, var(--example-text));
  font: 650 .97em/1.3 "Segoe UI", Arial, sans-serif;
}
.gmm-calculation-step p, .reveal .gmm-calculation-step p {
  margin: .1em 0 .23em;
  color: var(--example-muted);
  font-size: .79em;
}
.gmm-calculation-step dl, .reveal .gmm-calculation-step dl { display: grid; gap: .12em; margin: 0; }
.gmm-calculation-step dl > div {
  display: grid;
  grid-template-columns: minmax(0, 5em) minmax(0, 1fr);
  align-items: baseline;
  gap: .3em;
}
.gmm-calculation-step dt { margin: 0; color: var(--gmm-color); font-size: .83em; font-weight: 650; }
.gmm-calculation-step dd, .gmm-calculation-step output {
  margin: 0;
  color: var(--example-text);
  font-size: .92em;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 380px) {
  .clustering-handout .gmm-calculation-step dl > div { grid-template-columns: 1fr; gap: 0; }
}
.reveal .clustering-slide .posterior-notation, .clustering-handout .posterior-notation {
  display: grid;
  grid-template-columns: .87fr 1.1fr 1.03fr;
  gap: 25px;
}
.reveal .posterior-notation h3, .posterior-notation h3 {
  margin: 0 0 7px;
  color: #8ce7d5;
  font-size: 25px;
}
.reveal .posterior-notation p, .posterior-notation p {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.38;
}
.posterior-notation p:last-child { margin: 0; }
.clustering-handout .posterior-notation {
  margin-top: 12px;
  padding: 15px;
  border-left: 3px solid #007e70;
  background: #eff5f3;
}
.clustering-handout .posterior-notation h3 { color: #006d67; font-size: 17px; }
.clustering-handout .posterior-notation p { font-size: 15px; }
.clustering-handout .gmm-panel .density-plot { height: auto; }
@media (max-width: 800px) {
  .clustering-handout [data-gmm-demo="posterior"] .gmm-panel,
  .clustering-handout .posterior-notation { grid-template-columns: 1fr; gap: 14px; }
}
.reveal .clustering-slide .bayes-notation {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 28px;
}
.clustering-handout .bayes-notation { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.bayes-notation .notation-summary {
  grid-column: 1 / -1;
  border-top: 1px solid #3c5269;
  padding-top: .55em;
}
.clustering-handout .bayes-notation .notation-summary { border-color: #bed2d2; }
@media (max-width: 520px) {
  .clustering-handout .bayes-notation { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .gmm-controls { display: none; }
}
.walkthrough-stages { display: grid; }
.walkthrough-stage {
  display: grid;
  grid-area: 1 / 1;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 14px;
}
.walkthrough-stage[hidden] { display: grid; visibility: hidden; }
.walkthrough-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(65px, auto) 1fr;
  align-items: start;
  gap: 8px 20px;
  min-height: 188px;
  padding: 18px 25px;
  border: 1px solid #345467;
  border-radius: 10px;
  background: #14262f;
}
.reveal .walkthrough-equation h3 {
  margin: 4px 0 0;
  color: #8ce7d5;
  font-size: 27px;
}
.walkthrough-equation > .lesson-formula {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: center;
  padding: 8px 0;
  font-size: 37px;
}
.walkthrough-previous {
  grid-column: 2;
  color: #afc0cf;
  text-align: right;
  font-size: 17px;
}
.walkthrough-previous .lesson-formula { justify-content: end; font-size: 21px; }
.reveal .walkthrough-stage > .walkthrough-explanation {
  margin: 0;
  padding: 13px 19px;
  border-left: 3px solid #4bd7c6;
  background: #142a2e;
  color: #e0edf4;
  font-size: 24px;
  line-height: 1.4;
}
.handout-walkthrough { padding-left: 1.5em; }
.handout-walkthrough li { margin-block: 1em; break-inside: avoid; }
.handout-walkthrough .lesson-formula { margin-top: .5em; }
.training-loop {
  --loop-arrow: #84e6d4;
  --loop-parameter: #a7cbff;
  --loop-membership: #ffd289;
  color: #e2edf7;
}
.training-loop ol, .reveal .training-loop ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 64px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.training-loop li {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  min-width: 0;
  gap: 7px;
  position: relative;
  padding: 23px 26px;
  border: 1px solid #34475f;
  border-radius: 12px;
  background: #151f2e;
}
.training-loop li:first-child::after {
  content: "→";
  position: absolute;
  inset-inline-start: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 29px;
  color: var(--loop-arrow);
}
.training-loop h3, .reveal .training-loop h3 {
  margin: 0 0 .4em;
  color: var(--loop-arrow);
  font-size: 27px;
}
.training-loop p, .reveal .training-loop p { margin: 0; font-size: 24px; line-height: 1.4; }
.training-loop .lesson-formula { padding: 5px 0; font-size: 28px; }
.training-loop .loop-parameter { color: var(--loop-parameter); }
.training-loop .loop-membership { color: var(--loop-membership); }
.training-loop p.training-return, .reveal .training-loop p.training-return {
  margin-top: 13px;
  text-align: center;
  color: var(--loop-arrow);
}
.training-return span { margin-right: .35em; font-size: 1.18em; }
.clustering-handout .training-loop {
  --loop-arrow: #007469;
  --loop-parameter: #17528b;
  --loop-membership: #854709;
  color: #26394b;
}
.clustering-handout .training-loop li { padding: 15px; border-color: #c2d7d6; background: #eff5f3; }
.clustering-handout .training-loop h3 { font-size: 18px; }
.clustering-handout .training-loop p { font-size: 16px; }
.clustering-handout .training-loop .lesson-formula { padding: 7px 0; font-size: clamp(15px, 4.7vw, 20px); }
[data-example="em-rounds"] > [aria-live] { display: grid; }
[data-example="em-rounds"] .example-panel { grid-area: 1 / 1; }
[data-example="em-rounds"] .example-panel[hidden] { display: grid; visibility: hidden; }
.em-round-changes, .reveal .em-round-changes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  font-size: .79em;
}
.em-round-changes > div { border: 1px solid var(--example-edge); border-radius: 7px; padding: 6px 10px; }
.em-round-changes dt { color: var(--example-muted); }
.em-round-changes dd, .reveal .em-round-changes dd { font-weight: 650; margin: 0; }
.em-round-changes[data-em-phase="e"] > div:last-child dd,
.em-round-changes[data-em-phase="m"] > div:first-child dd { color: var(--plot-green); }
.em-round-stats, .reveal .em-round-stats {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  font-size: .9em;
}
.em-round-stats strong { margin-right: .3em; }
.em-round-plot .em-observation { fill: var(--example-muted); }
.em-round-plot .em-inspected { fill: var(--example-surface); stroke: var(--example-text); stroke-width: 2.5px; }
.em-round-plot text.em-axis-title { text-anchor: start; font-size: 18px; }
.em-round-visual { align-self: start; min-width: 0; }
.em-round-visual > p, .reveal .em-round-visual > p {
  margin: 5px 0 0;
  text-align: center;
  font-size: .84em;
  color: var(--example-text);
}
.em-membership {
  height: .48em;
  margin: 0 10% 4px;
  overflow: hidden;
  border-radius: 100px;
  background: var(--plot-orange);
}
.em-membership > span { display: block; width: var(--share); height: 100%; background: var(--plot-blue); }
@media (max-width: 1140px) {
  .clustering-handout .training-loop ol { grid-template-columns: 1fr; gap: 28px; }
  .clustering-handout .training-loop li:first-child::after {
    content: "↓";
    inset-inline-start: calc(50% - .25em);
    top: calc(100% + 4px);
    transform: none;
    font-size: 18px;
  }
}
@media print {
  #chapter-em-rounds .print-proof {
    --example-text: #24384a;
    --example-muted: #3a5061;
    --example-edge: #a5b8bc;
    --example-surface: white;
    --plot-orange: #bc5321;
    --plot-blue: #1f68a5;
    --plot-green: #006d67;
  }
  #chapter-em-rounds .print-proof li { break-inside: avoid; }
  #chapter-em-rounds .print-proof .example-plot { max-height: 3.6cm; }
}
.single-clustering-example .course-home-button,
.single-clustering-example .deck-nav,
.single-clustering-example .lesson-tag,
.single-clustering-example .slide-number,
.single-clustering-example .progress { display: none !important; }

/* Reading layout */
.clustering-handout {
  color: #26394b;
  background: #fdfdfa;
  margin: 0;
  font: 18px/1.62 Georgia, serif;
}
.clustering-handout * { box-sizing: border-box; }
.clustering-handout a { color: #006d67; text-underline-offset: .18em; }
.clustering-handout :focus-visible, .lesson-example :focus-visible { outline: 3px solid #d48b2c; outline-offset: 3px; }
.clustering-handout .skip-link { position: absolute; left: .7rem; top: -5rem; padding: 10px; z-index: 4; background: white; }
.clustering-handout .skip-link:focus { top: .5rem; }
.handout-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 26px;
  padding: 13px max(20px, calc((100vw - 1290px)/2));
  background: #122435;
  color: #f5f9ff;
  font: 15px/1.5 "Segoe UI", Arial, sans-serif;
}
.handout-top a { color: #98e6d6; }
.handout-page { display: grid; grid-template-columns: 245px minmax(0,950px); gap: 55px; max-width: 1340px; padding: 46px 24px 90px; margin: 0 auto; }
.handout-contents {
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
  position: sticky;
  top: 16px;
  padding: 14px 17px;
  background: #eff5f3;
  border-radius: 12px;
  font: 14px/1.45 "Segoe UI", Arial, sans-serif;
}
.handout-contents h2 { font-size: 19px; margin-top: 0; }
.handout-contents p { font-weight: 650; }
.handout-contents ul { padding-left: 1em; }
.handout-contents li { margin: .4em 0; }
.handout-hero h1, .clustering-handout h2 { font-family: "Segoe UI", Arial, sans-serif; line-height: 1.2; }
.handout-hero h1 { font-size: clamp(40px, 5vw, 62px); margin: 0; letter-spacing: -.033em; }
.chapter-topic { color: #006d67; font: 650 13px/1.45 "Segoe UI", Arial, sans-serif; letter-spacing: .055em; text-transform: uppercase; }
.chapter { border-top: 1px solid #c8d7dc; padding: 25px 0; scroll-margin-top: 12px; }
.chapter h2 { font-size: 28px; margin: .35em 0 .5em; }
.clustering-handout .lesson-formula {
  overflow-x: auto;
  justify-content: safe center;
  padding: 16px;
  border-radius: 8px;
  background: #edf5f3;
  font-size: 22px;
}
.clustering-handout .lesson-example {
  --example-text: #24384a;
  --example-muted: #3a5061;
  --example-edge: #bed2d2;
  --example-surface: #f0f7f5;
  --plot-orange: #bc5321;
  --plot-blue: #1f68a5;
  --plot-green: #007e70;
  font-size: 16px;
}
.clustering-handout .proof-panel .lesson-formula { font-size: 18px; }
.handout-lab iframe { display: block; margin-top: 12px; width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 8px; background: #101924; }
.handout-lab > a { margin-left: .65em; font: 15px "Segoe UI", Arial, sans-serif; }
.handout-lab button { color: #006d67; font-family: "Segoe UI", Arial, sans-serif; }
.clustering-handout .lesson-links a { background: #eff6f3; border-color: #c2d7d6; color: #0c655f; }
.clustering-handout .lesson-links span { color: #25546a; }
.print-proof, .print-plot { display: none; }
@media (max-width: 800px) {
  .handout-page { display: block; padding: 28px 20px 55px; }
  .handout-contents { position: static; max-height: 220px; margin-bottom: 25px; }
  .clustering-handout .example-panel.with-visual { grid-template-columns: 1fr; }
  .clustering-handout .lesson-links { grid-template-columns: 1fr; }
}
@media print {
  .handout-page { display: block; padding: 0; }
  .handout-top, .handout-contents, .skip-link, .handout-lab iframe,
  .handout-lab button, .handout-lab a, .example-toolbar, .lesson-links { display: none !important; }
  .clustering-handout { font-size: 11pt; }
  .chapter h2 { font-size: 16pt; break-after: avoid; }
  .print-proof, .print-plot { display: block; }
  .print-plot { max-width: 100%; max-height: 11cm; }
  .lesson-example:has(+ .print-proof) { display: none; }
  .lesson-formula, .lesson-example { break-inside: avoid; }
}


/* Part 1 application cards, method previews and worked diagrams. */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.concept-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.linkage-overview .concept-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.linkage-overview .concept-copy { border-top: 1px solid #34475f; }
.linkage-arc { fill: none; stroke: #77decf; stroke-width: 3; }
.linkage-arc-muted { stroke: #667a93; stroke-width: 1.5; stroke-dasharray: 6 5; }
.linkage-mean { fill: #101924; stroke-width: 3; }
.linkage-position, .linkage-distance {
  fill: #e5eef8;
  text-anchor: middle;
  font: 20px "Segoe UI", Arial, sans-serif;
}
.linkage-distance {
  fill: #a9f1e0;
  font-weight: 650;
  paint-order: stroke;
  stroke: #101924;
  stroke-width: 5px;
  stroke-linejoin: round;
}
.linkage-worked { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 20px; }
.linkage-worked figure, .reveal .linkage-worked figure {
  display: grid;
  align-content: center;
  width: auto;
  margin: 0;
  background: #101924;
}
.linkage-worked figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 26px;
  padding: 8px 12px 16px;
  color: #e5eef8;
  font-size: 19px;
}
.linkage-formulas { display: grid; align-content: center; padding: 12px 18px; }
.linkage-formulas > div { min-width: 0; padding: 9px 0; }
.linkage-formulas h3, .reveal .linkage-formulas h3 {
  margin: 0 0 6px;
  font-size: 22px;
  color: #8ce7d5;
}
.linkage-formulas .lesson-formula { padding: 7px 0; font-size: 28px; }
.linkage-substitution { border-top: 1px solid #34475f; color: #a9f1e0; }
.clustering-handout .linkage-overview .concept-copy { border-color: #c2d7d6; }
.clustering-handout .linkage-worked figure { background: #101924; }
.clustering-handout .linkage-worked figcaption { font-size: 14px; }
.clustering-handout .linkage-formulas h3 { font-size: 16px; color: #006d67; }
.clustering-handout .linkage-formulas .lesson-formula { padding: 7px 0; font-size: 17px; }
.clustering-handout .linkage-substitution { color: #006d67; border-color: #c2d7d6; }
@media (max-width: 1150px) {
  .clustering-handout .linkage-worked { grid-template-columns: 1fr; }
  .clustering-handout .linkage-overview .concept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .clustering-handout .linkage-overview .concept-grid { grid-template-columns: 1fr; }
  .clustering-handout .linkage-formulas { padding-inline: 8px; }
  .clustering-handout .linkage-formulas .lesson-formula { font-size: clamp(12px, 3.75vw, 17px); }
}

:is([data-example="linkage"], [data-example="next-merge"]) .concept-plot {
  max-height: 390px;
  border-radius: 8px;
}
.hierarchy-plot-label {
  paint-order: stroke;
  stroke: #101924;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.hierarchy-centroid { fill: #101924; stroke-width: 3px; }
.hierarchy-other { opacity: .63; }
.example-copy > .hierarchy-calculation, .reveal .example-copy > .hierarchy-calculation {
  margin-top: .75em;
  padding: .5em .65em;
  border-radius: 6px;
  background: var(--example-surface);
  color: var(--example-text);
  font-variant-numeric: tabular-nums;
}
.hierarchy-calculation strong, .hierarchy-winner { color: var(--plot-green); }
.hierarchy-pair-distances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .3em .85em;
  margin-top: .65em;
  padding-inline: .65em;
  font-size: .88em;
  color: var(--example-muted);
}
.hierarchy-pair-distances strong {
  margin-left: .35em;
  color: var(--example-text);
  font-variant-numeric: tabular-nums;
}
.hierarchy-candidates, .reveal .hierarchy-candidates {
  width: 100%;
  margin: .8em 0 0;
  border-collapse: collapse;
  font-size: .86em;
  line-height: 1.3;
}
.hierarchy-candidates :is(th, td), .reveal .hierarchy-candidates :is(th, td) {
  padding: .4em .5em;
  border: 0;
  border-bottom: 1px solid var(--example-edge);
  text-align: left;
}
.hierarchy-candidates tbody th { font-weight: 500; }
.hierarchy-candidates tbody td:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hierarchy-candidates .hierarchy-winner { background: var(--example-surface); }
.hierarchy-candidates td strong { display: block; font-size: .85em; }
@media (max-width: 1150px) {
  .clustering-handout :is([data-example="linkage"], [data-example="next-merge"]) .example-panel.with-visual {
    grid-template-columns: 1fr;
  }
}

.hierarchy-applications .concept-card {
  display: grid;
  grid-template-rows: auto 1fr;
}
.hierarchy-levels, .reveal .hierarchy-levels {
  display: grid;
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0 23px 20px;
  font-size: 22px;
  line-height: 1.35;
}
.hierarchy-levels > div {
  padding: 10px 12px;
  background: #101924;
  border-left: 3px solid #78acf9;
  border-radius: 0 7px 7px 0;
}
.hierarchy-levels > div + div { border-left-color: #55dfc8; }
.hierarchy-levels dt { font-weight: 650; color: #a7cbff; }
.hierarchy-levels > div + div dt { color: #a9f1e0; }
.hierarchy-levels dd, .reveal .hierarchy-levels dd { margin: 3px 0 0; }
.clustering-handout .hierarchy-levels { padding: 0 14px 14px; font-size: 15px; }
.clustering-handout .hierarchy-levels > div { background: white; }
.clustering-handout .hierarchy-levels dt { color: #17528b; }
.clustering-handout .hierarchy-levels > div + div dt { color: #006d67; }
.total-probability {
  --route-surface: #151f2e;
  --route-edge: #34475f;
  --route-blue: #88b7ff;
  --route-orange: #ffad76;
  --route-total: #8ce7d5;
  display: grid;
  gap: 14px;
}
.probability-route, .probability-result > div {
  min-width: 0;
  padding: 14px 20px;
  border: 1px solid var(--route-edge);
  border-radius: 11px;
  background: var(--route-surface);
  text-align: center;
}
.probability-route { --route-color: var(--route-blue); border-top: 3px solid var(--route-color); }
.probability-route:nth-child(2) { --route-color: var(--route-orange); }
.probability-route h3, .reveal .probability-route h3 {
  color: var(--route-color);
  margin: 0 0 6px;
  font-size: 25px;
}
.total-probability p, .reveal .total-probability p { margin: 3px 0; font-size: 22px; line-height: 1.3; }
.probability-question { text-align: center; }
.probability-bar {
  max-width: 365px;
  height: 9px;
  margin: 11px auto 8px;
  border-radius: 40px;
  background: var(--route-edge);
  overflow: hidden;
}
.probability-bar span {
  display: block;
  width: var(--short-song-rate);
  height: 100%;
  background: var(--route-color);
}
.total-probability .lesson-formula { margin-block: 7px; font-size: 28px; }
.probability-result { display: grid; grid-template-columns: .84fr 1.16fr; gap: 22px; }
.probability-overall {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
}
.probability-result > .probability-overall { border-color: var(--route-total); }
.probability-overall h3, .reveal .probability-overall h3 {
  margin: 0;
  color: var(--route-total);
  font-size: 24px;
}
.probability-overall .lesson-formula { color: var(--route-total); }
.clustering-handout .total-probability {
  --route-surface: #eff5f3;
  --route-edge: #c2d7d6;
  --route-blue: #2366a1;
  --route-orange: #ab512a;
  --route-total: #006d67;
}
.clustering-handout .total-probability h3 { font-size: 18px; }
.clustering-handout .total-probability p { font-size: 16px; }
.clustering-handout .total-probability .lesson-formula { padding: 6px 0; font-size: 20px; }
@media (max-width: 800px) {
  .clustering-handout .probability-result { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 520px) {
  .clustering-handout .total-probability .concept-grid { grid-template-columns: 1fr; gap: 14px; }
  .clustering-handout .probability-result > div { padding-inline: 8px; }
  .clustering-handout .probability-result .lesson-formula { font-size: 17px; }
}
.concept-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #34475f;
  border-radius: 16px;
  background: #151f2e;
}
.concept-copy { padding: 22px 26px; }
.concept-copy h3,
.reveal .concept-copy h3 {
  margin: 0 0 .35em;
  color: #75e0d1;
  font: 660 27px/1.25 "Segoe UI", Arial, sans-serif;
}
.concept-copy p,
.reveal .concept-copy p {
  margin: 0;
  color: #e1eaf6;
  font: 23px/1.4 "Segoe UI", Arial, sans-serif;
}
.cluster-photo {
  aspect-ratio: 16 / 9;
  background: #152a39 url("../images/clustering-applications.png") no-repeat 0 58% / 300% auto;
}
.cluster-photo.photo-1 { background-position-x: 50%; }
.cluster-photo.photo-2 { background-position-x: 100%; }
.concept-plot { display: block; width: 100%; background: #101924; }
.concept-card > .concept-plot { max-height: 310px; }
.concept-plot .concept-p0, .chip-0 { fill: #88b7ff; background-color: #88b7ff; }
.concept-plot .concept-p1, .chip-1 { fill: #ffad76; background-color: #ffad76; }
.concept-plot .concept-p2, .chip-2 { fill: #68ddc8; background-color: #68ddc8; }
.concept-plot .concept-pneutral { fill: #dce9f8; }
.concept-stroke-0 { stroke: #88b7ff; }
.concept-stroke-1 { stroke: #ffad76; }
.concept-stroke-2 { stroke: #68ddc8; }
.concept-line, .concept-contour, .concept-axis, .concept-cross,
.concept-dash, .concept-ray, .concept-gridline { fill: none; }
.concept-line, .concept-cross { stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; }
.concept-contour { stroke-width: 2.5px; }
.concept-cross { paint-order: stroke; }
.concept-axis { stroke: #667a93; stroke-width: 1.5px; }
.concept-gridline { stroke: #293a50; }
.concept-dash { stroke: #b2c8df; stroke-width: 1.5px; stroke-dasharray: 6 5; }
.concept-ray { opacity: .77; stroke-width: 2; }
.concept-selected { fill: #101924; stroke: #f1f7ff; stroke-width: 3; }
.concept-hint { fill: #e5eef8; font: 15px "Segoe UI", Arial, sans-serif; }
[data-example="first-merge"] .concept-plot { max-height: 390px; border-radius: 8px; }
[data-example="first-merge"] .first-merge-guide {
  paint-order: stroke;
  stroke: #101924;
  stroke-width: 4px;
  stroke-linejoin: round;
}
[data-example="first-merge"] .example-copy .lesson-formula { margin-top: .65em; }
.clustering-handout [data-example="first-merge"] .lesson-formula { font-size: clamp(14px, 3.8vw, 20px); }

.voronoi-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 1em;
  align-items: center;
  padding: .8em 1em;
}
.voronoi-demo .concept-plot {
  box-sizing: border-box;
  max-height: 430px;
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
}
.voronoi-demo .concept-gridline { stroke: #b6c8dd; opacity: .14; }
.voronoi-area { fill: #101924; stroke: #667a93; }
.voronoi-color-1 { --cell-color: #8ab9ff; }
.voronoi-color-2 { --cell-color: #ffb187; }
.voronoi-color-3 { --cell-color: #65dec4; }
.voronoi-demo polygon {
  fill: var(--cell-color);
  fill-opacity: .18;
  stroke: var(--cell-color);
  stroke-opacity: .65;
  stroke-width: 1.2;
}
.voronoi-demo line {
  pointer-events: none;
  stroke: var(--cell-color);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  opacity: .7;
}
.voronoi-demo line[data-nearest] { stroke-width: 3; stroke-dasharray: none; opacity: 1; }
.voronoi-demo [data-voronoi-marker] { cursor: grab; outline: none; }
.voronoi-demo [data-voronoi-marker]:active { cursor: grabbing; }
.voronoi-demo [data-voronoi-marker] circle {
  fill: var(--cell-color);
  stroke: #101924;
  stroke-width: 2;
}
.voronoi-demo [data-voronoi-marker] text {
  fill: #101924;
  font: 700 15px "Segoe UI", Arial, sans-serif;
  pointer-events: none;
}
.voronoi-demo [data-voronoi-marker="0"] path {
  fill: #f8fafc;
  stroke: #101924;
  stroke-width: 2.5;
}
.voronoi-demo [data-voronoi-marker]:focus-visible :is(circle, path) {
  stroke: #fff3a8;
  stroke-width: 3;
}
.voronoi-readout > p, .reveal .voronoi-readout > p {
  margin: 0 0 .65em;
  color: var(--example-muted);
  font-size: .96em;
}
.voronoi-result {
  display: grid;
  gap: .1em;
  border-left: 3px solid var(--plot-green);
  padding: .35em .6em;
  background: var(--example-surface);
  font-variant-numeric: tabular-nums;
}
.voronoi-result strong { color: var(--plot-green); font-size: 1.2em; }
.voronoi-readout > .voronoi-distance-label, .reveal .voronoi-readout > .voronoi-distance-label {
  margin: .55em 0 0;
  font-size: .82em;
}
.voronoi-distances, .reveal .voronoi-distances {
  display: grid;
  width: 100%;
  margin: .4em 0;
  font-size: .88em;
}
.voronoi-distances > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .65em;
  padding: .3em .55em;
  border-bottom: 1px solid var(--example-edge);
}
.voronoi-distances > div[data-nearest] { font-weight: 700; }
.voronoi-distances dt, .reveal .voronoi-distances dt { margin: 0; font-weight: inherit; }
.voronoi-distances dd, .reveal .voronoi-distances dd { margin: 0; font-variant-numeric: tabular-nums; }
.voronoi-distances i {
  display: inline-block;
  width: .56em;
  height: .56em;
  margin-right: .55em;
  border-radius: 50%;
  background: var(--cell-color);
}
.voronoi-actions { padding: .35em 0 0; border: 0; font-size: .85em; }
@media (max-width: 900px) {
  .clustering-handout .voronoi-layout { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .voronoi-demo { break-inside: avoid; print-color-adjust: exact; }
}

#hard-membership .concept-plot, #chapter-hard-membership .concept-plot {
  box-sizing: border-box;
  max-height: 340px;
  padding: 16px;
  border: 1px solid #34475f;
  border-radius: 14px;
}
.gaussian-spread .concept-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.gaussian-spread .concept-hint { font-size: 16px; }
.silhouette-build > .formula-toolbar { margin-bottom: 17px; }
.silhouette-worked { display: grid; align-items: stretch; gap: 22px; grid-template-columns: 1.1fr 1fr; }
.silhouette-worked .concept-card { display: flex; flex-direction: column; justify-content: center; background: #101924; }
.silhouette-worked .concept-plot { max-height: 355px; }
.silhouette-worked .concept-copy { padding-block: 12px 20px; text-align: center; }
.silhouette-steps { display: flex; flex-direction: column; gap: 15px; justify-content: center; min-width: 0; }
.silhouette-means {
  display: grid;
  padding: 12px 20px;
  border: 1px solid #34475f;
  border-radius: 12px;
  background: #151f2e;
  color: #e1eaf6;
  font: 23px/1.3 "Segoe UI", Arial, sans-serif;
}
.silhouette-means > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
}
.silhouette-means > div + div { border-top: 1px solid #34475f; }
.silhouette-means > div:has(> [data-formula-hidden]) > span { opacity: .62; }
.silhouette-means .lesson-formula { justify-content: end; }
.concept-chip { display: inline-block; width: .55em; height: .55em; border-radius: 50%; margin-right: .45em; }
.reveal .silhouette-score .lesson-formula {
  font-size: 33px;
  padding: 15px;
  background: #152632;
  border: 1px solid #375263;
  border-radius: 12px;
}
.reveal #elbow-rule .concept-plot { max-height: 345px; }
.clustering-handout .concept-card { background: #eff5f3; border-color: #c2d7d6; }
.clustering-handout .concept-copy { padding: 13px 16px; }
.clustering-handout .concept-copy h3 { color: #006d67; font-size: 18px; }
.clustering-handout .concept-copy p { color: #26394b; font-size: 15px; }
.clustering-handout .silhouette-means {
  color: #26394b;
  background: #eff5f3;
  border-color: #c2d7d6;
  padding: 5px 11px;
  font-size: 14px;
}
.clustering-handout .silhouette-means > div + div { border-color: #c2d7d6; }
.clustering-handout .silhouette-means .lesson-formula { padding: 0; font-size: 16px; }
.clustering-handout .silhouette-score .lesson-formula { font-size: clamp(16px, 2.3vw, 20px); }
@media (max-width: 800px) {
  .clustering-handout .concept-grid, .clustering-handout .silhouette-worked { grid-template-columns: 1fr; }
}


.feature-example {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}
.feature-table,
.reveal .feature-table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #34475f;
  border-radius: 12px;
  overflow: hidden;
  background: #151f2e;
  color: #e1eaf6;
  text-align: left;
  font: 24px/1.35 "Segoe UI", Arial, sans-serif;
}
.feature-table caption {
  padding: 0 0 12px;
  color: #c0d1e4;
  text-align: left;
  font-weight: 600;
}
.feature-table th,
.feature-table td,
.reveal .feature-table th,
.reveal .feature-table td {
  padding: 11px 18px;
  border: 0;
}
.feature-table thead { background: #192a3b; }
.feature-table thead th { color: #9aebdf; }
.feature-table tbody tr + tr > * { border-top: 1px solid #34475f; }
.feature-table .feature-selected { background: #204149; }
.feature-table .feature-selected > * { font-weight: 700; }
.reveal .feature-example .lesson-formula {
  padding: 22px;
  border: 1px solid #34475f;
  border-radius: 12px;
  background: #151f2e;
  font-size: 28px;
}
.clustering-handout .feature-example { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.clustering-handout .feature-table { color: #26394b; background: #f1f7f5; border-color: #c2d7d6; font-size: 17px; }
.clustering-handout .feature-table caption,
.clustering-handout .feature-table thead th { color: #215050; }
.clustering-handout .feature-table thead,
.clustering-handout .feature-table .feature-selected { background: #dcefeb; }
.clustering-handout .feature-table tbody tr + tr > * { border-color: #c2d7d6; }


@media (max-width: 600px) {
  .clustering-handout .feature-table th,
  .clustering-handout .feature-table td { padding: 9px 7px; }
}

.one-hot-example {
  --one-hot-edge: #3a5065;
  --one-hot-panel: #131e2c;
  --one-hot-tile: #1c2b3d;
  --one-hot-ink: #e8f0fa;
  --one-hot-muted: #b1c4db;
  --one-hot-accent: #8cf1da;
  --one-hot-selected: #214b49;
  color: var(--one-hot-ink);
  background: var(--one-hot-panel);
  border: 1px solid var(--one-hot-edge);
  border-radius: 16px;
  padding: 22px 28px;
  font: 22px/1.3 "Segoe UI", Arial, sans-serif;
}
.one-hot-flow {
  display: grid;
  grid-template-columns: minmax(0, .82fr) auto minmax(0, 1.35fr);
  align-items: center;
  gap: 34px;
  max-width: 1180px;
  margin: 0 auto;
}
.one-hot-assignment {
  background: var(--one-hot-tile);
  border-radius: 12px;
  padding: 21px 25px;
}
.one-hot-assignment > span {
  color: var(--one-hot-muted);
  font-weight: 650;
}
.one-hot-assignment p {
  margin: 6px 0 0;
  font-size: 1.22em;
}
.one-hot-assignment strong { color: var(--one-hot-accent); }
.one-hot-arrow {
  color: var(--one-hot-accent);
  font-size: 2em;
}
.one-hot-table,
.reveal .one-hot-table {
  width: calc(100% + 20px);
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 10px 5px;
  margin: 0 -10px;
}
.one-hot-table caption {
  font-weight: 650;
  font-size: 1.02em;
  color: var(--one-hot-ink);
  text-align: left;
  margin: 0 10px 4px;
}
.one-hot-table th,
.one-hot-table td,
.reveal .one-hot-table th,
.reveal .one-hot-table td {
  text-align: center;
  border: 0;
  padding: 0;
}
.one-hot-table th { color: var(--one-hot-muted); }
.one-hot-table td {
  font-weight: 700;
  font-size: 2.25em;
  font-variant-numeric: tabular-nums;
  color: var(--one-hot-muted);
  background: var(--one-hot-tile);
  border-radius: 10px;
}
.one-hot-table .one-hot-active {
  color: var(--one-hot-accent);
  background: var(--one-hot-selected);
  box-shadow: inset 0 0 0 2px var(--one-hot-accent);
}
.one-hot-example > .lesson-formula {
  border-top: 1px solid var(--one-hot-edge);
  margin-top: 16px;
  padding-top: 14px;
  font-size: 1.28em;
}
.clustering-handout .one-hot-example {
  --one-hot-edge: #c2d7d6;
  --one-hot-panel: #f1f7f5;
  --one-hot-tile: #e3edee;
  --one-hot-ink: #233a4c;
  --one-hot-muted: #3c5669;
  --one-hot-accent: #00675d;
  --one-hot-selected: #d3eee6;
  font-size: 17px;
}
.clustering-handout .one-hot-flow { gap: 18px; }
.clustering-handout .one-hot-example > .lesson-formula {
  background: transparent;
  padding: 12px 0 0;
  border-radius: 0;
}
@media (max-width: 600px) {
  .clustering-handout .one-hot-example { padding: 16px; }
  .clustering-handout .one-hot-flow {
    grid-template-columns: minmax(0,1fr);
    gap: 8px;
  }
  .clustering-handout .one-hot-assignment { padding: 12px 16px; }
  .clustering-handout .one-hot-arrow { justify-self: center; transform: rotate(90deg); }
  .clustering-handout .one-hot-example > .lesson-formula { font-size: 16px; }
}


.reveal .theory-slide .formula-build {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 17px;
  padding-top: 17px;
}
.formula-build > math { align-self: center; }
.formula-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #34465a;
  padding-bottom: 13px;
  font: 21px/1.3 "Segoe UI", Arial, sans-serif;
}
.formula-toolbar[hidden] { display: none; }
.formula-status,
.formula-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.formula-status > [data-formula-count] {
  color: #c1cfe0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.formula-status > [data-formula-label] { color: #a9f1e0; }
.formula-actions button {
  border: 1px solid #4a6377;
  border-radius: 7px;
  padding: 7px 14px;
  background: #1a2a3a;
  color: #edf4fb;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.formula-actions button[data-formula-next]:enabled {
  background: #8ce7d5;
  border-color: #8ce7d5;
  color: #112525;
}
.formula-actions button:disabled { opacity: .45; cursor: default; }
.formula-actions button:focus-visible { outline: 3px solid #ffd17d; outline-offset: 3px; }
.formula-build [data-formula-hidden] { visibility: hidden; }
.formula-build [data-formula-current] { color: #a9f1e0; }
@media print {
  .formula-toolbar { display: none !important; }
  .formula-build [data-formula-hidden] { visibility: visible; }
  .formula-build [data-formula-current] { color: inherit; }
  .silhouette-means > div:has(> [data-formula-hidden]) > span { opacity: 1; }
}


[data-example="assignment"] .example-copy .lesson-formula {
  justify-content: flex-start;
  margin-top: .75em;
  border-top: 1px solid var(--example-edge);
  padding-top: .55em;
  font-size: 1.12em;
}
.clustering-handout [data-example="assignment"] .example-copy .lesson-formula {
  background: transparent;
  padding-inline: 0;
}

