/* =========================================================
   La Marche vers l'Autonomisation — style « temple »
   ========================================================= */
:root {
  --red: #B5322B;
  --red-deep: #8E2A24;
  --gold: #C9992E;
  --gold-soft: #E8C877;
  --ink: #1D1D1D;
  --ink-2: #2A2522;
  --paper: #F3E9D2;
  --paper-2: #EADBB8;
  --cream: #FBF6EA;
  --navy: #1B3A6B;
  --text: #2B2622;
  --muted: #6B6158;
  --line: #D9C9A5;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(29, 29, 29, .14);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --brush: "Ma Shan Zheng", "KaiTi", "STKaiti", serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; font-family: var(--sans); color: var(--text); background: var(--cream); line-height: 1.6; font-size: 17px; overflow-x: hidden; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: inherit; }
.twrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Boutons ---------- */
.tbtn { display: inline-flex; align-items: center; justify-content: center; padding: 13px 24px; border-radius: 6px; font-weight: 600; font-family: var(--sans); font-size: 1rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .2s, background .2s; }
.tbtn:hover { transform: translateY(-2px); }
.tbtn--red { background: var(--red); color: #fff; border-color: var(--red); }
.tbtn--red:hover { background: var(--red-deep); }
.tbtn--ghost { border-color: var(--gold-soft); color: var(--gold-soft); background: transparent; }
.tbtn--ghost-dark { border-color: var(--line); color: var(--text); background: transparent; }
.tbtn--full { width: 100%; }
.tbtn:disabled { opacity: .4; cursor: default; transform: none; }
.tlink { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; margin-top: 18px; }

/* ---------- Navigation ---------- */
.tnav { position: sticky; top: 0; z-index: 40; background: rgba(29,29,29,.96); backdrop-filter: blur(6px); border-bottom: 2px solid var(--red); }
.tnav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.tbrand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.tbrand img { width: 44px; height: 44px; object-fit: contain; }
.tbrand span { display: flex; flex-direction: column; line-height: 1.05; }
.tbrand strong { font-family: var(--serif); }
.tbrand small { font-size: .75rem; opacity: .8; }
.tnav__links { display: flex; gap: 20px; align-items: center; }
.tnav__links a { color: #EDE3CF; text-decoration: none; font-size: .92rem; font-weight: 500; }
.tnav__links a:hover { color: var(--gold-soft); }
.tnav__back { color: var(--gold-soft) !important; }

/* ---------- Portique ---------- */
.gate { background: radial-gradient(ellipse at 50% 0%, #3A2A20 0%, var(--ink) 65%); color: #EDE3CF; padding: 40px 0 90px; text-align: center; overflow: hidden; }
.gate__svg { width: min(760px, 100%); margin: 0 auto -40px; display: block; }
.gate__text { position: relative; }
.gate h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); color: #fff; font-weight: 800; }
.gate__lead { max-width: 720px; margin: 0 auto 30px; font-size: 1.15rem; color: #D7CBB4; }
.gate__lead strong { color: var(--gold-soft); }
.gate__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.teyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; font-weight: 700; color: var(--red); margin-bottom: 12px; }
.gate .teyebrow, .teyebrow--gold { color: var(--gold-soft); }

/* ---------- Sections ---------- */
.tsection { padding: clamp(64px, 9vw, 110px) 0; }
.tsection--ink { background: var(--ink); color: #EDE3CF; background-image: radial-gradient(circle at 20% 0%, rgba(181,50,43,.18), transparent 50%); }
.tsection--paper { background: var(--paper); }
.th2 { font-size: clamp(1.7rem, 4vw, 2.7rem); color: var(--ink); max-width: 860px; margin-bottom: 28px; }
.th2--light { color: #fff; }
.tlead { color: var(--muted); max-width: 760px; margin-bottom: 30px; }

/* ---------- Principes ---------- */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.principle { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.principle h3 { color: var(--ink); }
.principle p { color: var(--muted); margin: 0; }
.seal { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 8px; background: var(--red); color: #fff; font-family: var(--brush); font-size: 2rem; margin-bottom: 16px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }

/* ---------- Temple ---------- */
.temple { display: grid; grid-template-columns: 360px 1fr; gap: 40px; align-items: start; }
.pagoda { position: sticky; top: 84px; }
.pagoda svg { width: 100%; height: auto; display: block; }
.tier { cursor: pointer; outline: none; }
.tier .roof { fill: var(--red-deep); transition: fill .2s; }
.tier .wall { fill: #3A2F28; stroke: var(--gold); stroke-width: 1; transition: fill .2s; }
.tier .label { fill: var(--gold-soft); font-family: var(--sans); font-weight: 700; font-size: 11px; letter-spacing: .08em; }
.tier .glyph { fill: #fff; font-family: var(--brush); font-size: 20px; }
.tier:hover .roof, .tier:focus-visible .roof { fill: var(--red); }
.tier.is-active .roof { fill: var(--gold); }
.tier.is-active .wall { fill: var(--red); }
.tier.is-done .wall { stroke: #8FD18B; stroke-width: 2; }
.crown text { font-family: var(--brush); }

.hall { background: var(--paper); color: var(--text); border-radius: var(--radius); padding: clamp(22px, 3.5vw, 36px); box-shadow: 0 20px 60px rgba(0,0,0,.4); min-height: 600px; animation: fade .4s ease; background-image: linear-gradient(rgba(255,255,255,.25), rgba(255,255,255,0)); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
.hall__head { display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.hall__seal { flex-shrink: 0; width: 84px; height: 84px; border-radius: 10px; background: var(--red); color: #fff; display: grid; place-items: center; font-family: var(--brush); font-size: 3rem; box-shadow: inset 0 0 0 4px rgba(255,255,255,.2); }
.hall__rank { font-weight: 700; color: var(--red); letter-spacing: .12em; font-size: .85rem; }
.hall h3 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--ink); margin: 2px 0 0; }
.hall__theme { color: var(--muted); font-style: italic; margin: 0; }
.hall__desc { margin-bottom: 22px; }
.livrets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 22px; }
.livret { position: relative; text-align: left; border: 0; cursor: pointer; font: inherit; color: var(--text); background: #FFF9EC; border-radius: 6px 12px 12px 6px; padding: 18px 18px 18px 26px; box-shadow: 0 4px 14px rgba(0,0,0,.08), inset 6px 0 0 var(--red); transition: transform .2s, box-shadow .2s; }
.livret:hover { transform: translateY(-3px) rotate(-.3deg); box-shadow: 0 10px 24px rgba(0,0,0,.14), inset 6px 0 0 var(--red); }
.livret__num { font-size: .75rem; font-weight: 700; color: var(--red); letter-spacing: .1em; text-transform: uppercase; }
.livret__title { display: block; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; color: var(--ink); margin: 4px 0; }
.livret__intro { display: block; font-size: .88rem; color: var(--muted); }
.livret-wrap { position: relative; display: flex; flex-direction: column; }
.livret-wrap .livret { flex: 1; padding-bottom: 40px; }
.livret__dl { position: absolute; left: 26px; bottom: 12px; display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--red-deep); text-decoration: none; border: 1px solid var(--line); background: #fff; padding: 3px 9px; border-radius: 99px; }
.livret__dl:hover { background: var(--red); color: #fff; border-color: var(--red); }
.book__dl { margin-top: 14px; font-size: .9rem; padding: 9px 16px; gap: 4px; }
.manual-dl { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 28px; background: var(--ink); color: #EDE3CF; border-radius: var(--radius); padding: 22px 26px; }
.manual-dl img { width: 64px; height: 64px; }
.manual-dl strong { color: #fff; font-family: var(--serif); font-size: 1.2rem; display: block; }
.manual-dl p { margin: 0; color: #CDBFA7; font-size: .93rem; }
.manual-dl > div { display: flex; gap: 16px; align-items: center; flex: 1; min-width: 240px; }
.livret__done { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: .8rem; font-family: var(--brush); }
.trial { border: 2px dashed var(--gold); border-radius: 12px; padding: 16px 18px; background: rgba(201,153,46,.08); }
.trial b { display: block; color: var(--red-deep); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }
.trial p { margin: 0; }
.ae { text-align: center; }
.ae .hall__seal { width: 120px; height: 120px; font-size: 3.2rem; background: var(--gold); color: var(--ink); margin: 0 auto 18px; }

/* ---------- Pacte ---------- */
.pact { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
.scroll { filter: drop-shadow(0 16px 30px rgba(0,0,0,.18)); padding: 0 24px; }
.scroll__rod { height: 22px; background: linear-gradient(180deg, #6E3B1F, #3A1F10 60%, #6E3B1F); border-radius: 11px; margin: 0 -10px; position: relative; }
.scroll__rod::before, .scroll__rod::after { content: ""; position: absolute; top: -4px; width: 18px; height: 30px; border-radius: 6px; background: var(--gold); }
.scroll__rod::before { left: -14px; } .scroll__rod::after { right: -14px; }
.scroll__paper { background: var(--paper); background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(139,101,48,.07) 31px 32px); padding: 34px clamp(20px, 4vw, 44px); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.scroll__title { text-align: center; color: var(--red-deep); font-size: 1.7rem; margin-bottom: 2px; }
.scroll__sub { text-align: center; color: var(--muted); font-style: italic; margin-bottom: 22px; }
.articles { padding-left: 22px; margin: 0 0 18px; }
.articles li { margin-bottom: 12px; }
.articles li::marker { color: var(--red); font-weight: 700; font-family: var(--serif); }
.scroll__note { font-size: .92rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin: 0; }
.pact__side h3 { color: var(--ink); }
.pact__side > p { color: var(--muted); }
.sanctions { list-style: none; padding: 0; margin: 0 0 30px; }
.sanctions li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sanctions li > span { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--red); font-size: .9rem; }
.sanctions li:nth-child(1) > span { background: #C9A36A; } .sanctions li:nth-child(2) > span { background: #C9863A; }
.sanctions li:nth-child(3) > span { background: #B8622F; } .sanctions li:nth-child(4) > span { background: #A2402B; }
.sanctions li:nth-child(5) > span { background: var(--ink); }
.sanctions strong { display: block; color: var(--ink); }
.sanctions div { font-size: .93rem; color: var(--muted); }
.sign { background: var(--ink); color: #EDE3CF; border-radius: var(--radius); padding: 26px; }
.sign h3 { color: #fff; }
.sign label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 12px; }
.sign input:not([type=checkbox]) { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; border-radius: 8px; border: 1px solid #4A423B; background: #2A2522; color: #fff; font: inherit; }
.sign input:focus { outline: 2px solid var(--gold); }
.sign__check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 500 !important; }
.sign__check input { margin-top: 4px; accent-color: var(--red); }
.sign__hint { font-size: .8rem; color: #A99F8E; margin: 10px 0 0; text-align: center; }

/* ---------- Carnet ---------- */
.carnet { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cell { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; font: inherit; color: var(--text); transition: transform .2s; }
.cell:hover { transform: translateY(-3px); }
.cell__glyph { font-family: var(--brush); font-size: 2rem; color: var(--red); line-height: 1; }
.cell__rank { font-weight: 700; font-size: .85rem; margin: 6px 0 8px; }
.cell__bar { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.cell__bar i { display: block; height: 100%; background: var(--red); border-radius: 99px; transition: width .6s; }
.cell__count { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.cell.is-done { background: var(--red); border-color: var(--red); color: #fff; }
.cell.is-done .cell__glyph { color: var(--gold-soft); }
.cell.is-done .cell__count { color: #F5D9D5; }
.cell.is-done .cell__bar { background: rgba(255,255,255,.3); }
.cell.is-done .cell__bar i { background: var(--gold-soft); }
.carnet__rank { grid-column: 1 / -1; background: var(--ink); color: #fff; border-radius: 12px; padding: 18px 22px; display: flex; align-items: center; gap: 16px; }
.carnet__rank .seal { margin: 0; flex-shrink: 0; }
.carnet__rank p { margin: 0; color: #D7CBB4; font-size: .93rem; }
.carnet__rank strong { color: var(--gold-soft); font-family: var(--serif); font-size: 1.2rem; display: block; }

/* ---------- Lecteur ---------- */
.reader { position: fixed; inset: 0; z-index: 100; background: rgba(15, 10, 8, .88); display: flex; align-items: center; justify-content: center; padding: 16px; }
.reader[hidden] { display: none; }
.book { position: relative; width: min(1040px, 100%); max-height: calc(100vh - 32px); display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; animation: fade .3s; }
.book::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 30px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, rgba(0,0,0,.12), transparent); pointer-events: none; }
.book__close { position: absolute; top: 8px; right: 12px; z-index: 2; background: none; border: 0; font-size: 2rem; cursor: pointer; color: var(--muted); line-height: 1; }
.book__page { padding: 28px; overflow-y: auto; }
.book__page--img { background: var(--paper-2); display: flex; align-items: center; justify-content: center; padding: 22px; }
.book__page--img img { width: 100%; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.18); aspect-ratio: 4 / 3; object-fit: cover; }
.ink { width: 100%; aspect-ratio: 4 / 3; border-radius: 4px; border: 2px solid var(--line); background: radial-gradient(circle at 30% 30%, #FFF7E3, var(--paper) 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); }
.ink__glyph { font-family: var(--brush); font-size: clamp(4rem, 12vw, 7rem); color: var(--red); opacity: .85; line-height: 1; }
.ink__step { font-family: var(--serif); font-weight: 700; color: var(--ink); margin-top: 8px; }
.ink small { font-size: .78rem; margin-top: 6px; }
.book__page--text { display: flex; flex-direction: column; }
.book__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-right: 30px; }
.book__rank { background: var(--red); color: #fff; font-weight: 700; font-size: .78rem; letter-spacing: .1em; padding: 4px 10px; border-radius: 4px; }
.book__count { color: var(--muted); font-size: .85rem; }
#bookBody { flex: 1; }
#bookBody h2 { font-size: clamp(1.5rem, 3vw, 2rem); color: var(--ink); }
#bookBody .book__step { color: var(--red); font-weight: 700; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
#bookBody ul { padding-left: 20px; }
.book__nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.master { display: flex; gap: 10px; align-items: center; margin-top: 18px; font-weight: 600; cursor: pointer; }
.master input { width: 20px; height: 20px; accent-color: var(--red); }

/* ---------- Pied ---------- */
.tfoot { background: var(--ink); color: #A99F8E; padding: 28px 0; font-size: .9rem; text-align: center; }
.tfoot strong { color: #fff; }

/* ---------- Pacte imprimable ---------- */
.print-pact { display: none; }
@media print {
  body > *:not(.print-pact) { display: none !important; }
  .print-pact { display: block !important; font-family: Georgia, serif; color: #000; padding: 20mm; }
  .print-pact h1 { text-align: center; font-size: 22pt; margin-bottom: 4pt; }
  .print-pact .sub { text-align: center; font-style: italic; margin-bottom: 18pt; }
  .print-pact li { margin-bottom: 8pt; }
  .print-pact .sigs { display: flex; justify-content: space-between; margin-top: 40pt; }
  .print-pact .sigs div { width: 45%; border-top: 1px solid #000; padding-top: 6pt; font-size: 10pt; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .temple { grid-template-columns: 1fr; }
  .pagoda { position: static; max-width: 340px; margin: 0 auto; }
  .pact { grid-template-columns: 1fr; }
  .carnet { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .tnav__links a:not(.tnav__back) { display: none; }
  .principles, .livrets { grid-template-columns: 1fr; }
  .book { grid-template-columns: 1fr; overflow-y: auto; }
  .book::after { display: none; }
  .book__page { overflow: visible; }
  .carnet { grid-template-columns: repeat(2, 1fr); }
  .hall__head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
