/* =========================================================================
   Formulaire de contact — Contact Form 7
   -------------------------------------------------------------------------
   Chargée uniquement quand la feuille de CF7 l'est elle-même, donc seulement
   sur les pages portant un formulaire. Cf. inc/formulaire.php.
   ========================================================================= */

:root {
    --cf7-orange: #EB5C37;
    --cf7-grey-bg: #E4E4E4;
    --cf7-grey-text: #9A9A9A;
    --font-text: var(--wp--preset--font-family--acumin);
    --font-tag: var(--wp--preset--font-family--acumin-condensed);
}

.wpcf7-form {
    font-family: var(--font-text);
    font-weight: 400;
    line-height: 1.65;
    font-size: var(--wp--preset--font-size--texte);
}

.cf7-title { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.cf7-required-note { color: #555; margin-bottom: 2rem; }

.screen-reader-text {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* --- Tags radio (fieldset natif, style visuel "ticket") --- */
.cf7-radio-tags {
    border: none; padding: 0; margin: 0 0 2rem;
    display: flex; gap: 1rem; flex-wrap: wrap;
}
.cf7-radio-tags .wpcf7-radio {
    display: flex; gap: 1rem; flex-wrap: wrap;
}
.cf7-radio-tags .wpcf7-list-item { margin: 0; }
.cf7-radio-tags label {
    display: inline-flex; align-items: center;
    cursor: pointer;
}

/* input réel conservé accessible au clavier, visuellement masqué mais pas display:none */
.cf7-radio-tags input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
}

.cf7-radio-tags .wpcf7-list-item-label {
    font-family: var(--font-tag);
    font-weight: 800;
    line-height: 1.05;
    font-size: 1.5rem;
    padding: .9rem 1.75rem .67rem 1.5rem;
    background: var(--cf7-grey-bg);
    color: var(--cf7-grey-text);
    clip-path: polygon( 2% 15%, 100% 0, 98% 100%, 0 95% );
    transition: background-color .15s ease, color .15s ease;
}

.wpcf7-list-item-label a, .wpcf7-list-item-label a:visited {
     color: var(--cf7-grey-text);
     text-decoration: none;
}


.cf7-radio-tags input[type="radio"]:checked + .wpcf7-list-item-label {
    background: var(--cf7-orange);
    color: #fff;
}

/* focus clavier visible, jamais supprimé (RGAA 10.7) */
.cf7-radio-tags input[type="radio"]:focus-visible + .wpcf7-list-item-label {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* --- Grille champs --- */
.cf7-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 3rem;
}
.cf7-full { grid-column: 1 / -1; }

.wpcf7-form label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .0;
}

.wpcf7-form {
    padding-top: 2rem;
}

.wpcf7-form p {
margin: 0 !important;
}

.wpcf7-form legend {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: .65rem .75rem;
    font-family: var(--font-text);
    font-size: 1rem;
}

.wpcf7-form input:focus-visible,
.wpcf7-form textarea:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

.wpcf7-form .wpcf7-spinner {
    display: block;
}

.wpcf7-form textarea { min-height: 8rem; resize: vertical; }

/* Honeypot : hors écran, ignoré des lecteurs d'écran via aria-hidden sur le wrapper */
.cf7-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px; overflow: hidden;
}

/* --- Case à cocher acceptance --- */
.wpcf7-acceptance .wpcf7-list-item { margin: 0; display: flex; gap: .5rem; align-items: flex-start; }
.wpcf7-acceptance input[type="checkbox"] { margin-top: .3rem; flex-shrink: 0; }

/* --- Bouton submit --- */
.cf7-submit-wrap { text-align: center; margin-top: 2rem; }
.wpcf7-form input[type="submit"] {
    font-family: var(--font-tag);
    font-weight: 800;
    line-height: 1.05;
    font-size: 1.5rem;
    color: #fff;
    background: var(--cf7-orange);
    border: none;
    padding: .9rem 2.5rem;
    clip-path: polygon( 2% 15%, 100% 0, 98% 100%, 0 95% );
    cursor: pointer;
}
.wpcf7-form input[type="submit"]:hover { background: color-mix(in srgb, var(--cf7-orange) 85%, black); }
.wpcf7-form input[type="submit"]:focus-visible { outline: 3px solid #005fcc; outline-offset: 3px; }

/* --- Champ fichier : zone de dépôt ---------------------------------------

   Le bouton natif d'un <input type="file"> ne peut pas être renommé en CSS :
   son texte (« Choisir un fichier »…) vient du navigateur, pas modifiable
   par `content`. Et ::before/::after ne s'appliquent pas de façon fiable à
   un <input> (élément remplacé) : le texte « Déposez les fichiers ici »
   n'existe donc pas dans le champ CF7 lui-même.

   Solution : le vrai <input type="file"> de CF7 reste tel quel, mais
   recouvre toute la zone en opacity: 0 — clic ET glisser-déposer natifs
   continuent d'atterrir dessus, et le focus clavier / lecteur d'écran
   restent sur un vrai contrôle de formulaire. La zone visible est purement
   décorative, en dessous. Même principe que .cf7-radio-tags plus haut.

   Suppose le HTML du formulaire enrichi ainsi autour de [file …] :

     <div class="cf7-fichier">
         <p class="cf7-fichier__texte">Déposez les fichiers ici ou
             <span class="cf7-fichier__bouton">sélectionner des fichiers</span>
         </p>
         [file fichier …]
         <p class="cf7-fichier__selection" aria-live="polite"></p>
     </div>

   .cf7-fichier__selection : le nom du fichier choisi, réaffiché en JS
   puisque l'affichage natif de l'input est masqué avec lui — cf.
   assets/js/cf7-fichier.js.
   --------------------------------------------------------------------------- */

.cf7-fichier {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 7rem;
    padding: 1.5rem;
    background: #F0E3D9;
    border-radius: 10px;
    text-align: center;
    transition: background-color .15s ease;
}

.cf7-fichier__texte {
    font-family: var(--font-text);
    font-size: 1rem;
    /* Pas de gris dans la charte pour du texte courant : encre, comme le
       reste du corps de texte, garantit le contraste RGAA (4,5:1) que
       --cf7-grey-text (pensé pour un intitulé en gras, plus grand) ne
       tiendrait pas ici. */
    color: var(--wp--preset--color--encre, #1D1D1B);
}

.cf7-fichier__bouton {
    display: inline-block;
    margin-left: .35rem;
    padding: .5rem 1.25rem .4rem;
    background: var(--cf7-grey-bg);
    color: var(--cf7-grey-text);
    font-family: var(--font-tag);
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.05;
    clip-path: polygon( 2% 15%, 100% 0, 98% 100%, 0 95% );
}

.cf7-fichier:hover .cf7-fichier__bouton {
    background: color-mix(in srgb, var(--cf7-grey-bg) 85%, black);
}

/* Nom du fichier choisi : rempli en JS (assets/js/cf7-fichier.js), le vrai
   <input> étant invisible — voir la note en tête de section. :empty évite un
   espace réservé tant qu'aucun fichier n'est encore sélectionné. */
.cf7-fichier__selection {
    font-family: var(--font-text);
    font-size: .9rem;
    font-weight: 700;
    color: var(--wp--preset--color--violet, #502D87);
}

.cf7-fichier__selection:empty {
    display: none;
}

/* Le wrapper de CF7 et son input recouvrent toute la zone : z-index pour
   rester au-dessus du texte décoratif même si l'ordre du HTML change. */
/* CF7 encadre [file …] de son propre <p>, et sa feuille pose position:
   relative sur tout <p> du formulaire. Ce <p> deviendrait donc le bloc
   conteneur de l'input absolument positionné plus bas — et se réduirait à
   0×0, son seul contenu (le span) en étant sorti. On le neutralise ici pour
   que .cf7-fichier (position: relative, lui, dimensionné) serve de repère. */
.cf7-fichier p {
    position: static !important;
}

.cf7-fichier .wpcf7-form-control-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.cf7-fichier input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Focus clavier visible sur la zone entière, jamais supprimé (RGAA 10.7) —
   :focus-within plutôt que :focus-visible directement sur l'input, invisible :
   c'est le cadre autour de la zone qui doit se voir, pas l'input lui-même. */
.cf7-fichier:focus-within {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* --- Erreurs CF7 --- */
.wpcf7-not-valid-tip { color: #b30000; font-size: .9rem; margin-top: .25rem; }
.wpcf7-response-output { border-width: 2px; background-color: white; font-size: .85rem; }

/* --- Responsive mobile : 1 colonne --- */
@media (max-width: 640px) {
    .cf7-grid { grid-template-columns: 1fr; }
    .cf7-radio-tags { flex-direction: column; align-items: flex-start; }
}
