/* Module 06 — Embeddings. Only what styles.css does not already cover:
   the signed vector bars, the neighbour ranking, the SVG map, the
   dimension-by-dimension compare table and the retrieval demo rows. */

:root {
  --emb-network:   #1d4ed8;
  --emb-threat:    #b91c1c;
  --emb-people:    #15803d;
  --emb-everyday:  #b45309;
  --emb-abstract:  #6d28d9;
  --emb-ambiguous: #0f766e;
}

/* ------------------------------------------------- the seven-number vector */

.vec-chart { display: grid; gap: 6px; margin-top: 4px; }

.vec-row {
  display: grid;
  grid-template-columns: 96px 1fr 52px;
  align-items: center;
  gap: 8px;
}
.vec-name { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.vec-track {
  position: relative;
  height: 16px;
  border-radius: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
}
.vec-zero {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: var(--line-strong);
}
.vec-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.vec-bar.pos { background: var(--accent); }
.vec-bar.neg { background: var(--ink-faint); }
.vec-val {
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums; color: var(--ink);
}
.vec-scale {
  display: grid; grid-template-columns: 96px 1fr 52px; gap: 8px;
  font-size: .72rem; color: var(--ink-faint); margin-top: 4px;
}
.vec-scale .ends { display: flex; justify-content: space-between; }

/* ------------------------------------------------------- nearest neighbours */

.near-list { display: grid; gap: 9px; margin-top: 4px; }

.near-row {
  display: grid;
  grid-template-columns: 22px 1fr 44px;
  gap: 9px;
  align-items: center;
}
.near-rank {
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  color: var(--ink-faint); text-align: right;
}
.near-mid { min-width: 0; }
.near-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.near-word { font-weight: 700; font-size: .98rem; }
.near-bar {
  height: 7px; border-radius: 999px; background: #e3e9f2;
  overflow: hidden; margin-top: 4px;
}
.near-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.near-score {
  font-family: var(--mono); font-size: .85rem; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums;
}
.near-far { font-size: .85rem; color: var(--ink-faint); margin: 10px 0 0; font-style: italic; }

/* cluster tags */

.cl-tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.cl-tag.cl-network   { color: var(--emb-network); }
.cl-tag.cl-threat    { color: var(--emb-threat); }
.cl-tag.cl-people    { color: var(--emb-people); }
.cl-tag.cl-everyday  { color: var(--emb-everyday); }
.cl-tag.cl-abstract  { color: var(--emb-abstract); }
.cl-tag.cl-ambiguous { color: var(--emb-ambiguous); }

/* ---------------------------------------------------- the headline callout */

.hl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
}
.hl-cell {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 11px;
}
.hl-cell.hl-near { border-color: var(--accent-line); }
.hl-pair { font-size: .86rem; font-weight: 600; }
.hl-score {
  font-family: var(--mono); font-weight: 700; font-size: .95rem;
  font-variant-numeric: tabular-nums;
}
.hl-near .hl-score { color: var(--accent); }
.hl-far  .hl-score { color: var(--ink-faint); }

/* --------------------------------------------------------------- the map */

.map-axes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.map-holder { max-width: 620px; margin: 14px auto 0; }
.map-canvas {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  touch-action: manipulation;
}
.map-grid { stroke: var(--line); stroke-width: 1; }
.map-axis { stroke: var(--line-strong); stroke-width: 1.5; }
.map-axis-name { font-size: 11px; font-weight: 700; fill: var(--ink-soft); }
.map-tick { font-size: 10px; fill: var(--ink-faint); font-family: var(--mono); }
.map-label { font-size: 11px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.map-hit { fill: transparent; }
.map-dot { stroke: #fff; stroke-width: 1.2; }
.map-pt { cursor: pointer; }
.map-pt:focus { outline: none; }
.map-pt:focus-visible .map-dot { stroke: var(--ink); stroke-width: 2.5; }

.map-pt.cl-network   .map-dot { fill: var(--emb-network); }
.map-pt.cl-threat    .map-dot { fill: var(--emb-threat); }
.map-pt.cl-people    .map-dot { fill: var(--emb-people); }
.map-pt.cl-everyday  .map-dot { fill: var(--emb-everyday); }
.map-pt.cl-abstract  .map-dot { fill: var(--emb-abstract); }
.map-pt.cl-ambiguous .map-dot { fill: var(--emb-ambiguous); }

/* The shared .chip lands at 43px; nudge this module's chips over the 44px
   tap-target line without touching styles.css. */
#nn-chips .chip, #cmp-chips .chip, .cl-chip { min-height: 44px; }

.cl-chip::before {
  content: ""; width: 11px; height: 11px; border-radius: 50%;
  display: inline-block; margin-right: 7px; background: currentColor;
  vertical-align: -1px;
}
.cl-chip.cl-network   { color: var(--emb-network); }
.cl-chip.cl-threat    { color: var(--emb-threat); }
.cl-chip.cl-people    { color: var(--emb-people); }
.cl-chip.cl-everyday  { color: var(--emb-everyday); }
.cl-chip.cl-abstract  { color: var(--emb-abstract); }
.cl-chip.cl-ambiguous { color: var(--emb-ambiguous); }
.cl-chip[aria-pressed="false"] { opacity: .45; }

.map-readout {
  font-size: .85rem; color: var(--ink-soft);
  margin: 10px 0 0; min-height: 2.6em;
}

/* --------------------------------------------------------- compare two */

.cmp-table {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 14px;
}
.cmp-row {
  display: grid;
  grid-template-columns: 1fr 50px 50px 62px;
  gap: 6px;
  align-items: center;
  padding: 9px 11px;
  border-top: 1px solid var(--line);
  font-size: .85rem;
}
.cmp-row:first-child { border-top: 0; }
.cmp-head {
  background: var(--surface-alt);
  font-size: .64rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em;
  color: var(--ink-faint);
  word-break: normal;
  overflow-wrap: normal;
}
.cmp-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-head span:not(:first-child) { text-align: center; }
.cmp-dim { font-weight: 600; color: var(--ink-soft); }
.cmp-num {
  font-family: var(--mono); font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.cmp-flag {
  font-size: .7rem; font-weight: 700; text-align: center;
  padding: 3px 5px; border-radius: 999px;
}
.cmp-flag.ok  { background: var(--ok-soft);     color: var(--ok); }
.cmp-flag.mid { background: var(--surface-alt); color: var(--ink-faint); }
.cmp-flag.bad { background: var(--danger-soft); color: var(--danger); }

/* -------------------------------------------------- retrieval demo rows */

.doc-list { display: grid; gap: 10px; margin-top: 4px; }
.doc-row {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 11px 13px;
}
.doc-row.doc-top { border-left-color: var(--accent); background: var(--accent-soft); }
.doc-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 5px; }
.doc-score {
  font-family: var(--mono); font-weight: 700; font-size: .95rem;
  font-variant-numeric: tabular-nums; color: var(--accent-dark);
}
.doc-flag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; padding: 2px 8px; border-radius: 999px;
}
.doc-flag.lit   { background: var(--ok-soft); color: var(--ok); }
.doc-flag.nolit { background: var(--warn-soft); color: var(--warn); }
.doc-text { margin: 0; font-size: .96rem; }
.doc-known { margin: 5px 0 0; font-size: .78rem; color: var(--ink-faint); font-family: var(--mono); }

/* ------------------------------------------------------------- narrow */

/* The shared .meter-foot has three items here rather than two; keep them apart. */
.meter-box .meter-foot { gap: 8px; font-size: .76rem; }

@media (max-width: 460px) {
  .vec-row, .vec-scale { grid-template-columns: 90px 1fr 46px; }
  .vec-name { font-size: .75rem; }
  .cmp-row { grid-template-columns: 1fr 58px 58px 56px; font-size: .78rem; gap: 5px; }
  .cmp-head { font-size: .6rem; }
  .cmp-dim { font-size: .76rem; }
  .near-row { grid-template-columns: 18px 1fr 40px; }
}
