/* ========================================
   FORMULAIRES (témoignage et manuscrit)
   Champs soulignés, choix en pastilles, cases carrées.
======================================== */

/* Piège à robots (invisible) */
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}


/* ========================================
   BARRE DE PROGRESSION (collée sous l'en-tête)
======================================== */

.progress {
    position: sticky;
    top: var(--header-h);
    z-index: 20;
    background: var(--bg);
    border-top: 1px solid var(--line);
    transition: background-color 0.4s ease;
}

.progress-inner {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 14px var(--gutter);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 20px;
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.progress-label span:first-child {
    margin-right: 12px;
    color: var(--fg);
}

.progress-bar {
    height: 1px;
    background: var(--line);
}

.progress-fill {
    width: 0;
    height: 100%;
    background: var(--fg);
    transition: width 0.2s linear;
}


/* ========================================
   MISE EN PAGE : INTRO À GAUCHE, FORMULAIRE À DROITE
======================================== */

.form-page {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: clamp(56px, 8vw, 96px) var(--gutter) clamp(96px, 12vw, 160px);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 64px 120px;
}

.form-intro {
    flex: 1 1 340px;
    min-width: 0;
    max-width: 440px;
    position: sticky;
    top: calc(var(--header-h) + 72px);
}

.form-intro h1 {
    margin-top: 20px;
    font-size: clamp(2.6rem, 4.6vw, 4.25rem);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.intro-text {
    margin-top: 28px;
    font-size: 17px;
    line-height: 1.7;
    color: var(--body);
}

.form-steps {
    margin-top: 56px;
    list-style: none;
    border-bottom: 1px solid var(--line);
}

.form-steps li {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    font-size: 15px;
    color: var(--muted);
    transition: color 0.4s ease;
}

.form-steps li span {
    width: 22px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* Étape en cours : texte plein + petit point */
.form-steps li[aria-current="step"] {
    color: var(--fg);
}

.form-steps li[aria-current="step"]::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: auto;
    align-self: center;
    border-radius: 50%;
    background: var(--fg);
}

.form-page form {
    flex: 999 1 560px;
    min-width: 0;
}

.required {
    color: var(--muted);
}

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


/* ========================================
   SECTIONS
======================================== */

.form-section {
    padding: 64px 0 72px;
    border-top: 1px solid var(--line);
}

.form-section:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.section-number {
    display: block;
    font-size: 14px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.section-header h2 {
    margin-top: 10px;
    font-size: 36px;
    line-height: 1.15;
}

.section-header p {
    max-width: 46ch;
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--body);
}


/* ========================================
   CHAMPS SOULIGNÉS
======================================== */

fieldset {
    border: 0;
    min-width: 0;
}

.field {
    margin-top: 44px;
}

.field > label,
.field > legend {
    display: block;
    padding: 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--fg);
}

.hint {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted);
}

textarea,
input[type="text"],
input[type="email"],
select {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--control);
    border-radius: 0;
    color: var(--fg);
    font-size: 18px;
    font-weight: 300;
    line-height: 1.6;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

textarea::placeholder,
input::placeholder {
    color: var(--muted);
    opacity: 1;
}

textarea:hover,
input[type="text"]:hover,
input[type="email"]:hover,
select:hover {
    border-bottom-color: var(--fg);
}

/* Focus : le trait s'épaissit (il remplace le contour général) */
textarea:focus-visible,
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
select:focus-visible {
    outline: none;
}

/* Focus : le trait s'épaissit */
textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
select:focus {
    border-bottom-color: var(--fg);
    box-shadow: 0 1px 0 0 var(--fg);
}

.character-count {
    margin-top: 8px;
    text-align: right;
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Champ signalé comme invalide après une tentative d'envoi */
.was-validated textarea:invalid,
.was-validated input:invalid,
.was-validated select:invalid {
    border-bottom-color: var(--error);
    box-shadow: 0 1px 0 0 var(--error);
}


/* ========================================
   CHOIX EN PASTILLES (radios et cases)
======================================== */

.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.choice {
    position: relative;
    cursor: pointer;
}

.choice input {
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.choice span {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid var(--control);
    border-radius: 999px;
    font-size: 15px;
    transition:
        background-color 0.4s var(--ease),
        color 0.4s var(--ease),
        border-color 0.3s ease;
}

.choice:hover span {
    border-color: var(--fg);
}

.choice input:checked + span {
    background: var(--fg);
    border-color: var(--fg);
    color: var(--bg);
}

.choice input:focus-visible + span {
    outline: 2px solid var(--fg);
    outline-offset: 3px;
}

.was-validated .choice input:invalid + span {
    border-color: var(--error);
}

.notice {
    margin-top: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 15px;
    line-height: 1.6;
    color: var(--body);
}

.identity-fields {
    padding: 0;
}


/* ========================================
   AUTORISATIONS : CASES CARRÉES
======================================== */

.form-section > .check:first-of-type {
    margin-top: 44px;
    border-top: 1px solid var(--line);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
    line-height: 1.6;
    color: var(--body);
    cursor: pointer;
}

.check input {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    -webkit-appearance: none;
    appearance: none;
    display: grid;
    place-content: center;
    background: transparent;
    border: 1px solid var(--control);
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.check input::after {
    content: "";
    width: 10px;
    height: 5px;
    border-left: 1.6px solid var(--bg);
    border-bottom: 1.6px solid var(--bg);
    transform: rotate(-45deg) translate(1px, -1px) scale(0);
    transition: transform 0.25s var(--ease);
}

.check input:checked {
    background: var(--fg);
    border-color: var(--fg);
}

.check input:checked::after {
    transform: rotate(-45deg) translate(1px, -1px) scale(1);
}

.check:hover input {
    border-color: var(--fg);
}

.was-validated .check input:invalid {
    border-color: var(--error);
}


/* ========================================
   ENVOI
======================================== */

.form-error {
    margin-top: 20px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--error);
}

.form-actions {
    margin-top: 48px;
}

.submit-button {
    min-height: 56px;
    padding: 17px 34px;
}

/* Ancienne flèche texte, si elle reste dans le HTML */
.submit-button > span[aria-hidden="true"] {
    display: none;
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 1000px) {

    .form-intro {
        position: static;
        max-width: none;
    }

    .form-steps {
        display: none;
    }
}

@media (max-width: 800px) {

    .progress-percent {
        display: none;
    }

    .form-page {
        gap: 48px;
    }

    .section-header h2 {
        font-size: 30px;
    }

    .field {
        margin-top: 36px;
    }

    .submit-button {
        width: 100%;
    }
}


/* ========================================
   ACCESSIBILITÉ
======================================== */

@media (prefers-reduced-motion: reduce) {

    .progress-fill,
    .choice span,
    .check input,
    .check input::after,
    textarea,
    input,
    select {
        transition: none;
    }
}
