/* ── Page frame ───────────────────────────────────────────────────────────── */
.quote-page { background: var(--paper); min-height: 100svh; }
.qhead { position: sticky; top: 0; z-index: var(--z-header); background: rgb(250 247 245 / 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.qhead__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 44rem; margin-inline: auto; padding: 0.7rem var(--gutter); }
.qhead .brand__mark { width: 2.1rem; height: 2.1rem; font-size: 0.85rem; }
.qhead .brand__name { font-size: 0.98rem; }
.qhead__help { display: grid; text-align: right; line-height: 1.2; text-decoration: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.qhead__help-label { font-size: 0.78rem; font-weight: 500; color: var(--ink-2); }
@media (max-width: 420px) { .qhead .brand__name { display: none; } }

.progress { height: 4px; background: var(--line); }
.progress__bar { display: block; height: 100%; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform 450ms var(--ease-out); }

.qmain { max-width: 44rem; margin-inline: auto; padding: 1.5rem var(--gutter) 0; }
.qmeta { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 1.25rem; padding: 0.8rem 1rem; border-radius: var(--radius-sm); background: var(--surface); font-size: 0.95rem; }
.noscript { padding: 1rem; background: var(--red-tint); border-radius: var(--radius-sm); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Step ─────────────────────────────────────────────────────────────────── */
.step { padding: 1.1rem 0 2rem; }
.step__title { font-size: clamp(1.75rem, 5.5vw, 2.35rem); line-height: 1.1; letter-spacing: -0.03em; outline: none; }
.step__sub { margin-top: 0.6rem; color: var(--ink-2); font-size: 1.02rem; max-width: 46ch; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 1rem; margin-top: 1.9rem; }
.field { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; border: 0; }
.field--half { grid-column: span 1; }
@media (max-width: 480px) { .field--half { grid-column: 1 / -1; } }
.field[hidden] { display: none; }

/* Step change: new screen slides in from the side it's coming from */
.step.enter-fwd { animation: step-in-fwd 320ms var(--ease-out); }
.step.enter-back { animation: step-in-back 320ms var(--ease-out); }
@keyframes step-in-fwd { from { opacity: 0; transform: translateX(28px); } }
@keyframes step-in-back { from { opacity: 0; transform: translateX(-28px); } }

/* A follow-up question that appears because of an answer drops in beneath it */
.field.is-arriving, .repeat__row.is-arriving { animation: arrive 300ms var(--ease-out); }
@keyframes arrive { from { opacity: 0; transform: translateY(-8px); } }

/* ── Labels & text inputs ─────────────────────────────────────────────────── */
.field > label, .field legend, .field .label { display: block; margin-bottom: 0.5rem; font-weight: 650; font-size: 1rem; line-height: 1.35; }
.field legend { padding: 0; }
.opt { font-weight: 500; font-size: 0.85rem; color: var(--ink-2); margin-left: 0.25rem; }
.hint { margin: -0.2rem 0 0.6rem; font-size: 0.9rem; color: var(--ink-2); }

.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="date"],
.field input[type="month"], .field textarea, .select select, .repeat input {
  width: 100%; min-height: 3.35rem; padding: 0.8rem 1rem;
  font-size: 1.0625rem; /* 17px: iOS won't zoom on focus */
  background: var(--card); border: 1.5px solid var(--field); border-radius: var(--radius-sm);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder, .repeat input::placeholder { color: #8f8284; }
.field input:focus, .field textarea:focus, .select select:focus, .repeat input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgb(165 28 48 / 0.18); }
.field input:disabled { background: var(--surface); border-style: dashed; }
.select { position: relative; }
.select select { padding-right: 2.75rem; cursor: pointer; }
.select select:invalid, .select select option[value=""] { color: #8f8284; }
.select::after { content: ""; position: absolute; right: 1.05rem; top: 50%; width: 0.6rem; height: 0.6rem; margin-top: -0.45rem; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }

/* ── Tap choices (radio/checkbox styled as buttons) ───────────────────────── */
.opts { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.opts--2 { display: grid; grid-template-columns: 1fr 1fr; }
.opts--list { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .opts--list { grid-template-columns: 1fr; } }
.opt-btn { position: relative; flex: 1 1 auto; }
.opt-btn input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt-btn span {
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 3.1rem; height: 100%; padding: 0.6rem 1rem; text-align: center;
  background: var(--card); border: 1.5px solid var(--field); border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.98rem; line-height: 1.25;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.opts--list .opt-btn span { justify-content: flex-start; text-align: left; }
.opt-btn input:checked + span { background: var(--red-tint); border-color: var(--red); color: var(--red-press); box-shadow: inset 0 0 0 1px var(--red); }
.opt-btn input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }
.opt-btn input:active + span { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .opt-btn:hover span { border-color: var(--ink-2); } }

/* The tick in multi-select chips pops in when chosen */
.tick { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.opt-btn .tick { display: none; }
.opt-btn input[type="checkbox"] + span .tick { display: block; opacity: 0.25; transform: scale(0.6); transition: transform 220ms var(--ease-pop), opacity 150ms ease; }
.opt-btn input[type="checkbox"]:checked + span .tick { opacity: 1; transform: none; }

/* ── Cover cards (step 1) ─────────────────────────────────────────────────── */
.cards { display: grid; gap: 0.7rem; }
.card-opt { position: relative; display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: 0.9rem; padding: 0.9rem 1rem; background: var(--card); border: 1.5px solid var(--field); border-radius: var(--radius); cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease, transform 120ms var(--ease-out); }
.card-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.card-opt:active { transform: scale(0.985); }
.card-opt__icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 10px; background: var(--surface); color: var(--ink); transition: background-color 150ms ease, color 150ms ease; }
.card-opt__icon svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card-opt__text strong { display: block; font-size: 1.05rem; }
.card-opt__text small { display: block; color: var(--ink-2); font-size: 0.9rem; }
.card-opt__check { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1.5px solid var(--field); color: #fff8f7; transition: background-color 150ms ease, border-color 150ms ease; }
.card-opt__check .tick { transform: scale(0.4); opacity: 0; transition: transform 240ms var(--ease-pop), opacity 120ms ease; }
.card-opt:has(input:checked) { border-color: var(--red); background: var(--red-tint); box-shadow: inset 0 0 0 1px var(--red); }
.card-opt:has(input:checked) .card-opt__icon { background: var(--red); color: #fff8f7; }
.card-opt:has(input:checked) .card-opt__check { background: var(--red); border-color: var(--red); }
.card-opt:has(input:checked) .card-opt__check .tick { transform: none; opacity: 1; }
.card-opt:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }

/* ── Single checkbox (consent, "not sure") ────────────────────────────────── */
.check { position: relative; display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; font-size: 0.98rem; line-height: 1.45; }
.check input { position: absolute; opacity: 0; width: 1.6rem; height: 1.6rem; margin: 0; cursor: pointer; }
.check__box { display: grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 6px; border: 1.5px solid var(--field); background: var(--card); color: #fff8f7; transition: background-color 150ms ease, border-color 150ms ease; }
.check__box .tick { width: 1rem; height: 1rem; transform: scale(0.4); opacity: 0; transition: transform 240ms var(--ease-pop), opacity 120ms ease; }
.check input:checked + .check__box { background: var(--red); border-color: var(--red); }
.check input:checked + .check__box .tick { transform: none; opacity: 1; }
.check input:focus-visible + .check__box { outline: 3px solid var(--red); outline-offset: 2px; }
.check a { color: var(--red); font-weight: 600; }
.check--sm { margin-top: 0.7rem; font-size: 0.95rem; align-items: center; }

/* ── ID number readout ────────────────────────────────────────────────────── */
.decoded { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.55rem; font-size: 0.92rem; font-weight: 600; color: var(--ok); min-height: 0; }
.decoded:empty { display: none; }
.decoded .tick { width: 1.1rem; height: 1.1rem; }
.decoded.is-ok { animation: arrive 300ms var(--ease-out); }

/* ── Claims: one row of dropdowns per claim ─────────────────────────────── */
.claimrows { display: grid; gap: 0.6rem; }
.claimrows__row { display: grid; grid-template-columns: 1.75rem 7.5rem 1fr; gap: 0.5rem; align-items: center; animation: arrive 300ms var(--ease-out); }
.claimrows__n { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--surface); font-weight: 700; font-size: 0.85rem; color: var(--ink-2); }
@media (max-width: 400px) { .claimrows__row { grid-template-columns: 1.5rem 6.25rem 1fr; } }

/* ── Email typo suggestion ────────────────────────────────────────────────── */
.suggest { margin-top: 0.5rem; font-size: 0.93rem; color: var(--ink-2); animation: arrive 250ms var(--ease-out); }
.suggest strong { color: var(--ink); }
.suggest .linkbtn { min-height: 0; padding: 0; margin-left: 0.25rem; }

/* ── Repeatable rows ──────────────────────────────────────────────────────── */
.repeat { display: grid; gap: 0.6rem; }
.repeat:empty { display: none; }
.repeat__row { display: grid; grid-template-columns: 11rem 1fr 7.5rem 3rem; gap: 0.5rem; }
@media (max-width: 560px) {
  .repeat__row { grid-template-columns: 1fr 7rem 2.75rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
  .repeat__cat { grid-column: 1 / -1; }
}
.iconbtn { width: 100%; min-height: 3.35rem; border: 0; border-radius: var(--radius-sm); background: var(--surface); font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { color: var(--red); }
.addbtn { display: inline-flex; align-items: center; gap: 0.55rem; margin-top: 1.5rem; min-height: 3.1rem; padding: 0 1.1rem; border: 1.5px dashed var(--field); border-radius: var(--radius-sm); background: transparent; font-weight: 650; cursor: pointer; width: 100%; justify-content: center; transition: background-color 150ms ease, border-color 150ms ease; }
.addbtn span { font-size: 1.3rem; line-height: 1; color: var(--red); }
.addbtn:hover { background: var(--card); border-color: var(--red); }
.addbtn--sm { margin-top: 0.7rem; }
.linkbtn { border: 0; background: none; padding: 0.4rem 0; min-height: 2.75rem; font-weight: 650; color: var(--red); cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.step > .linkbtn { margin-top: 1.25rem; }

/* ── Errors ───────────────────────────────────────────────────────────────── */
.err { margin: 0.45rem 0 0; font-size: 0.92rem; font-weight: 600; color: var(--red); }
.err:empty { display: none; }
.has-error input:not([type="checkbox"]):not([type="radio"]), .has-error textarea, .has-error select { border-color: var(--red); background: #fffafa; }
.has-error .opt-btn span, .has-error .card-opt, .has-error .check__box { border-color: var(--red); }
.nudge { animation: nudge 320ms var(--ease-out); }
@keyframes nudge { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }
.errsum { margin-bottom: 1.25rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--red-tint); color: var(--ink); outline: none; box-shadow: inset 0 0 0 1.5px var(--red); }
.errsum:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.errsum ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.errsum a { color: var(--red-press); font-weight: 650; }

/* ── Bottom navigation ────────────────────────────────────────────────────── */
.qnav { position: sticky; bottom: 0; z-index: var(--z-bar); margin-inline: calc(-1 * var(--gutter)); padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--paper) 78%, rgb(250 247 245 / 0)); }
.qnav__inner { display: flex; gap: 0.6rem; }
.qnav__back { width: 3.35rem; min-height: 3.35rem; padding: 0; flex: none; }
.qnav__back svg { width: 1.3rem; height: 1.3rem; }
.qnav__next { flex: 1; min-height: 3.35rem; font-size: 1.05rem; }
.qnav__safe { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 0.55rem; font-size: 0.8rem; color: var(--ink-2); }
.qnav__safe svg { width: 0.9rem; height: 0.9rem; }

.spinner { display: none; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2.5px solid rgb(255 248 247 / 0.35); border-top-color: #fff8f7; animation: spin 700ms linear infinite; }
.qnav__next.is-busy .spinner { display: block; }
.qnav__next.is-busy .icon-arrow { display: none; }
.qnav__next:disabled { cursor: progress; opacity: 0.85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Review ───────────────────────────────────────────────────────────────── */
.review { display: grid; gap: 1rem; margin-top: 1.75rem; }
.review__sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 1.1rem 0.8rem; }
.review__sec header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.review__sec h2 { font-size: 1.1rem; letter-spacing: -0.01em; }
.review__sec dl { margin: 0.5rem 0 0; display: grid; }
.review__sec dl > div { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; gap: 0.75rem; padding: 0.4rem 0; font-size: 0.95rem; }
.review__sec dt { color: var(--ink-2); }
.review__sec dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.senderr { margin-top: 1rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--red-tint); box-shadow: inset 0 0 0 1.5px var(--red); }
.senderr a { color: var(--red-press); font-weight: 700; }

/* ── Done ─────────────────────────────────────────────────────────────────── */
.is-done #quote, .is-done .resume { display: none; }
.is-done .progress__bar { transform: scaleX(1) !important; }
.done { padding: 2.5rem 0 4rem; }
.done__mark { width: 4.5rem; height: 4.5rem; fill: none; stroke: var(--ok); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.done__mark circle { stroke-dasharray: 183; stroke-dashoffset: 183; animation: draw 700ms var(--ease-out) forwards; }
.done__mark path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 400ms var(--ease-out) 550ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h1 { margin-top: 1.5rem; font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1.1; letter-spacing: -0.03em; outline: none; }
.done__how { margin-top: 0.8rem; font-size: 1.1rem; color: var(--ink-2); }
.done__ref { margin-top: 1.25rem; display: inline-flex; gap: 0.5rem; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); background: var(--surface); font-size: 0.95rem; }
.done__ref strong { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.done__test { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: #fff4d6; font-size: 0.92rem; }
.done__next { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.done__next h2 { font-size: 1.2rem; }
.done__next ol { margin: 0.9rem 0 0; padding-left: 1.3rem; display: grid; gap: 0.5rem; color: var(--ink-2); }
.done__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2.25rem; }

/* ── Reduced motion: keep the fades, drop the movement ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .step.enter-fwd, .step.enter-back, .field.is-arriving, .repeat__row.is-arriving, .decoded.is-ok, .claimrows__row, .suggest { animation: fade 200ms ease; }
  .nudge { animation: none; }
  .progress__bar { transition: none; }
  .opt-btn span, .card-opt, .opt-btn input:active + span { transform: none !important; }
  .done__mark circle, .done__mark path { animation: none; stroke-dashoffset: 0; }
  @keyframes fade { from { opacity: 0; } }
}
