/* =========================================================
   LEAD-FORM — the stepped questionnaire the three lead forms run
   (general contact, service request, buy-a-van).

   The shell is still form-overlay.css (panel, head, success view,
   dropdowns); this file styles what form-overlay.js's enhanceSteps()
   builds from a <form data-steps>: the progress header, one
   .lead-step at a time, the choice cards a question answers with, the
   Back / Continue row, the review chips on the final step, and the
   optional-details disclosure.

   Everything here sits on the elevation ladder (surfaces.css): a card at
   rest is --tv-band, lifts to --tv-surface-hover, and a chosen one is
   carried by hue (the same red tint the work-type checkboxes use) —
   never by a fifth grey.

   The sitewide `* {}` reset forces font-weight/colour and h3 carries a
   global uppercase, so every text style below restates its own.
   ========================================================= */

/* ── The form itself: one step visible, the fieldset grid switched off ── */
.lead-steps fieldset {
    display: block;
    gap: 0;
}

.lead-steps .lead-step {
    display: block;
    grid-column: 1 / -1;
}

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

/* ── Progress header ── */
.lead-steps__progress {
    margin: 0 0 1.35rem;
}

.lead-steps__bar {
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--tv-surface-hover);
}

.lead-steps__bar i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8f0f0f, #e05260);
    transition: width 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.lead-steps__meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.6rem;
}

.lead-steps__count {
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.lead-steps__name {
    color: var(--fd-text-soft, #d6d7dc);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── A step ── */
.lead-step__head {
    margin: 0 0 1.1rem;
}

.lead-step__title {
    margin: 0;
    color: var(--fd-text, #f5f5f5);
    font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.55rem);
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: -0.015em;
    text-transform: none;
}

.lead-step__hint {
    max-width: 38rem;
    margin: 0.45rem 0 0;
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.92rem;
    font-weight: 300;
    line-height: 1.55;
}

.lead-step__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1rem;
    min-width: 0;
}

.lead-step__body > .gr-fl {
    grid-column: 1 / -1;
}

@keyframes lead-step-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.lead-step.is-entering {
    /* `backwards`, never `both` — a filled transform leaves the step as
       the containing block for the fixed-position .tv-select__list. */
    animation: lead-step-in 360ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* A step the visitor tried to leave with a required answer missing */
.lead-step.is-invalid .lead-step__title {
    color: #f3a9b1;
}

/* ── Choice cards — a radio (or checkbox) drawn as a tappable card ── */
.tv-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.tv-choices--stack {
    grid-template-columns: 1fr;
}

/* The form-dark label rule (`body.form-dark form label`, (0,1,3)) turns
   every <label> into an uppercase eyebrow; a card is body text, restated
   in full. The class is doubled to (0,2,0) so it out-specifies that rule
   whatever the load order. */
.tv-choice.tv-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0;
    padding: 0.85rem 1rem;
    min-height: 3.6rem;

    background: var(--tv-band);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0.65rem;
    color: var(--fd-text-soft, #d6d7dc);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.3;
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.tv-choice.tv-choice:hover {
    background: var(--tv-surface-hover);
    border-color: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* The native radio stays in the tree — focusable, submittable, validated —
   but paints nothing; the card carries its state. */
.tv-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.tv-choice:has(input:checked) {
    background: rgba(224, 82, 96, 0.1);
    border-color: rgba(224, 82, 96, 0.5);
    color: #fff;
}

.tv-choice:has(input:focus-visible) {
    outline: 2px solid rgba(224, 82, 96, 0.55);
    outline-offset: 2px;
}

/* form.css paints every span inside a <label> as the red required
   asterisk (`label span`, and form-dark's `body.form-dark form label span`
   at (0,1,4)). A card's spans are its body copy, so every one is restated
   at (0,2,1) or better below. */
.tv-choice.tv-choice span {
    color: inherit;
    font-weight: inherit;
}

.tv-choice.tv-choice .tv-choice__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.7rem;
    background: var(--tv-surface);
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.95rem;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tv-choice.tv-choice:hover .tv-choice__icon,
.tv-choice.tv-choice:has(input:checked) .tv-choice__icon {
    color: #fff;
}

.tv-choice.tv-choice:has(input:checked) .tv-choice__icon {
    border-color: rgba(224, 82, 96, 0.45);
    background: rgba(224, 82, 96, 0.16);
}

/* The shared line-art van (includes/van-icon.php) inside an icon tile */
.tv-choice__van {
    width: 1.7rem;
    height: auto;
    stroke-width: 1.8;
}

.tv-choice.tv-choice .tv-choice__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1 1 auto;
}

.tv-choice.tv-choice .tv-choice__label {
    color: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.25;
}

.tv-choice.tv-choice .tv-choice__note {
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.78rem;
    font-weight: 300;
    line-height: 1.35;
}

.tv-choice.tv-choice:has(input:checked) .tv-choice__note {
    color: var(--fd-text-soft, #d6d7dc);
}

/* The tick: an empty ring at rest, filled red when chosen */
.tv-choice.tv-choice .tv-choice__tick {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 1.2rem;
    height: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: var(--tv-surface);
    transition: background 160ms ease, border-color 160ms ease;
}

.tv-choice__tick::after {
    content: "";
    width: 0.62rem;
    height: 0.62rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l5 5 10-11'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: scale(0);
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tv-choice.tv-choice:has(input:checked) .tv-choice__tick {
    background: #c4242e;
    border-color: rgba(224, 82, 96, 0.9);
}

.tv-choice:has(input:checked) .tv-choice__tick::after {
    transform: scale(1);
}

/* Checkbox cards (multi-select — the service work types) square the tick */
.tv-choice.tv-choice:has(input[type="checkbox"]) .tv-choice__tick {
    border-radius: 0.35rem;
}

/* A card that is really a link to another form (service, from contact) */
.tv-choice--link .tv-choice__go {
    flex: 0 0 auto;
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.85rem;
    transition: transform 160ms ease, color 160ms ease;
}

.tv-choice--link:hover .tv-choice__go {
    color: #fff;
    transform: translateX(3px);
}

.tv-choice--link:focus-visible {
    outline: 2px solid rgba(224, 82, 96, 0.55);
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .tv-choices {
        grid-template-columns: 1fr;
    }
}

/* ── Back / Continue ── */
.lead-steps__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.lead-steps__nav .lead-steps__back[hidden],
.lead-steps__nav .lead-steps__next[hidden] {
    display: none;
}

.lead-steps__nav .lead-steps__next {
    margin-left: auto;
}

.lead-steps__nav .cta-icon-left {
    margin-right: 0.55rem;
}

.lead-steps__tail[hidden] {
    display: none;
}

/* On the final step the nav only holds Back; the tail's submit anchors
   the panel, so pull the two closer. */
.lead-steps.is-final-step .lead-steps__nav {
    margin-top: 1.1rem;
}

.lead-steps.is-final-step .lead-steps__nav + .lead-steps__tail > .form-status {
    margin-top: 0;
}

/* ── Review chips (final step) ── */
.lead-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.lead-summary[hidden] {
    display: none;
}

.lead-summary__chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    max-width: 100%;
    margin: 0;
    padding: 0.42rem 0.8rem;

    background: var(--tv-band);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: var(--fd-text-soft, #d6d7dc);
    font: inherit;
    font-size: 0.82rem;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.lead-summary__chip:hover,
.lead-summary__chip:focus-visible {
    background: var(--tv-surface-hover);
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff;
    outline: none;
}

.lead-summary__key {
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.lead-summary__val {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-summary__chip::after {
    content: "edit";
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.68rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Optional details disclosure (the service form's address) ── */
.lead-optional {
    grid-column: 1 / -1;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 0.65rem;
    background: var(--tv-band);
}

.lead-optional > summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    color: var(--fd-text-soft, #d6d7dc);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
}

.lead-optional > summary::-webkit-details-marker {
    display: none;
}

.lead-optional > summary::before {
    content: "+";
    display: inline-grid;
    place-items: center;
    width: 1.3rem;
    height: 1.3rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.95rem;
    line-height: 1;
}

.lead-optional[open] > summary::before {
    content: "–";
}

.lead-optional > summary:hover {
    color: #fff;
}

.lead-optional__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem 1rem;
    padding: 0.25rem 1rem 1.1rem;
}

.lead-optional__body > .gr-fl {
    grid-column: 1 / -1;
}

/* ── Small helper line under a field ── */
.lead-field-note {
    margin: 0.4rem 0 0;
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.78rem;
    font-weight: 300;
    line-height: 1.45;
}

/* ── Chips of "have ready" items inside a step hint ── */
.lead-ready {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.7rem 0 0;
    padding: 0;
    list-style: none;
}

.lead-ready li {
    padding: 0.28rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: var(--fd-text-muted, #a6a8b0);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .lead-step__body,
    .lead-optional__body {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lead-step.is-entering {
        animation: none;
    }

    .lead-steps__bar i,
    .tv-choice.tv-choice,
    .tv-choice__tick,
    .tv-choice__tick::after,
    .tv-choice--link .tv-choice__go {
        transition: none;
    }
}
