/*
 * The referrer sign-up page, /refer/ (washmates-referrals 16, prototype A "form first").
 *
 * Builds on styles.css's /quote shell (.qp, .qp-slim, .qp-fine, .quote-form, .wm-field, .qf-check,
 * .qf-alert, .qf-error, .hp) and the light theme's tokens; only this page's own layout lives here.
 *  - Phone (default): one column. Pill, headline, the owner's line, the 3-step strip, the form card,
 *    then "The small print in brief" (grid areas, so the DOM order stays intro → form → small print).
 *  - Desktop (from 960px): A-desktop's two columns. Intro and small print on the left, the form on the
 *    right with its "Get your link" heading; the step strip becomes a list of A-desktop's longer lines.
 *  - After sign-up (.rf-done): prototype A screen 2 in a single 520px column, centred.
 */

.rf {
  /* .qp's 16px top padding is tight for a page that opens on a headline. */
  padding-top: 24px;
}

.rf__col {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.rf__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    'intro'
    'form'
    'small';
  gap: 24px;
}

.rf__grid[hidden] {
  display: none;
}

.rf__intro {
  grid-area: intro;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.rf__form {
  grid-area: form;
  min-width: 0;
}

/* The yellow pill (prototype A): a sun fill with on-sun text, sentence case. */
.rf__pill {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--sun);
  color: var(--on-sun);
}

.rf__title {
  margin: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

/* "roof clean" in the headline and the name in "You're in, Mike." (prototype A). */
.rf__accent {
  color: var(--aqua-ink);
}

.rf__lede {
  margin: 0;
}

/* The 3-step strip: three small white cards on phones (prototype A screen 1). */
.rf-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rf-steps__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  font: var(--text-caption);
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.rf-steps__n {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--aqua);
  color: var(--on-aqua);
}

.rf-steps__long {
  display: none;
}

/* The form card: the quote form's card, with the fields a little closer (one screen of fields). */
.rf-form {
  gap: 16px;
}

/*
 * Phones: /quote drops its card and paints the page white there (styles.css, "no card, the form is
 * the page"), but prototype A keeps the white card on the light ground, like the step cards above it.
 */
@media (max-width: 639px) {
  .qp.rf {
    background: var(--surface);
  }

  .rf .rf-form {
    padding: 20px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
  }
}

/* "Get your link" is A-desktop's; on phones the headline above already says it, so screen readers only. */
.rf-form__title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.rf-form__pair {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rf-form__optional {
  font-weight: 500;
  color: var(--ink-muted);
}

.rf-form__terms {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* The tick's sentence wraps on phones: keep the box on its first line. */
.rf-form__check {
  align-items: flex-start;
  min-height: 44px;
}

.rf-form__check input {
  margin-top: 1px;
}

.rf-form__check input[aria-invalid='true'] {
  outline: 2px solid var(--danger);
  outline-offset: 1px;
}

.rf-form__check a {
  color: var(--aqua-ink);
}

.rf-form__secure {
  margin: 0;
  color: var(--ink-muted);
  text-align: center;
}

.rf-form__secure svg {
  display: inline-block;
  margin-right: 2px;
  vertical-align: -3px;
  color: var(--aqua-ink);
}

/* "The small print in brief". */
.rf-small {
  grid-area: small;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.rf-small h2 {
  margin: 0;
}

.rf-small__list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: var(--text-body);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
}

.rf-small__link {
  align-self: flex-start;
  color: var(--aqua-ink);
}

/* ---------- After sign-up (prototype A screen 2) ---------- */

.rf-done {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.rf-done[hidden] {
  display: none;
}

.rf-done h2,
.rf-done p {
  margin: 0;
}

.rf-done__title {
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

/* The code and link on teal (data-theme="teal" swaps the tokens for the teal ground). */
.rf-code {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
}

.rf-code__label {
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.rf-code__code {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: 2px;
  overflow-wrap: anywhere;
}

.rf-code__link {
  color: var(--aqua-ink);
  overflow-wrap: anywhere;
}

/* More ways + Copy link side by side; Copy link alone takes the row when sharing isn't supported. */
.rf-share {
  display: flex;
  gap: 12px;
}

.rf-share__btn {
  flex: 1 1 0;
  min-width: 0;
}

.rf-share__btn[hidden] {
  display: none;
}

.rf-nudge {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.rf-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.rf-page strong {
  overflow-wrap: anywhere;
}

.rf-done--emailed {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

/* ---------- Desktop: A-desktop's two columns ---------- */

@media (min-width: 960px) {
  .rf {
    padding-top: 48px;
  }

  .rf__col {
    max-width: 1120px;
  }

  .rf__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      'intro form'
      'small form';
    column-gap: 56px;
    row-gap: 0;
  }

  .rf__intro {
    gap: 20px;
  }

  .rf__title {
    font: var(--text-display-l);
    letter-spacing: -1px;
  }

  .rf__lede {
    font: var(--text-body-l);
  }

  .rf__form {
    align-self: start;
  }

  .rf-form {
    padding: 28px;
  }

  .rf-form__title {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .rf-form__pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* The longer step lines as a plain list (A-desktop). */
  .rf-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .rf-steps__item {
    flex-direction: row;
    gap: 12px;
    padding: 0;
    border: 0;
    background: none;
    font: var(--text-body);
    text-align: left;
  }

  .rf-steps__n {
    width: 30px;
    height: 30px;
    font-weight: 700;
  }

  .rf-steps__short {
    display: none;
  }

  .rf-steps__long {
    display: inline;
  }

  .rf-small {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }
}

/* ---------- Who we are (washmates-referrals 26, prototype A) ---------- */

/* One line under the pill (it wraps on phones): who and where, the Google rating, the insurance. */
.rf-trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  font: var(--text-caption);
  font-weight: 700;
  color: var(--ink);
}

.rf-trust__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rf-trust__item > svg {
  flex-shrink: 0;
  color: var(--aqua-ink);
}

@media (min-width: 960px) {
  .rf-trust {
    font: var(--text-body);
    font-weight: 700;
  }
}
