/* Full-screen quiz dialog (clients/retirewealth/sections/quiz.html). Form field styles live in forms.css.
   One question per screen, in the style of modern booking forms (ROAS Form, Typeform): answer cards with
   letter badges, tapping an answer moves straight on, a slim progress bar and a small Back pill.
   Sized for older visitors and phones first: large text, big tap targets, high contrast. */

html.rw-quiz-locked { overflow: hidden; }

.rw-quiz {
    position: fixed; inset: 0;
    width: 100%; height: 100%; max-width: none; max-height: none;
    margin: 0; padding: 0; border: 0;
    color: var(--ink-2); background: var(--bg-soft);
}
.rw-quiz[open] { display: flex; flex-direction: column; }
.rw-quiz::backdrop { background: rgba(14, 28, 43, 0.5); }
@media (prefers-reduced-motion: no-preference) {
    .rw-quiz[open] { animation: rw-quiz-in .2s ease-out; }
    .rw-quiz-step:not([hidden]) { animation: rw-step-in .22s ease-out; }
}
@keyframes rw-quiz-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rw-step-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Top bar: brand and offer on the left, close on the right, progress underneath. */
.rw-quiz-bar { flex: none; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.rw-quiz-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
/* Same width as the question column, so the logo, Back pill and answers line up on one left edge. */
@media (min-width: 768px) { .rw-quiz-bar-inner { max-width: 744px; } }
.rw-quiz-title { display: flex; align-items: center; gap: 10px; min-width: 0; font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--ink); }
.rw-quiz-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rw-quiz-title .rw-mark { width: 30px; height: 30px; flex: none; }
.rw-quiz-close {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; color: var(--ink-2); background: var(--bg-soft);
    border: 0; border-radius: 50%; cursor: pointer;
}
.rw-quiz-close:hover { color: var(--ink); background: var(--line); }
.rw-quiz-progress { height: 6px; background: var(--line); }
.rw-quiz-progress span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: 0 3px 3px 0; transition: width .3s ease; }

/* The step sits in a centred column. */
.rw-quiz-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px 20px calc(40px + env(safe-area-inset-bottom, 0px)); font-size: 18px; }
.rw-quiz-step { width: 100%; max-width: 680px; margin: 0 auto; }
@media (min-width: 768px) { .rw-quiz-body { padding-top: clamp(32px, 8vh, 88px); } }

/* Back pill, top left of every step. On the first question it reads "Back to the page" and closes the quiz. */
.rw-quiz-back {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 18px 8px 10px;
    font: inherit; font-family: var(--font-head); font-size: 16px; font-weight: 600; color: var(--accent-strong);
    background: var(--bg); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
    cursor: pointer; transition: background .15s, border-color .15s;
}
.rw-quiz-back::before {
    content: "\2190"; display: inline-grid; place-items: center; width: 28px; height: 28px;
    font-size: 16px; line-height: 1; color: var(--on-accent); background: var(--accent); border-radius: 50%;
}
.rw-quiz-back:hover { background: var(--bg-tint); border-color: var(--accent-line); }

.rw-quiz-meta { margin-top: 28px; font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--accent); }
.rw-quiz-step h2 { margin-top: 6px; font-size: clamp(24px, 3.4vw, 32px); line-height: 1.2; letter-spacing: -0.3px; text-wrap: pretty; }
/* Headings take focus only so screen readers announce each new step. They are not controls, so no ring. */
.rw-quiz-step h2:focus { outline: none; }
.rw-quiz-hint { margin-top: 8px; font-size: 17px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

/* Answer cards: one per row, a letter badge, the whole card is the button. */
.rw-quiz-options { display: grid; gap: 10px; margin-top: 22px; }
.rw-quiz-option {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 12px 16px;
    font: inherit; font-size: 18px; font-weight: 600; color: var(--ink); text-align: left;
    background: var(--bg); border: 1.5px solid #7D8A9B; border-radius: 14px;
    cursor: pointer; transition: border-color .12s, background .12s, transform .12s;
}
.rw-quiz-key {
    display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px;
    font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--accent-strong);
    background: var(--bg-tint); border: 1px solid var(--accent-line); border-radius: 8px;
}
.rw-quiz-option:hover { border-color: var(--accent); background: var(--bg-tint); }
.rw-quiz-option:active { transform: scale(0.99); }
.rw-quiz-option[aria-pressed="true"] { color: var(--accent-strong); background: var(--bg-tint); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-line); }
.rw-quiz-option[aria-pressed="true"] .rw-quiz-key { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.rw-quiz-select {
    display: block; width: 100%; min-height: 62px; margin-top: 22px; padding: 12px 48px 12px 18px;
    font: inherit; font-size: 19px; font-weight: 600; color: var(--ink);
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23133B69' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 16px center / 22px;
    border: 1.5px solid #7D8A9B; border-radius: 14px; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.rw-quiz-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rw-quiz-shortcut { margin-top: 14px; font-size: 14px; color: var(--ink-3); }
@media (hover: none) { .rw-quiz-shortcut { display: none; } }

/* The booking step is wider than the questions so Calendly can use its side-by-side layout
   (details on the left, calendar on the right) and the whole calendar fits in view. */
.rw-quiz-step[data-step="booking"] { max-width: 1080px; }
.rw-calendar { margin-top: 22px; }
.rw-calendar--live { min-height: 760px; }
.rw-calendar--live iframe { display: block; width: 100%; height: 760px; border: 0; }
/* On wider screens Calendly centres its card in the frame and grows it when a date is picked, so the
   booking heading is centred over it, Calendly's own top gap (about 66px) is pulled in, and the frame is
   tall enough to show the time slots without cutting them off. */
@media (min-width: 760px) {
    .rw-quiz-step[data-step="booking"] { text-align: center; }
    .rw-quiz-step[data-step="booking"] .rw-quiz-hint { max-width: none; }
    .rw-calendar--live { min-height: 860px; margin-top: -30px; }
    .rw-calendar--live iframe { height: 860px; }
}
.rw-calendar-placeholder {
    display: grid; place-content: center; gap: 10px; min-height: 260px; padding: 32px 24px; text-align: center;
    background: var(--bg); border: 2px dashed var(--accent-line); border-radius: 16px;
}
.rw-calendar-placeholder-title { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--ink); }
.rw-calendar-placeholder p:not(.rw-calendar-placeholder-title) { max-width: 420px; font-size: 17px; color: var(--ink-2); }
.rw-calendar-placeholder .rw-btn { justify-self: center; }

.rw-quiz-noscript {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
    font-size: 16px; text-align: center; color: #fff; background: var(--accent-strong);
}
.rw-quiz-noscript a { color: #fff; font-weight: 700; }
