/* Hand-built figures for lesson 25, Similarity. a is gold, b is accent, the query is ink, in every figure. */

/* shared: planes, arrows, ticks, keys */
.sm-line { stroke: var(--line); }
.sm-axis { stroke: var(--ink-3); stroke-width: 1.2; }
.sm-tick { font: 12px var(--f-mono); fill: var(--ink-3); }
.sm-arr { --h: var(--ink-2); }
.sm-arr .sm-shaft { stroke: var(--h); stroke-width: 3; stroke-linecap: round; }
.sm-arr .sm-head { fill: var(--h); }
.sm-arr.va { --h: var(--gold); }
.sm-arr.vb { --h: var(--accent); }
.sm-arr.query { --h: var(--ink); }
.sm-arr.doc .sm-shaft { stroke-width: 2.4; }
.sm-handle { fill: var(--ink); fill-opacity: 0.12; stroke: var(--ink-2); stroke-width: 1.5; cursor: grab; touch-action: none; }
.sm-handle:focus-visible { outline: none; stroke: var(--gold); stroke-width: 3; }
.sm-check { display: inline-flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--ink-2); }
.cs-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.8rem; color: var(--ink-2); margin: 8px 0 0; }
.cs-key .k { display: inline-flex; align-items: center; gap: 6px; }
.cs-key .k::before { content: ""; width: 14px; height: 10px; border-radius: 2px; background: var(--kc); }
.k.near, .k.cut { --kc: var(--gold); }
.k.near::before, .k.cut::before { width: 3px; height: 14px; }
.k.pile { --kc: var(--accent); }
.k.pa { --kc: var(--good); }
.k.un { --kc: var(--ink-3); }
.fig .pos { color: var(--good); } .fig .neg { color: var(--bad); } .fig .zero { color: var(--gold); }

/* hero */
.sm-hero { width: 100%; height: auto; display: block; margin: 0 auto; max-width: 860px; }
.sm-hero .sm-axis { stroke: var(--line-2); }
.sm-hero .sm-arr .sm-shaft { stroke-width: 4; }
.sm-arr.hero-q { --h: var(--ink); }
.sm-arr.hero-a { --h: var(--gold); }
.sm-arr.hero-b { --h: var(--accent); }
.sm-arr.hero-c { --h: var(--good); }
.sm-hero-wedge { fill: var(--gold); fill-opacity: 0.22; }
.sm-hero-gap { stroke: var(--good); stroke-width: 2; stroke-dasharray: 5 5; }
.sm-hero-lbl { font: 500 17px var(--f-ui); }
.sm-hero-lbl.a { fill: var(--gold); } .sm-hero-lbl.b { fill: var(--accent-ink); } .sm-hero-lbl.c { fill: var(--good); } .sm-hero-lbl.q { fill: var(--ink-2); }
.sm-hero-key { display: none; }
@media (max-width: 600px) {
  .sm-hero-lbl { display: none; }
  .sm-hero-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; list-style: none; margin: 6px 16px 0; padding: 0; font-size: 0.8rem; }
  .sm-hero-key li { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
  .sm-hero-key li::before { content: ""; width: 14px; height: 4px; border-radius: 2px; background: var(--kc); }
  .sm-hero-key .a { --kc: var(--gold); } .sm-hero-key .b { --kc: var(--accent); } .sm-hero-key .c { --kc: var(--good); } .sm-hero-key .q { --kc: var(--ink); }
}

/* 1: by hand */
.hw-vecs { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; margin-bottom: 14px; }
.hw-vec { font: 1.05rem var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.hw-vec input { width: 3.4em; font: 1rem var(--f-mono); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 4px 4px 8px; }
.hw-name { font: italic 600 1.15rem var(--f-body); }
.hw-name.va { color: var(--gold); } .hw-name.vb { color: var(--accent-ink); }
.hw-presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.85rem; }
.hw-scroll { overflow-x: auto; }
.hw-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
/* on a phone the working is dropped from the cells and only each result shows, so the table fits */
@media (max-width: 560px) { .hw-work { display: none; } .hw-table th, .hw-table td { padding: 6px 5px; } }
.hw-table th, .hw-table td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.hw-table thead th { font-weight: 500; color: var(--ink-2); font-size: 0.8rem; }
.hw-table thead .muted { font-size: 0.72rem; font-weight: 400; }
.hw-table tbody th, .hw-table tfoot th { color: var(--ink-3); font-weight: 500; }
.hw-table td { font-family: var(--f-mono); color: var(--ink-2); }
.hw-table tfoot td b { color: var(--ink); }
.hw-cell { display: block; white-space: nowrap; }
.hw-bar { display: block; height: 6px; margin-top: 5px; border-radius: 3px; width: calc(var(--w) * 100%); min-width: 2px; background: var(--ink-3); }
.hw-bar.pos { background: var(--good); } .hw-bar.neg { background: var(--bad); } .hw-bar.gap { background: var(--accent); }
.hw-out { margin-top: 14px; display: grid; gap: 2px; font-size: 0.95rem; min-height: 9.5em; }
.hw-out p { margin: 0; }
.hw-k { display: inline-block; min-width: 7.5em; color: var(--ink-3); font: 0.85rem var(--f-ui); }
.hw-big { font: 400 1.5rem var(--f-display); }
.hw-verdict { font-weight: 600; margin: 0 0 4px !important; }

/* 2: the angle sweep */
.as-top, .ps-top, .cs-top, .cq-top, .tc-top, .ra-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; margin-bottom: 12px; font-size: 0.85rem; }
.as-top input[type="range"], .ps-top input[type="range"], .cs-top input[type="range"], .cq-top input[type="range"], .tc-ctl input[type="range"] { width: min(200px, 55vw); }
.ra-top .seg, .tc-top .seg { max-width: 100%; }
.ra-top .seg button, .tc-top .seg button { height: auto; min-height: 28px; padding: 4px 12px; line-height: 1.25; }
.as-grid { display: grid; gap: 14px 22px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .as-grid { grid-template-columns: 1fr 1fr; } }
.as-h { margin: 0 0 4px; font-size: 0.85rem; color: var(--ink-2); }
.as-h b { color: var(--ink); font-variant-numeric: tabular-nums; }
.as-plot, .as-arrows { width: 100%; display: block; }
.as-curve { fill: none; stroke-width: 2.4; }
.as-curve.cos, .as-dot.cos { stroke: var(--gold); }
.as-curve.dot, .as-dot.dot { stroke: var(--accent); }
.as-curve.dist, .as-dot.dist { stroke: var(--good); }
.as-dot { fill: var(--bg); stroke-width: 3; }
.as-arc { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.as-gap { stroke: var(--good); stroke-width: 2; stroke-dasharray: 5 4; }

/* 3: ranking agreement */
.ra { display: grid; gap: 18px 26px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .ra { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.ra-plane { width: 100%; max-width: 400px; margin: 0 auto; display: block; touch-action: none; }
.ra-unit { fill: none; stroke: var(--ink-3); stroke-dasharray: 4 4; }
.ra-num { font: 600 14px var(--f-mono); }
.ra-lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ra-h { margin: 0 0 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.ra-h .muted { font-weight: 400; font-size: 0.74rem; }
.ra-col ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ra-col li { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; background: var(--surface-2); font: 0.8rem var(--f-mono); color: var(--ink-2); }
.ra-chip { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--h); color: var(--bg); font-weight: 600; flex: none; }
.ra-score { font-variant-numeric: tabular-nums; }
.ra-verdict { margin: 12px 0 0; font-weight: 600; font-size: 0.9rem; min-height: 2.8em; }

/* 4: popularity */
.ps-plane { width: 100%; display: block; max-width: 620px; margin: 0 auto; }
.ps-boards { display: grid; grid-template-columns: 1fr; gap: 12px 26px; margin-top: 12px; }
@media (min-width: 640px) { .ps-boards { grid-template-columns: 1fr 1fr; } }
.ps-board { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-1, 8px); background: var(--bg-2); }
.ps-h { margin: 0 0 8px; font-weight: 600; }
.ps-row { display: grid; grid-template-columns: 5.2em 1fr 3.6em; gap: 10px; align-items: center; font-size: 0.85rem; margin: 4px 0; color: var(--ink-2); }
.ps-row b { text-align: right; font: 500 0.85rem var(--f-mono); color: var(--ink); }
.ps-row.win .ps-name::after { content: " ✓"; }
.ps-name.va { color: var(--gold); } .ps-name.vb { color: var(--accent-ink); }
.ps-bar { height: 10px; border-radius: 3px; width: calc(var(--w) * 100%); min-width: 2px; }
.ps-bar.va { background: var(--gold); } .ps-bar.vb { background: var(--accent); }
.ps-pick { margin: 8px 0 0; font-size: 0.85rem; color: var(--ink-2); }

/* 5: the curse */
.cs-read, .cq-read, .tc-read { font-size: 0.92rem; line-height: 1.6; margin: 6px 0 10px; min-height: 3.2em; }
.cs-plot, .tc-plot { width: 100%; display: block; }
.cs-bar { fill: var(--accent); fill-opacity: 0.8; }
.cs-near { stroke: var(--gold); stroke-width: 3; }

/* 6a: the cone */
.cq { display: grid; gap: 16px 26px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 860px) { .cq { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.cq-fan, .cq-scale { width: 100%; display: block; }
.sm-arr.fan { --h: var(--accent); }
.sm-arr.fan .sm-shaft { stroke-width: 1.6; opacity: 0.8; }
.sm-arr.lean { --h: var(--gold); }
.cq-band { fill: var(--good); fill-opacity: 0.85; }
.cq-un { fill: var(--ink-3); }

/* 6b: the threshold */
.tc-bar.pa { fill: var(--good); }
.tc-bar.un { fill: var(--ink-3); }
.tc-cut { stroke: var(--gold); stroke-width: 2.5; }
.tc-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 10px; font-size: 0.85rem; }
