/*
 * Forza onboarding — pure black, treatment 3a.
 *
 * Colour discipline from the locked spec: #000 ground, #f2f2f5 primary text,
 * outlined white pill CTAs. Red is reserved for hairlines, arrows, radio dots
 * and errors — never for large fills, or it stops reading as an accent.
 */

:root {
  --ground: #000;
  --surface: #0c0c0f;
  --text: #f2f2f5;
  --text-dim: #8b8b93;
  --text-faint: #6b6b73;
  --text-mid: #c4c4cb;
  --line: rgba(255, 255, 255, 0.16);
  --line-input: rgba(255, 255, 255, 0.18);
  --line-focus: rgba(255, 255, 255, 0.65);
  --red: #e33b30;
  --red-bright: #ff6157;
  --green: #3fb977;
  --radius: 6px;
}

* { box-sizing: border-box; }

/*
 * The `hidden` attribute must beat layout classes.
 *
 * The UA stylesheet's [hidden] { display: none } loses to any class that sets
 * display — .grid on the conditional billing and NOA blocks, for instance —
 * which left those fields on screen when they were meant to be hidden. This is
 * the standard fix and the reason it carries !important.
 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
}

body {
  font-family: Archivo, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--text); }
a:hover { color: var(--red-bright); }

/* Visible only to screen readers, but focusable when it needs to be. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A consistent, high-contrast focus ring everywhere. The spec's dark ground
   makes the browser default nearly invisible, and keyboard users are exactly
   the people this form must not lose. */
:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 2px;
}

/* ---------- Decorative road lines ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/*
 * Two soft glows behind the hairlines, echoing the prototype's road artwork.
 *
 * On a wide desktop the hairlines alone leave the right two-thirds as flat
 * black, which reads as unfinished rather than as a deliberately dark design.
 * These stay low-opacity so red remains an accent — the spec reserves it for
 * hairlines, arrows, radio dots and errors, never for large fills.
 */
.backdrop::before,
.backdrop::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.backdrop::before {
  right: -8%;
  top: -18%;
  width: 62%;
  height: 70%;
  background: radial-gradient(
    ellipse at 50% 60%,
    rgba(227, 59, 48, .17),
    rgba(120, 10, 16, .06) 55%,
    transparent 75%
  );
  filter: blur(60px);
}
.backdrop::after {
  right: 8%;
  bottom: -22%;
  width: 54%;
  height: 58%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(255, 110, 60, .10),
    rgba(227, 59, 48, .04) 52%,
    transparent 74%
  );
  filter: blur(52px);
}
.backdrop span {
  position: absolute;
  right: -20%;
  width: 120%;
  display: block;
}
.backdrop span:nth-child(1) { top: 26%; height: 1px;  background: linear-gradient(90deg, transparent, #d8d8de); transform: rotate(-15deg); filter: blur(1px);  opacity: .42; }
.backdrop span:nth-child(2) { top: 44%; height: 2px;  background: linear-gradient(90deg, transparent, var(--red)); transform: rotate(-11deg); filter: blur(2px); opacity: .58; }
.backdrop span:nth-child(3) { top: 58%; height: 1px;  background: linear-gradient(90deg, transparent, #9a9aa3); transform: rotate(-7deg); filter: blur(1px); opacity: .34; }
.backdrop span:nth-child(4) { top: 88%; height: 16px; background: linear-gradient(90deg, transparent, #4a0a0d); transform: rotate(2deg); filter: blur(16px); opacity: .65; }
.backdrop span:nth-child(5) { top: 34%; height: 1px;  background: linear-gradient(90deg, transparent, rgba(255,97,87,.7)); transform: rotate(-13deg); filter: blur(1px); opacity: .3; }
.backdrop span:nth-child(6) { top: 71%; height: 1px;  background: linear-gradient(90deg, transparent, #6f6f79); transform: rotate(-3deg); filter: blur(1px); opacity: .24; }

/* ---------- Layout ---------- */

.screen { position: relative; z-index: 1; }
.screen[hidden] { display: none; }

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 34px 24px 72px;
}

.logo {
  height: 34px;
  width: auto;
  /*
   * The welcome screen is a column flexbox, so without this the image is
   * stretched to the full container width on the cross axis and `width: auto`
   * loses. align-self keeps it at its natural size; flex: none stops it being
   * squashed on short viewports.
   */
  align-self: flex-start;
  flex: none;
  max-width: 260px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: .96;
}

/* ---------- Welcome ---------- */

.welcome {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 44px 8vw 40px;
}

/*
 * Logo at the top, hero centred, value props pinned to the bottom.
 *
 * The hero was previously pushed down by `margin-top: auto`, which reads well
 * on a phone but leaves a dead band through the middle of a wide desktop
 * window — the backdrop here is far subtler than the prototype's artwork, so
 * there is nothing to fill it. Centring the hero and letting the props take
 * the auto margin distributes the space instead of pooling it.
 */
.welcome__body {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  max-width: 640px;
}
.rule {
  width: 52px;
  height: 2px;
  background: linear-gradient(90deg, var(--red), rgba(227, 59, 48, 0));
}
.rule--sm { width: 38px; }

.display {
  font: 800 clamp(38px, 6vw, 64px)/1.02 Archivo, sans-serif;
  letter-spacing: -.03em;
  background: linear-gradient(160deg, #fff 25%, #6f6f79);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
}
.display--sm {
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: -.02em;
  line-height: 1.08;
}
.lede { font: 400 clamp(17px, 2vw, 21px)/1.35 Archivo, sans-serif; color: var(--text-dim); margin: 0; }

.props {
  margin-top: auto;
  padding-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 26px;
  border-top: 1px solid var(--line);
  max-width: 900px;
}
.prop { display: flex; gap: 12px; align-items: center; }
.prop__mark {
  width: 32px; height: 32px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--red-bright);
  font: 700 13px Archivo, sans-serif;
}
/* Both are spans inside one wrapper, so they need to be told to stack —
   otherwise the title and its description run together on a single line. */
.prop__title { display: block; font: 700 12px/1.35 Archivo, sans-serif; }
.prop__sub { display: block; font: 400 11px/1.35 Archivo, sans-serif; color: #78787f; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 30px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  font: 700 12px/1 Archivo, sans-serif;
  letter-spacing: .14em;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), transparent);
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: #fff; background: rgba(255, 255, 255, .12); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn__arrow { font-size: 14px; color: var(--red-bright); }

.btn--quiet {
  border-color: rgba(255, 255, 255, .18);
  color: #9a9aa3;
  background: none;
  padding: 14px 26px;
  font-size: 11px;
}

.link {
  background: none;
  border: none;
  padding: 0;
  font: 500 12px Archivo, sans-serif;
  color: var(--text-mid);
  text-decoration: underline;
  cursor: pointer;
}
.link--faint { font-size: 11px; color: var(--text-faint); }
.link--faint:hover { color: var(--text-mid); }

/* ---------- Progress ---------- */

.meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.meta__step {
  font: 600 10px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .14em;
  color: var(--text-dim);
}
.meta__saved { font: 400 10px/1 Archivo, sans-serif; color: var(--text-faint); }

.bar { margin-top: 11px; height: 2px; background: rgba(255, 255, 255, .1); display: flex; }
.bar__fill { height: 2px; background: linear-gradient(90deg, #5c5c64, var(--text)); transition: width .28s ease; }
.bar__tip { width: 2%; height: 2px; background: var(--red); }

.head { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.head__sub { margin: 8px 0 0; font: 400 13px/1.55 Archivo, sans-serif; color: var(--text-dim); max-width: 480px; }

/* ---------- Fieldsets ---------- */

.group { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; border-left: 0; border-right: 0; border-bottom: 0; padding-left: 0; padding-right: 0; min-width: 0; }
.group:first-of-type { margin-top: 30px; }
.group__legend {
  font: 700 11px/1 Archivo, sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text);
  padding: 0;
}
.group__note { margin-top: 7px; font: 400 11px Archivo, sans-serif; color: var(--text-faint); }
.group__aside { font: 600 9px ui-monospace, Menlo, monospace; letter-spacing: .1em; color: var(--text-dim); }

.grid { margin-top: 16px; display: grid; gap: 16px 18px; grid-template-columns: 1fr 1fr; }
.grid--addr { grid-template-columns: 2fr 1fr 1fr; }
.grid--contact { grid-template-columns: 1.2fr 1.4fr 1fr; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

@media (max-width: 620px) {
  .grid, .grid--addr, .grid--contact { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
}

/* ---------- Fields ---------- */

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field__label {
  font: 600 9px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .12em;
  color: var(--text-dim);
}
.field__req { color: var(--red-bright); }
.field__help { font: 400 11px/1.45 Archivo, sans-serif; color: var(--text-faint); }

.field input,
.field textarea {
  border: 1px solid var(--line-input);
  background: rgba(255, 255, 255, .03);
  border-radius: var(--radius);
  font: 400 14px Archivo, sans-serif;
  color: var(--text);
  outline: none;
  width: 100%;
}
.field input { height: 42px; padding: 0 13px; }
.field textarea { padding: 11px 13px; font-size: 13px; line-height: 1.5; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #5d5d65; }
.field input:focus, .field textarea:focus { border-color: var(--line-focus); }

.field input[aria-invalid='true'],
.field textarea[aria-invalid='true'] { border-color: var(--red); }

.field__error {
  font: 500 11px/1.4 Archivo, sans-serif;
  color: var(--red-bright);
}
.field__error:empty { display: none; }

/*
 * Once validation has run, reserve the error line even when empty.
 *
 * Without this, correcting a form full of errors makes the page creep upward:
 * each field cleared removes its message, and everything below shifts under
 * the user's cursor mid-reach. The pristine form stays compact because the
 * class is only added after the first failed submit.
 */
form.is-validated .field__error:empty {
  display: block;
  min-height: 15px;
}

.field--narrow input { max-width: 220px; }

/* ---------- Toggle (role=switch) ---------- */

.toggle {
  grid-column: span 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: var(--radius);
}
.toggle__title { font: 600 13px/1.3 Archivo, sans-serif; }
.toggle__sub { font: 400 11px/1.35 Archivo, sans-serif; color: var(--text-faint); }
.switch {
  width: 46px; height: 25px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .45);
  background: transparent;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 0 3px;
  flex: none;
  cursor: pointer;
  transition: background .16s ease;
}
.switch[aria-checked='true'] { background: rgba(255, 255, 255, .22); justify-content: flex-end; }
.switch__knob { width: 17px; height: 17px; border-radius: 50%; background: var(--text); display: block; }

/* ---------- Choice controls: real inputs, styled ---------- */

.choice { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.choice input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin: 1px 0 0;
  border: 1.5px solid rgba(255, 255, 255, .6);
  background: transparent;
  flex: none;
  cursor: pointer;
  display: grid;
  place-content: center;
}
.choice input[type='checkbox'] { border-radius: 3px; }
.choice input[type='radio'] { border-radius: 50%; }

.choice input[type='checkbox']::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform .12s ease;
}
.choice input[type='checkbox']:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }

.choice input[type='radio']::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red-bright);
  transform: scale(0);
  transition: transform .12s ease;
}
.choice input[type='radio']:checked::after { transform: scale(1); }

.choice input[aria-invalid='true'] { border-color: var(--red); }
.choice__text { font: 400 13px/1.5 Archivo, sans-serif; color: #e2e2e7; }

.radios { display: flex; flex-wrap: wrap; gap: 22px; }

/* ---------- Desk chips ---------- */

.chips { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  font: 500 12px Archivo, sans-serif;
  color: var(--text-mid);
  background: transparent;
  cursor: pointer;
}
.chip[aria-pressed='true'] {
  border-color: rgba(255, 255, 255, .6);
  color: var(--text);
  background: rgba(255, 255, 255, .1);
}

/* ---------- Uploads ---------- */

.drop {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px dashed rgba(255, 255, 255, .22);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
}
.drop:hover { border-color: rgba(255, 255, 255, .45); }
.drop__icon { width: 22px; height: 26px; border: 1.5px solid rgba(255, 255, 255, .4); border-radius: 2px; flex: none; }
.drop__title { display: block; font: 600 13px/1.3 Archivo, sans-serif; }
.drop__sub { display: block; margin-top: 3px; font: 400 11px/1.4 Archivo, sans-serif; color: var(--text-faint); }

.docs { display: flex; flex-wrap: wrap; gap: 9px; }
.doc {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 13px;
  border: 1px solid var(--line-input);
  border-radius: 999px;
  font: 500 11px Archivo, sans-serif;
  color: var(--text-mid);
}
.doc button { background: none; border: none; padding: 0; color: var(--text-dim); font: 600 14px Archivo, sans-serif; cursor: pointer; line-height: 1; }

/* ---------- Notices ---------- */

.notice {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px;
  border-left: 1px solid rgba(227, 59, 48, .6);
  background: rgba(255, 255, 255, .025);
  font: 400 12px/1.6 Archivo, sans-serif;
  color: var(--text-mid);
}
.notice strong { color: var(--text); font-weight: 400; }

.errors {
  margin-top: 22px;
  padding: 13px 15px;
  border: 1px solid rgba(227, 59, 48, .55);
  border-radius: var(--radius);
  font: 500 12px/1.6 Archivo, sans-serif;
  color: var(--red-bright);
}
.errors ul { margin: 8px 0 0; padding-left: 18px; }
.errors button { color: var(--red-bright); font-size: 12px; }

/* ---------- Review ---------- */

.cards { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; }
@media (max-width: 620px) { .cards { grid-template-columns: 1fr; } }
.card { border-top: 1px solid var(--line); padding-top: 14px; }
.card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card__title { font: 600 9px ui-monospace, Menlo, monospace; letter-spacing: .12em; color: var(--text-dim); }
.card__body { margin-top: 10px; font: 400 13px/1.75 Archivo, sans-serif; color: #e2e2e7; white-space: pre-line; }
.card__edit { background: none; border: none; padding: 0; font: 600 10px Archivo, sans-serif; color: var(--text); text-decoration: underline; cursor: pointer; }

/* ---------- Actions ---------- */

.actions {
  margin-top: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Terms dialog ---------- */

dialog.terms {
  width: min(760px, 92vw);
  max-height: 84vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
dialog.terms::backdrop { background: rgba(0, 0, 0, .78); }
.terms__bar {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.terms__title { font: 700 13px Archivo, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.terms__close { background: none; border: 1px solid var(--line-input); border-radius: 999px; width: 30px; height: 30px; color: var(--text); font-size: 15px; cursor: pointer; }
.terms__body { padding: 22px 26px 30px; font: 400 13px/1.7 Archivo, sans-serif; color: #d7d7dd; }
.terms__body h1 { font-size: 18px; margin: 0 0 4px; color: var(--text); }
.terms__body h2 { font-size: 13px; margin: 24px 0 6px; color: var(--text); letter-spacing: .02em; }
.terms__body blockquote {
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 2px solid var(--red);
  background: rgba(227, 59, 48, .07);
  color: #e2e2e7;
  font-size: 12px;
}
.terms__body ul { padding-left: 18px; }
.terms__body em { color: var(--text-dim); }

/* ---------- Success ---------- */

.success { max-width: 720px; margin: 0 auto; padding: 76px 24px 72px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.tick {
  width: 62px; height: 62px;
  border: 1px solid rgba(63, 185, 119, .7);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--green);
  font: 700 21px Archivo, sans-serif;
}
.success__body { margin-top: 13px; max-width: 470px; font: 400 14px/1.65 Archivo, sans-serif; color: var(--text-dim); }
.refbox {
  margin-top: 26px;
  padding: 16px 22px;
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  text-align: center;
}
.refbox__label { font: 600 9px ui-monospace, Menlo, monospace; letter-spacing: .14em; color: var(--text-dim); }
.refbox__value { margin-top: 8px; font: 700 24px ui-monospace, Menlo, monospace; letter-spacing: .06em; color: var(--text); }
.steps { margin-top: 34px; width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.step { display: flex; align-items: center; gap: 14px; padding: 16px 2px; border-top: 1px solid var(--line); }
.step__dot { width: 11px; height: 11px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .4); flex: none; }
.step__dot--live { border-color: var(--text); }
/* Both are spans inside one wrapper, so they need to be told to stack —
   otherwise the title and its description run together on a single line. */
.step__title { display: block; font: 600 13px/1.4 Archivo, sans-serif; }
.step__meta { display: block; font: 400 11px/1.4 Archivo, sans-serif; color: var(--text-faint); }
.success__actions { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Address suggestions ---------- */

.suggestions {
  margin-top: -8px;
  border: 1px solid var(--line-input);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.suggestions__head {
  margin: 0;
  padding: 9px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font: 600 9px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font: 400 13px Archivo, sans-serif;
  color: #e2e2e7;
  cursor: pointer;
}
.suggestions button:last-child { border-bottom: none; }
.suggestions button:hover,
.suggestions button:focus-visible { background: rgba(255, 255, 255, .06); }

/*
 * The backdrop glows are sized as a percentage of the viewport, so on a narrow
 * screen the same ellipse concentrates into a much denser wash. Damp them
 * there — the spec reserves red for hairlines and accents, not large fills,
 * and on a phone the desktop values read as the latter.
 */
@media (max-width: 620px) {
  .backdrop::before { opacity: .55; }
  .backdrop::after { opacity: .5; }
  .backdrop span:nth-child(4) { opacity: .4; }
}

/* ---------- Chosen address confirmation ---------- */

.chosen {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(63, 185, 119, .35);
  border-radius: var(--radius);
  background: rgba(63, 185, 119, .05);
}
.chosen__mark { color: var(--green); font: 700 13px Archivo, sans-serif; flex: none; }
.chosen__text { flex: 1; font: 500 13px/1.4 Archivo, sans-serif; color: var(--text); min-width: 0; }
.chosen__change { flex: none; }

.manual-toggle { margin: 0; }
.manual-fields { margin-top: 0; }
