/* =============================================================
   QUIZ-MODULE — V38 Stage 2
   Card chrome for the shared 5-step quiz (public/v39/_lib/quiz-module.js).
   Scoped under .qm- so it never collides with page-level styles; the
   card visual language (ink border, offset shadow, lemon accent on
   checked chips) matches the direction-b-night-sky comp's .quiz-card.
   Depends only on lemon.css tokens (--ink/--cream/--pink/--pink-dark/
   --lemon-2/--rule/--mute/--blush-2) — no local :root additions needed.
   ============================================================= */

.qm-card {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 24px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 26px 22px 30px;
  max-width: 560px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
@media (min-width: 780px) {
  .qm-card { padding: 38px 42px 42px; min-height: 340px; }
}

.qm-top { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.qm-back {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: none; border: none; cursor: pointer; padding: 6px 0;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px; color: var(--mute);
}
.qm-back svg { width: 15px; height: 15px; }
.qm-back:hover { color: var(--ink); }

.qm-progress { flex: 1; }
.qm-progress-track {
  width: 100%; height: 5px; border-radius: 999px; background: var(--rule);
  overflow: hidden; margin-bottom: 8px;
}
.qm-progress-fill {
  height: 100%; width: 20%; background: var(--pink); border-radius: 999px;
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}
.qm-progress-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 600;
}

.qm-steps { flex: 1; display: flex; }
.qm-step {
  border: none; margin: 0; padding: 0; width: 100%;
  display: flex; flex-direction: column; flex: 1; justify-content: center;
  animation: qm-step-in .5s cubic-bezier(.22,.61,.36,1);
}
@keyframes qm-step-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .qm-step { animation: none; } }

.qm-question {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 24px;
  line-height: 1.25; letter-spacing: -.01em; color: var(--ink);
  padding: 0; margin: 0 0 8px; max-width: 440px;
  /* Stops the ragged last-line orphan — "Sex as it appears on your / ID" was
     dropping a two-letter line on its own at 390px. Progressive: browsers
     without it get exactly the previous behaviour. */
  text-wrap: balance;
}
@media (min-width: 780px) { .qm-question { font-size: 27px; } }
.qm-sub { font-size: 14px; color: var(--mute); margin: 0 0 22px; max-width: 420px; }

.qm-zip-input {
  width: 100%; max-width: 220px; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 24px; letter-spacing: .1em; font-weight: 600;
  padding: 14px 18px; border: 2px solid var(--rule); border-radius: 12px;
  background: var(--cream); color: var(--ink); margin-bottom: 20px;
  transition: border-color .12s cubic-bezier(.22,.61,.36,1);
}
.qm-zip-input:focus-visible { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(0,181,216,.16); }

.qm-dob-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 16px; }
.qm-dob-part {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 20px; font-weight: 600;
  text-align: center; padding: 13px 4px; border: 2px solid var(--rule); border-radius: 12px;
  background: var(--cream); color: var(--ink); width: 64px;
  transition: border-color .12s cubic-bezier(.22,.61,.36,1);
}
.qm-dob-part.qm-dob-year { width: 90px; }
.qm-dob-part:focus-visible { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(0,181,216,.16); }
.qm-dob-sep { color: var(--mute); font-size: 20px; font-weight: 600; }

.qm-chip-group { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }

/* The answer options are the ONLY action on a question screen, but as
   intrinsically-sized pills they read as secondary next to a 27px Fraunces
   headline — two small pills floated left in a 490px card, with the rest of
   the row empty. Equal-width tracks give them presence and a consistent
   rhythm from screen to screen (2 options on sex, 3 on household), and make
   every target the same size instead of "Male" being half the width of
   "Me and my spouse". Capped so they stay a control, not a banner. */
.qm-chip-group.large {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
  max-width: 440px;
}
/* height:100% down the whole chain, or a wrapping label makes its own pill
   taller than its neighbour and the row goes ragged — "Me and my spouse"
   wraps to two lines at 390px while "Just me" stays one, and the grid cell
   stretches but the pill inside it does not. */
.qm-chip-group.large .qm-chip { display: block; height: 100%; }
.qm-chip-group.large .qm-chip span {
  width: 100%; height: 100%;
  justify-content: center; padding: 16px 18px;
  line-height: 1.3;
}

/* Above mobile, stop stretching. Equal full-width tracks are right on a
   phone — they are thumb targets and the width is genuinely scarce — but on
   a wider card the same rule puts "Male" in a 200px pill, which reads as an
   empty container rather than a confident control. Here they size to their
   content against a floor, so a short answer stays a button and a long one
   ("Me and my spouse") still fits. */
@media (min-width: 641px) {
  .qm-chip-group.large {
    display: flex;
    flex-wrap: wrap;
    max-width: 440px;
  }
  .qm-chip-group.large .qm-chip span { width: auto; min-width: 124px; padding: 15px 26px; }
}

.qm-chip { position: relative; cursor: pointer; }
.qm-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.qm-chip span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 24px; border: 2px solid var(--rule); border-radius: 999px;
  font-size: 15px; font-weight: 600; color: var(--ink);
  text-align: center;
  transition: border-color .12s cubic-bezier(.22,.61,.36,1), background .12s cubic-bezier(.22,.61,.36,1),
              transform .12s cubic-bezier(.22,.61,.36,1);
}
/* Hover is a real affordance here — these look like static labels otherwise. */
.qm-chip:hover span { border-color: var(--ink); }
.qm-chip:has(input:checked) span {
  border-color: var(--ink); background: var(--lemon-2); box-shadow: 3px 3px 0 var(--ink);
}
@media (prefers-reduced-motion: reduce) { .qm-chip span { transition: none; } }
.qm-chip input:focus-visible ~ span { outline: 2px solid var(--pink); outline-offset: 2px; }

/* V38 · Stage 1 — coarse-prefill note (opts.prefill). Visible whenever a
   caller (e.g. 38c's filter bar) supplied a value for this step so the
   visitor sees where it came from and that they can still change it. */
.qm-prefill-note {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--pink-dark);
  background: var(--blush-2); padding: 6px 12px; border-radius: 999px;
  margin: 0 0 14px;
}

.qm-reassure { font-size: 13px; line-height: 1.55; color: var(--mute); margin: 12px 0 0; max-width: 420px; }
.qm-reassure.strong {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--pink-dark); font-weight: 500;
  background: var(--blush-2); padding: 12px 14px; border-radius: 12px; margin-top: 16px;
}
.qm-reassure.strong svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

.qm-continue {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  background: var(--pink); color: var(--cream); border: 2px solid var(--ink);
  padding: 13px 20px; border-radius: 999px; font-family: 'Inter', sans-serif;
  font-weight: 700; font-size: 14px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s cubic-bezier(.22,.61,.36,1), box-shadow .12s cubic-bezier(.22,.61,.36,1), opacity .12s;
}
.qm-continue svg { width: 14px; height: 14px; }
.qm-continue:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.qm-continue:disabled { opacity: .35; cursor: not-allowed; box-shadow: 3px 3px 0 var(--ink); }
