/*
 * IMMGO — Charte : champs, sélecteurs, tuiles de choix, interrupteur et assistant « une question par écran »
 * Auteur : Jacks Ngalangala
 */

/* ─── Champ ─── */
.champ {
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
}
.champ-libelle {
  font-size: var(--taille-petit);
  font-weight: var(--graisse-forte);
  color: var(--texte);
}
.champ-aide {
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.champ-boite {
  display: flex;
  align-items: center;
  gap: var(--e-2);
  min-height: 56px;
  padding: 0 var(--e-4);
  background: var(--surface);
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-moyen);
  transition:
    border-color var(--duree) var(--courbe),
    box-shadow var(--duree) var(--courbe);
}
.champ-boite:focus-within {
  border-color: var(--or);
  box-shadow: var(--anneau);
}
.champ-boite > svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--texte-faible);
}
.champ-saisie {
  flex: 1;
  min-width: 0;
  height: 54px;
  border: 0;
  background: transparent;
  font-size: var(--taille-grand);
  outline: none;
}
.champ-saisie:focus-visible {
  box-shadow: none; /* l'anneau est porté par .champ-boite */
}
.champ-saisie::placeholder {
  color: var(--texte-faible);
}
textarea.champ-saisie {
  height: auto;
  min-height: 120px;
  padding: var(--e-3) 0;
  resize: vertical;
}
select.champ-saisie {
  appearance: none;
  cursor: pointer;
}
.champ-affixe {
  flex: none;
  color: var(--texte-second);
  font-size: var(--taille-corps);
  font-weight: var(--graisse-moyenne);
}
.champ-erreur {
  display: flex;
  align-items: flex-start;
  gap: var(--e-2);
  font-size: var(--taille-petit);
  color: var(--danger);
  font-weight: var(--graisse-moyenne);
}
.champ-erreur svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.champ[aria-invalid='true'] .champ-boite {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger-pale) 35%, var(--surface));
}
.champ-saisie:disabled {
  cursor: not-allowed;
  color: var(--texte-faible);
}

/* ─── Tuiles de choix (une seule réponse ou plusieurs) ─── */
.choix {
  display: grid;
  gap: var(--e-3);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.choix-liste {
  grid-template-columns: 1fr;
}
.choix-tuile {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  min-height: 64px;
  padding: var(--e-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-moyen);
  font-size: var(--taille-corps);
  font-weight: var(--graisse-moyenne);
  transition:
    border-color var(--duree) var(--courbe),
    background var(--duree) var(--courbe);
}
.choix-tuile:hover {
  border-color: var(--or);
}
.choix-tuile svg {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--texte-second);
}
.choix-tuile[aria-checked='true'] {
  border-color: var(--or);
  background: var(--or-pale);
  box-shadow: inset 0 0 0 1px var(--or);
}
.choix-tuile[aria-checked='true'] svg {
  color: var(--or-texte);
}
.choix-texte {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.choix-detail {
  font-size: var(--taille-petit);
  color: var(--texte-second);
  font-weight: var(--graisse-normale);
}

/* ─── Interrupteur ─── */
.interrupteur {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--e-4);
  min-height: 56px;
  cursor: pointer;
}
.interrupteur input {
  appearance: none;
  flex: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: var(--r-pilule);
  background: var(--trait-fort);
  position: relative;
  cursor: pointer;
  transition: background var(--duree) var(--courbe);
}
.interrupteur input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--ombre-1);
  transition: transform var(--duree) var(--courbe);
}
.interrupteur input:checked {
  background: var(--or);
}
.interrupteur input:checked::after {
  transform: translateX(20px);
}

/* ─── Assistant : une question par écran ─── */
.assistant {
  display: flex;
  flex-direction: column;
  gap: var(--e-8);
  width: 100%;
  max-width: var(--largeur-lecture);
  margin: 0 auto;
}
.assistant-tete {
  display: flex;
  flex-direction: column;
  gap: var(--e-3);
}
.assistant-compteur {
  display: flex;
  justify-content: space-between;
  font-size: var(--taille-petit);
  color: var(--texte-second);
  font-weight: var(--graisse-moyenne);
}
.progression {
  height: 6px;
  border-radius: var(--r-pilule);
  background: var(--trait);
  overflow: hidden;
}
.progression-barre {
  height: 100%;
  width: calc(var(--progression, 0) * 1%);
  border-radius: inherit;
  background: var(--or);
  transition: width 320ms var(--courbe);
}
.assistant-corps {
  display: flex;
  flex-direction: column;
  gap: var(--e-6);
  animation: assistant-entre 240ms var(--courbe);
}
.assistant-question {
  font-size: var(--taille-titre-2);
  line-height: var(--interligne-titre);
  font-weight: var(--graisse-titre);
  letter-spacing: -0.015em;
}
.assistant-aide {
  margin-top: calc(var(--e-4) * -1);
  color: var(--texte-second);
}
.assistant-pied {
  padding-top: var(--e-6);
  border-top: 1px solid var(--trait);
}
@keyframes assistant-entre {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
.assistant[data-sens='retour'] .assistant-corps {
  animation-name: assistant-revient;
}
@keyframes assistant-revient {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
}

/* Résumé final : chaque réponse se relit et se modifie */
.resume {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-grand);
}
.resume-ligne {
  display: flex;
  align-items: center;
  gap: var(--e-4);
  padding: var(--e-4) var(--e-5);
}
.resume-ligne + .resume-ligne {
  border-top: 1px solid var(--trait);
}
.resume-texte {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.resume-question {
  font-size: var(--taille-petit);
  color: var(--texte-second);
}
.resume-reponse {
  font-weight: var(--graisse-forte);
  overflow-wrap: anywhere;
}
