/* ---- 16c. Stepper (case pipeline) ---------------------------------------
 * A horizontal rail: numbered markers joined by a rule, the done ones ticked.
 * Both the marker and its label are one clickable face, so the target is the
 * whole step rather than a 24px dot.
 *
 * ONE accent carries progress — done and current are the same hue, separated by
 * fill (done is solid, current is outlined). Colouring done green and current
 * blue implies two different kinds of state; they are the same pipeline. */

section.stepper {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: var(--ta-r-lg);
  /* A clipping pane in a flex column must not shrink, or it crops its rail. */
  flex-shrink: 0;
  margin-bottom: 1.5rem;
}

.stepper-head {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ta-border);
}

.stepper-heading {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  letter-spacing: 0;
}

.stepper-body {
  min-height: 0;
  flex: 1;
  padding: 1rem;
  /* More stages than fit scroll sideways rather than crushing the labels. */
  overflow-x: auto;
}

.stepper-steps {
  display: flex;
  align-items: flex-start;
  min-width: 100%;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Every step but the last shares the leftover width equally, so the rails come
   out the same length; the last one takes only its label's width so the rail
   doesn't run off the end into empty space. */
.stepper-step {
  display: flex;
  align-items: flex-start;
  flex: 1;
}

.stepper-step:last-child {
  flex: none;
}

.stepper-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: center;
  cursor: pointer;
  border-radius: var(--ta-r);
  transition: opacity var(--ta-t) var(--ta-ease);
}

.stepper-face:hover {
  opacity: 0.8;
}

.stepper-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--ta-r);
  border: 2px solid var(--ta-border-strong);
  color: var(--ta-muted);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: background var(--ta-t) var(--ta-ease),
    border-color var(--ta-t) var(--ta-ease), color var(--ta-t) var(--ta-ease);
}

.stepper-dot svg {
  width: 0.875rem;
  height: 0.875rem;
}

.stepper-step.done .stepper-dot {
  background: var(--ta-accent);
  border-color: var(--ta-accent);
  color: #fff;
}

.stepper-step.active .stepper-dot {
  border-color: var(--ta-accent);
  color: var(--ta-accent);
}

.stepper-label {
  max-width: 6rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--ta-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stepper-step.done .stepper-label,
.stepper-step.active .stepper-label {
  color: var(--ta-text);
  font-weight: 500;
}

/* The rail is nudged to the marker's centre-line: a 24px marker with a 2px
   rule centres at 11px. */
.stepper-rail {
  flex: 1;
  align-self: flex-start;
  height: 2px;
  margin: 0.6875rem 0.5rem 0;
  background: var(--ta-border);
}

.stepper-step.done .stepper-rail {
  background: var(--ta-accent);
}
