/* Moteur du questionnaire : un écran à la fois, transitions entre styles.
   Chaque écran (s00.css …) définit son propre univers dans .slide[data-screen="NN"]. */

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; overflow: hidden;
  background: var(--bg, #e6e7e9);
  color: var(--fg, #111);
  font-family: "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, sans-serif;
  line-height: 1.4;
  transition: background-color .7s cubic-bezier(.4,0,.2,1), color .7s;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus, #1f2bff); outline-offset: 3px; }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; color: #111; padding: .5rem; z-index: 50; }
.noscript { padding: 2rem; text-align: center; }

/* Scène : les slides s'empilent, une seule active */
.stage { position: fixed; inset: 0; width: 100%; height: 100dvh; }
.slide {
  position: absolute; inset: 0; overflow: hidden auto;
  display: flex; flex-direction: column;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(24px) scale(.985);
  transition: opacity .55s cubic-bezier(.4,0,.2,1), transform .55s cubic-bezier(.4,0,.2,1), visibility 0s .55s;
}
.slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }
.slide.is-leaving { opacity: 0; transform: translateY(-18px) scale(.985); }
.slide.dir-back.is-active { transform: none; }
.slide.dir-back.is-leaving { transform: translateY(24px) scale(.985); }

/* Contenu centré, largeur mobile-first */
.slide > .wrap { width: 100%; max-width: 30rem; margin: auto; display: flex; flex-direction: column; gap: 1.25rem; }

/* Barre d'avancement : style par défaut, chaque écran la rhabille (.slide[data-screen="NN"] .q-progress).
   --progress (0 → 1) est posé par le moteur sur la section ; la largeur s'anime depuis l'écran précédent. */
.q-progress {
  position: sticky; top: 0; z-index: 30; flex: none;
  height: .3rem; margin: calc(-1 * max(1rem, env(safe-area-inset-top))) -1rem 1rem;
  background: rgb(0 0 0 / .08); overflow: hidden;
}
.q-progress i { display: block; height: 100%; width: calc(var(--progress, 0) * 100%); background: currentColor; transition: width .7s cubic-bezier(.4,0,.2,1); }
.q-progress b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Bouton retour discret, au-dessus de tout */
.q-back {
  /* Sous la barre d'avancement (qui occupe le bord haut), pour ne jamais la chevaucher */
  position: fixed; top: calc(max(.75rem, env(safe-area-inset-top)) + 1.1rem); left: .6rem; z-index: 40;
  width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: transparent; color: var(--fg, #111);
  opacity: .55; transition: opacity .2s, background .2s;
}
.q-back[hidden] { display: none; }
.q-back:hover { opacity: 1; background: rgb(0 0 0 / .06); }

/* Motif commun : un choix qui « rebondit » au toucher (chaque écran rhabille l'aspect) */
.tap { transition: transform .18s cubic-bezier(.34,1.56,.64,1); -webkit-tap-highlight-color: transparent; }
.tap:active { transform: scale(.96); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
}
