/* ==========================================================================
   Certified ProBooks — quote quiz modal
   Same interaction pattern shipped for K&E Cleaning (one question per screen,
   tap-to-advance, progress bar, back on every step but the first), rebranded
   to navy/green and rewritten for a bookkeeping intake.
   ========================================================================== */

.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(27, 47, 85, .58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.quiz-overlay.is-open { opacity: 1; pointer-events: auto; }

.quiz-modal {
  background: #fff;
  border-radius: 22px;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 30px 80px rgba(27, 47, 85, .4);
  transform: translateY(14px) scale(.985);
  transition: transform .22s ease;
}
.quiz-overlay.is-open .quiz-modal { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .quiz-overlay, .quiz-modal { transition: none; }
}

/* Phones: use the full sheet, anchored to the bottom like a native sheet. */
@media (max-width: 560px) {
  .quiz-overlay { padding: 0; align-items: flex-end; }
  .quiz-modal { max-width: 100%; max-height: 100vh; height: 100%; border-radius: 0; }
}

/* ── Header ────────────────────────────────────────────────────────────── */
.quiz-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
}
@media (max-width: 560px) { .quiz-head { border-radius: 0; } }

.quiz-head__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 34px;
}

.quiz-back, .quiz-close {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  /* Full 44px tap targets — these are the two controls a visitor reaches for
     most often on a phone. */
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  margin: -8px;
  border-radius: 10px;
}
.quiz-back:hover, .quiz-close:hover { color: var(--navy); background: var(--navy-tint); }
.quiz-back[hidden] { visibility: hidden; display: inline-flex; }
.quiz-close { font-size: 1.6rem; line-height: 1; }

.quiz-progress {
  height: 8px;
  background: var(--navy-tint);
  border-radius: 999px;
  overflow: hidden;
}
.quiz-progress__fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--green) 0%, var(--green-dark) 100%);
  border-radius: 999px;
  transition: width .28s ease;
}
.quiz-progress__label {
  font-family: var(--font-head);
  font-size: .76rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .05em;
  margin-top: 8px;
  display: block;
}

/* ── Steps ─────────────────────────────────────────────────────────────── */
.quiz-body { padding: 26px 22px 32px; }

.quiz-step { display: none; }
.quiz-step.is-active { display: block; animation: quizIn .22s ease; }
@keyframes quizIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .quiz-step.is-active { animation: none; } }

.quiz-q {
  font-family: var(--font-head);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--navy-deep);
  line-height: 1.3;
  margin: 0 0 6px;
}
.quiz-help { font-size: .92rem; color: var(--muted); margin: 0 0 20px; }

.quiz-options { display: grid; gap: 11px; }

.quiz-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 13px;
  padding: 16px 18px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  min-height: 58px;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.quiz-option:hover { border-color: var(--green); background: var(--green-tint); }
.quiz-option.is-selected { border-color: var(--green-dark); background: var(--green-tint); }
.quiz-option:active { transform: scale(.99); }

.quiz-option__icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--navy-tint);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}
.quiz-option:hover .quiz-option__icon,
.quiz-option.is-selected .quiz-option__icon { background: #fff; color: var(--green-dark); }

.quiz-option__text strong {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy-deep);
  line-height: 1.3;
}
.quiz-option__text span { font-size: .85rem; color: var(--muted); }

/* ── Contact fields ────────────────────────────────────────────────────── */
.quiz-field { margin-bottom: 15px; }
.quiz-field label {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .88rem;
  color: var(--navy-deep);
  margin-bottom: 6px;
}
.quiz-input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 11px;
  padding: 14px 15px;
  /* 16px minimum stops iOS Safari zooming the page on focus. */
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink);
  background: #fff;
  min-height: 52px;
}
.quiz-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(146,208,80,.18); }
.quiz-input::placeholder { color: #A6AFC0; }
.quiz-input[aria-invalid="true"] { border-color: #DC5B5B; }

.quiz-error { color: #C13C3C; font-size: .85rem; margin-top: 6px; display: none; }
.quiz-error.is-shown { display: block; }

/* Honeypot — off-screen, never focusable by a real visitor. */
.quiz-hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  opacity: 0;
}

.quiz-submit { width: 100%; margin-top: 8px; }
.quiz-submit[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.quiz-fineprint {
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
}

.quiz-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.quiz-trust img { width: 34px; }
.quiz-trust span { font-size: .8rem; color: var(--muted); }

/* ── Result screen ─────────────────────────────────────────────────────── */
.quiz-result { text-align: center; }
.quiz-result__icon {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--green-tint);
  border: 2px solid var(--green);
  display: grid;
  place-items: center;
  font-size: 1.7rem;
}
.quiz-result h3 { font-size: 1.4rem; margin-bottom: .4em; }
.quiz-result > p { color: var(--body); font-size: 1rem; }

.quiz-rec {
  text-align: left;
  background: var(--off);
  border: 1px solid var(--border);
  border-left: 5px solid var(--green);
  border-radius: 12px;
  padding: 20px;
  margin: 22px 0 20px;
}
.quiz-rec__kicker {
  font-family: var(--font-head);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.quiz-rec h4 {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--navy-deep);
  margin: 0 0 8px;
}
.quiz-rec p { font-size: .95rem; margin: 0; }

.quiz-summary {
  text-align: left;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 16px;
}
.quiz-summary dl { margin: 0; display: grid; gap: 8px; }
.quiz-summary .row { display: flex; justify-content: space-between; gap: 14px; font-size: .89rem; }
.quiz-summary dt { color: var(--muted); }
.quiz-summary dd { margin: 0; color: var(--navy-deep); font-weight: 600; text-align: right; }

/* Spinner on the submit button while the POST is in flight */
.quiz-spinner {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(27,47,85,.25);
  border-top-color: var(--navy-deep);
  border-radius: 50%;
  animation: quizSpin .7s linear infinite;
}
@keyframes quizSpin { to { transform: rotate(360deg); } }
