/**
 * Formulaires Contact Form 7 dont le modèle est enveloppé dans <div class="ctf"> : champs et bouton repris
 * du bloc estimation (blocks/estimation/style.css), sans fond : le conteneur Gutenberg de la page le donne.
 *
 * Couleurs : variables GeneratePress ; les teintes hors charte reprennent les --est-* du bloc estimation.
 * Chaque règle part de .wpcf7 .ctf, pour passer devant les styles de GeneratePress (champs, boutons)
 * et ceux de Contact Form 7 (message de réponse, bulles d'erreur).
 */

.wpcf7 .ctf {
    --ctf-muted: #5E626D;
    --ctf-accent-hover: color-mix(in srgb, var(--orange) 88%, black);
    --ctf-field: #FCFAF7;
    --ctf-field-border: #DDD2C6;
    --ctf-placeholder: #7A7D86;
    --ctf-error: #B3261E;
    --ctf-success: #2B6E47; /* Pas de vert dans la charte : teinte sourde, contraste proche de --ctf-error. */
    --ctf-radius: 12px;

    display: flex;
    flex-direction: column;
    gap: 20px;
    color: var(--bleu);
    line-height: normal; /* Le body du site est à 1,75 ; la maquette est en interligne normal. */
}

.wpcf7 .ctf *,
.wpcf7 .ctf *::before,
.wpcf7 .ctf *::after {
    box-sizing: border-box;
}

/* Paragraphes et sauts de ligne ajoutés par Contact Form 7 autour des champs : sans effet sur la mise en page. */

.wpcf7 .ctf p {
    display: contents;
}

.wpcf7 .ctf br {
    display: none;
}

.wpcf7 .ctf a {
    color: var(--orange);
}

.wpcf7 .ctf a:hover,
.wpcf7 .ctf a:focus {
    color: var(--bleu);
}

.wpcf7 .ctf .ctf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Champs. */

.wpcf7 .ctf .ctf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 20px;
}

.wpcf7 .ctf .ctf-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.wpcf7 .ctf .ctf-label {
    font-size: 0.9375rem;
    font-weight: 700;
}

.wpcf7 .ctf .ctf-req {
    color: var(--orange);
}

.wpcf7 .ctf .ctf-control {
    display: block;
    width: 100%;
    max-width: none;
    height: 52px;
    margin: 0;
    padding: 0 16px;
    border: 1px solid var(--ctf-field-border);
    border-radius: var(--ctf-radius);
    background: var(--ctf-field);
    color: var(--bleu);
    font: inherit;
    font-size: 1rem;
    line-height: normal;
}

.wpcf7 .ctf textarea.ctf-control {
    height: auto;
    min-height: 120px;
    padding: 14px 16px;
    resize: vertical;
}

.wpcf7 .ctf .ctf-control::placeholder {
    color: var(--ctf-placeholder);
    opacity: 1;
}

.wpcf7 .ctf .ctf-control:focus {
    border-color: var(--orange);
    outline: 2px solid var(--orange);
    outline-offset: 1px;
    background: var(--ctf-field);
    color: var(--bleu);
}

.wpcf7 .ctf .ctf-control.wpcf7-not-valid {
    border-color: var(--orange);
}

.wpcf7 .ctf .wpcf7-not-valid-tip {
    margin-top: 8px;
    color: var(--ctf-error);
    font-size: 0.875rem;
}

/* Consentement : case de la balise [acceptance]. */

.wpcf7 .ctf .wpcf7-acceptance .wpcf7-list-item {
    display: block;
    margin: 0;
}

.wpcf7 .ctf .wpcf7-acceptance label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--ctf-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    cursor: pointer;
}

.wpcf7 .ctf .wpcf7-acceptance input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--orange);
}

.wpcf7 .ctf .wpcf7-acceptance .wpcf7-list-item-label::before,
.wpcf7 .ctf .wpcf7-acceptance .wpcf7-list-item-label::after {
    content: none;
}

/* Message de réponse, placé par la balise [response] : erreur comme dans le bloc estimation, envoi réussi en vert. */

.wpcf7 .ctf .wpcf7-response-output {
    margin: 0;
    padding: 16px 20px;
    border: 1px solid;
    border-radius: var(--ctf-radius);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.wpcf7 form:is(.invalid, .unaccepted, .payment-required, .failed, .aborted, .spam) .ctf .wpcf7-response-output {
    border-color: var(--ctf-error);
    background: color-mix(in srgb, var(--ctf-error) 5%, var(--blanc));
    color: var(--ctf-error);
}

.wpcf7 form.sent .ctf .wpcf7-response-output {
    border-color: var(--ctf-success);
    background: color-mix(in srgb, var(--ctf-success) 5%, var(--blanc));
    color: var(--ctf-success);
}

/* Bouton d'envoi. */

.wpcf7 .ctf .ctf-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 16px;
}

.wpcf7 .ctf .ctf-btn,
.wpcf7 .ctf .ctf-btn:focus {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    margin: 0;
    padding: 0 32px;
    border: 0;
    border-radius: var(--ctf-radius);
    background: var(--orange);
    color: var(--blanc);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

.wpcf7 .ctf .ctf-btn:hover {
    background: var(--ctf-accent-hover);
    color: var(--blanc);
}

.wpcf7 .ctf .ctf-btn:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

.wpcf7 form.submitting .ctf .ctf-btn {
    cursor: progress;
    opacity: 0.7;
}

/* Indicateur d'envoi, inséré par Contact Form 7 après le bouton : affiché à sa gauche, pendant l'envoi seulement. */

.wpcf7 .ctf .wpcf7-spinner {
    display: none;
    order: -1;
    margin: 0;
    background-color: var(--bleu);
}

.wpcf7 form.submitting .ctf .wpcf7-spinner {
    display: inline-block;
}

@media (max-width: 640px) {
    .wpcf7 .ctf .ctf-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}
