/* MTP Quote Wizard
   Design: MTP Field Green. Accent #15803D locked, 8px radius everywhere,
   pill reserved for the progress track. Hairline borders over elevation.
   Loaded only on the quote page by the MTP Quote Wizard sandbox module. */

.qw {
    --qw-accent: var(--ocf-primary, #15803D);
    --qw-accent-hover: var(--ocf-primary-hover, #0F5132);
    --qw-ink: var(--ocf-heading, #1B1B0D);
    --qw-body: var(--ocf-body, #111827);
    --qw-surface: #FFFFFF;
    --qw-ground: var(--ocf-bg, #F8FAFC);
    --qw-border: var(--ocf-border, #D4D7D0);
    --qw-border-light: var(--ocf-border-light, #E5E7E4);
    --qw-radius: 8px;
    --qw-wash: color-mix(in srgb, var(--qw-accent) 7%, #FFFFFF);
    --qw-shadow: 0 0.18rem 0.55rem color-mix(in srgb, var(--qw-ink) 7%, transparent);

    max-width: 780px;
    margin: 0 auto;
    background: var(--qw-surface);
    border: 1px solid var(--qw-border-light);
    border-radius: var(--qw-radius);
    box-shadow: var(--qw-shadow);
    overflow: hidden;
    color: var(--qw-body);
    font-size: 16px;
}

/* ---------- Page intro above the wizard ---------- */

.section--quote .quote-intro {
    margin: 1.5rem 0 1.75rem;
    line-height: 1.6;
}

.section--quote .quote-intro p {
    margin: 0;
}

/* Centred from tablet up, where the measure is short enough to read as a
   deliberate lead-in. Stays left aligned on mobile. */
@media (min-width: 641px) {
    .section--quote .quote-intro {
        max-width: 58ch;
        margin: clamp(2rem, 4vw, 2.75rem) auto;
        text-align: center;
    }
}

/* ---------- Progress ---------- */

.qw-progress {
    height: 6px;
    background: var(--qw-border-light);
    border-radius: 999px;
    overflow: hidden;
}

.qw-progress-fill {
    height: 100%;
    width: 0;
    background: var(--qw-accent);
    border-radius: 999px;
    transition: width 260ms ease;
}

/* ---------- Step body ---------- */

.qw-viewport {
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.qw-step {
    border: 0;
    margin: 0;
    padding: 0;
    min-inline-size: 0;
}

.qw-step[hidden] {
    display: none;
}

.qw-step.is-entering {
    animation: qw-fade-in 220ms ease both;
}

@keyframes qw-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.qw-legend {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0 0 0.35rem;
    font-family: var(--ocf-font-heading, "Cormorant Garamond", serif);
    font-weight: 600;
    font-size: clamp(24px, 3.4vw, 32px);
    line-height: 1.12;
    color: var(--qw-ink);
}

/* The legend is focused programmatically on each step change so screen readers
   announce the new question. That focus must not paint a visible ring, since
   the legend is not an interactive control. */
.qw-legend:focus {
    outline: none;
}

.qw-hint {
    margin: 0 0 1.4rem;
    font-size: 15px;
    line-height: 1.6;
    color: color-mix(in srgb, var(--qw-body) 72%, var(--qw-ground));
    max-width: 60ch;
}

/* ---------- Option cards ---------- */

.qw-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.qw-options--single {
    grid-template-columns: minmax(0, 1fr);
}

.qw-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    background: var(--qw-surface);
    border: 1px solid var(--qw-border);
    border-radius: var(--qw-radius);
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
    line-height: 1.4;
}

.qw-card:hover {
    border-color: var(--qw-accent);
    background: var(--qw-wash);
}

.qw-card input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

/* Selection indicator: circle for single choice, square for multi. */
.qw-marker {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--qw-border);
    background: var(--qw-surface);
    display: grid;
    place-items: center;
    transition: border-color 140ms ease, background-color 140ms ease;
}

.qw-card--radio .qw-marker { border-radius: 999px; }
.qw-card--check .qw-marker { border-radius: 4px; }

.qw-marker::after {
    content: "";
    opacity: 0;
    transition: opacity 140ms ease;
}

.qw-card--radio .qw-marker::after {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #FFFFFF;
}

.qw-card--check .qw-marker::after {
    width: 10px;
    height: 6px;
    border-left: 2px solid #FFFFFF;
    border-bottom: 2px solid #FFFFFF;
    transform: rotate(-45deg) translate(1px, -1px);
}

.qw-card-label {
    font-size: 15.5px;
    color: var(--qw-ink);
}

/* Selected: border + wash + marker, never colour alone. */
.qw-card:has(input:checked) {
    border-color: var(--qw-accent);
    background: var(--qw-wash);
}

.qw-card:has(input:checked) .qw-marker {
    border-color: var(--qw-accent);
    background: var(--qw-accent);
}

.qw-card:has(input:checked) .qw-marker::after {
    opacity: 1;
}

.qw-card:has(input:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--qw-accent) 45%, transparent);
    outline-offset: 2px;
    border-color: var(--qw-accent);
}

/* Brief confirmation flash before an auto-advancing step moves on. */
.qw-card.is-confirming {
    transform: scale(0.985);
}

/* ---------- Text fields ---------- */

.qw-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.qw-field--wide { grid-column: 1 / -1; }

.qw-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--qw-ink);
    margin-bottom: 0.35rem;
}

.qw-req {
    color: var(--qw-accent-hover);
    margin-left: 2px;
}

.qw-field input,
.qw-field textarea {
    width: 100%;
    padding: 0.75rem 0.85rem;
    font: inherit;
    font-size: 16px; /* prevents iOS zoom on focus */
    color: var(--qw-body);
    background: var(--qw-surface);
    border: 1px solid var(--qw-border);
    border-radius: var(--qw-radius);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.qw-field textarea {
    min-height: 130px;
    resize: vertical;
}

.qw-field input::placeholder,
.qw-field textarea::placeholder {
    color: color-mix(in srgb, var(--qw-body) 55%, #FFFFFF);
}

.qw-field input:focus,
.qw-field textarea:focus {
    outline: none;
    border-color: var(--qw-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--qw-accent) 30%, transparent);
}

.qw-field.has-error input,
.qw-field.has-error textarea {
    border-color: #B42318;
}

.qw-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 13.5px;
    color: #B42318;
}

.qw-error:empty { display: none; }

/* Honeypot. Hidden from people, reachable by naive bots. */
.qw-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Consent ---------- */

.qw-consent {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    background: var(--qw-ground);
    border: 1px solid var(--qw-border-light);
    border-radius: var(--qw-radius);
    cursor: pointer;
}

.qw-consent input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--qw-accent);
}

.qw-consent span {
    font-size: 14.5px;
    line-height: 1.55;
}

.qw-consent a { color: var(--qw-accent-hover); }

.qw-consent.has-error {
    border-color: #B42318;
}

/* ---------- Navigation ---------- */

.qw-foot {
    padding: 1.1rem clamp(1.5rem, 4vw, 2.5rem) 1.5rem;
    border-top: 1px solid var(--qw-border-light);
    text-align: center;
}

.qw-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qw-nav[hidden] { display: none; }

/* Reuses .ocf-form-secure-note from the home page contact form for the icon
   and type; this only handles placement under the wizard buttons. */
.qw-secure {
    margin-top: 0.95rem;
}

.qw-nav[hidden] + .qw-secure {
    margin-top: 0;
}

.qw-btn {
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    padding: 0.8rem 1.5rem;
    border-radius: var(--qw-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.qw-btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--qw-accent) 45%, transparent);
    outline-offset: 2px;
}

.qw-btn--primary {
    margin-left: auto;
    background: var(--qw-accent);
    color: #FFFFFF;
    box-shadow: 0 0.45rem 1rem color-mix(in srgb, var(--qw-ink) 12%, transparent);
}

.qw-btn--primary:hover:not(:disabled) {
    background: var(--qw-accent-hover);
    transform: translateY(-1px);
}

.qw-btn--primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.qw-btn--ghost {
    background: transparent;
    color: var(--qw-body);
    border-color: var(--qw-border);
}

.qw-btn--ghost:hover {
    border-color: var(--qw-accent);
    color: var(--qw-accent-hover);
}

.qw-btn--ghost[hidden] { display: none; }

/* Progress is shown by the bar alone. The step count is kept for screen
   readers only, since the total changes once a service branch is chosen. */
.qw-steplabel {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Form-level status ---------- */

.qw-formerror {
    margin: 0 clamp(1.5rem, 4vw, 2.5rem);
    padding: 0.8rem 1rem;
    border: 1px solid #B42318;
    border-radius: var(--qw-radius);
    background: color-mix(in srgb, #B42318 5%, #FFFFFF);
    color: #912018;
    font-size: 14.5px;
}

.qw-formerror[hidden] { display: none; }

/* ---------- Success ---------- */

.qw-success {
    padding: clamp(2rem, 6vw, 3.5rem) clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.qw-success[hidden] { display: none; }

.qw-success-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    border-radius: 999px;
    background: var(--qw-wash);
    border: 1.5px solid var(--qw-accent);
    display: grid;
    place-items: center;
    color: var(--qw-accent);
}

.qw-success-mark svg { width: 26px; height: 26px; }

.qw-success h2 {
    font-family: var(--ocf-font-heading, "Cormorant Garamond", serif);
    font-weight: 600;
    font-size: clamp(26px, 3.6vw, 34px);
    line-height: 1.12;
    color: var(--qw-ink);
    margin: 0 0 0.6rem;
}

.qw-success p {
    margin: 0 auto;
    max-width: 46ch;
    font-size: 16px;
    line-height: 1.65;
}

.qw-success-actions {
    margin-top: 1.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.qw-success-actions .qw-btn--primary { margin-left: 0; }

/* ---------- No JavaScript ---------- */

.qw-nojs {
    padding: clamp(1.5rem, 4vw, 2.5rem);
    font-size: 15.5px;
    line-height: 1.65;
}

.qw-nojs a { color: var(--qw-accent-hover); font-weight: 500; }

.qw.is-ready .qw-nojs { display: none; }
.qw:not(.is-ready) .qw-form,
.qw:not(.is-ready) .qw-progress { display: none; }

/* ---------- Mobile collapse ---------- */

@media (max-width: 640px) {
    .qw-options { grid-template-columns: minmax(0, 1fr); }
    .qw-fields { grid-template-columns: minmax(0, 1fr); }
    .qw-nav { flex-wrap: wrap; }
    .qw-btn { flex: 1 1 auto; text-align: center; }

    /* On a single-choice step the primary button is hidden, so Back is alone.
       Let it size to its label instead of stretching the full width. */
    .qw-nav:has(.qw-next[hidden]) .qw-back {
        flex: 0 0 auto;
        padding-inline: 1.75rem;
    }

    /* Icon and text on one left-aligned block, so the padlock sits against the
       first line rather than floating beside centred, wrapped text. */
    .qw-foot { text-align: left; }

    .qw-secure {
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
        white-space: normal;
        padding-right: 4.5rem; /* clears the floating WhatsApp button */
    }

    .qw-secure svg { margin-top: 0.18rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .qw-progress-fill,
    .qw-card,
    .qw-btn,
    .qw-marker,
    .qw-marker::after,
    .qw-field input,
    .qw-field textarea {
        transition: none;
    }
    .qw-step.is-entering { animation: none; }
    .qw-card.is-confirming { transform: none; }
    .qw-btn--primary:hover:not(:disabled) { transform: none; }
}
