/* A choice row (ui/choice_row.cljs): a radio ring or a checkbox box before
   the text. The chosen row takes a 2px ink border and gives the extra pixel
   back from its padding, at rest and under the cursor alike, so choosing a
   row never changes its size. Amber is not used. */

.choice-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  background: var(--color-bg-option);
  border: var(--border-width) solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default);
}

.choice-row:hover:not(.choice-row--disabled) {
  border-color: var(--color-text-muted);
}

.choice-row:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.choice-row--chosen,
.choice-row--chosen:hover:not(.choice-row--disabled) {
  padding: calc(var(--space-3) - var(--border-width)) calc(var(--space-4) - var(--border-width));
  border: calc(var(--border-width) * 2) solid var(--color-text);
}

.choice-row--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* The body: the text over its note, taking the width between the choice
   mark and the corner. */
.choice-row__body {
  flex: 1;
  min-width: 0;
}

.choice-row__text {
  margin: 0;
  font-size: var(--text-body);
  line-height: var(--leading-snug);
  overflow-wrap: anywhere;
}

/* The note under the text, aligned with it: a muted line at note size,
   its marks 8px apart. */
.choice-row__note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 2px 0 0;
  font-size: var(--text-note);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
}

/* The choice mark sits centred on the first line of text. */
.choice-row__radio,
.choice-row .choice-row__box {
  margin-top: calc((var(--text-body) * var(--leading-snug) - var(--choice-mark-size)) / 2);
}

/* The ring of a single choice; chosen, it thickens to 5px around a 6px
   centre. */
.choice-row__radio {
  flex-shrink: 0;
  box-sizing: border-box;
  width: var(--choice-mark-size);
  height: var(--choice-mark-size);
  border: 1.5px solid var(--color-text);
  border-radius: 50%;
}

.choice-row__radio--on {
  border-width: 5px;
}

.choice-row .choice-row__box {
  pointer-events: none;
}

/* The checkbox of a shown row (`:check`): a control of its own, centred on
   the first line of text like the mark. */
.choice-row .choice-row__check {
  flex-shrink: 0;
  margin-top: calc((var(--text-body) * var(--leading-snug) - var(--choice-mark-size)) / 2);
  cursor: pointer;
}

.choice-row__check .checkbox__box {
  margin: 0;
  cursor: pointer;
}

.choice-row__check .checkbox__box:disabled {
  cursor: not-allowed;
}

/* As tall as the first line of text: an action taller than the line
   overflows into the row's padding, so choosing a row does not make it
   taller. */
.choice-row__corner {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
  height: calc(var(--text-body) * var(--leading-snug));
}

.choice-row__number {
  font-size: var(--text-note);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  white-space: nowrap;
}
