@font-face { font-family: 'Atkinson'; src: url('polices/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url('polices/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('polices/fraunces-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('polices/fraunces-latin-600-italic.woff2') format('woff2'); font-weight: 600; font-style: italic; font-display: swap; }

:root {
  /* Charte de la Guilde des Traceurs */
  --parchemin: #FAF5EA;
  --papier: #FFFDF8;
  --encre: #1B4B54;
  --encre-douce: #4A6A70;
  --encre-pale: #5C777B;
  --braise: #C0552F;
  --braise-fonce: #A2441F;
  --vert: #57806A;
  --trait: #E3DACA;
  --trait-fort: #CFC3AE;
  --choisi: #EAF0EE;
  --erreur: #B23A1E;
  --rayon: 14px;
  --ombre: 0 1px 0 rgba(27, 75, 84, .04), 0 6px 20px rgba(27, 75, 84, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--parchemin); color: var(--encre);
  font: 400 17px/1.55 'Atkinson', system-ui, sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--encre); }
:focus-visible { outline: 3px solid rgba(192, 85, 47, .45); outline-offset: 2px; }

/* En-tête et progression */
.entete {
  position: sticky; top: 0; z-index: 5; background: rgba(250, 245, 234, .94);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--trait);
}
.entete-int { max-width: 760px; margin: 0 auto; padding: 12px 20px 10px; }
.marque { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--encre-douce); }
.marque strong { color: var(--encre); font-weight: 700; }
.barre { height: 5px; border-radius: 99px; background: var(--trait); margin-top: 9px; overflow: hidden; }
.barre span { display: block; height: 100%; width: 0; background: var(--vert); border-radius: 99px; transition: width .4s ease; }

main { max-width: 760px; margin: 0 auto; padding: 28px 20px 140px; }

h1, h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(30px, 6vw, 44px); }
h1 em { font-style: italic; color: var(--braise); }
h2 { font-size: clamp(26px, 5vw, 34px); }
.surtitre { font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--vert); margin-bottom: 8px; }
.intro-section { color: var(--encre-douce); margin: 10px 0 0; }

/* Accueil */
.accueil p { margin: 16px 0 0; }
.accueil .lettre { font-size: 18px; }
.repere { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--encre-douce); font-size: 15px; }
.repere li::before { content: '·'; margin-right: 8px; color: var(--braise); font-weight: 700; }
.repere li:first-child::before { content: none; }
.note { font-size: 14px; color: var(--encre-douce); margin-top: 26px; }
.reprise { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 16px; margin-top: 22px; }

/* Questions */
.question { scroll-margin-top: 84px; background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 20px 20px 18px; margin-top: 18px; box-shadow: var(--ombre); }
.question.en-erreur { border-color: var(--erreur); }
.q-titre { font-weight: 700; font-size: 18px; line-height: 1.4; margin: 0; }
.q-titre .fac { font-weight: 400; color: var(--encre-pale); font-size: 15px; white-space: nowrap; }
.q-aide { color: var(--encre-douce); font-size: 15px; margin: 5px 0 0; }
.q-erreur { color: var(--erreur); font-size: 15px; font-weight: 700; margin: 12px 0 0; }
.options { display: grid; gap: 8px; margin-top: 14px; }

.option {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1.5px solid var(--trait); border-radius: 11px; background: #fff; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.option:hover { border-color: var(--trait-fort); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .coche {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 1px; border: 2px solid var(--trait-fort); background: #fff;
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.option.radio .coche { border-radius: 50%; }
.option.case .coche { border-radius: 6px; }
.option .coche::after { content: ''; opacity: 0; transition: opacity .15s; }
.option.radio .coche::after { width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.option.case .coche::after { width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.option.choisie { background: var(--choisi); border-color: var(--encre); }
.option.choisie .coche { background: var(--encre); border-color: var(--encre); }
.option.choisie .coche::after { opacity: 1; }
.option.bloquee { opacity: .45; cursor: not-allowed; }
.option input:focus-visible + .coche { outline: 3px solid rgba(192, 85, 47, .45); outline-offset: 2px; }
.champ-autre { margin: 2px 0 0 48px; }

input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; border: 1.5px solid var(--trait-fort); border-radius: 10px; background: #fff; padding: 11px 13px;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, textarea:focus { outline: none; border-color: var(--encre); box-shadow: 0 0 0 3px rgba(27, 75, 84, .12); }
textarea { min-height: 120px; resize: vertical; margin-top: 14px; line-height: 1.5; }
.q-email input { margin-top: 14px; }

/* Échelle 1 à 5 */
.echelle { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.echelle button, .pastilles button {
  border: 1.5px solid var(--trait); background: #fff; border-radius: 10px; padding: 11px 6px; cursor: pointer; font-weight: 700;
  transition: background .15s, border-color .15s, color .15s;
}
.echelle button:hover, .pastilles button:hover { border-color: var(--trait-fort); }
.echelle button[aria-pressed=true], .pastilles button[aria-pressed=true] { background: var(--encre); border-color: var(--encre); color: #fff; }
.echelle-bornes { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--encre-douce); margin-top: 6px; }

/* Grille : une ligne = une affirmation + des pastilles */
.grille { margin-top: 10px; }
.ligne { padding: 14px 0; border-top: 1px solid var(--trait); }
.ligne:first-child { border-top: 0; }
.ligne-titre { margin: 0 0 9px; font-size: 16px; }
.pastilles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pastilles button { font-weight: 400; font-size: 14px; line-height: 1.25; padding: 9px 4px; }
.ligne.manque .ligne-titre { color: var(--erreur); font-weight: 700; }

/* Navigation */
.navigation {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: rgba(250, 245, 234, .96);
  backdrop-filter: blur(6px); border-top: 1px solid var(--trait);
}
.navigation-int { max-width: 760px; margin: 0 auto; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; }
.bouton {
  border: 0; border-radius: 12px; padding: 14px 22px; font-weight: 700; font-size: 17px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.bouton:active { transform: translateY(1px); }
.bouton-principal { background: var(--braise); color: #fff; margin-left: auto; min-width: 160px; }
.bouton-principal:hover { background: var(--braise-fonce); }
.bouton-principal[disabled] { opacity: .6; cursor: wait; }
.bouton-retour { background: transparent; color: var(--encre-douce); padding-left: 6px; padding-right: 10px; }
.bouton-retour:hover { color: var(--encre); }
.accueil-action { margin-top: 30px; }
.accueil-action .bouton-principal { margin-left: 0; }

/* Fin */
.merci { text-align: center; padding-top: 24px; }
.merci img { width: 170px; height: auto; display: block; margin: 0 auto 18px; }
.merci p { max-width: 520px; margin: 14px auto 0; }
.echec { background: #FBEDE7; border: 1px solid #E9C2B3; color: var(--erreur); border-radius: var(--rayon); padding: 14px 16px; margin-top: 18px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  main { padding: 22px 16px 130px; }
  .entete-int, .navigation-int { padding-left: 16px; padding-right: 16px; }
  .question { padding: 17px 15px 15px; }
  .pastilles { grid-template-columns: repeat(2, 1fr); }
  .champ-autre { margin-left: 0; }
  .bouton-principal { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
