/* Wizard stage chrome.
 *
 * Additive only. static/css/theme.css is a verbatim port and is not touched;
 * everything here is a new .wz-* class built on that file's own tokens
 * (--ink, --ink-muted, --ink-faint, --border, --border-strong, --brand,
 * --brand-tint, --surface, --surface-subtle, --success, --warning, --danger)
 * so a rebrand through Organisation still recolours the wizard.
 *
 * Mobile is the design, 375 px first; the lg breakpoint adds the desktop
 * rail. Borders, never shadows. Tabular figures on every money value.
 */

/* ---------------------------------------------------------------------------
   The four-stage indicator. One <ol>, two layouts: a dot strip across the top
   at phone widths, a vertical rail from lg up. The labels stay in the DOM at
   every width — they are clipped, not display:none, so a screen reader still
   reads "Stage 2 of 4, About you".
--------------------------------------------------------------------------- */
.wz-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.wz-stage-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-faint);
  font-size: .75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}

.wz-stage--done .wz-stage-dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.wz-stage--current .wz-stage-dot {
  border: 2px solid var(--brand);
  color: var(--brand);
}

.wz-stage-title {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ink-faint);
}

.wz-stage--done .wz-stage-title,
.wz-stage--current .wz-stage-title { color: var(--ink); }

.wz-stage-hint {
  display: block;
  font-size: .75rem;
  line-height: 1.4;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

.wz-stage-link { text-decoration: none; color: inherit; }
.wz-stage-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: .5rem; }

@media (max-width: 991.98px) {
  .wz-rail-card { border-radius: .75rem; }

  .wz-stage {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
  }

  /* The connector between two dots. Filled once the stage before it is done,
     so the strip reads as progress rather than as four separate markers. */
  .wz-stage + .wz-stage::before {
    content: "";
    position: absolute;
    top: 13px;
    right: 50%;
    width: 100%;
    height: 1px;
    background: var(--border);
  }

  .wz-stage--done + .wz-stage::before,
  .wz-stage--current::before { background: var(--brand); }

  .wz-stage-link {
    position: relative;
    z-index: 1;
    display: inline-flex;
  }

  .wz-stage-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (min-width: 992px) {
  .wz-rail-card { position: sticky; top: 1.5rem; }

  .wz-stages { flex-direction: column; gap: .125rem; }

  .wz-stage-link {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .625rem .5rem;
    border-radius: .5rem;
  }

  a.wz-stage-link:hover { background: var(--surface-subtle); }
  .wz-stage--current .wz-stage-link { background: var(--brand-tint); }
  .wz-stage-text { min-width: 0; }
}

.wz-stage-counter {
  font-size: .8125rem;
  color: var(--ink-muted);
  margin: 0 0 .5rem;
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---------------------------------------------------------------------------
   Sections inside one stage. Open carries the form; done collapses to a
   summary the applicant can still read; locked has no form at all, which is
   what stops a stage's second fieldset being posted before its first.
--------------------------------------------------------------------------- */
.wz-section {
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--surface);
  margin-bottom: .75rem;
}

.wz-section--open { border-color: var(--border-strong, #CBD5E1); }
.wz-section--locked { background: var(--surface-subtle); }

.wz-section-body { padding: 1rem; }

@media (min-width: 992px) {
  .wz-section-body { padding: 1.5rem; }
}

.wz-section-heading {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .25rem;
}

.wz-section-lead {
  font-size: .875rem;
  color: var(--ink-muted);
  margin: 0 0 1.25rem;
  max-width: 60ch;
}

/* The disclosure. A real <button aria-expanded> + aria-controls; the body is
   rendered expanded by the server and collapsed by wizard-stages.js, so with
   no JavaScript every completed answer is simply visible. */
.wz-disclosure {
  display: flex;
  width: 100%;
  align-items: center;
  gap: .75rem;
  padding: 1rem;
  background: transparent;
  border: 0;
  border-radius: .75rem;
  text-align: left;
  color: inherit;
}

.wz-disclosure:hover { background: var(--surface-subtle); }
.wz-disclosure:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.wz-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}

.wz-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-faint);
}

.wz-disclosure-text { min-width: 0; flex: 1 1 auto; }

.wz-disclosure-title {
  display: block;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--ink);
}

.wz-disclosure-summary {
  display: block;
  font-size: .8125rem;
  color: var(--ink-muted);
  margin-top: .125rem;
  overflow-wrap: anywhere;
}

.wz-chevron {
  flex: 0 0 auto;
  color: var(--ink-faint);
  transition: transform .15s ease;
}

.wz-disclosure[aria-expanded="true"] .wz-chevron { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
  .wz-chevron { transition: none; }
}

.wz-disclosure-body { padding: 0 1rem 1rem; }

/* ---------------------------------------------------------------------------
   Read-back rows. Label left, value right, wrapping to two lines at 375 px
   rather than pushing the page sideways.
--------------------------------------------------------------------------- */
.wz-rows { margin: 0; }

.wz-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .25rem 1rem;
  padding: .5rem 0;
  border-top: 1px solid var(--border);
  font-size: .8125rem;
}

.wz-row dt { font-weight: 400; color: var(--ink-muted); flex: 0 1 auto; }
.wz-row dd { margin: 0; text-align: right; color: var(--ink); flex: 1 1 auto; overflow-wrap: anywhere; }
.wz-row dd.num { font-variant-numeric: tabular-nums lining-nums; }

/* ---------------------------------------------------------------------------
   Stage 1: the bike an applicant arrived wanting.
--------------------------------------------------------------------------- */
.wz-bike-photo {
  aspect-ratio: 16 / 10;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: .75rem;
  text-align: center;
  padding: .5rem;
  overflow: hidden;
}

.wz-bike-photo img { width: 100%; height: 100%; object-fit: cover; }

.wz-figure {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
}

.wz-assumptions {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  font-size: .75rem;
  color: var(--ink-muted);
}

.wz-assumptions li { display: flex; gap: .25rem; }
.wz-assumptions .wz-assumption-value { color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }

/* ---------------------------------------------------------------------------
   Field groups. Eight visible fields is the mobile ceiling, so anything
   conditional is a disclosure rather than a permanently open block.
--------------------------------------------------------------------------- */
.wz-fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.wz-fieldset:last-of-type { margin-bottom: 0; }

.wz-legend {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0;
  margin: 0 0 .75rem;
  float: none;
  width: auto;
}

.wz-optional-toggle {
  background: transparent;
  border: 0;
  padding: .25rem 0;
  color: var(--brand);
  font-size: .8125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

.wz-optional-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: .25rem; }
.wz-optional-toggle[aria-expanded="true"] .wz-chevron { transform: rotate(180deg); }

/* ---------------------------------------------------------------------------
   Actions. Full-width and stacked at 375 px, inline from sm up. Never sticky:
   a bar pinned to the bottom of a phone covers the field being typed into.
--------------------------------------------------------------------------- */
.wz-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: .75rem;
  margin-top: 1.5rem;
}

.wz-actions .btn { width: 100%; }

@media (min-width: 576px) {
  .wz-actions { flex-direction: row; align-items: center; justify-content: space-between; }
  .wz-actions .btn { width: auto; }
}

/* ---------------------------------------------------------------------------
   Post-decision document tiles.
--------------------------------------------------------------------------- */
.wz-doc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  border-top: 1px solid var(--border);
}

.wz-doc:first-child { border-top: 0; }
.wz-doc-text { flex: 1 1 12rem; min-width: 0; }
.wz-doc-title { font-size: .875rem; font-weight: 500; color: var(--ink); }
.wz-doc-meta { font-size: .75rem; color: var(--ink-faint); }
.wz-doc-actions { flex: 0 0 auto; display: flex; gap: .5rem; align-items: center; }

/* Nothing on any width may push the page sideways. */
.wz-section, .wz-rows, .wz-doc { max-width: 100%; }
