/* ============================================================================
   Start a quote: the intake overlay.
   Same building as the page: navy bar, off-white ground, the neutral ramp,
   Libre Franklin through var(--font), flat. No gradients, shadows or glows.
   Tokens come from styles.css. Transitions stay under 200ms and switch off
   under prefers-reduced-motion.
   ========================================================================= */

:root { --z-dialog: 40; }

html.qf-open { overflow: hidden; }

.qf {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow-y: auto;
  background: var(--n50);
  color: var(--navy);
}
.qf[hidden] { display: none; }
.qf:focus { outline: none; }

.qf input,
.qf textarea { font: inherit; color: inherit; }
/* Buttons keep their own colour. ".qf button { color: inherit }" outranked .btn and turned
   the plain navy button (Pick up where I left off, Continue) navy on navy. */
.qf button { font: inherit; }

/* ---- The bar ------------------------------------------------------------- */

.qf__bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-h);
  padding: 0.5rem var(--gutter);
  background: var(--navy);
  color: var(--white);
}
.qf__logo { width: 150px; height: auto; flex: none; }
.qf__progress {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.qf__call {
  margin-left: auto;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.qf__call:hover { text-decoration: underline; text-underline-offset: 3px; }
.qf__bar a:focus-visible,
.qf__bar button:focus-visible { outline-color: var(--green); }
.qf__close {
  flex: none;
  color: inherit;
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  border: 2px solid var(--white);
  border-radius: 4px;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.qf__close:hover { background: var(--white); color: var(--navy); }

/* ---- Screens ------------------------------------------------------------- */

.qf__body { padding: var(--space-6) var(--gutter) var(--space-8); }

.qf__screen {
  width: min(56rem, 100%);
  margin-inline: auto;
}
.qf__screen--node { width: min(66rem, 100%); }
.qf__screen--in { animation: qf-in 150ms var(--ease-out); }
@keyframes qf-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.qf__screen h2 {
  max-width: 22ch;
  font-size: var(--text-h2);
  line-height: 1.08;
}
.qf__screen h2:focus { outline: none; }
.qf__kicker {
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--n600);
}
.qf__hint,
.qf__lead {
  margin-top: var(--space-3);
  max-width: 52ch;
  font-size: var(--text-lead);
  line-height: 1.45;
  color: var(--n600);
}
.qf__lead strong { color: var(--navy); }
.qf__small {
  margin-top: var(--space-4);
  max-width: 60ch;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--n600);
}
.qf__phone {
  margin-top: var(--space-6);
  font-size: var(--text-base);
  color: var(--n600);
}
.qf__phone a { font-weight: 700; color: var(--navy); text-underline-offset: 3px; }

fieldset.qf-q,
fieldset.qf-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.qf-legend { padding: 0; }
.qf-legend + .qf__hint,
.qf-legend + .qf-cards { margin-top: var(--space-3); }

/* ---- Cards: every choice is a big button, never a select ----------------- */

.qf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-5);
}
.qf-cards--node { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

.qf-card {
  color: var(--navy);
  display: grid;
  gap: 0.35rem;
  align-content: center;
  min-height: 4.5rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--navy);
  border-radius: 4px;
  background: var(--white);
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.qf-cards--node .qf-card { min-height: 7rem; }
.qf-card:hover { background: var(--n100); }
.qf-card[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.qf-card__label {
  font-size: var(--text-lead);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.qf-card__note {
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.4;
  color: var(--n600);
}
.qf-card[aria-pressed="true"] .qf-card__note { color: var(--n200); }
/* "Not sure, advise me" carries the hero tag's green dot. */
.qf-card--advise .qf-card__label::before {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  vertical-align: 0.05em;
}

/* ---- Typed fields --------------------------------------------------------- */

.qf-field { margin-top: var(--space-5); }
.qf-field--sub { margin-top: var(--space-3); }
.qf-fieldrow { display: grid; gap: 0; }
.qf-fieldrow--contact { max-width: 32rem; }
.qf-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.35;
}
.qf-input {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--navy);
  border-radius: 4px;
  background: var(--white);
  font-size: var(--text-lead);
  line-height: 1.3;
}
.qf-input--short { max-width: 12rem; }
.qf-input::placeholder { color: var(--n500); opacity: 1; }
.qf-input:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.qf-input[aria-invalid="true"] { border-width: 3px; }
.qf-input:disabled { background: var(--n100); color: var(--n500); border-color: var(--n300); }
textarea.qf-input { resize: vertical; min-height: 3.5rem; }

.qf-error {
  margin-top: var(--space-3);
  font-weight: 700;
  color: var(--navy);
}
.qf-error::before { content: "Check this: "; color: var(--n600); }

.qf__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}
.qf__actions .btn { cursor: pointer; }
.qf__actions .btn--ghost { background: var(--white); }
.qf__actions .btn--ghost:hover { background: var(--navy); }

/* ---- Phase 2: sectioned, pre-filled ---------------------------------------- */

.qf__screen--p2 .qf-field { margin-top: var(--space-5); }
.qf__screen--p2 .qf-field[hidden] { display: none; }
.qf-field__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.qf-field__row .qf-input { flex: 1 1 16rem; width: auto; }
.qf-field__row .qf-input--short { flex: 0 1 12rem; }

.qf-fieldhint {
  margin: -0.15rem 0 0.5rem;
  max-width: 52ch;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--n600);
}

.qf-tag {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.15rem 0.5rem;
  vertical-align: 0.1em;
  border-radius: 3px;
  background: var(--green);
  color: var(--navy);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.qf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.qf-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--navy);
  border-radius: 4px;
  background: var(--white);
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.qf-chip input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}
.qf-chip:hover { background: var(--n100); }
.qf-chip:has(input:checked) { background: var(--navy); color: var(--white); }
.qf-chip:has(input:focus-visible) { outline: 3px solid var(--navy); outline-offset: 3px; }
.qf-chip--idk { border-style: dashed; border-color: var(--n500); color: var(--n600); }
.qf-chip--idk:has(input:checked) { background: var(--n600); border-color: var(--n600); color: var(--white); }

.qf__aside {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--n200);
  color: var(--n600);
}
.qf__aside-line { margin-top: var(--space-2); }
.qf__aside-line a { font-weight: 700; color: var(--navy); text-underline-offset: 3px; }
.qf__textbtn {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.qf__textbtn:disabled { text-decoration: none; color: var(--n600); cursor: default; }
.qf__aside .qf__small { margin-top: var(--space-2); }

/* ---- Phones -------------------------------------------------------------- */

@media (max-width: 720px) {
  .qf__bar { gap: var(--space-3); font-size: var(--text-xs); flex-wrap: wrap; }
  .qf__logo { display: none; }
  .qf__num { display: none; }
  .qf__close { min-height: 2.5rem; padding: 0.3rem 0.75rem; }
  .qf__body { padding: var(--space-5) var(--gutter) var(--space-7); }
  .qf-cards,
  .qf-cards--node { grid-template-columns: 1fr; }
  .qf-cards--node .qf-card { min-height: 4.5rem; }
  .qf-card { min-height: 4rem; padding: 0.9rem 1rem; }
  .qf-card__label { font-size: var(--text-base); }
  .qf-card__note { font-size: var(--text-xs); }
  .qf__hint,
  .qf__lead { font-size: var(--text-base); }
  .qf-input { font-size: var(--text-base); }
  .qf__actions .btn { flex: 1 1 auto; }
}

/* ---- Motion preferences -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .qf__screen--in { animation: none; }
  .qf-card,
  .qf-chip,
  .qf__close { transition: none; }
}
