/* =========================================================
   Questionnaire for version G (start-g.html).
   Same look as index-g.html: Manrope headlines at 500, spaced rose labels,
   the upright serif name, 8px buttons with an arrow, paper and mist.
   ========================================================= */
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/instrument-serif-latin.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("../fonts/manrope-latin.woff2") format("woff2"); }

:root {
  --paper: #faf9f6;
  --mist: #f1efeb;
  --stone: #e3ddd5;
  --ink: #221f1d;
  --ink-hover: #3a3632;
  --body: #45403b;
  --muted: #6a635c;
  --rose: #8a4b52;
  --line: rgba(34, 31, 29, .16);
  --on-dark: #f7f4f0;
  --sans: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
p, h1, h2 { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.q-app { display: flex; flex-direction: column; min-height: 100dvh; max-width: 600px; margin: 0 auto; padding: 0 24px calc(24px + env(safe-area-inset-bottom)); }

/* ---------- Top bar: back · name · count ---------- */
.q-top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 64px; }
.q-back { width: 44px; height: 44px; margin-left: -10px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.q-back svg { width: 22px; height: 22px; }
.q-back:hover { background: var(--mist); }
.q-back[hidden] { display: grid; visibility: hidden; }
.q-logo { justify-self: center; font: 400 24px/1 var(--serif); letter-spacing: -.005em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.q-count { justify-self: end; font: 600 12px/1 var(--sans); letter-spacing: .08em; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Chapter label above four bars ---------- */
.q-progress { padding-top: 4px; }
.q-progress[hidden] { display: none; }
.q-progress__label { margin-bottom: 10px; font: 600 12px/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--rose); }
.q-progress__bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.q-progress__bars span { position: relative; height: 3px; border-radius: 3px; background: rgba(34, 31, 29, .12); overflow: hidden; }
.q-progress__bars span::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(var(--fill, 0)); transition: transform .4s ease; }

/* ---------- Screens: a quiet fade between them ---------- */
.q-stage { flex: 1; display: flex; flex-direction: column; outline: none; }
.q-screen { flex: 1; display: flex; flex-direction: column; padding-top: clamp(28px, 6vh, 56px); animation: q-in .3s ease-out both; }
.q-screen.is-out { animation: q-out .2s ease-in both; }
@keyframes q-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes q-out { to { opacity: 0; } }
.q-screen :focus { outline: none; }

/* ---------- Type ---------- */
.q-kicker { margin-bottom: 10px; font: 700 13px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--rose); }
.q-intro { margin-bottom: 24px; font-size: 15px; color: var(--muted); text-align: center; }
.q-from { display: flex; justify-content: center; margin-bottom: 16px; }
.q-from img { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; }
.q-title { font: 500 clamp(28px, 7.4vw, 40px)/1.1 var(--sans); letter-spacing: -.028em; text-wrap: balance; text-align: center; }
.q-help { margin: 12px auto 0; max-width: 30rem; font-size: 16px; color: var(--body); text-align: center; }
.q-body-gap { margin-top: 28px; }

/* ---------- Buttons ---------- */
.q-foot { margin-top: auto; padding-top: 32px; }
.q-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 32px; border: 0; border-radius: 8px; background: var(--ink); color: var(--on-dark); font: 600 16px/1 var(--sans); cursor: pointer; transition: background .15s ease, opacity .15s ease; }
.q-btn:hover { background: var(--ink-hover); }
.q-btn:hover .q-arr { transform: translateX(3px); }
.q-arr { transition: transform .15s ease; }
.q-btn[disabled] { opacity: .3; pointer-events: none; }
.q-btn:focus-visible, .q-choice:focus-visible, .q-back:focus-visible, .q-link:focus-visible, .q-logo:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.q-link { display: block; margin: 16px auto 0; padding: 12px; border: 0; background: none; color: var(--body); font: 500 14px/1 var(--sans); text-decoration: underline; text-underline-offset: 4px; text-align: center; cursor: pointer; }
.q-facts { text-wrap: balance; margin-top: 14px; font: 600 12px/1.45 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; }
.q-note { margin-top: 12px; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- Welcome and thank you ---------- */
.q-welcome, .q-thanks { text-align: center; align-items: center; }
.q-welcome__photo { position: relative; width: 112px; height: 112px; margin: 0 auto 28px; }
.q-welcome__photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.q-bf { --bf: 56px; position: absolute; right: -30px; top: -22px; width: var(--bf); height: var(--bf); background: url("../butterfly/butterfly-sprite.png") calc(var(--bf) * -2) calc(var(--bf) * -4) / calc(var(--bf) * 6) calc(var(--bf) * 5) no-repeat; pointer-events: none; }
.q-welcome .q-title, .q-thanks .q-title { font-size: clamp(32px, 9vw, 48px); }
.q-welcome .q-foot, .q-thanks .q-foot { width: 100%; }
.q-thanks { justify-content: center; }
.q-thanks .q-foot { margin-top: 24px; }

/* ---------- Fields ---------- */
.q-field { display: block; margin-top: 20px; }
.q-field:first-child { margin-top: 0; }
.q-field__label { display: block; margin-bottom: 8px; font: 600 14px/1.3 var(--sans); color: var(--body); }
.q-input, .q-text { width: 100%; padding: 15px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: 400 17px/1.5 var(--sans); transition: border-color .15s ease; }   /* 17px: no zoom on iPhone */
.q-text { min-height: 168px; resize: vertical; }
.q-input:focus, .q-text:focus { outline: none; border-color: var(--ink); }
.q-optional { margin-top: 8px; font-size: 14px; color: var(--muted); }
.q-consent { position: relative; display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: 14px; line-height: 1.5; color: var(--body); cursor: pointer; }
.q-consent input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; }
.q-consent__box { flex: none; width: 22px; height: 22px; margin-top: 0; border: 1.5px solid rgba(34, 31, 29, .4); border-radius: 5px; background: #fff; display: grid; place-items: center; }
.q-consent__box::after { content: ""; width: 10px; height: 5px; margin-top: -3px; border-left: 2px solid var(--on-dark); border-bottom: 2px solid var(--on-dark); transform: rotate(-45deg) scale(0); transition: transform .15s ease; }
.q-consent input:checked + .q-consent__box { background: var(--ink); border-color: var(--ink); }
.q-consent input:checked + .q-consent__box::after { transform: rotate(-45deg) scale(1); }
.q-consent input:focus-visible + .q-consent__box { outline: 2px solid var(--ink); outline-offset: 3px; }
.q-consent a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- Choices: chips (several) and rows (one) ---------- */
.q-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.q-choices--stack { flex-direction: column; }
.q-choice { min-height: 48px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: 500 16px/1.3 var(--sans); text-align: center; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease; }
.q-choices--stack .q-choice { min-height: 54px; text-align: left; padding: 14px 18px; }
.q-choice:hover { border-color: var(--ink); }
.q-choice[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.q-choice.is-dim { opacity: .4; }
.q-other { margin-top: 12px; }
.q-other[hidden] { display: none; }

/* ---------- Choose & pay ---------- */
.q-pay { text-align: center; }
.q-pay .q-kicker { text-align: center; }
.q-cover { position: relative; width: min(52vw, 210px); aspect-ratio: 148 / 210; margin: 28px auto 0; padding: 22% 10% 0; border-radius: 4px; background: #262320; color: #f6f4f0; display: flex; flex-direction: column; align-items: center; box-shadow: 0 24px 34px -20px rgba(34, 31, 29, .55); }
.q-cover__k { font: 600 8px/1 var(--sans); letter-spacing: .3em; text-transform: uppercase; color: rgba(246, 244, 240, .6); }
.q-cover__name { margin-top: 28%; font: 400 clamp(34px, 11vw, 46px)/1 var(--serif); overflow-wrap: anywhere; }
.q-cover__rule { width: 22px; height: 1px; margin-top: auto; background: rgba(246, 244, 240, .3); }
.q-cover__by { margin: 10px 0 14%; font: 500 9px/1 var(--sans); color: rgba(246, 244, 240, .85); }
.q-plans { display: grid; gap: 14px; margin-top: 32px; text-align: left; }
.q-plan { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.q-plan--fav { background: var(--stone); }
.q-plan input { position: absolute; opacity: 0; pointer-events: none; }
.q-plan:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.q-plan:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
.q-plan__name { font: 700 13px/1.35 var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.q-plan__price { grid-row: span 2; font: 400 44px/1 var(--serif); font-variant-numeric: lining-nums; }
.q-plan__note { font-size: 14px; color: var(--muted); }
.q-plan__tag { position: absolute; top: -10px; right: 16px; padding: 4px 10px; border-radius: 999px; background: var(--ink); color: var(--on-dark); font: 600 10px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; }

/* ---------- Stand-in for Stripe's payment page (prototype only) ---------- */
.q-hosted { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: #fff; color: #1a1a1a; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.q-hosted__in { max-width: 420px; margin: 0 auto; padding: 20px 20px 40px; }
.q-hosted__back { min-height: 44px; padding: 0; border: 0; background: none; color: #555; font-size: 14px; cursor: pointer; }
.q-hosted__item { margin-top: 18px; font-size: 15px; color: #666; }
.q-hosted__price { margin-top: 4px; font-size: 34px; font-weight: 600; }
.q-hosted__tag { margin: 14px 0 20px; padding: 10px 12px; border-radius: 8px; background: #fff7e0; font-size: 13px; color: #6b4f00; }
.q-hosted__f { display: block; margin-top: 14px; }
.q-hosted__f > span { display: block; margin-bottom: 6px; font-size: 13px; color: #555; }
.q-hosted__box { padding: 11px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; }
.q-hosted__muted { color: #999; }
.q-hosted__pay { width: 100%; min-height: 46px; margin-top: 22px; border: 0; border-radius: 6px; background: #0570de; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }

@media (min-width: 900px) {
  .q-screen { padding-top: 8vh; }
  .q-btn { width: auto; min-width: 280px; margin: 0 auto; }
  .q-plans { grid-template-columns: 1fr 1fr; }
  .q-plan { grid-template-columns: 1fr; align-content: start; }
  .q-plan__price { grid-row: auto; margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .q-screen, .q-screen.is-out { animation: none; }
  .q-progress__bars span::after, .q-btn, .q-arr, .q-choice { transition: none; }
}
