/* Feuille de style du formulaire.
 *
 * Portage en CSS natif du thème Tailwind de la version Next.js : mêmes
 * variables de couleur, même rayon d'angle. Aucune dépendance externe — sur un
 * hébergement mutualisé, une CDN indisponible laisserait le formulaire nu.
 */

:root {
  --background: 0 0% 100%;
  --foreground: 222 47% 11%;
  --card: 0 0% 100%;
  --primary: 149 62% 26%;
  --primary-foreground: 0 0% 100%;
  --muted: 210 40% 96%;
  --muted-foreground: 215 16% 40%;
  --destructive: 0 72% 42%;
  --destructive-foreground: 0 0% 100%;
  --border: 214 32% 88%;
  --ring: 149 62% 26%;
  --radius: 0.5rem;
}

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

body {
  margin: 0;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Le focus doit rester nettement visible : le formulaire est parcouru au clavier. */
:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Réservé aux lecteurs d'écran. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lien-evitement {
  position: absolute;
  left: -9999px;
}

.lien-evitement:focus {
  left: 1rem;
  top: 1rem;
  z-index: 50;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}

/* Masque le honeypot à l'œil tout en le laissant dans le DOM pour les robots.
   `display:none` serait ignoré par certains d'entre eux — on le sort de l'écran. */
.champ-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* --- Structure ----------------------------------------------------------- */

.entete-site {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 1.5rem 1rem;
}

.entete-site .conteneur {
  max-width: 52rem;
  margin: 0 auto;
}

.entete-site .institution {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  margin: 0 0 0.25rem;
}

.entete-site h1 {
  font-size: 1.35rem;
  margin: 0;
  font-weight: 600;
}

.conteneur {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  padding: 1.5rem 0 4rem;
}

.carte {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
}

@media (max-width: 640px) {
  .carte {
    padding: 1.125rem;
  }
}

.pied-page {
  border-top: 1px solid hsl(var(--border));
  padding: 1.5rem 1rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

/* --- Barre de progression ------------------------------------------------ */

.progression {
  margin-bottom: 1.5rem;
}

.progression-entete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.progression-entete strong {
  color: hsl(var(--foreground));
}

.progression-piste {
  height: 6px;
  background: hsl(var(--border));
  border-radius: 999px;
  overflow: hidden;
}

.progression-jauge {
  height: 100%;
  background: hsl(var(--primary));
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* --- Étapes -------------------------------------------------------------- */

.etape[hidden] {
  display: none;
}

.etape-titre {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.etape-description {
  margin: 0 0 1.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

/* --- Champs -------------------------------------------------------------- */

.champ {
  margin-bottom: 1.25rem;
}

.champ label,
.legende {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.obligatoire {
  color: hsl(var(--destructive));
  margin-left: 0.15rem;
}

.aide {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin: 0.375rem 0 0;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
}

textarea {
  resize: vertical;
  min-height: 5rem;
}

input[readonly] {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

select:disabled {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  cursor: not-allowed;
}

.champ-erreur input,
.champ-erreur select,
.champ-erreur textarea {
  border-color: hsl(var(--destructive));
}

.message-erreur {
  display: block;
  color: hsl(var(--destructive));
  font-size: 0.8125rem;
  margin-top: 0.375rem;
}

.grille-2 {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .grille-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Cases et boutons radio ---------------------------------------------- */

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.option:hover {
  background: hsl(var(--muted));
}

.option input {
  margin: 0.2rem 0 0;
  accent-color: hsl(var(--primary));
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}

.option.selectionnee {
  border-color: hsl(var(--primary) / 0.4);
  background: hsl(var(--primary) / 0.06);
  font-weight: 500;
}

.options-en-ligne {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.options-en-ligne .option {
  margin-bottom: 0;
  flex: 1 1 12rem;
  align-items: center;
}

.groupe-options {
  border: 0;
  padding: 0;
  margin: 0 0 1.25rem;
}

.colonnes-options {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .colonnes-options {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Blocs conditionnels ------------------------------------------------- */

/* Le décalage rattache visuellement les champs révélés à la case qui les ouvre. */
.bloc-conditionnel {
  border-left: 2px solid hsl(var(--primary) / 0.25);
  padding-left: 1rem;
  margin: 0.75rem 0 1.5rem 0.25rem;
}

.bloc-conditionnel[hidden] {
  display: none;
}

.encadre-pointille {
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 1rem 0.25rem;
  margin-bottom: 1.25rem;
}

.encadre-pointille:empty {
  display: none;
}

/* --- Messages ------------------------------------------------------------ */

.note {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border-radius: calc(var(--radius) - 2px);
  padding: 0.75rem;
  font-size: 0.875rem;
  margin: 0 0 1.25rem;
}

.note-importante {
  background: hsl(var(--primary) / 0.06);
  border: 1px solid hsl(var(--primary) / 0.3);
  color: hsl(var(--foreground));
}

.alerte {
  border-radius: calc(var(--radius) - 2px);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.alerte-erreur {
  border: 1px solid hsl(var(--destructive) / 0.4);
  background: hsl(var(--destructive) / 0.06);
  color: hsl(var(--destructive));
}

.alerte-erreur ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.alerte-erreur a {
  color: inherit;
}

.alerte-succes {
  border: 1px solid hsl(var(--primary) / 0.4);
  background: hsl(var(--primary) / 0.06);
}

.compteur-mots {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  text-align: right;
  margin: 0.375rem 0 0;
}

.compteur-mots.depasse {
  color: hsl(var(--destructive));
  font-weight: 500;
}

/* --- Boutons ------------------------------------------------------------- */

.barre-navigation {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

.bouton {
  font: inherit;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bouton-principal {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.bouton-principal:hover {
  background: hsl(var(--primary) / 0.9);
}

.bouton-secondaire {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.bouton-secondaire:hover {
  background: hsl(var(--muted));
}

.bouton[disabled],
.bouton[hidden] {
  opacity: 0.5;
  cursor: not-allowed;
}

.bouton[hidden] {
  display: none;
}

/* --- Récapitulatif ------------------------------------------------------- */

.recap-section {
  margin-bottom: 1.5rem;
}

.recap-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 0.5rem;
}

.recap-liste {
  margin: 0;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
}

.recap-ligne {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border-top: 1px solid hsl(var(--border));
}

.recap-ligne:first-child {
  border-top: 0;
}

@media (min-width: 640px) {
  .recap-ligne {
    grid-template-columns: minmax(0, 14rem) 1fr;
    gap: 1rem;
  }
}

.recap-ligne dt {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.recap-ligne dd {
  margin: 0;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* --- Page de confirmation ------------------------------------------------ */

.page-message {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.page-message h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.page-message p {
  color: hsl(var(--muted-foreground));
  margin: 0 auto 1rem;
  max-width: 34rem;
}

/* Sur une page imprimée, la navigation n'a aucun sens. */
@media print {
  .barre-navigation,
  .progression,
  .lien-evitement {
    display: none !important;
  }
}
