/* Hand-built figures for lesson 30, Clustering and matching. */

/* shared: control rows, readouts, labels, chips, planes */
.cz-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-bottom: 12px; }
.cz-top .slider { font-size: 0.85rem; }
.cz-top input[type="range"] { width: min(200px, 52vw); }
.cz-buttons { margin: 12px 0 0; gap: 8px 10px; }
.cz-buttons .btn[disabled] { opacity: 0.5; cursor: default; transform: none; }
.cz-hint { font-size: 0.8rem; color: var(--ink-3); }
.cz-lbl { font: 500 0.7rem/1.4 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 6px; }
span.cz-lbl { margin: 0 4px 0 0; }
.cz-read { margin-top: 12px; min-height: 4.6em; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }
.cz-read p { margin: 0 0 4px; }
.cz-read b, .cz-sum b { font-variant-numeric: tabular-nums; }
.cz-trail { color: var(--ink-2); font: 0.84rem/1.5 var(--f-mono); }
.cz-kind { display: inline-flex; align-items: center; gap: 5px; font: 500 0.74rem/1.5 var(--f-ui); color: var(--ink-2); white-space: nowrap; }
.cz-kind::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--k); }
.cz-chip { display: inline-block; font: 600 0.78rem/1.6 var(--f-ui); padding: 1px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.cz-chip.good { color: var(--good); border-color: color-mix(in oklab, var(--good) 55%, transparent); background: color-mix(in oklab, var(--good) 10%, transparent); }
.cz-chip.bad { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 55%, transparent); background: color-mix(in oklab, var(--bad) 10%, transparent); }
.cz-plane { display: block; width: 100%; max-width: 460px; margin: 0 auto; background: var(--surface-2); border-radius: var(--r-1); touch-action: none; }
.cz-plane:focus-visible, .cz-grid:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cz-pt { stroke: var(--surface); stroke-width: 1; }
.cz-pt.gold { fill: var(--gold); }
.cz-ring { fill: none; stroke: var(--ink); stroke-width: 2; }
.cz-axis { stroke: var(--ink-3); stroke-width: 1.2; }
.cz-tag { font: 600 14px var(--f-ui); fill: var(--gold); }

/* hero: a grey pile of tickets fades into coloured groups, both laid out in the same spot */
.cz-hero { display: block; width: 100%; height: auto; }
.cz-hero-dot { fill: var(--ink-3); opacity: 0.55; }
.cz-hero-x { stroke: var(--ink-3); stroke-width: 3; stroke-linecap: round; }
.cz-hero-pile, .cz-hero-groups { transition: opacity 1.2s ease; }
.cz-hero-groups { opacity: 0; }
.cz-grouped .cz-hero-groups { opacity: 1; }
.cz-grouped .cz-hero-pile { opacity: 0; }

/* overview: the similarity grid */
.cz-gridwrap { max-width: 470px; margin: 0 auto; }
.cz-grid { display: block; width: 100%; height: auto; cursor: crosshair; }
.cz-cell { fill: var(--accent); }
.cz-sel { fill: none; stroke: var(--gold); stroke-width: 2.5; }

/* k-means */
.cz-walk { stroke-width: 1; opacity: 0.45; }
.cz-hub { cursor: grab; outline: none; }
.cz-hub-hit { fill: transparent; }
.cz-hub:focus-visible .cz-hub-hit { stroke: var(--accent); stroke-width: 2; }
.cz-hub-x { stroke-width: 4; stroke-linecap: round; fill: none; }

/* choosing k */
.cz-split { display: grid; gap: 14px 24px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .cz-split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.cz-charts { display: grid; gap: 6px; }
.cz-charts .cz-lbl { margin: 4px 0 2px; }
.cz-chart { display: block; width: 100%; max-width: 380px; height: auto; }
.cz-curve { fill: none; stroke: var(--accent); stroke-width: 2; }
.cz-dot { fill: var(--accent); }
.cz-dot-on { fill: var(--gold); stroke: var(--surface); stroke-width: 2; }
.cz-tick { font: 12px var(--f-mono); fill: var(--ink-3); }
.cz-tick.on { fill: var(--ink); font-weight: 600; }
.cz-val { font: 600 13px var(--f-mono); fill: var(--gold); }
.cz-near { stroke: var(--ink); stroke-width: 2; }

/* DBSCAN */
.cz-map { max-width: 500px; }
.cz-link { stroke: var(--ink-2); stroke-width: 1.2; opacity: 0.7; }
.cz-noise { stroke: var(--ink-3); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.cz-sum { margin: 10px 0 4px; font-size: 0.9rem; color: var(--ink-2); }
.fig ul.cz-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.82rem; color: var(--ink-2); }
.fig ul.cz-legend > li { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.cz-sw { width: 10px; height: 10px; border-radius: 50%; background: var(--k); display: inline-block; flex: none; }
.cz-sw-x { background: none; width: auto; height: auto; color: var(--ink-3); font-weight: 700; line-height: 1; }
.cz-nb { font-size: 0.84rem; color: var(--ink-2); }

/* PCA */
.cz-line { stroke: var(--accent); stroke-width: 2; }
.cz-drop { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.cz-drop.gold { stroke: var(--gold); }
.cz-foot { fill: var(--accent); }
.cz-strip { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; }

/* routing */
.fig ol.cz-reqs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .fig ol.cz-reqs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fig ol.cz-reqs > li { margin: 0; }
.cz-req { padding: 10px 12px; border-radius: var(--r-1); background: var(--surface-2); border: 1px solid var(--line); }
.cz-req-top { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 6px; }
.cz-q { font: 0.95rem/1.4 var(--f-body); color: var(--ink); margin: 0; }
.cz-bar { display: grid; grid-template-columns: 6.2em minmax(0, 1fr) 3.4em; align-items: center; gap: 8px; height: 22px; }
.cz-bar-name { font-size: 0.78rem; color: var(--ink-2); white-space: nowrap; }
.cz-bar-v { font-size: 0.78rem; color: var(--ink-2); text-align: right; }
.cz-track { position: relative; height: 12px; border-radius: 3px; background: color-mix(in oklab, var(--ink) 6%, transparent); }
.cz-track i { position: absolute; top: 0; bottom: 0; }
.cz-zero { width: 1px; background: var(--ink-3); }
.cz-fill { background: var(--ink-3); opacity: 0.55; border-radius: 2px; }
.cz-fill.win { background: var(--good); opacity: 1; }
.cz-theta { top: -4px !important; bottom: -4px !important; width: 0; border-left: 2px dashed var(--gold); }

/* the cache */
.cz-select { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-3); max-width: 100%; }
.cz-select select { font: 0.9rem var(--f-ui); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; max-width: 100%; min-width: 0; }
.cz-ctx { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.cz-ctx .seg button { font-family: var(--f-mono); font-size: 0.76rem; padding: 0 10px; }
.fig ol.cz-entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .fig ol.cz-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fig ol.cz-entries > li { margin: 0; }
.cz-entry { padding: 10px 12px; border-radius: var(--r-1); background: var(--surface-2); border: 1px solid var(--line); }
.cz-entry.out { opacity: 0.6; border-style: dashed; }
.cz-entry.best { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.cz-ans { margin: 2px 0 0; font-size: 0.88rem; color: var(--ink-2); }
.cz-meta { margin: 6px 0 0; font-size: 0.8rem; color: var(--ink-3); }
.cz-result { min-height: 3.2em; font-size: 0.92rem; line-height: 1.55; }
.cz-result p { margin: 0; }

@media (max-width: 600px) {
  .cz-bar { grid-template-columns: 5.6em minmax(0, 1fr) 3em; }
}
@media (prefers-reduced-motion: reduce) { .cz-hero-pile, .cz-hero-groups { transition: none; } }
