/* Formulaire client, charte Avest. Aucune couleur ecrite a la main : tout vient de charte.css.
   --bouton et --blanc figent les valeurs du theme clair, pour qu'un bouton a texte blanc garde
   le bleu #2B5ED4 meme sur la couverture nuit (le #5C92FF du theme nuit n'est pas assez
   contraste sous du texte blanc). */

@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url(polices/manrope-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url(polices/manrope-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(polices/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(polices/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(polices/inter-latin-600-normal.woff2) format("woff2"); }

:root {
  --bouton: var(--accent);
  --blanc: var(--surface);
  --fond-fonce: var(--titre);
  --rayon: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-2);
  color: var(--texte);
  font: 400 16px/1.55 var(--police-texte);
}
h1, h2, h3 { font-family: var(--police-titres); color: var(--titre); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-weight: 800; font-size: clamp(1.75rem, 6vw, 2.5rem); }
h2 { font-weight: 800; font-size: 1.4rem; }
h3 { font-weight: 700; font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
.secondaire { color: var(--texte-secondaire); font-size: .925rem; }
.surtitre { color: var(--accent); font: 700 .8rem/1.2 var(--police-titres); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .4rem; }

/* Couverture nuit plein ecran */
.couverture {
  min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  color: var(--texte);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 28px 20px 32px;
}
.couverture .logo { height: 28px; width: auto; }
.couverture .contenu { max-width: 34rem; margin: 3rem auto 2rem; width: 100%; }
.couverture p { color: var(--texte-secondaire); font-size: 1.05rem; }
.couverture .pied { max-width: 34rem; margin: 0 auto; width: 100%; }

/* Ecrans clairs */
.entete {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border-bottom: 1px solid var(--filet);
  padding: 10px 16px 0;
}
.entete .ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 40rem; margin: 0 auto; }
.entete .logo { height: 20px; width: auto; }
.entete .etape { font-size: .825rem; color: var(--texte-secondaire); text-align: right; }
.avancement { height: 4px; background: var(--filet); border-radius: 2px; margin: 10px auto 0; max-width: 40rem; overflow: hidden; }
.avancement span { display: block; height: 100%; background: var(--aplat); transition: width .3s; }
.sous-entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 40rem; margin: 4px auto 6px; min-height: 1.4em; }
.sauvegarde { font-size: .75rem; color: var(--texte-secondaire); }
.sous-entete .bouton.lien { font-size: .8rem; padding: 4px 0; white-space: nowrap; }

.ecran { max-width: 40rem; margin: 0 auto; padding: 24px 16px 120px; }
.ecran > header { margin-bottom: 1.25rem; }

.carte {
  background: var(--surface); border: 1px solid var(--filet); border-radius: var(--rayon);
  padding: 16px; margin-bottom: 14px;
}
.carte.discrete { background: var(--surface-3); border-color: transparent; }

/* Champs */
.champ { margin-bottom: 16px; }
.champ:last-child { margin-bottom: 0; }
label, .libelle { display: block; font-weight: 600; margin-bottom: 6px; color: var(--titre); }
.aide { display: block; font-size: .85rem; color: var(--texte-secondaire); margin: -2px 0 6px; font-weight: 400; }
.facultatif { font-weight: 400; color: var(--texte-secondaire); font-size: .85rem; }
input[type=text], input[type=url], input[type=email], input[type=tel], textarea, select {
  width: 100%; font: inherit; color: var(--texte); background: var(--surface);
  border: 1px solid var(--filet); border-radius: var(--rayon); padding: 12px;
  min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, .choix:focus-within {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.invalide { border-color: var(--erreur) !important; }
.erreur { color: var(--erreur); font-size: .85rem; margin-top: 6px; }

.choix {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--filet); border-radius: var(--rayon); background: var(--surface);
  padding: 14px; margin-bottom: 10px; cursor: pointer; font-weight: 400;
}
.choix input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.choix strong { display: block; color: var(--titre); font-weight: 600; }
.choix.actif { border-color: var(--accent); }
.note { border-left: 3px solid var(--accent); padding: 8px 12px; background: var(--surface-3); border-radius: 0 var(--rayon) var(--rayon) 0; font-size: .9rem; margin-top: 8px; }
.note.alerte { border-left-color: var(--alerte); }

/* Boutons */
button { font: inherit; cursor: pointer; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: var(--rayon);
  background: var(--bouton); color: var(--blanc); border: 0; font-weight: 600;
}
.bouton:disabled { opacity: .45; cursor: not-allowed; }
.bouton.second { background: transparent; color: var(--accent); border: 1px solid var(--filet); }
.bouton.lien { background: none; border: 0; color: var(--accent); padding: 8px 0; min-height: 0; text-decoration: underline; }
.bouton.large { width: 100%; }
.navigation {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--surface); border-top: 1px solid var(--filet);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.navigation .ligne { max-width: 40rem; margin: 0 auto; display: flex; gap: 10px; }
.navigation .bouton { flex: 1; }
.navigation .bouton.second { flex: 0 0 auto; }

/* Depot de fichiers */
.depot { border: 1px dashed var(--texte-secondaire); border-radius: var(--rayon); padding: 14px; background: var(--surface); }
.depot input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.depot .fichier { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .9rem; }
.depot .fichier img { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: var(--surface-3); }
.depot.fonce .fichier img { background: var(--titre); }
.depot .nom { flex: 1; word-break: break-all; }

/* Couleurs */
.couleur { display: flex; gap: 10px; align-items: center; }
.couleur input[type=color] { width: 56px; height: 48px; border: 1px solid var(--filet); border-radius: var(--rayon); padding: 4px; background: var(--surface); }

/* Textes des pages */
.bloc-texte { border-top: 1px solid var(--filet); padding-top: 14px; margin-top: 14px; }
.bloc-texte:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.propose { white-space: pre-line; background: var(--surface-2); border-radius: var(--rayon); padding: 12px; margin: 6px 0 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .bouton { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.garde { color: var(--succes); font-size: .85rem; font-weight: 600; }
/* Avest × logo de l'agence */
.duo { display: inline-flex; align-items: center; gap: 10px; }
.duo .fois { color: var(--texte-secondaire); font-size: .9rem; }
.duo .tuile { display: inline-flex; align-items: center; justify-content: center; height: 32px; max-width: 120px; padding: 4px 8px; border-radius: 8px; background: var(--blanc); border: 1px solid var(--filet); }
.duo .tuile img { max-height: 24px; max-width: 104px; object-fit: contain; }
.duo .tuile.foncee { background: var(--fond-fonce); border-color: transparent; }
.couverture .duo .logo { height: 28px; }
.couverture .duo .tuile { height: 44px; max-width: 160px; }
.couverture .duo .tuile img { max-height: 34px; max-width: 144px; }

/* Réponses suggérées à toucher */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--filet); background: var(--surface); color: var(--texte); font-size: .9rem; }
.puce.on { border-color: var(--accent); background: var(--surface-3); color: var(--titre); font-weight: 600; }
.puce .reco { font-size: .72rem; font-weight: 600; color: var(--accent); margin-left: 4px; }
.lecture { min-height: 1.4em; margin: -6px 0 0; font-size: .85rem; }

/* Confirmation d'envoi */
.confirmation { display: flex; gap: 16px; align-items: center; margin-bottom: 1.25rem; }
.coche { flex: none; width: 52px; height: 52px; }
.coche circle { fill: none; stroke: var(--succes); stroke-width: 3; }
.coche path { fill: none; stroke: var(--succes); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: no-preference) {
  .coche circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: trace .5s ease-out forwards; }
  .coche path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: trace .35s .45s ease-out forwards; }
}
@keyframes trace { to { stroke-dashoffset: 0; } }

.apercu-logo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 12px; }
.apercu-logo .fond { display: flex; align-items: center; justify-content: center; min-height: 88px; padding: 12px; border-radius: var(--rayon); border: 1px solid var(--filet); }
.apercu-logo .clair { background: var(--surface-2); }
.apercu-logo .fonce { background: var(--titre); }
.apercu-logo img { max-width: 100%; max-height: 64px; object-fit: contain; }
.apercu-logo .fond { color: var(--texte-secondaire); font-size: .8rem; }

.emplacement { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 6px; color: var(--accent); font-weight: 600; font-size: .9rem; }
.emplacement::after { content: "\2197"; margin-left: 6px; }

/* Recapitulatif */
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--filet); }
.liste li:first-child { border-top: 0; }
.jauge { font: 800 2.5rem/1 var(--police-titres); color: var(--titre); }
.etapes-suite { padding-left: 1.2rem; margin: 0; }
.etapes-suite li { margin-bottom: 6px; }
.test { font-size: .8rem; color: var(--alerte); border: 1px solid var(--alerte); border-radius: var(--rayon); padding: 6px 10px; display: inline-block; }

@media (min-width: 720px) {
  .couverture { padding: 40px 48px; }
  .ecran { padding-top: 36px; }
}

/* Avertissement avant l'envoi */
.modale { border: 0; border-radius: var(--rayon); padding: 22px 20px; max-width: min(28rem, calc(100vw - 32px)); background: var(--surface); color: var(--texte); }
.modale::backdrop { background: rgba(11, 29, 58, .55); }
.modale h2 { font-size: 1.2rem; margin-bottom: .75rem; }
.modale .liste { margin-bottom: .75rem; }
.modale .liste li { padding: 8px 0; }
.actions-modale { display: flex; flex-direction: column; gap: 10px; margin-top: 1rem; }
