/*
 * .seq-reclassify — the reclassify control on issue show (docs/design-system/component-inventory.md).
 *
 * A choice over the classification vocabulary transient, environmental, input, tool,
 * unclassified, with the implied next action shown beside each option; on change the app
 * appends an issue_events row. A native <select> cannot show a sentence beside each option,
 * so the control is a radio group: one .seq-reclassify__option per classification, the word
 * in mono, the next action in prose beside it, the current classification marked with
 * .is-current. Submits through a gem .button; not .form-submit, which is full width.
 *
 * Markup:
 *   <form class="seq-reclassify">
 *     <fieldset class="seq-reclassify__options">
 *       <legend class="seq-reclassify__legend">classification</legend>
 *       <label class="seq-reclassify__option is-current">
 *         <input type="radio" name="classification" value="transient" checked>
 *         <code class="seq-reclassify__word">transient</code>
 *         <span class="seq-reclassify__next">Wait; the job retries automatically.</span>
 *       </label>
 *       ...
 *     </fieldset>
 *     <div class="seq-reclassify__submit">...</div>
 *   </form>
 */

.seq-reclassify {
  --_word-width: 13rem;   /* the classification word column; wide enough for "environmental · current" at --font-size-14 */
  display: flex;
  flex-direction: column;
  gap: var(--spacing-12);
}
.seq-reclassify__options {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
}
.seq-reclassify__legend {
  padding: 0;
  margin-block-end: var(--spacing-8);
  font-family: var(--font-family-body);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-secondary);
}

.seq-reclassify__option {
  display: grid;
  grid-template-columns: auto minmax(0, var(--_word-width)) minmax(0, 1fr);
  align-items: baseline;
  column-gap: var(--spacing-12);
  padding: var(--spacing-8) var(--spacing-12);
  border-block-end: var(--stroke-weight-1) solid var(--border-subtle);
  cursor: pointer;
}
.seq-reclassify__option:first-of-type {
  border-block-start: var(--stroke-weight-1) solid var(--border-subtle);
}
.seq-reclassify__option:hover {
  background: var(--background-hover);
}
.seq-reclassify__option input {
  align-self: center;
}
.seq-reclassify__word {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-primary);
}
.seq-reclassify__next {
  font-family: var(--font-family-body);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-secondary);
  line-height: 1.4;
}
.seq-reclassify__next code {
  font-size: var(--font-size-12);
}

/* The issue's current classification: marked with the word "current" after it, not by color alone. */
.seq-reclassify__option.is-current .seq-reclassify__word::after {
  content: " · current";
  color: var(--text-secondary);
}

.seq-reclassify__submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-12);
}
.seq-reclassify__submit > .form-input {
  flex: 1 1 12rem;
  max-width: 20rem;
  width: auto;
}

/* ---------- Touch: the option's label is the radio's target ----------
   The radio is 13px and keeps the platform's look, so on a coarse pointer the whole label is
   what a finger taps (WCAG 2.5.5): its block padding grows to --spacing-16, which puts at
   least 21px of label above and below the radio's centre in one row and in the two rows
   below 768px, and a transparent ::before reaches --spacing-12 before the label, which with
   the label's own inline padding puts 21px before the radio's centre. The options stay
   edge to edge, so no two labels overlap. */
@media (pointer: coarse) {
  .seq-reclassify__option {
    position: relative;
    padding-block: var(--spacing-16);
  }
  .seq-reclassify__option::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline: calc(-1 * var(--spacing-12)) 0;
  }
}

@media (max-width: 767px) {
  .seq-reclassify__option {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: var(--spacing-4);
  }
  .seq-reclassify__next { grid-column: 2; }
}
