/*
 * Money-type quiz (templates/quiz/index.html.twig + assets/controllers/quiz_controller.js).
 * Mobile-first quiz funnel: proof chips, big tappable cards, tap-to-advance answers,
 * social-proof screens, analysing screen, email step. Tokens from theme.css.
 */

.qf-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 90% 45% at 100% 0%, rgba(168, 90, 56, 0.10) 0%, transparent 70%),
    radial-gradient(ellipse 80% 40% at 0% 100%, rgba(94, 107, 85, 0.10) 0%, transparent 70%),
    var(--ayw-cream);
  background-attachment: fixed;
  color: var(--gray-700);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.qf-page em { font-style: italic; color: var(--ayw-terracotta); }

.qf-shell { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.qf-top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.75rem 1rem 0.6rem;
  background: linear-gradient(var(--ayw-cream) 70%, rgba(243, 240, 232, 0));
}
.qf-top__row { display: grid; grid-template-columns: 2.5rem 1fr 2.5rem; align-items: center; min-height: 2.5rem; }
.qf-top__back {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 12px;
  background: rgba(28, 36, 32, 0.07);
  color: var(--ayw-ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.qf-top__back[hidden] { display: block; visibility: hidden; }
.qf-top__brand {
  grid-column: 2;
  justify-self: center;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ayw-ink);
  text-decoration: none;
  white-space: nowrap;
}
.qf-top__count { justify-self: end; font-size: 0.8rem; font-weight: 600; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.qf-top__progress { height: 4px; border-radius: 4px; background: rgba(28, 36, 32, 0.1); margin-top: 0.7rem; overflow: hidden; }
.qf-top__progress span { display: block; height: 100%; border-radius: 4px; background: var(--ayw-terracotta); transition: width .4s ease; }

[data-stage="welcome"] .qf-top__progress,
[data-stage="welcome"] .qf-top__count { visibility: hidden; }

/* ---------- Screens ---------- */
.qf-main { flex: 1; padding: 0.5rem 1rem 2rem; position: relative; }
.qf-main.is-loading { pointer-events: none; }
.qf-screen { animation: qf-in .35s ease both; }
@keyframes qf-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.qf-center { text-align: center; }
.qf-loading { padding-top: 30vh; }
.qf-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 3px solid var(--ayw-hairline);
  border-top-color: var(--ayw-terracotta);
  animation: qf-spin .8s linear infinite;
}
@keyframes qf-spin { to { transform: rotate(360deg); } }

.qf-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ayw-terracotta);
  margin: 0.75rem 0 0.6rem;
}
.qf-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ayw-ink);
  margin: 0 0 0.6rem;
}
.qf-title--xl { font-size: clamp(2.1rem, 9vw, 2.9rem); line-height: 1.05; }
.qf-sub { font-size: 1rem; line-height: 1.55; color: var(--gray-600); margin: 0 auto 1.25rem; max-width: 34rem; }
.qf-caps { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-600); margin: 0.25rem 0 1.4rem; }
.qf-ask { font-size: 1.15rem; font-weight: 600; color: var(--ayw-ink); margin: 0 0 0.9rem; }

/* ---------- Welcome: proof chips ---------- */
.qf-proof { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.25rem 0 1.4rem; }
.qf-proof__chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.7rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--ayw-hairline);
}
.qf-proof__chip small { display: block; font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gray-500); }
.qf-proof__chip strong { display: block; font-size: 0.85rem; color: var(--ayw-ink); }
.qf-proof__ic {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(168, 90, 56, 0.12);
  color: var(--ayw-terracotta);
  font-size: 1rem;
}
.qf-proof__ic--star { background: rgba(94, 107, 85, 0.14); color: var(--ayw-sage); }

/* ---------- Welcome: gender cards ---------- */
.qf-gender { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.qf-gender__card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(180deg, #EFE7DA 0%, #E6DCCB 100%);
  box-shadow: 0 1px 2px rgba(28, 36, 32, 0.06), 0 8px 22px rgba(28, 36, 32, 0.08);
  transition: transform .15s ease, box-shadow .15s ease;
  font: inherit;
}
.qf-gender__card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(28, 36, 32, 0.08), 0 14px 30px rgba(28, 36, 32, 0.12); }
.qf-gender__card:active, .qf-gender__card.is-picked { transform: scale(0.98); }
.qf-gender__card.is-picked .qf-gender__label { background: var(--ayw-terracotta); }
.qf-gender__art { display: grid; place-items: end center; height: 9.5rem; font-size: 6.5rem; line-height: 1; padding-top: 0.75rem; }
.qf-gender__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  background: var(--ayw-ink);
  color: var(--ayw-paper);
  font-size: 1.05rem;
  font-weight: 600;
  transition: background .15s ease;
}
.qf-gender__label span { font-size: 1.5rem; line-height: 1; }

.qf-legal { font-size: 0.78rem; line-height: 1.5; color: var(--gray-500); text-align: center; margin: 1.1rem auto 0; max-width: 30rem; }
.qf-legal a { color: inherit; }

/* ---------- Questions ---------- */
.qf-qhead { padding: 0.75rem 0 0.4rem; }
.qf-options { display: grid; gap: 0.6rem; }
.qf-option {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem 1fr 1.5rem;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  background: #fff;
  border: 2px solid transparent;
  box-shadow: 0 1px 2px rgba(28, 36, 32, 0.05), 0 4px 14px rgba(28, 36, 32, 0.05);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .1s ease;
}
.qf-option:active { transform: scale(0.99); }
.qf-option input { position: absolute; opacity: 0; pointer-events: none; }
.qf-option__emoji { font-size: 1.75rem; line-height: 1; text-align: center; }
.qf-option__text { font-size: 1rem; font-weight: 500; line-height: 1.35; color: var(--ayw-ink); }
.qf-option__radio {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  transition: all .15s ease;
}
.qf-option:hover { border-color: var(--ayw-hairline); }
.qf-option:has(input:checked) { border-color: var(--ayw-terracotta); background: #FFFCF8; }
.qf-option input:checked ~ .qf-option__radio {
  border-color: var(--ayw-terracotta);
  background: var(--ayw-terracotta);
  box-shadow: inset 0 0 0 3px #fff;
}
.qf-option input:focus-visible ~ .qf-option__radio { outline: 2px solid var(--ayw-ink); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.qf-actions { display: grid; gap: 0.6rem; margin-top: 1.5rem; }
.qf-actions[hidden] { display: none; }
.qf-actions--sticky {
  position: sticky;
  bottom: 0;
  padding: 1rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(243, 240, 232, 0), var(--ayw-cream) 35%);
}
.qf-btn {
  width: 100%;
  padding: 1.05rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--ayw-ink);
  color: var(--ayw-paper);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.qf-btn:hover { background: var(--ayw-ink-soft); }
.qf-btn:disabled { opacity: 0.6; cursor: default; }
.qf-btn--ghost { background: transparent; color: var(--ayw-ink); border: 1.5px solid var(--gray-300); }
.qf-btn--ghost:hover { background: rgba(28, 36, 32, 0.05); }
.qf-btn--cta {
  background: linear-gradient(135deg, #B8673F 0%, var(--ayw-terracotta-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(138, 69, 40, 0.28);
  margin-top: 0.5rem;
}
.qf-btn--cta:hover { background: linear-gradient(135deg, #B8673F 0%, var(--ayw-terracotta-dark) 100%); transform: translateY(-1px); }

/* ---------- Resume ---------- */
.qf-resume-bar { height: 8px; border-radius: 8px; background: rgba(28, 36, 32, 0.1); overflow: hidden; margin: 0.5rem auto 0; max-width: 20rem; }
.qf-resume-bar span { display: block; height: 100%; background: var(--ayw-terracotta); }

/* ---------- Interstitial quote ---------- */
.qf-quote {
  position: relative;
  margin: 0.5rem 0 0;
  padding: 1.6rem 1.4rem 1.3rem;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(28, 36, 32, 0.05), 0 12px 30px rgba(28, 36, 32, 0.08);
  text-align: center;
}
.qf-quote__mark { position: absolute; top: -0.2rem; left: 1rem; font-family: var(--font-display); font-size: 4rem; line-height: 1; color: var(--ayw-terracotta); opacity: 0.35; }
.qf-quote blockquote { margin: 0 0 1rem; font-family: var(--font-display); font-size: 1.2rem; line-height: 1.45; color: var(--ayw-ink); }
.qf-quote figcaption { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--gray-500); }
.qf-quote__stars { color: var(--ayw-terracotta); letter-spacing: 0.12em; }

/* ---------- Analysing ---------- */
.qf-analysis { display: grid; justify-items: center; gap: 1.75rem; margin-top: 1.5rem; }
.qf-analysis__ring {
  --p: 0;
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(closest-side, var(--ayw-cream) 82%, transparent 83%),
    conic-gradient(var(--ayw-terracotta) calc(var(--p) * 1%), rgba(28, 36, 32, 0.1) 0);
}
.qf-analysis__ring span { font-family: var(--font-display); font-size: 2rem; color: var(--ayw-ink); font-variant-numeric: tabular-nums; }
.qf-analysis__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; width: 100%; max-width: 20rem; }
.qf-analysis__steps li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.95rem;
  color: var(--gray-400);
  transition: color .3s ease;
}
.qf-analysis__steps li::before {
  content: '';
  flex-shrink: 0;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: #fff;
  transition: all .3s ease;
}
.qf-analysis__steps li.is-done { color: var(--ayw-ink); }
.qf-analysis__steps li.is-done::before { content: '✓'; background: var(--ayw-sage); border-color: var(--ayw-sage); }

/* ---------- Email step ---------- */
.qf-done-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0.75rem auto 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ayw-sage);
  color: #fff;
  font-size: 1.5rem;
}
.qf-form { display: grid; gap: 0.9rem; margin-top: 0.5rem; }
.qf-field { display: grid; gap: 0.35rem; margin-bottom: 0.75rem; }
.qf-field > span { font-size: 0.85rem; font-weight: 600; color: var(--ayw-ink); }
.qf-field .form-control-modern {
  width: 100%;
  box-sizing: border-box;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1.5px solid var(--gray-300);
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: var(--ayw-ink);
}
.qf-field .form-control-modern:focus { outline: none; border-color: var(--ayw-ink); box-shadow: 0 0 0 3px rgba(28, 36, 32, 0.08); }
.qf-field .invalid-feedback { display: none; font-size: 0.8rem; color: var(--ayw-terracotta-dark); }
.was-validated .form-control-modern:invalid { border-color: var(--ayw-terracotta); }
.was-validated .form-control-modern:invalid ~ .invalid-feedback { display: block; }

/* ---------- Errors ---------- */
.qf-alert {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(168, 90, 56, 0.1);
  border: 1px solid rgba(168, 90, 56, 0.3);
  color: var(--ayw-terracotta-dark);
  font-size: 0.9rem;
}
.qf-alert a { color: inherit; font-weight: 600; }

@media (min-width: 640px) {
  .qf-main { padding-top: 1.5rem; }
  .qf-gender__art { height: 11rem; font-size: 7.5rem; }
}
@media (max-width: 360px) {
  .qf-proof { grid-template-columns: 1fr; }
}
