/* #facts - what happened to this image, and how to change it.
 *
 * Three blocks, each a separate concern, each with its own heading:
 *
 *   versions   every encode the run produced, as a row of chips
 *   measured   the numbers behind the one it kept
 *   redo       overriding the plan for this image alone
 *
 * The chips are the interesting part. Every one of them already exists as bytes
 * by the time it is drawn, so tapping one swaps the stage instantly and nothing
 * is re-encoded. That immediacy is the point: it is how someone finds out they
 * had a choice without being told they did.
 */

/* -------------------------------- versions ------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-top: var(--s-3);
}

.chip {
  font: inherit;
  display: grid;
  grid-template-columns: auto;
  gap: 2px;
  padding: var(--s-2) var(--s-3);
  min-width: 84px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  background: var(--c-raised);
  color: var(--c-ink);
  box-shadow: var(--elev-1);
  cursor: pointer;
  text-align: left;
  transition:
    background-color var(--dur-fx) var(--ease-fx),
    border-color var(--dur-fx) var(--ease-fx),
    box-shadow var(--dur-fx) var(--ease-fx),
    transform var(--dur-move) var(--ease-move);
}
.chip:hover:not(:disabled) {
  border-color: var(--c-line-hover);
  box-shadow: var(--elev-2);
  transform: translateY(calc(-1px * var(--motion-scale)));
}
.chip:active:not(:disabled) { transform: none; }
.chip:disabled { cursor: default; opacity: 0.75; box-shadow: none; }

/* The one on the stage: the system's selected fill and edge. */
.chip[aria-pressed="true"] {
  background: var(--c-selected);
  border-color: var(--c-border-selected);
  box-shadow: inset 0 0 0 1px var(--c-border-selected);
}

.chip > .cf { font-size: 14px; font-weight: 600; }
.chip > .cb { font-size: 14px; color: var(--c-ink-2); }
/* How this one compares to the kept file. Signed, because the sign is the
   whole message: a chip that is bigger than the winner has to look bigger. */
.chip > .cd { font-size: 13px; color: var(--c-ink-3); }

/* The encode the engine kept. Marked in words as well as with a border, so the
   reason it won is readable and not just its outline. */
.chip[data-win="1"] > .cf::after {
  content: " · kept";
  font-weight: 400;
  color: var(--c-accent);
}

/* Tried, and came in under the quality floor. Still choosable - wanting the
   smaller file is legitimate - but it must not read as a free win. */
.chip[data-under="1"] > .cd { color: var(--c-warn); }
.chip[data-under="1"] > .cf::after {
  content: " · under floor";
  font-weight: 400;
  color: var(--c-warn);
}
/* Both at once is a real result: a size cap can force the engine to keep the best
   thing that fits even when nothing cleared the floor. One ::after per element, so
   the combination needs its own rule or the two silently overwrite each other. */
.chip[data-win="1"][data-under="1"] > .cf::after {
  content: " · kept, under floor";
  color: var(--c-warn);
}

/* Why this one won, in a sentence, under the chips. */
#chip-why {
  padding-top: var(--s-3);
  font-size: 14px;
  color: var(--c-ink-3);
}

/* -------------------------------- measured ------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: var(--s-3);
  padding-top: var(--s-3);
}
.stats > div > .k {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-ink-3);
}
.stats > div > .v { font-size: 16px; }

/* Notes that only appear when they are true. Each carries its meaning in its
   words; the colour is a second signal, never the only one. */
.note {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-left: 2px solid var(--c-line);
  font-size: 15px;
  color: var(--c-ink-2);
}
.note.good { border-color: var(--c-good); }
.note.warn { border-color: var(--c-warn); }
.note.bad { border-color: var(--c-bad); }

/* The resize disclosure. Full-strength ink at body size, above the stat grid:
   it must never read smaller or quieter than the number it explains. */
.note.strong {
  font-size: 16px;
  color: var(--c-ink);
  border-color: var(--c-ink-3);
}

/* ---------------------------------- redo --------------------------------- */

/* A different scope from the plan, and it says so: these two controls override
   the plan for this one image and can name a format the automatic comparison
   never tried. Their empty state reads "follow the plan" rather than a dash
   that could equally mean off, unset, or inherited. */
#redo .field > label { flex-basis: 100px; }

.redo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-top: var(--s-3);
}
