/* ==========================================================================
   NOWVE — Fiche de contact
   Prolonge la « planche du bureau d'études » : le formulaire est un bon de
   commande. Chaque champ correctement rempli allume son voyant (feu vert).
   S'appuie sur styles.css (tokens, header, footer, boutons, grain).
   ========================================================================== */

.contact-page {
  min-height: 100vh;
  padding-top: clamp(7rem, 12vh, 9.5rem);
  padding-bottom: clamp(4rem, 9vh, 7rem);
  position: relative;
  isolation: isolate;
}

/* fond papier millimétré, très discret, sur toute la page */
.contact-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(var(--quadrille) 1px, transparent 1px),
    linear-gradient(90deg, var(--quadrille) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(120% 80% at 70% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(120% 80% at 70% 0%, #000 0%, transparent 78%);
  opacity: 0.9;
  pointer-events: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
}

/* ---------- colonne de gauche : l'accueil ---------- */

.form-aside { padding-top: 0.4rem; }

.form-title {
  font-size: clamp(2.4rem, 5.4vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin-bottom: 1.4rem;
}

.form-aside .lead {
  color: var(--encre);
  max-width: 42ch;
  margin-bottom: 1.1rem;
}
.form-aside p.form-corps {
  color: var(--encre-douce);
  max-width: 44ch;
  margin-bottom: 2.2rem;
}

/* le repli : écrire directement, et la promesse humaine */
.form-repli {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding-top: 1.6rem;
  border-top: 1px dashed var(--trait);
  max-width: 42ch;
}
.form-repli-ligne {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.form-repli dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--encre-douce);
  flex: none;
  width: 6.5rem;
}
.form-repli dd { font-size: 0.98rem; }
.form-repli a { color: var(--vert-franc); text-decoration: none; border-bottom: 1px solid var(--craie-verte); transition: border-color var(--vif); }
.form-repli a:hover { border-bottom-color: var(--vert-franc); }

/* ---------- colonne de droite : la fiche ---------- */

.form-panel {
  position: relative;
  background:
    linear-gradient(var(--quadrille) 1px, transparent 1px),
    linear-gradient(90deg, var(--quadrille) 1px, transparent 1px),
    #ffffff;
  background-size: 26px 26px, 26px 26px, auto;
  border: 1px solid var(--trait);
  border-radius: 22px;
  padding: clamp(1.6rem, 3vw, 2.6rem);
  box-shadow:
    0 30px 60px -32px rgba(16, 21, 15, 0.32),
    0 3px 10px -4px rgba(16, 21, 15, 0.08);
}
/* repères d'angle : coins « techniques » verts */
.form-panel::before,
.form-panel::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.form-panel::before {
  top: 12px; left: 12px;
  border-top: 2px solid var(--vert-franc);
  border-left: 2px solid var(--vert-franc);
  border-top-left-radius: 4px;
}
.form-panel::after {
  bottom: 12px; right: 12px;
  border-bottom: 2px solid var(--vert-franc);
  border-right: 2px solid var(--vert-franc);
  border-bottom-right-radius: 4px;
}

/* ---------- champs ---------- */

.champs {
  display: grid;
  gap: 1.5rem;
}
.champ-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.champ { display: flex; flex-direction: column; gap: 0.5rem; }

.champ-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.champ-label .opt { color: var(--trait); text-transform: none; letter-spacing: 0.06em; }

/* le voyant du champ : éteint par défaut, vert quand rempli & valide */
.champ-voyant {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--trait);
  box-shadow: none;
  transition: background var(--net) var(--ease-machine), border-color var(--net), box-shadow var(--net);
}
.champ:has(.saisie:not(:placeholder-shown):valid) .champ-voyant {
  background: var(--vert);
  border-color: var(--vert-appuye);
  box-shadow: 0 0 10px var(--lueur-verte);
}

.saisie {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--encre);
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  transition: border-color var(--vif) var(--ease-machine), box-shadow var(--net) var(--ease-machine), background var(--vif);
}
.saisie::placeholder { color: rgba(16, 21, 15, 0.34); }
.saisie:hover { border-color: rgba(16, 21, 15, 0.28); }
.saisie:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--vert-franc);
  box-shadow: 0 0 0 3px var(--lueur-verte);
}
textarea.saisie { resize: vertical; min-height: 8.5rem; }

/* ---------- besoin : puces à cocher ---------- */

.champ-besoin > .champ-label { margin-bottom: 0.2rem; }
.puces {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.puce { position: relative; }
.puce input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}
.puce span {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--encre-douce);
  background: var(--papier);
  border: 1px solid var(--trait);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: border-color var(--vif), color var(--vif), background var(--vif), box-shadow var(--vif), transform var(--vif) var(--ease-tampon);
}
.puce:hover span { border-color: rgba(16, 21, 15, 0.3); transform: translateY(-1px); }
.puce input:checked + span {
  color: var(--encre);
  background: var(--vert-eau);
  border-color: var(--vert-appuye);
  box-shadow: inset 0 0 0 1px var(--vert-appuye), 0 6px 14px -8px rgba(30, 122, 70, 0.5);
}
.puce input:focus-visible + span { outline: 2px solid var(--vert-franc); outline-offset: 2px; }

/* ---------- pied de fiche ---------- */

.form-pied {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.form-envoyer { border: 0; background: none; cursor: pointer; font: inherit; padding: 0; }

/* ---------- envoi : le cercle dont la bordure se remplit ---------- */

.form-envoyer .btn-spin {
  display: none;
  width: 15px;
  height: 15px;
  margin-right: 0.6rem;
  flex: none;
}
.form-envoyer .btn-spin circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 92;
}
.form-envoyer.is-sending .btn-spin {
  display: block;
  animation: spin-tour 0.9s linear infinite;
}
.form-envoyer.is-sending .btn-spin circle {
  animation: spin-remplit 1.4s ease-in-out infinite;
}
.form-envoyer[disabled] { cursor: progress; }
@keyframes spin-tour { to { transform: rotate(360deg); } }
@keyframes spin-remplit {
  0%   { stroke-dashoffset: 92; }
  55%  { stroke-dashoffset: 22; }
  100% { stroke-dashoffset: 92; }
}
@media (prefers-reduced-motion: reduce) {
  .form-envoyer.is-sending .btn-spin { animation: spin-tour 1.8s linear infinite; }
  .form-envoyer.is-sending .btn-spin circle { animation: none; stroke-dashoffset: 30; }
}

/* ---------- confirmation ---------- */

.form-merci {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: clamp(2rem, 4vw, 3rem) 0.4rem;
}
.form-merci.is-on { display: flex; }
.form-panel.is-envoye .champs,
.form-panel.is-envoye .form-pied,
.form-panel.is-envoye .champ-besoin { display: none; }
.form-merci-voyant {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--vert);
  box-shadow: 0 0 16px var(--lueur-verte);
  animation: respiration 3.4s ease-in-out infinite;
}
.form-merci h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); }
.form-merci p { color: var(--encre-douce); max-width: 42ch; }
.form-merci a { color: var(--vert-franc); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; gap: clamp(2rem, 6vw, 3rem); }
  .form-aside { max-width: 46rem; }
}

@media (max-width: 520px) {
  .champ-duo { grid-template-columns: 1fr; }
  .form-pied { flex-direction: column-reverse; align-items: stretch; }
  .form-pied .btn { width: 100%; }
  .form-pied .btn-int { width: 100%; }
}

/* ---------- mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  .form-merci-voyant { animation: none; }
}
