:root {
  --bg: #faf8f4;
  --papier: #ffffff;
  --encre: #3a322c;
  --doux: #8b7f74;
  --taupe: #8a7c70;
  --trait: #e5ded3;
  --sable: #efe8dc;
  --argile: #e3d3c1;
  --rose: #ebdad0;
  --pierre: #e4e0d6;
  --moka: #7a6350;
  --ok: #5f7a5c;
  --ko: #a2564a;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--encre);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--moka); }

:focus-visible { outline: 2px solid var(--moka); outline-offset: 3px; }

/* En-tête */
.bandeau {
  background: var(--taupe);
  color: #fff;
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 7px 16px;
}

.entete {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.nav { display: flex; gap: 30px; }
.nav.droite { justify-content: flex-end; }

.nav a {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
}
.nav a.actif { border-bottom-color: var(--taupe); color: var(--moka); }

.marque { text-align: center; line-height: 1; }
.marque .nom {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 38px;
  letter-spacing: -0.01em;
  display: block;
}
.marque .nom i { font-style: italic; font-weight: 300; }
.marque .sous {
  display: block;
  margin-top: 8px;
  font-size: 9.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--doux);
  font-weight: 400;
}

main:focus { outline: none; }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  min-height: 60vh;
}

/* Titres */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.12;
  margin: 0;
}
h1 { font-size: clamp(36px, 6vw, 62px); font-weight: 300; }
h2 { font-size: clamp(26px, 3.4vw, 36px); }
h3 { font-size: 24px; }

.etiquette {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--doux);
}

.filet { width: 56px; height: 1px; background: var(--taupe); margin: 22px 0; border: 0; }

/* Boutons */
.bouton {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 15px 26px;
  border: 1px solid var(--encre);
  background: var(--encre);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.bouton:hover { background: var(--moka); border-color: var(--moka); color: #fff; }
.bouton.clair { background: transparent; color: var(--encre); }
.bouton.clair:hover { background: var(--encre); color: #fff; }
.bouton[disabled] { opacity: 0.35; cursor: default; pointer-events: none; }

.retour {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--doux);
  display: block;
  margin-bottom: 22px;
}

/* Accueil */
.accueil {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: center;
  padding: 36px 0 24px;
}
.accueil p.chapeau { font-size: 19px; color: #5a4f46; max-width: 34em; margin: 0 0 30px; }
.accueil .actions { display: flex; flex-wrap: wrap; gap: 14px; }

.planche {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.planche { align-items: start; }
.planche div {
  padding: 26px 22px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.planche div:nth-child(1) { background: var(--sable); min-height: 190px; }
.planche div:nth-child(2) { background: var(--argile); min-height: 150px; margin-top: 40px; }
.planche div:nth-child(3) { background: var(--rose); min-height: 150px; }
.planche div:nth-child(4) { background: var(--pierre); min-height: 190px; margin-top: -10px; }
.planche .num { font-family: var(--serif); font-size: 40px; font-weight: 300; line-height: 1; }
.planche .lib { font-size: 13px; letter-spacing: 0.04em; }

.bloc-bac {
  margin-top: 64px;
  border-top: 1px solid var(--trait);
  padding-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  flex-wrap: wrap;
}
.bloc-bac p { margin: 12px 0 0; max-width: 34em; color: #5a4f46; }

/* Parcours */
.tete-page { margin-bottom: 40px; max-width: 40em; }
.tete-page p { margin: 18px 0 0; color: #5a4f46; }

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
}

.chap {
  background: var(--papier);
  border: 1px solid var(--trait);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}
.chap:hover { border-color: var(--taupe); transform: translateY(-2px); }
.chap .haut { padding: 22px 22px 16px; min-height: 92px; }
.chap .haut .n { font-family: var(--serif); font-size: 46px; font-weight: 300; line-height: 1; }
.chap .corps { padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 18px; flex: 1; justify-content: space-between; }
.chap .corps h3 { font-size: 22px; line-height: 1.2; }
.chap .barres { display: flex; gap: 5px; }
.chap .barres span { flex: 1; height: 3px; background: var(--trait); }
.chap .barres span.fait { background: var(--moka); }
.chap .pied { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--doux); }

.t0 .haut { background: var(--sable); }
.t1 .haut { background: var(--argile); }
.t2 .haut { background: var(--rose); }
.t3 .haut { background: var(--pierre); }

/* Page chapitre */
.etapes { margin-top: 40px; border-top: 1px solid var(--trait); }
.etape {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--trait);
}
.etape .num { font-family: var(--serif); font-size: 34px; font-weight: 300; color: var(--taupe); line-height: 1; }
.etape h3 { font-size: 26px; }
.etape p { margin: 4px 0 0; color: var(--doux); font-size: 15px; }
.etape .etat { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ok); margin-top: 6px; display: block; }

/* Cours */
.lecture { max-width: 40em; }
.lecture p { font-size: 18px; margin: 0 0 20px; }
.notions { margin: 34px 0; padding: 24px 26px; background: var(--sable); }
.notions .etiquette { margin-bottom: 10px; }
.notions p { margin: 0; font-size: 16px; }
.navchap { display: flex; justify-content: space-between; gap: 16px; margin-top: 44px; flex-wrap: wrap; }

/* Listes (cours, cartes) */
.liste { border-top: 1px solid var(--trait); }
.liste a {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 18px 4px;
  border-bottom: 1px solid var(--trait);
}
.liste a:hover { background: var(--sable); }
.liste .n { font-family: var(--serif); font-size: 28px; font-weight: 300; color: var(--taupe); }
.liste .t { font-family: var(--serif); font-size: 22px; line-height: 1.25; }
.liste .m { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--doux); white-space: nowrap; }

/* Cartes */
.zone-carte { max-width: 640px; margin: 8px auto 0; }
.carte {
  perspective: 1400px;
  height: 340px;
  cursor: pointer;
  outline-offset: 6px;
}
.carte .face {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1);
  transform-style: preserve-3d;
}
.carte.retournee .face { transform: rotateY(180deg); }
.carte .cote {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 40px;
  border: 1px solid var(--trait);
}
.carte .recto { background: var(--papier); }
.carte .verso { background: var(--sable); transform: rotateY(180deg); }
.carte .cote .etiquette { position: absolute; top: 18px; left: 0; right: 0; }
.carte .texte { font-family: var(--serif); font-size: clamp(24px, 3.6vw, 32px); line-height: 1.25; font-weight: 400; }
.carte .aide { position: absolute; bottom: 16px; left: 0; right: 0; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--doux); }

.compteur { text-align: center; margin: 26px 0 16px; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--doux); }
.commandes { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.avancee { height: 2px; background: var(--trait); margin-top: 22px; }
.avancee span { display: block; height: 100%; background: var(--moka); transition: width 0.3s; }

/* Quiz */
.quiz { max-width: 680px; margin: 0 auto; }
.quiz .q { font-family: var(--serif); font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 14px 0 28px; }
.reponses { display: grid; gap: 12px; }
.rep {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: baseline;
  text-align: left;
  font: inherit;
  font-size: 17px;
  color: var(--encre);
  background: var(--papier);
  border: 1px solid var(--trait);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.rep:hover { border-color: var(--taupe); }
.rep .lettre { font-family: var(--serif); font-size: 22px; color: var(--taupe); }
.rep.bonne { border-color: var(--ok); background: #eef3ec; }
.rep.fausse { border-color: var(--ko); background: #f6e9e6; }
.rep[disabled] { cursor: default; }
.retour-q { min-height: 30px; margin: 20px 0 6px; font-size: 16px; }
.retour-q.ok { color: var(--ok); }
.retour-q.ko { color: var(--ko); }
.score { font-family: var(--serif); font-size: clamp(54px, 10vw, 96px); font-weight: 300; line-height: 1; margin: 10px 0 6px; }
.ratees { margin: 30px 0; border-top: 1px solid var(--trait); }
.ratees div { padding: 14px 0; border-bottom: 1px solid var(--trait); }
.ratees b { font-weight: 400; display: block; }
.ratees span { color: var(--doux); font-size: 15px; }

/* Association */
.assoc { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; max-width: 860px; margin: 0 auto; }
.assoc .col { display: grid; gap: 12px; align-content: start; }
.tuile {
  font: inherit;
  font-size: 16px;
  text-align: left;
  padding: 16px 18px;
  background: var(--papier);
  border: 1px solid var(--trait);
  color: var(--encre);
  cursor: pointer;
  min-height: 64px;
  transition: border-color 0.15s, background 0.15s, opacity 0.2s;
}
.tuile.notion { font-family: var(--serif); font-size: 22px; line-height: 1.15; }
.tuile:hover { border-color: var(--taupe); }
.tuile.choisie { border-color: var(--moka); background: var(--sable); }
.tuile.trouvee { border-color: var(--ok); background: #eef3ec; opacity: 0.75; pointer-events: none; }
.tuile.erreur { animation: secoue 0.35s; border-color: var(--ko); }
@keyframes secoue { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.fin-jeu { text-align: center; margin-top: 36px; }

/* Méthodologie */
.methodo { max-width: 46em; }
.methodo section { margin-top: 54px; padding-top: 34px; border-top: 1px solid var(--trait); }
.methodo .rom { font-family: var(--serif); font-size: 18px; color: var(--taupe); display: block; margin-bottom: 6px; }
.methodo ul, .methodo ol { padding-left: 1.2em; }
.methodo li { margin: 6px 0; }
.methodo ol { counter-reset: e; list-style: none; padding: 0; margin: 22px 0; }
.methodo ol li { counter-increment: e; display: grid; grid-template-columns: 52px 1fr; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--trait); }
.methodo ol li::before { content: counter(e); font-family: var(--serif); font-size: 28px; color: var(--taupe); }
.exemple { background: var(--sable); padding: 26px 28px; margin: 28px 0 0; }
.exemple .quest { font-family: var(--serif); font-size: 22px; line-height: 1.25; margin: 8px 0 14px; }
.exemple p { margin: 0 0 10px; font-size: 16px; white-space: pre-line; }

/* Pied */
.pied-site {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  border-top: 1px solid var(--trait);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--doux);
}

/* Mobile */
@media (max-width: 820px) {
  body { font-size: 16px; }
  .entete { grid-template-columns: 1fr; gap: 16px; padding: 20px 18px 14px; justify-items: center; }
  .marque { order: -1; }
  .marque .nom { font-size: 32px; }
  .nav { gap: 18px; flex-wrap: wrap; justify-content: center; }
  .nav.droite { justify-content: center; }
  main { padding: 14px 18px 60px; }
  .accueil { grid-template-columns: 1fr; gap: 36px; }
  .carte { height: 300px; }
  .carte .cote { padding: 30px 24px; }
  .assoc { grid-template-columns: 1fr; }
  .etape { grid-template-columns: 40px 1fr; }
  .etape .action { grid-column: 2; }
  .liste a { grid-template-columns: 44px 1fr; }
  .liste .m { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
