/* ============================================================
   survey.css — /survey wizard only. Loads after base.css.
   ============================================================ */

.survey-secure {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--body);
    font-size: var(--fs-xs);
    font-weight: 600;
    white-space: nowrap;
}

.survey-secure svg {
    width: 16px;
    height: 16px;
    fill: var(--blue);
}

.survey-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--s4) var(--pad) var(--s8);
}

.survey-progress {
    margin-bottom: var(--s2);
}

.survey-progress-label {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--body);
    margin-bottom: 8px;
}

.survey-progress-track {
    height: 6px;
    border-radius: 999px;
    background: #e3ecf7;
    overflow: hidden;
}

.survey-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: var(--blue);
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.survey-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s4);
}

.survey-step {
    display: none;
}

/* fill-mode backwards, not both: a filled transform animation would turn the step into a
   containing block and trap the fixed-position select sheet/backdrop inside the card */
.survey-step.active {
    display: block;
    animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.survey-step h2 {
    font-size: clamp(1.35rem, 2.4vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.survey-sub {
    color: var(--body);
    font-size: var(--fs-md);
    margin: 6px 0 var(--s3);
}

/* ============ Fields ============ */
.field {
    margin-bottom: var(--s2);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s2);
}

.field label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    margin-bottom: 6px;
}

.field .optional {
    color: var(--muted);
    font-weight: 500;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #dfe7f0;
    border-radius: var(--r-sm);
    background: #fff;
    font: inherit;
    font-size: 1rem;
    color: var(--navy);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.field-error {
    display: block;
    min-height: 0;
    color: #d23b4e;
    font-size: var(--fs-xs);
    font-weight: 600;
    margin-top: 4px;
}

/* ============ Choice pills ============ */
.choice-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.option-grid-single {
    grid-template-columns: 1fr;
}

.choice-pill {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--card);
    border: 1.5px solid #dfe7f0;
    border-radius: 12px;
    font: inherit;
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.pill-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--disc);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--blue);
    transition: background 0.15s ease, transform 0.15s ease;
}

.pill-icon svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.choice-pill:hover .pill-icon {
    transform: scale(1.06);
}

.choice-pill.selected .pill-icon {
    background: var(--blue);
    color: #fff;
}

.choice-pill:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: #fff;
}

.choice-pill:active {
    transform: scale(0.98);
}

.choice-pill.selected {
    border-color: var(--blue);
    background: #eaf2fe;
    box-shadow: 0 0 0 1px var(--blue) inset;
}

/* ============ Consent + agreement ============ */
.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: var(--s2);
    padding: var(--s2);
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: var(--r-sm);
}

.consent-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--blue);
    cursor: pointer;
}

.consent-check label {
    font-size: var(--fs-xs);
    line-height: 1.55;
    color: var(--body);
    cursor: pointer;
}

.consent-check a {
    color: var(--blue);
    font-weight: 600;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ============ Custom select ============ */
.select-wrap {
    position: relative;
}

.select-wrap select {
    display: none;
}

.select-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px;
    border: 1.5px solid #dfe7f0;
    border-radius: var(--r-sm);
    background: #fff;
    font: inherit;
    font-size: 1rem;
    color: var(--navy);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-btn:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.select-btn .placeholder {
    color: #9aa7b8;
}

.select-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--muted);
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.select-wrap.open .select-btn svg {
    transform: rotate(180deg);
}

.select-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(13, 33, 55, 0.16);
    max-height: 280px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.select-wrap.open .select-menu {
    display: flex;
    animation: rise 0.16s ease-out both;
}

.select-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-family: var(--heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    flex-shrink: 0;
}

.select-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--card);
    color: var(--body);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.select-close:hover {
    background: var(--soft);
    color: var(--navy);
}

.select-options {
    overflow-y: auto;
    padding: 6px;
    min-height: 0;
}

.select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border-radius: 8px;
    font-size: var(--fs-md);
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
}

.select-option + .select-option {
    margin-top: 2px;
}

.select-option:hover,
.select-option.active {
    background: var(--soft);
}

.select-option.selected {
    color: var(--blue);
    font-weight: 700;
}

.select-option.selected::after {
    content: "\2713";
    font-weight: 800;
    color: var(--blue);
}

.select-backdrop {
    display: none;
}

@keyframes sheet-up {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* thin, on-brand scrollbars for the legal scroll boxes */
.agreement-box,
.consent-check,
.select-menu {
    scrollbar-width: thin;
    scrollbar-color: #c3d2e5 transparent;
}

.agreement-box::-webkit-scrollbar,
.consent-check::-webkit-scrollbar {
    width: 5px;
}

.agreement-box::-webkit-scrollbar-thumb,
.consent-check::-webkit-scrollbar-thumb {
    background: #c3d2e5;
    border-radius: 999px;
}

.agreement-box::-webkit-scrollbar-track,
.consent-check::-webkit-scrollbar-track {
    background: transparent;
}

.agreement-box {
    max-height: 280px;
    overflow-y: auto;
    padding: var(--s2);
    margin-bottom: var(--s3);
    background: var(--card);
    border: 1px solid var(--card-line);
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    line-height: 1.6;
    color: var(--body);
}

.agreement-box strong {
    color: var(--navy);
    font-size: var(--fs-sm);
}

.agreement-box p {
    margin: 4px 0 10px;
    color: var(--muted);
}

.agreement-box ol {
    margin-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agreement-box b {
    color: var(--navy);
}

.agreement-box a {
    color: var(--blue);
    font-weight: 600;
}

.signature-input {
    font-family: "Segoe Script", "Comic Sans MS", cursive;
    font-size: 1.15rem;
}

.signature-date {
    display: block;
    margin-top: 6px;
    font-size: var(--fs-xs);
    color: var(--muted);
}

/* ============ Step navigation ============ */
.survey-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s2);
    margin-top: var(--s3);
}

.survey-nav span:empty {
    display: none;
}

.survey-nav .cta-button {
    font-size: var(--fs-md);
    padding: 14px 24px;
}

.survey-nav .cta-button:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.btn-back {
    background: none;
    border: none;
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--body);
    cursor: pointer;
    padding: 10px 0;
    transition: color 0.15s ease;
}

.btn-back:hover,
.btn-back:focus-visible {
    color: var(--blue);
}

/* ============ Done screen ============ */
.survey-done {
    text-align: center;
    padding: var(--s3) 0;
}

.done-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--disc);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    margin-bottom: var(--s2);
    animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s backwards;
}

.done-icon svg {
    width: 34px;
    height: 34px;
    fill: currentColor;
}

.survey-done .cta-trust {
    justify-content: center;
    margin-top: var(--s3);
}

.done-home {
    display: inline-block;
    margin-top: var(--s2);
}

/* ============ Legal line ============ */
.survey-legal {
    margin-top: var(--s3);
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--muted);
}

.survey-legal a {
    color: var(--body);
    font-weight: 600;
}

.legal-short {
    display: none;
}

/* ============ Mobile: app-style screens, no page scroll ============ */
@media (max-width: 640px) {
    .survey-body {
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .survey-body .navbar {
        flex-shrink: 0;
    }

    .survey-body .navbar-inner {
        min-height: 52px;
        padding: 6px var(--pad);
    }

    .survey-body .brand img {
        width: 132px;
    }

    .survey-page {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 10px var(--pad) 12px;
    }

    .survey-progress {
        margin-bottom: 8px;
    }

    .survey-progress-label {
        margin-bottom: 6px;
    }

    /* card hugs its content; it can shrink below the viewport but never exceed it */
    .survey-card {
        flex: 0 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 14px;
    }

    .survey-step.active {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .survey-step h2 {
        font-size: 1.25rem;
    }

    .survey-sub {
        font-size: var(--fs-sm);
        margin-bottom: 10px;
    }

    .field {
        margin-bottom: 11px;
    }

    .select-btn {
        font-size: var(--fs-md);
    }

    .field label {
        margin-bottom: 5px;
    }

    .field input,
    .field select,
    .field textarea,
    .select-btn {
        padding: 12px;
    }

    .field textarea {
        height: 76px;
    }

    /* state picker becomes a bottom sheet on mobile (also avoids the step's overflow clipping) */
    .select-wrap.open .select-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(13, 33, 55, 0.4);
    }

    .select-wrap.open .select-menu {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 80;
        max-height: 62vh;
        border-radius: var(--r-lg);
        animation: sheet-up 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .select-wrap.open .select-head {
        display: flex;
    }

    .select-options {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    }

    .select-option {
        padding: 13px 12px;
        font-size: 1rem;
    }

    .select-option + .select-option {
        margin-top: 0;
        border-top: 1px solid var(--card-line);
        border-radius: 0;
    }

    .select-option:first-child {
        border-radius: 8px 8px 0 0;
    }

    .select-option:last-child {
        border-radius: 0 0 8px 8px;
    }

    .field-row {
        gap: 12px;
    }

    .choice-row {
        gap: 8px;
    }

    .choice-row .choice-pill {
        flex: 1;
        justify-content: center;
        gap: 6px;
        padding: 9px 4px;
        font-size: var(--fs-xs);
        text-align: center;
    }

    .choice-row .pill-icon {
        width: 24px;
        height: 24px;
    }

    .choice-row .pill-icon svg {
        width: 13px;
        height: 13px;
    }

    .option-grid {
        gap: 8px;
    }

    .option-grid .choice-pill {
        padding: 9px 10px;
        font-size: var(--fs-sm);
        min-height: 44px;
        gap: 8px;
    }

    .option-grid .pill-icon {
        width: 30px;
        height: 30px;
    }

    .option-grid .pill-icon svg {
        width: 15px;
        height: 15px;
    }

    .consent-check {
        padding: 10px;
        gap: 8px;
        margin-top: 8px;
    }

    .survey-nav {
        padding-top: 10px;
    }

    /* only the long TCPA disclosure compresses and scrolls; the short agree row stays natural */
    [data-step="contact"] .consent-check {
        min-height: 96px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .consent-check label {
        font-size: 0.72rem;
        line-height: 1.5;
    }

    /* the heading covers it — the line is worth more to the disclosure box */
    [data-step="contact"] .survey-sub {
        display: none;
    }

    .agreement-box {
        flex: 1;
        min-height: 120px;
        max-height: none;
        margin-bottom: var(--s2);
    }

    .survey-nav {
        margin-top: auto;
        padding-top: 12px;
        gap: 8px;
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .survey-nav .cta-button {
        width: 100%;
    }

    .survey-nav .btn-back {
        text-align: center;
        padding: 8px 0;
    }

    .survey-legal {
        margin-top: 10px;
        font-size: 0.62rem;
        line-height: 1.45;
    }

    .legal-long {
        display: none;
    }

    .legal-short {
        display: inline;
    }
}

/* short phones (e.g. iPhone SE): tighten density so every step still fits */
@media (max-width: 640px) and (max-height: 720px) {
    .survey-card {
        padding: 12px;
    }

    .survey-step h2 {
        font-size: 1.05rem;
    }

    .survey-sub {
        margin-bottom: 8px;
    }

    [data-step="contact"] .survey-sub {
        display: none;
    }

    .field {
        margin-bottom: 8px;
    }

    .field label {
        margin-bottom: 3px;
    }

    .consent-check label {
        font-size: 0.68rem;
        line-height: 1.45;
    }

    .field input,
    .field select,
    .select-btn {
        padding: 10px 12px;
    }

    .field textarea {
        height: 56px;
    }

    [data-step="contact"] .consent-check {
        min-height: 72px;
    }

    .agreement-box {
        min-height: 88px;
    }

    .signature-input {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .signature-date {
        margin-top: 3px;
        font-size: 0.62rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .survey-step.active,
    .done-icon {
        animation: none;
    }

    .survey-progress-fill,
    .choice-pill {
        transition: none;
    }
}
