/* ==========================================================================
   Page « Étudier mon projet » et page 404 : styles propres à ces pages (chargés seulement par elles).
   Réutilise les variables de style.css. Le bordeaux reste réservé au CTA « Étudier mon projet ».
   ========================================================================== */

/* En-tête de la page : bande Lin pleine largeur, fil d'Ariane compris (décision du dirigeant du 21/10/2026), sans élément ajouté.
   Ombre sans flou de 100vmax, découpée en haut et en bas (clip-path) : elle peint le fond sans élargir la page (aucun défilement
   horizontal). Rien sur la 404, qui charge aussi ce fichier mais n'a ni .etude ni .etude__entete. */
.etude .fil,
.etude__entete {
  background: var(--c-fond-alt);
  box-shadow: 0 0 0 100vmax var(--c-fond-alt);
  clip-path: inset(0 -100vmax);
}

/* Le fil couvre aussi la marge haute de la page ; plus d'écart blanc entre le fil et l'en-tête */
.etude .fil {
  padding-bottom: var(--s-5);
  clip-path: inset(calc(-1 * var(--s-6)) -100vmax 0);
}

.etude .fil ol {
  margin-bottom: 0;
}

.etude__entete {
  margin-bottom: 0;
  padding-bottom: var(--s-7);
}

.etude__formulaire {
  margin-top: var(--s-7);
}

.etude__rapide {
  margin-top: var(--s-3);
  font-weight: var(--fw-demi);
  color: var(--c-marine);
}

.etude__reassurances {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin: var(--s-5) 0 0;
  padding: 0;
  list-style: none;
}

.etude__reassurances li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: var(--fw-medium);
  color: var(--c-marine);
}

.etude__reassurances li::before {
  content: "";
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--c-marine);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.etude__precision {
  margin-top: var(--s-3);
  color: var(--c-texte-doux);
}

/* Formulaire */
.etude__formulaire h2 {
  margin-bottom: var(--s-3);
  font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
}

.etude__donnees,
.etude__obligatoires {
  max-width: var(--colonne-texte);
  font-size: var(--fs-petit);
  color: var(--c-texte-doux);
}

.etude__obligatoires {
  margin-top: var(--s-2);
}

.etude__secours {
  max-width: var(--colonne-texte);
  margin-top: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r-carte);
  background: var(--c-marine-pale);
}

.etude__form {
  display: grid;
  gap: var(--s-5);
  max-width: var(--colonne-texte);
  margin-top: var(--s-5);
}

.etude__form[hidden],
.etude__confirmation[hidden],
.etude__erreur-envoi[hidden],
.etude__secours[hidden],
.champ__erreur[hidden] {
  display: none;
}

.etude__ligne {
  display: grid;
  gap: var(--s-5);
}

.champ {
  display: grid;
  gap: var(--s-2);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.champ > label,
.champ > legend {
  padding: 0;
  font-size: 1rem;
  font-weight: var(--fw-demi);
  line-height: 1.4;
  color: var(--c-texte);
}

.champ__etoile {
  color: var(--c-marine);
}

.champ input[type="text"],
.champ input[type="email"],
.champ input[type="tel"],
.champ textarea {
  width: 100%;
  min-height: 3.25rem;
  padding: calc(var(--s-2) + 0.5px) calc(var(--s-3) + 0.5px);
  border: var(--bordure-champ);
  border-radius: var(--r-bouton);
  font: inherit;
  font-size: 1.0625rem; /* 17 px : pas d'agrandissement automatique sur iPhone */
  color: var(--c-texte);
  background: var(--c-fond);
}

/* Focus : bordure de 2 px Marine et anneau Marine (le remplissage compense la bordure plus épaisse : rien ne bouge) */
.champ input:focus-visible,
.champ textarea:focus-visible {
  padding: var(--s-2) var(--s-3);
  border: 2px solid var(--c-marine);
  outline: var(--focus-anneau);
  outline-offset: 2px;
}

.champ input:disabled,
.champ textarea:disabled {
  border-color: var(--c-bordure);
  color: var(--c-texte-doux);
  background: var(--c-fond-alt);
}

@media (prefers-reduced-motion: no-preference) {
  .champ input,
  .champ textarea {
    transition: border-color var(--transition), background-color var(--transition);
  }
}

.champ textarea {
  resize: vertical;
}

.champ input[aria-invalid="true"] {
  padding: var(--s-2) var(--s-3);
  border-color: var(--c-erreur);
  border-width: 2px;
}

.champ__erreur {
  position: relative;
  padding-left: 1.75rem;
  font-size: 0.9375rem;
  font-weight: var(--fw-demi);
  line-height: 1.4;
  color: var(--c-erreur);
}

/* Pictogramme « ! » dessiné en CSS (masque SVG en data URI, aucune requête), décor non lu ; le message reste le seul texte */
.champ__erreur::before,
.etude__erreur-envoi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.0625rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--c-erreur);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM9 5h2v7H9zm0 9h2v2H9z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM9 5h2v7H9zm0 9h2v2H9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Choix (boutons radio, cases à cocher) : cible de 44 px au moins */
.champ--choix {
  gap: 0;
}

.champ--choix > legend {
  margin-bottom: var(--s-2);
}

.choix {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-height: var(--cible-min);
  padding-block: var(--s-2);
  cursor: pointer;
}

.choix input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.125rem 0 0;
  accent-color: var(--c-marine);
}

.champ--consentement {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-carte);
  background: var(--c-fond-alt);
}

/* Tuiles : seulement les trois groupes de choix (.champ--choix), jamais la case de consentement.
   Repli, navigateur sans :has() : les lignes actuelles (case native, sans cadre), aucune règle ci-dessous ne s'applique. */
@supports selector(:has(*)) {
  .champ--choix {
    row-gap: var(--s-2);
  }

  .champ--choix .choix {
    align-items: center;
    min-height: 3.5rem;
    padding: calc(var(--s-3) + 0.5px) calc(var(--s-4) + 0.5px);
    border: var(--bordure-champ);
    border-radius: var(--r-bouton);
    background: var(--c-fond);
  }

  .champ--choix .choix input {
    width: 1.375rem;
    height: 1.375rem;
    margin: 0;
  }

  .champ--choix .choix:hover {
    border-color: var(--c-marine);
  }

  /* Cochée : bordure de 2 px Marine et fond Brume (le remplissage compense la bordure : rien ne bouge) */
  .champ--choix .choix:has(input:checked) {
    padding: var(--s-3) var(--s-4);
    border: 2px solid var(--c-marine);
    background: var(--c-marine-pale);
  }

  /* L'anneau de focus entoure la tuile entière */
  .champ--choix .choix:has(input:focus-visible) {
    outline: var(--focus-anneau);
    outline-offset: 2px;
  }

  .champ--choix .choix input:focus-visible {
    outline: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    .champ--choix .choix {
      transition: border-color var(--transition), background-color var(--transition);
    }
  }

  /* Bureau : « Où en êtes-vous ? » et « Vous êtes… » sur 2 colonnes, « Travaux envisagés » sur 3 ; une tuile par ligne sur téléphone */
  @media (min-width: 37.5rem) {
    .champ--choix:has(input[type="radio"]) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: var(--s-2);
    }
  }

  @media (min-width: 48rem) {
    .champ--choix:has(input[name="travaux_envisages"]) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
      column-gap: var(--s-2);
    }
  }
}

/* Prénom et nom, téléphone et code postal côte à côte dès 600 px */
@media (min-width: 37.5rem) {
  .etude__ligne {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Champ piège : hors de l'écran, sans taille, jamais atteint au clavier */
.etude__piege {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Bouton d'envoi : bleu marine (le bordeaux reste réservé au CTA d'entrée dans l'étude) */
.etude__envoyer {
  width: 100%;
  min-height: 3.25rem;
  color: var(--c-blanc);
  background: var(--c-marine);
  border-color: var(--c-marine);
}

.etude__envoyer:hover {
  background: var(--c-marine-fonce);
  border-color: var(--c-marine-fonce);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.etude__envoyer:disabled {
  cursor: progress;
  color: var(--c-texte-doux);
  background: var(--c-bordure);
  border-color: var(--c-bordure);
  text-decoration: none;
}

@media (min-width: 40rem) {
  .etude__envoyer {
    width: auto;
    justify-self: start;
    min-width: 16rem;
  }
}

/* Échec d'envoi et confirmation */
.etude__erreur-envoi {
  position: relative;
  padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 1.75rem);
  border: 2px solid var(--c-erreur);
  border-radius: var(--r-carte);
  font-weight: var(--fw-demi);
  color: var(--c-texte);
  background: var(--c-fond);
}

.etude__erreur-envoi::before {
  left: var(--s-4);
  top: calc(var(--s-4) + 0.125rem);
}

.etude__confirmation {
  position: relative;
  max-width: var(--colonne-texte);
  margin-top: var(--s-5);
  padding: var(--s-5) var(--s-5) var(--s-5) calc(var(--s-5) + 2rem);
  border: 2px solid var(--c-validation);
  border-radius: var(--r-carte);
  font-size: 1.125rem;
  font-weight: var(--fw-medium);
  color: var(--c-texte);
  background: var(--c-fond);
}

/* Coche dessinée en CSS (masque SVG en data URI), décor non lu */
.etude__confirmation::before {
  content: "";
  position: absolute;
  left: var(--s-5);
  top: calc(var(--s-5) + 0.125rem);
  width: 1.5rem;
  height: 1.5rem;
  background: var(--c-validation);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.etude__erreur-envoi:focus,
.etude__confirmation:focus {
  outline: var(--focus-anneau);
  outline-offset: 2px;
}

/* Page 404 */
.page-404__liens {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  margin: var(--s-6) 0 0;
  padding: 0;
  list-style: none;
}
