/* ==========================================================================
   Questionnaire d'accueil : s'appuie sur les couleurs, typographies et
   espacements de styles.css.
   ========================================================================== */

/* ---------- En-tête ---------- */

/* Progression : un simple trait coloré sous l'en-tête ; sur grand écran, une jauge avec
   le compte au centre de l'en-tête (colonne à part pour ne jamais chevaucher le nom) */
.q-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  display: flex;
  align-items: center;
  gap: 12px;
  translate: 0 50%;
}

.q-progress[hidden] {
  display: none;
}

.q-progress__count {
  display: none;
  min-width: 4.2em;
  font-family: var(--font-hand);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.q-progress__track {
  width: 100%;
  height: 5px;
  overflow: hidden;
}

@media (min-width: 1000px) {
  .q-page .site-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: var(--space-m);
  }

  .q-page .brand {
    justify-self: start;
  }

  .q-page .q-back {
    justify-self: end;
  }

  .q-progress {
    position: static;
    translate: none;
  }

  .q-progress__count {
    display: block;
  }

  .q-progress__track {
    width: 150px;
    height: 12px;
    border: var(--border);
    border-radius: 999px;
    background: var(--card);
  }
}

.q-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--sky-2), var(--pink), var(--butter));
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}

/* ---------- Introduction ---------- */

.q-intro {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--section-gap) / 2 + 60px) var(--gutter) var(--space-xl);
  text-align: center;
}

.q-intro__title {
  margin-bottom: var(--space-l);
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.05;
}

.q-intro__text {
  margin: 0 auto;
  max-width: 560px;
}

.q-intro__sticker {
  position: absolute;
  width: clamp(40px, 5vw, 60px);
  height: clamp(40px, 5vw, 60px);
}

.q-intro__sticker--heart {
  top: calc(var(--section-gap) / 2 + 40px);
  left: 2%;
  rotate: -12deg;
}

.q-intro__sticker--sparkle {
  top: calc(var(--section-gap) / 2 + 10px);
  right: 6%;
  rotate: 10deg;
}

.q-intro__sticker--leaf {
  bottom: var(--space-xl);
  right: 0;
  rotate: 18deg;
}

/* ---------- Formulaire ---------- */

.q-form {
  display: grid;
  gap: var(--space-m);
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--section-gap) / 2 + 80px);
}

.q-honeypot {
  position: absolute;
  left: -9999px;
}

.q-step {
  display: block;
  min-width: 0;
  margin: 0;
  padding: var(--space-l) clamp(20px, 4vw, 44px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-hard);
}

.js .q-step {
  opacity: 0;
  translate: 0 32px;
  transition: opacity 0.6s var(--ease), translate 0.7s var(--ease);
}

.js .q-step.is-visible {
  opacity: 1;
  translate: 0 0;
}

.q-step__title {
  display: flex;
  align-items: flex-start;
  gap: var(--space-s);
  float: left;
  width: 100%;
  padding: 0;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.q-step__title + * {
  clear: both;
}

/* Bloc et non grille : Safari ignore le flottement de la légende dans une grille
   et la pose sur le bord du cadre */
.q-step__title {
  margin-bottom: var(--space-m);
}

.q-step__title:has(+ .q-step__hint) {
  margin-bottom: calc(var(--space-m) - var(--space-s));
}

.q-step > :not(:first-child) {
  margin-top: var(--space-m);
}

.q-step > .q-step__title + * {
  margin-top: 0;
}

.q-step__num {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -5px;
  border: var(--border);
  border-radius: 50%;
  background: var(--tone, var(--pink));
  font-family: var(--font-hand);
  font-size: 1.15rem;
}

.q-step__num > * {
  grid-area: 1 / 1;
  transition: opacity 0.25s, scale 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.q-step__check {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  scale: 0.3;
}

.q-step.is-done .q-step__digit {
  opacity: 0;
  scale: 0.3;
}

.q-step.is-done .q-step__check {
  opacity: 1;
  scale: 1;
}

.q-step .q-step__hint {
  margin-left: calc(44px + var(--space-s));
}

.q-field {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.q-label {
  padding: 0;
  font-weight: 600;
}

.q-hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.92em;
}

.q-input {
  width: 100%;
  padding: 14px 18px;
  border: var(--border);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  transition: background 0.2s, box-shadow 0.2s var(--ease);
}

/* Un champ ciblé après une erreur ne passe pas sous la barre de navigation */
.q-input,
.q-choice input {
  scroll-margin-top: calc(var(--space-2xl) + var(--space-l));
}

.q-input:focus {
  outline: none;
  background: var(--card);
  box-shadow: 0 0 0 4px var(--sky-2);
}

.q-textarea {
  min-height: 110px;
  resize: vertical;
}

/* Réponses à choix : de grandes pastilles cliquables */
.q-choices {
  gap: 10px;
}

.q-choice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border: var(--border);
  border-radius: 16px;
  background: var(--paper);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s var(--ease);
}

.q-choice:hover {
  transform: translate(-1px, -1px);
}

.q-choice input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  border: var(--border);
  border-radius: 50%;
  background: var(--card);
  appearance: none;
  cursor: pointer;
}

.q-choice input:checked {
  background: radial-gradient(circle, var(--ink) 0 5px, var(--card) 6px);
}

.q-choice:has(input:checked) {
  background: var(--tone, var(--pink));
}

.q-choice:has(input:focus-visible) {
  box-shadow: 0 0 0 4px var(--sky-2);
}

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

.q-error {
  margin: 0;
  color: #b3261e;
  font-size: 0.92em;
  font-weight: 600;
}

.q-input[aria-invalid="true"],
.q-choices[data-invalid] .q-choice {
  border-color: #b3261e;
}

/* ---------- Envoi ---------- */

.q-submit {
  display: grid;
  justify-items: center;
  gap: var(--space-s);
  margin-top: var(--space-m);
  text-align: center;
}

.q-privacy {
  margin: 0;
  max-width: 460px;
  color: var(--ink-2);
  font-size: 0.92em;
}

.q-submit__btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.q-submit__btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.q-status {
  min-height: 1.6em;
  margin: 0;
  font-weight: 600;
}

.q-status[data-tone="error"] {
  color: #b3261e;
}

/* ---------- Remerciement ---------- */

/* Occupe l'écran pour que le pied de page ne remonte pas au milieu */
.q-thanks {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--space-m);
  max-width: 640px;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(var(--section-gap) / 2 + 60px) var(--gutter) calc(var(--section-gap) / 2 + 80px);
  text-align: center;
}

.q-intro[hidden],
.q-form[hidden],
.q-thanks[hidden] {
  display: none;
}

.q-thanks__sticker {
  width: 72px;
  height: 72px;
  rotate: -8deg;
}

.q-thanks__title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
}

@media (max-width: 600px) {
  .q-intro__sticker {
    display: none;
  }

  .q-step .q-step__hint {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .q-step {
    opacity: 1;
    translate: 0 0;
  }
}
