/* HYPERPART: form-chrome */
/* Promoted from Dazzle fragments.css (Tier F3, fleet convergence):
 * the form SECTION chrome, the form_errors validation summary, the
 * form_stepper progress list, and the steps_indicator (experience
 * wizard). Emitter contracts unchanged. NOT promoted (deleted at the
 * source instead): .dz-form-shell/-header/-title/-body/-actions — that
 * wrapper family's producer was the legacy form_renderer.py deleted in
 * ADR-0049 Phase 3b; the substrate form path never emitted it — and
 * .dz-form-errors-message (the errors emitter renders title+list only). */

/* ── form sections (live: FormSection primitive) ── */

.dz-form-section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--colour-text);
  margin-block-end: var(--space-md);
}

.dz-form-section-note {
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  margin-block-end: var(--space-md);
}

.dz-form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-block-end: var(--space-lg);
}

/* ─────────────────────────── form_errors fragment ───────────────
 * Form-level validation error block (HTMX-swapped). Always uses the
 * destructive/danger tone — no need for an attribute selector. */

.dz-form-errors {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-block-end: var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--colour-danger);
  background: color-mix(in oklch, var(--colour-danger) 8%, transparent);
}

.dz-form-errors-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--colour-danger);
}

.dz-form-errors-body {
  min-width: 0;
}

.dz-form-errors-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--colour-text);
  margin: 0;
}


.dz-form-errors-list {
  font-size: var(--text-sm);
  color: var(--colour-text);
  list-style: disc inside;
  margin: 0.125rem 0 0;
  padding-inline-start: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* ─────────────────────────── form_stepper fragment ──────────────
 * Multi-section form progress list. Each <li> is a (number-circle
 * + label + connector). Active state via .is-active modifier on
 * the whole li. */

.dz-form-stepper {
  display: flex;
  align-items: center;
  width: 100%;
  margin-block-end: var(--space-xl);
  gap: var(--space-sm);
  list-style: none;
  padding-inline-start: 0;
}

.dz-form-stepper-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  cursor: pointer;
}

.dz-form-stepper-item.is-not-last {
  flex: 1 1 0;
}

.dz-form-stepper-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--colour-border);
  background: var(--colour-surface);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--colour-text-muted);
  transition: background var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}

.dz-form-stepper-circle.is-active {
  background: var(--colour-brand);
  color: var(--colour-brand-contrast);
  border-color: var(--colour-brand);
}

.dz-form-stepper-circle > svg {
  width: 0.75rem;
  height: 0.75rem;
}

.dz-form-stepper-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--colour-text-muted);
  transition: color var(--duration-base) var(--ease-out);
}

/* HYPERPART: wizard */
/* The keyboard-operable step trigger — a real <button> inside the li,
 * visually transparent (the circle/label carry the design). */
.dz-form-stepper-button {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.dz-form-stepper-button:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* Completed steps swap the number for a pure-CSS checkmark — keyed
 * off data-dz-state (set by dz-wizard.js; the SSR default is
 * current/pending, so no-JS renders numbers throughout). */
[data-dz-state="complete"] .dz-form-stepper-circle span {
  display: none;
}

[data-dz-state="complete"] .dz-form-stepper-circle::after {
  content: "\2713";
}

.dz-form-stepper-label.is-active {
  color: var(--colour-text);
}

.dz-form-stepper-connector {
  flex: 1 1 0;
  height: 1px;
  background: var(--colour-border);
  transition: background var(--duration-base) var(--ease-out);
}

.dz-form-stepper-connector.is-active {
  background: var(--colour-brand);
}

/* ─────────────────────────── steps_indicator fragment ───────────
 * Visual step indicator (cycle 251). Position-based — every step at
 * or before the current is "complete" and rendered with brand fill.
 * Distinct from form_stepper which uses Alpine + per-step state. */

.dz-steps {
  display: flex;
  align-items: center;
  width: 100%;
  list-style: none;
  padding-inline-start: 0;
  margin: 0;
}

.dz-steps-item {
  display: flex;
  align-items: center;
}

.dz-steps-item.is-not-last {
  flex: 1 1 0;
}

.dz-steps-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.dz-steps-circle {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--colour-bg);
  color: var(--colour-text-muted);
}

.dz-steps-circle.is-completed {
  background: var(--colour-brand);
  color: var(--colour-brand-contrast);
}

.dz-steps-label {
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
}

.dz-steps-label.is-completed {
  color: var(--colour-text);
  font-weight: var(--weight-medium);
}

.dz-steps-connector {
  flex: 1 1 0;
  margin-inline: var(--space-md);
  height: 1px;
  background: var(--colour-border);
}

.dz-steps-connector.is-completed {
  background: var(--colour-brand);
}
