/* ==========================================================================
   Questionnaire EVJF
   ========================================================================== */

:root {
  color-scheme: light;

  /* Couleurs */
  --creme: #fbf1e9;
  --papier: #fffdfb;
  --encre: #2e1a26;
  --prune: #5a2644;
  --prune-fonce: #431a32;
  --attenue: #7b6570;
  --trait: #ecdcd3;
  --trait-fort: #d9c2b8;
  --peche: #f7cdbb;
  --rose: #f3a9bd;
  --or: #c59a45;

  /* Réponses du tableau de disponibilités */
  --oui: #1f7a58;
  --oui-fond: #e4f4ec;
  --peut-etre: #96610c;
  --peut-etre-fond: #fbefd6;
  --non: #b3384a;
  --non-fond: #fbe6e8;

  --erreur: #b3261e;
  --erreur-fond: #fdecea;
  --erreur-trait: #eaa9a3;

  /* Typographie : polices du système, aucune ressource externe */
  --police-titre: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --police-texte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;

  --rayon: 16px;
  --rayon-carte: 28px;
  --anneau: 0 0 0 4px rgba(90, 38, 68, .16);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--police-texte);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--encre);
  background-color: var(--creme);
  -webkit-font-smoothing: antialiased;
}

/* Halos de couleur fixes derrière la page. */
body::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background:
    radial-gradient(42rem 30rem at 105% -8%, rgba(243, 169, 189, .5), transparent 62%),
    radial-gradient(38rem 28rem at -12% 6%, rgba(247, 205, 187, .78), transparent 62%),
    radial-gradient(40rem 26rem at 50% 112%, rgba(197, 154, 69, .2), transparent 62%);
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

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

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Champ piège de l'anti-spam : hors écran, invisible pour un humain. */
.piege {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Mise en page
   -------------------------------------------------------------------------- */

.page {
  max-width: 43rem;
  margin: 0 auto;
  padding: clamp(2.25rem, 7vw, 4.5rem) 1rem 2.5rem;
}

.entete {
  position: relative;
  padding: 0 .5rem clamp(1.75rem, 5vw, 2.5rem);
  text-align: center;
}

.entete__surtitre {
  position: relative;
  margin: 0 0 1rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--prune);
}

.entete__titre {
  position: relative;
  margin: 0;
  font-family: var(--police-titre);
  font-size: clamp(2.5rem, 11.5vw, 4.4rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.02em;
}

.entete__titre em {
  position: relative;
  display: inline-block;
  font-style: italic;
  font-weight: 500;
  color: var(--prune);
  white-space: nowrap;
}

.entete__trait {
  position: absolute;
  bottom: -.14em;
  left: -3%;
  width: 106%;
  height: .28em;
  overflow: visible;
  color: var(--or);
}

.entete__intro {
  position: relative;
  max-width: 29rem;
  margin: 1.6rem auto 0;
  font-size: 1.0625rem;
  color: var(--attenue);
}

/* Confettis autour du titre (la zone s'arrête avant la phrase d'introduction). */
.confettis {
  position: absolute;
  top: -1.25rem;
  right: 0;
  left: 0;
  height: 8.75rem;
  pointer-events: none;
}

.confettis span {
  position: absolute;
  display: block;
  width: .6rem;
  height: .6rem;
  border-radius: 2px;
}

.confettis span:nth-child(1) { top: 4%; left: 5%; background: var(--rose); transform: rotate(18deg); }
.confettis span:nth-child(2) { top: 40%; left: 1%; width: .45rem; height: .45rem; border-radius: 50%; background: var(--or); }
.confettis span:nth-child(3) { top: 76%; left: 7%; width: .35rem; height: .9rem; background: var(--peche); transform: rotate(-28deg); }
.confettis span:nth-child(4) { top: -2%; left: 27%; width: .4rem; height: .4rem; border-radius: 50%; background: var(--prune); opacity: .45; }
.confettis span:nth-child(5) { top: -3%; right: 26%; width: .9rem; height: .35rem; background: var(--or); transform: rotate(32deg); }
.confettis span:nth-child(6) { top: 9%; right: 5%; background: var(--peche); transform: rotate(-14deg); }
.confettis span:nth-child(7) { top: 44%; right: 1%; width: .45rem; height: .45rem; border-radius: 50%; background: var(--rose); }
.confettis span:nth-child(8) { top: 78%; right: 8%; width: .35rem; height: .9rem; background: var(--prune); opacity: .4; transform: rotate(24deg); }

.carte {
  position: relative;
  padding: clamp(1.25rem, 5vw, 2.5rem);
  background: var(--papier);
  border: 1px solid rgba(90, 38, 68, .08);
  border-radius: var(--rayon-carte);
  box-shadow:
    0 1px 2px rgba(67, 26, 50, .05),
    0 22px 50px -22px rgba(67, 26, 50, .32);
}

.pied {
  padding-top: 1.75rem;
  font-size: .8rem;
  color: var(--attenue);
  text-align: center;
}

.pied p {
  margin: 0;
}

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

.question {
  padding: 1.9rem 0;
  border-top: 1px dashed var(--trait-fort);
}

.question:first-of-type {
  padding-top: .25rem;
  border-top: 0;
}

.question__tete {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1.15rem;
}

.question__numero {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  font-family: var(--police-titre);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1;
  color: var(--prune);
  background: #fff8ee;
  border: 1.5px solid var(--or);
  border-radius: 50%;
}

.question__titre {
  margin: 0;
  padding-top: .3rem;   /* aligne la première ligne sur le numéro */
  font-family: var(--police-titre);
  font-size: clamp(1.25rem, 4.8vw, 1.5rem);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

.question__aide {
  margin: -.35rem 0 1rem;
  font-size: .95rem;
  color: var(--attenue);
}

/* --------------------------------------------------------------------------
   Champs de saisie
   -------------------------------------------------------------------------- */

.champ__label {
  display: block;
  margin-bottom: .45rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--prune);
}

.champ__saisie {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: .7rem 1rem;
  font: inherit;
  font-size: 1.0625rem;
  color: var(--encre);
  background: #fff;
  border: 1.5px solid var(--trait);
  border-radius: var(--rayon);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.champ__saisie::placeholder {
  color: #bba9b0;
  opacity: 1;
}

.champ__saisie:hover {
  border-color: var(--trait-fort);
}

.champ__saisie:focus {
  border-color: var(--prune);
  outline: none;
  box-shadow: var(--anneau);
}

.champ__saisie[aria-invalid="true"] {
  background: #fffafa;
  border-color: var(--erreur);
}

.montant {
  position: relative;
  max-width: 13rem;
}

.montant .champ__saisie {
  padding-right: 3rem;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.montant .champ__saisie::placeholder {
  font-weight: 400;
}

.montant__unite {
  position: absolute;
  top: 50%;
  right: 1.1rem;
  font-family: var(--police-titre);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--attenue);
  transform: translateY(-50%);
  pointer-events: none;
}

.erreur {
  margin: .6rem 0 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--erreur);
}

.alerte {
  margin: 0 0 1.5rem;
  padding: .9rem 1.1rem;
  font-weight: 600;
  color: #7a1a14;
  background: var(--erreur-fond);
  border: 1px solid #f3c4bf;
  border-radius: var(--rayon);
}

/* --------------------------------------------------------------------------
   Tableau des disponibilités
   -------------------------------------------------------------------------- */

.dispos {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
}

.dispos thead th {
  padding: 0 .25rem .65rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
  color: var(--attenue);
}

.dispos thead th:first-child {
  padding-left: 0;
  text-align: left;
}

.dispos__ligne {
  border-top: 1px solid var(--trait);
}

.dispos__date {
  padding: .7rem .75rem .7rem 0;
  font-weight: 600;
  text-align: left;
}

.dispos td {
  width: 5.75rem;
  padding: .4rem .25rem;
  text-align: center;
}

.dispos__ligne.est-en-erreur .dispos__date {
  color: var(--erreur);
}

/* Une réponse du tableau : bouton radio habillé en pastille. */
.choix {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.choix--oui { --teinte: var(--oui); --teinte-fond: var(--oui-fond); }
.choix--peut-etre { --teinte: var(--peut-etre); --teinte-fond: var(--peut-etre-fond); }
.choix--non { --teinte: var(--non); --teinte-fond: var(--non-fond); }

/* Le bouton radio natif reste présent (clavier, lecteurs d'écran), mais transparent. */
.choix input,
.option input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.choix__pastille {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--teinte);
  background: #fff;
  border: 1.5px solid var(--trait);
  border-radius: 999px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.choix__icone {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
}

.choix:hover .choix__pastille {
  background: var(--teinte-fond);
  border-color: var(--teinte);
}

.dispos__ligne.est-en-erreur .choix__pastille {
  border-color: var(--erreur-trait);
}

.choix input:checked + .choix__pastille {
  color: #fff;
  background: var(--teinte);
  border-color: var(--teinte);
  box-shadow: 0 8px 16px -8px var(--teinte);
}

.choix input:focus-visible + .choix__pastille,
.option input:focus-visible + .option__boite {
  outline: 3px solid rgba(90, 38, 68, .45);
  outline-offset: 2px;
}

.choix input:active + .choix__pastille {
  transform: scale(.94);
}

/* Grand écran : vrai tableau, le libellé de chaque pastille est porté par la colonne. */
@media (min-width: 40em) {
  .choix__texte {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .dispos__ligne:hover {
    background: rgba(247, 205, 187, .14);
  }
}

/* Petit écran : chaque date devient un bloc, avec ses trois réponses côte à côte. */
@media (max-width: 39.99em) {
  .dispos,
  .dispos tbody,
  .dispos td {
    display: block;
  }

  .dispos thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .dispos__ligne {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    padding: .95rem 0;
  }

  .dispos tbody .dispos__ligne:first-child {
    padding-top: .25rem;
    border-top: 0;
  }

  .dispos__date {
    display: block;
    grid-column: 1 / -1;
    padding: 0;
  }

  .dispos td {
    width: auto;
    padding: 0;
  }

  .choix {
    display: flex;
  }

  .choix__pastille {
    flex-direction: column;
    gap: .1rem;
    width: 100%;
    height: auto;
    min-height: 3.6rem;
    padding: .45rem .25rem;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 14px;
  }
}

/* --------------------------------------------------------------------------
   Choix unique (question sur les congés)
   -------------------------------------------------------------------------- */

.options {
  display: grid;
  gap: .6rem;
}

.option {
  position: relative;
  display: flex;
}

.option__boite {
  display: flex;
  flex: 1;
  align-items: center;
  gap: .7rem;
  min-height: 3.25rem;
  padding: .7rem .95rem;
  font-weight: 600;
  line-height: 1.3;
  background: #fff;
  border: 1.5px solid var(--trait);
  border-radius: var(--rayon);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.option__puce {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  background: #fff;
  border: 1.5px solid #cbb3a9;
  border-radius: 50%;
  transition: border-color .15s ease, border-width .15s ease;
}

.option:hover .option__boite {
  border-color: var(--trait-fort);
}

.options.est-en-erreur .option__boite {
  border-color: var(--erreur-trait);
}

.option input:checked + .option__boite {
  background: #fbf2f6;
  border-color: var(--prune);
  box-shadow: 0 0 0 1px var(--prune);
}

.option input:checked + .option__boite .option__puce {
  border-color: var(--prune);
  border-width: .42rem;
}

/* Grand écran : les trois réponses sur une ligne, chacune à la largeur de son texte. */
@media (min-width: 40em) {
  .options {
    grid-template-columns: repeat(3, auto);
  }
}

/* --------------------------------------------------------------------------
   Validation
   -------------------------------------------------------------------------- */

.actions {
  padding-top: 1.75rem;
  border-top: 1px dashed var(--trait-fort);
}

.bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  min-height: 3.6rem;
  padding: .9rem 1.5rem;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(180deg, #6c3053, var(--prune-fonce));
  border: 0;
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 16px 28px -14px rgba(67, 26, 50, .7);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}

.bouton__icone {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  transition: transform .2s ease;
}

.bouton:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.bouton:hover .bouton__icone {
  transform: translateX(3px);
}

.bouton:active {
  transform: translateY(1px);
}

.bouton:focus-visible {
  outline: 3px solid var(--or);
  outline-offset: 3px;
}

.bouton:disabled {
  cursor: progress;
  filter: none;
  opacity: .7;
  transform: none;
}

.actions__note {
  margin: 1rem 0 0;
  font-size: .85rem;
  color: var(--attenue);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Page de remerciement
   -------------------------------------------------------------------------- */

.merci {
  text-align: center;
}

.merci__sceau {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: .5rem auto 1.4rem;
  color: #fff;
  background: linear-gradient(180deg, #6c3053, var(--prune-fonce));
  border-radius: 50%;
  box-shadow:
    0 0 0 6px var(--papier),
    0 0 0 7.5px var(--or),
    0 18px 30px -14px rgba(67, 26, 50, .65);
}

.merci__sceau svg {
  width: 2.2rem;
  height: 2.2rem;
}

.merci__titre {
  margin: 0;
  font-family: var(--police-titre);
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.merci__texte {
  max-width: 26rem;
  margin: .6rem auto 0;
  color: var(--attenue);
}

.avertissement {
  margin: 1.25rem 0 0;
  padding: .9rem 1.1rem;
  font-weight: 600;
  color: #6b4406;
  text-align: left;
  background: var(--peut-etre-fond);
  border: 1px solid #efd9a8;
  border-radius: var(--rayon);
}

.recap {
  margin-top: 2rem;
  padding-top: 1.5rem;
  text-align: left;
  border-top: 1px dashed var(--trait-fort);
}

.recap__titre {
  margin: 0 0 .5rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--attenue);
}

.recap__liste {
  margin: 0;
}

.recap__ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 0;
  border-top: 1px solid var(--trait);
}

.recap__ligne:first-child {
  border-top: 0;
}

.recap__ligne dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.etiquette {
  display: inline-block;
  padding: .2rem .8rem;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 999px;
}

.etiquette--oui { color: var(--oui); background: var(--oui-fond); }
.etiquette--peut-etre { color: var(--peut-etre); background: var(--peut-etre-fond); }
.etiquette--non { color: var(--non); background: var(--non-fond); }

/* Petit écran : texte un peu plus serré pour garder chaque date sur une ligne. */
@media (max-width: 39.99em) {
  .recap__ligne {
    gap: .75rem;
    font-size: .9rem;
  }

  .etiquette {
    padding: .2rem .65rem;
    font-size: .8rem;
  }
}

.merci__suite {
  margin: 1.75rem 0 0;
  font-size: .95rem;
  color: var(--attenue);
}

.lien {
  font-weight: 600;
  color: var(--prune);
  text-underline-offset: .2em;
}

.lien:hover {
  color: var(--prune-fonce);
}

.lien:focus-visible {
  border-radius: 4px;
  outline: 3px solid rgba(90, 38, 68, .45);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Animations (désactivées si le système demande moins de mouvement)
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .entete__surtitre,
  .entete__titre,
  .entete__intro,
  .carte {
    animation: apparition .7s cubic-bezier(.2, .7, .2, 1) both;
  }

  .entete__titre { animation-delay: .06s; }
  .entete__intro { animation-delay: .12s; }
  .carte { animation-delay: .2s; }

  .confettis span {
    animation: chute .9s cubic-bezier(.2, .7, .2, 1) both;
  }

  .confettis span:nth-child(odd) { animation-delay: .15s; }
  .confettis span:nth-child(3n) { animation-delay: .3s; }
}

@keyframes apparition {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes chute {
  from {
    margin-top: -1.5rem;
    opacity: 0;
  }
}
