/* Hand-built figures for lesson 24, Word embeddings. */

/* shared: a plane beside its readout, and arrows on it */
.w2-two { display: grid; gap: 22px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .w2-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.w2-plane { width: 100%; max-width: 360px; margin: 0 auto; display: block; touch-action: none; }
.w2-grid { stroke: var(--line); }
.w2-axis { stroke: var(--ink-3); stroke-width: 1.2; }
.w2-vec { stroke-width: 3.5; stroke-linecap: round; }
.w2-name { font: 600 13px var(--f-ui); }
.w2-vec.w2-center { stroke: var(--gold); } .w2-name.w2-center, span.w2-center { fill: var(--gold); color: var(--gold); }
.w2-vec.w2-true { stroke: var(--good); } .w2-name.w2-true, span.w2-true { fill: var(--good); color: var(--good); }
.w2-vec.w2-noise { stroke: var(--bad); } .w2-name.w2-noise, span.w2-noise { fill: var(--bad); color: var(--bad); }
.w2-handle { fill: var(--ink); fill-opacity: 0.12; stroke: var(--ink-2); stroke-width: 1.5; cursor: grab; }
.w2-handle:focus-visible { outline: none; stroke: var(--gold); stroke-width: 3; }

/* hero */
.hw { display: grid; gap: 14px; justify-items: center; padding: 10px 0; }
.hw-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; }
.hw-w { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font: 400 clamp(1.1rem, 2.6vw, 1.6rem)/1.2 var(--f-display); color: var(--ink-3); transition: background 0.35s, color 0.35s, border-color 0.35s; }
.hw-w.k { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.hw-w.c { color: var(--bg); border-color: var(--gold); background: var(--gold); }
.hw-stack { display: grid; }
.hw-line { grid-area: 1 / 1; margin: 0; text-align: center; font: 0.95rem/1.5 var(--f-ui); color: var(--ink-2); opacity: 0; transition: opacity 0.35s; }
.hw-line.in { opacity: 1; }
.hw-c { color: var(--gold); font-weight: 600; }
.hw-k { color: var(--accent-ink); font-weight: 600; }

/* 1: one nudge */
.nu-bar { margin: 0 0 12px; }
.nu-k { margin: 0 0 4px; font: 0.95rem/1.4 var(--f-mono); color: var(--ink-2); }
.nu-k b { color: var(--ink); }
.nu-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.nu-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.nu-track i.w2-true { background: var(--good); }
.nu-track i.w2-noise { background: var(--bad); }
.nu-track i.ghost { background: var(--ink-3); opacity: 0.35; }
.nu-want { margin: 3px 0 0; font-size: 0.8rem; }
.nu-loss { font: 400 1.6rem/1.2 var(--f-display); margin: 6px 0 4px; }
.nu-loss b { color: var(--gold); font-weight: 400; }
.nu-loss .muted { font: 0.85rem var(--f-ui); }
.nu-side .slider { font-size: 0.85rem; margin-top: 10px; }
.nu-hist { width: 100%; max-width: 380px; display: block; }
.nu-line { fill: none; stroke: var(--gold); stroke-width: 2; }
.nu-dot { fill: var(--gold); }
.nu-tick { font: 11px var(--f-mono); fill: var(--ink-3); }

/* 2: noise words */
.nd-power { font-size: 0.9rem; }
.nd-power input { flex: 1 1 180px; }
.nd-marks { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; font-size: 0.78rem; margin: 4px 0 14px; }
.nd-rows { display: grid; gap: 6px; }
.nd-row { display: grid; grid-template-columns: 4.6rem 3.4rem minmax(0, 1fr) 3.4rem; gap: 10px; align-items: center; font: 0.9rem var(--f-ui); }
.nd-head { font-size: 0.75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.nd-w { font-family: var(--f-mono); color: var(--ink); }
.nd-c, .nd-t { font-family: var(--f-mono); color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.nd-bar { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.nd-bar i { position: absolute; left: 0; top: 0; bottom: 0; }
.nd-bar i.raw { background: var(--ink-3); opacity: 0.25; }
.nd-bar i.now { background: var(--accent); opacity: 0.8; top: 5px; bottom: 5px; border-radius: 0 4px 4px 0; }
.nd-bar b { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font: 600 0.8rem var(--f-mono); color: var(--ink); background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.nd-last { min-height: 2.8em; font-size: 0.85rem; margin: 8px 0 0; }

/* 3: train, then the arithmetic */
.ta-map { width: 100%; max-width: 460px; display: block; margin: 0 auto; }
.ta-mf { stroke: var(--accent); stroke-width: 2; stroke-opacity: 0.75; }
.ta-tipm { fill: var(--accent); }
.ta-off { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 5 4; }
.ta-target { fill: none; stroke: var(--gold); stroke-width: 2.5; }
.ta-dot { fill: var(--ink-2); }
.ta-dot.on { fill: var(--ink); }
.ta-lbl { font: 600 14px var(--f-ui); fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.ta-lbl.on { fill: var(--ink); }
.ta-key { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 0.8rem; margin: 6px 0 0; }
.ta-key i { display: inline-block; width: 22px; height: 0; margin-right: 6px; vertical-align: middle; }
.ta-key .k-mf { border-top: 2px solid var(--accent); }
.ta-key .k-off { border-top: 2px dashed var(--gold); }
.ta-key .k-static { border-top: 2px dashed var(--ink-3); }
.ta-key .k-here { border-top: 3px solid var(--gold); }
.ta-prog { font-size: 0.9rem; margin: 0; min-height: 2.8em; }
.ta-q { font: 1.05rem var(--f-ui); margin: 16px 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ta-q select { font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 6px; }
.ta-ans { margin: 0; padding-left: 1.4em; font: 0.95rem/1.7 var(--f-mono); color: var(--ink-2); min-height: 5.1em; }
.ta-ans li.top b { color: var(--gold); }
.ta-ans b { color: var(--ink); }
.ta-par { font-size: 0.85rem; color: var(--ink-2); margin: 10px 0 0; min-height: 2.8em; }
.ta-par b { color: var(--ink); }

/* 4: the tally sheet */
.pt-wrap { overflow-x: auto; margin: 14px 0 6px; }
.pt-grid { border-collapse: separate; border-spacing: 4px; font: 0.9rem var(--f-ui); }
@media (max-width: 480px) { .pt-cell { font-size: 0.82rem; } .pt-grid th { padding: 2px 2px; font-size: 0.8rem; } }
.pt-grid th { font: 600 0.85rem var(--f-mono); color: var(--ink-2); padding: 2px 6px; text-align: center; }
.pt-grid th[scope="row"] { text-align: right; }
.pt-cell { width: clamp(46px, 12.5vw, 64px); height: 42px; border-radius: 8px; border: 1px solid var(--line-2); cursor: pointer; font: 500 0.95rem var(--f-mono); color: var(--ink);
  background: color-mix(in oklab, var(--accent) calc(var(--a) * 70%), var(--surface-2)); }
.pt-cell.on { outline: 3px solid var(--gold); outline-offset: 1px; }
.pt-work { min-height: 7.4em; }
.pt-work .kicker { margin: 8px 0 4px; }
.pt-eq { font: 0.9rem/1.7 var(--f-mono); color: var(--ink-2); margin: 0 0 4px; }
.pt-eq b, .pt-verdict b { color: var(--ink); }
.pt-verdict { margin: 0; color: var(--ink-2); font: 0.92rem/1.5 var(--f-ui); }

/* 5: bank in a sentence */
.bb-axis { font: 600 12px var(--f-ui); fill: var(--ink-3); }
.w2-vec.bb-nb { stroke: var(--accent); stroke-opacity: 0.6; }
.w2-name.bb-nb { fill: var(--accent-ink); }
.w2-vec.bb-static { stroke: var(--ink-3); stroke-dasharray: 6 5; stroke-width: 2.5; }
.w2-name.bb-static { fill: var(--ink-2); }
.bb-tip { fill: var(--gold); }
.bb-side .slider { font-size: 0.9rem; }
.bb-shares { font: 0.85rem var(--f-mono); color: var(--ink-2); margin: 10px 0 4px; }
.bb-shares b { color: var(--ink); }
.bb-new { font: 0.9rem/1.6 var(--f-mono); color: var(--ink-2); margin: 0 0 14px; }
.bb-new b { color: var(--gold); }
.seg + .w2-two, .seg + .pt-wrap { margin-top: 14px; }
