/* Enquête Nestor : gros caractères, fort contraste (AAA), mobile d'abord, mode sombre selon le système.
   Toutes les tailles sont en rem/em : elles suivent la taille de texte choisie sur le téléphone. */

:root {
  --fond: #ffffff;
  --texte: #111111;
  --texte-doux: #333333;
  --accent: #0a3a85;
  --sur-accent: #ffffff;
  --bord: #4d4d4d;
  --fond-choix: #ffffff;
  --fond-coche: #e3ecfa;
  --erreur: #a00000;
  --fond-erreur: #fdeeee;
  --danger: #8f0000;
  --focus: #0a3a85;
  --fond-doux: #f2f4f7;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121212;
    --texte: #f2f2f2;
    --texte-doux: #d6d6d6;
    --accent: #a8c8ff;
    --sur-accent: #0b1a33;
    --bord: #a6a6a6;
    --fond-choix: #1b1b1b;
    --fond-coche: #1d2b45;
    --erreur: #ffa3a3;
    --fond-erreur: #2e1414;
    --danger: #ffa3a3;
    --focus: #ffd75e;
    --fond-doux: #1e1e1e;
  }
}

/* iPhone et iPad seulement : suit la « taille du texte » choisie dans les réglages (Dynamic Type). */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html {
    font: -apple-system-body;
  }
}

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.125rem; /* 18 px avec le réglage par défaut, plus si le texte est agrandi */
  line-height: 1.55;
  overflow-wrap: break-word;
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

h1,
h2,
h3 {
  overflow-wrap: anywhere;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0.5rem 0 1.25rem;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.3;
  margin: 2.25rem 0 0.75rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  text-decoration-thickness: 0.15em;
}

:focus-visible {
  outline: 0.25rem solid var(--focus);
  outline-offset: 0.2rem;
}

[hidden] {
  display: none !important;
}

.visuellement-cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Questions ---------- */

.partie {
  margin-top: 1.5rem;
}

.intro-partie {
  font-size: 1.05em;
}

.question {
  border: 0;
  margin: 0 0 2rem;
  padding: 0;
  min-width: 0;
}

legend,
.legende {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.5rem;
  padding: 0;
}

/* Titre de question : h3 (ou h2) dans la légende, pour la navigation par titres des lecteurs d'écran.
   Il garde l'apparence de la légende. */
.titre-question {
  font: inherit;
  margin: 0;
}

.numero {
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--texte-doux);
  margin-bottom: 0.15rem;
}

.obligatoire {
  font-weight: 600;
}

.aide {
  color: var(--texte-doux);
  margin: 0 0 0.75rem;
}

.choix-liste {
  display: grid;
  gap: 0.6rem;
}

.choix {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-height: 3.25rem; /* cible tactile bien au-dessus de 48 px */
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--bord);
  border-radius: 0.6rem;
  background: var(--fond-choix);
  cursor: pointer;
}

.choix:hover {
  border-color: var(--accent);
}

.choix:has(input:checked) {
  background: var(--fond-coche);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choix:has(input:focus-visible) {
  outline: 0.25rem solid var(--focus);
  outline-offset: 0.2rem;
}

.choix input {
  flex: none;
  font-size: inherit; /* sinon la case reste à la taille de police propre au champ (13 px) */
  width: 1.6em;
  height: 1.6em;
  margin: 0.05em 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.choix input:focus-visible {
  outline-offset: 0.1rem;
}

.choix span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.champ {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--texte);
  background: var(--fond-choix);
  border: 2px solid var(--bord);
  border-radius: 0.6rem;
}

textarea.champ {
  min-height: 9rem;
  resize: vertical;
}

.compteur {
  margin: 0.35rem 0 0;
  text-align: right;
  color: var(--texte-doux);
  font-size: 0.95rem;
}

/* ---------- Erreurs ---------- */

.erreur {
  color: var(--erreur);
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.en-erreur .choix,
.en-erreur .champ {
  border-color: var(--erreur);
}

.en-erreur {
  border-left: 0.35rem solid var(--erreur);
  padding-left: 0.75rem;
}

.erreurs {
  border: 3px solid var(--erreur);
  background: var(--fond-erreur);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  margin: 0 0 2rem;
}

.erreurs h2 {
  margin-top: 0;
  color: var(--erreur);
  font-size: 1.3rem;
}

.erreurs ul {
  margin: 0;
  padding-left: 1.25rem;
}

.erreurs li {
  margin: 0.2rem 0;
  padding: 0.45rem 0;
}

.erreurs a {
  color: var(--erreur);
  font-weight: 700;
  display: inline;
}

.alerte {
  border: 3px solid var(--erreur);
  background: var(--fond-erreur);
  color: var(--texte);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

/* ---------- Données, envoi ---------- */

.envoi {
  margin-top: 2rem;
}

.bouton {
  display: block;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.8rem 1.5rem;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sur-accent);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 0.6rem;
  cursor: pointer;
}

.bouton[aria-disabled="true"] {
  opacity: 0.75;
  cursor: progress;
}

.bouton-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--fond);
}

.statut {
  margin-top: 0.75rem;
  font-weight: 600;
}

.lien-bouton {
  display: inline-block;
  min-height: 3.25rem;
  padding: 0.75rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: 0.6rem;
  font-weight: 700;
}

.merci h2 {
  margin-top: 0.5rem;
}

.numero-reponse {
  margin-top: 1.5rem;
  color: var(--texte-doux);
}

#merci-numero {
  white-space: nowrap;
}

/* Pied de page : éditeur et hébergeur (mentions légales). */
.pied {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  border-top: 1px solid var(--bord);
  color: var(--texte-doux);
  font-size: 0.95rem;
}

.pied p {
  margin: 0;
}

.texte-donnees p {
  background: var(--fond-doux);
  border-radius: 0.6rem;
  padding: 1rem;
}

/* Champ piège : hors de l'écran, ignoré par les lecteurs d'écran. */
.piege {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (min-width: 40rem) {
  main {
    padding-top: 2.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  .bouton {
    width: auto;
    min-width: 14rem;
  }
}

/* ---------- Page des résultats ---------- */

.resultats {
  max-width: 60rem;
}

.chiffre-cle strong {
  font-size: 1.6rem;
}

.liens li,
.sommaire li {
  margin: 0.35rem 0;
}

.sommaire {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
  list-style: none;
}

.sommaire a {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.4rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--bord);
}

thead th {
  border-bottom-width: 2px;
}

td:nth-child(2),
td:nth-child(3) {
  white-space: nowrap;
}

.contacts td:nth-child(2),
.contacts td:nth-child(3) {
  white-space: normal;
}

.sans-reponse th,
.sans-reponse td {
  color: var(--texte-doux);
  font-style: italic;
}

.textes {
  padding-left: 1.5rem;
}

.textes li {
  margin: 0 0 1.25rem;
}

.textes .meta {
  margin: 0 0 0.25rem;
  color: var(--texte-doux);
  font-size: 0.95rem;
}

.texte-libre {
  white-space: pre-wrap;
  background: var(--fond-doux);
  border-radius: 0.4rem;
  padding: 0.6rem 0.8rem;
}

.avertissement {
  font-weight: 700;
}

.message {
  border: 3px solid var(--accent);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  font-weight: 700;
}
