/* =============================================================================
   Autodiagnostic inondations — charte graphique (d'après inondV2)
   Polices : Baloo 2 (titres) + Nunito (texte) · palette terracotta + vert d'eau
   ========================================================================== */

:root {
  --bg:            #f0f8fa;
  --footer-bg:     #e3f2f6;
  --footer-brd:    #cde4ec;

  --navy:          #143c4f;  /* titres, texte fort */
  --slate:         #3f6274;  /* texte courant */
  --muted:         #6d8b9b;  /* texte secondaire */
  --teal-link:     #17789c;  /* liens */
  --teal-link-h:   #174c61;
  --teal:          #2ab3c0;  /* accent vif */

  --card:          #fff;
  --card-brd:      #c9e2ea;
  --pill-bg:       #d9edf2;
  --note-bg:       #edf6f8;
  --icon-bg:       #d8f0f3;

  --orange:        #f7a41d;  /* CTA primaire / vigilance */
  --orange-dk:     #b97507;
  --orange-bg:     #fef4e3;
  --orange-brd:    #f5dfae;

  --yellow-dk:     #9c7c1b;  /* à vérifier */
  --yellow-bg:     #f8f2dc;
  --yellow-brd:    #e5d9a8;

  --green-dk:      #35752f;  /* favorable */
  --green-bg:      #e6f2e4;
  --green-brd:     #bfdcba;

  --shadow-cta:    0 4px 14px rgba(247,164,29,.35);
  --shadow-card:   0 6px 20px rgba(40,60,50,.10);
  --radius:        18px;

  --sans:  "Nunito", system-ui, -apple-system, sans-serif;
  --title: "Baloo 2", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  font-family: var(--sans);
  color: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--teal-link); }
a:hover { color: var(--teal-link-h); }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* --------------------------------------------------------- En-tête ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 44px;
  background: var(--bg);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font: 700 16px var(--title);
  color: var(--navy);
  cursor: pointer;
}
.brand .brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.lang-switch {
  display: flex; gap: 4px;
  background: var(--pill-bg);
  border-radius: 999px; padding: 4px;
  font: 600 12.5px var(--sans);
}
.lang-switch button {
  padding: 6px 14px; border-radius: 999px; color: var(--muted);
  transition: background .15s, color .15s;
}
.lang-switch button.active { background: var(--navy); color: var(--bg); }

/* --------------------------------------------------------- Pied de page ----- */
.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 44px;
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-brd);
  margin-top: auto;
}
.site-footer .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex: none; }
.site-footer p { margin: 0; font: 400 13px var(--sans); color: var(--slate); text-align: center; }

/* --------------------------------------------------------- Écrans ----------- */
.screen { display: none; flex: 1; }
.screen.active { display: block; }
main.wrap { max-width: 820px; margin: 0 auto; padding: 36px 24px 48px; }
main.wrap.wide { max-width: 1020px; }
main.wrap.synth { max-width: 920px; }

/* =========================================================== ACCUEIL ======== */
.home-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: stretch;
}
.home-copy {
  padding: 60px 40px 60px 44px;
  display: flex; flex-direction: column; justify-content: center;
}
.eyebrow {
  margin: 0 0 16px; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 12.5px var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--teal); background: var(--green-bg);
  padding: 7px 14px; border-radius: 999px;
}
.home-copy h1 {
  margin: 0 0 18px;
  font: 800 46px/1.1 var(--title); color: var(--navy); text-wrap: balance;
}
.home-copy h1 .hl { color: var(--teal-link); }
.home-subtitle { margin: 0 0 12px; font: 600 16px var(--sans); color: var(--slate); }
.home-lead { margin: 0 0 30px; font: 400 16.5px/1.65 var(--sans); color: var(--slate); text-wrap: pretty; max-width: 480px; }

.entry-list { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.entry {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: 14px;
  text-align: left; width: 100%;
  transition: transform .12s, box-shadow .12s;
}
.entry:hover { transform: translateY(-2px); }
.entry .num {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font: 700 17px var(--title);
}
.entry .txt { flex: 1; }
.entry .txt strong { display: block; font: 700 16px var(--title); }
.entry .txt span { display: block; margin-top: 2px; font: 400 13px/1.4 var(--sans); }
.entry .arrow { font-size: 20px; }
.entry-primary { background: var(--orange); color: #fff; box-shadow: var(--shadow-cta); }
.entry-primary:hover { box-shadow: 0 8px 22px rgba(247,164,29,.42); }
.entry-primary .num { background: rgba(255,255,255,.2); }
.entry-primary .txt span { opacity: .92; }
.entry-secondary { background: #fff; border: 1.5px solid var(--card-brd); color: var(--navy); }
.entry-secondary .num { background: var(--green-bg); color: var(--teal); }
.entry-secondary .txt span { color: #5c7d8b; }
.entry-secondary .arrow { color: var(--teal); }

.home-visual {
  position: relative;
  background: linear-gradient(180deg, #dff0f4 0%, #cfe8ee 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 560px; overflow: hidden;
}
.home-visual img { position: absolute; inset: 28px; width: calc(100% - 56px); height: calc(100% - 56px); object-fit: contain; }
.home-visual .badge {
  position: absolute; left: 52px; bottom: 52px;
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow-card);
}
.home-visual .badge .b-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--teal-link); color: #fff;
  display: flex; align-items: center; justify-content: center; font: 700 13px var(--sans);
}
.home-visual .badge span:last-child { font: 600 13px var(--sans); color: var(--navy); }

/* =========================================================== QUESTIONNAIRE == */
.progress-row { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.progress-track { flex: 1; height: 8px; border-radius: 4px; background: #d5eaf0; overflow: hidden; }
.progress-bar { height: 100%; background: var(--teal); border-radius: 4px; transition: width .35s ease; }
.progress-count { font: 600 13.5px var(--sans); color: var(--slate); white-space: nowrap; }

.q-card {
  background: #fff; border: 1.5px solid var(--card-brd); border-radius: var(--radius);
  padding: 36px 40px; display: flex; flex-direction: column; gap: 20px;
}
.q-head { display: flex; align-items: center; gap: 12px; }
.q-letter {
  width: 42px; height: 42px; border-radius: 12px; background: var(--icon-bg);
  display: flex; align-items: center; justify-content: center;
  font: 800 19px var(--title); color: var(--teal-link);
}
.q-group { font: 600 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.q-title { margin: 0; font: 700 25px/1.3 var(--title); color: var(--navy); text-wrap: balance; }
.q-note { margin: 0; padding: 14px 18px; border-radius: 10px; background: var(--note-bg); font: 400 14.5px/1.6 var(--sans); color: var(--slate); }

.cigale {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border: 1.5px dashed #8ecbd8; border-radius: 12px; background: #e9f6f9;
  text-align: left; width: 100%;
}
.cigale .c-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--teal-link); color: #fff; display: flex; align-items: center; justify-content: center; font: 700 15px var(--sans); flex: none; }
.cigale .c-title { margin: 0; font: 700 14.5px var(--sans); color: var(--teal-link); }
.cigale .c-sub { margin: 2px 0 0; font: 400 13px/1.45 var(--sans); color: var(--slate); }

.answers { display: flex; gap: 12px; flex-wrap: wrap; }
.answer {
  flex: 1 1 0; min-width: 120px; text-align: center;
  padding: 15px 10px; border-radius: 12px;
  border: 1.5px solid var(--card-brd); background: #f7fcfd;
  font: 600 15.5px var(--sans); color: var(--navy);
  transition: border-color .12s, background .12s, color .12s;
}
.answer:hover { border-color: var(--teal); background: #eefafc; }
.answer.selected { border: 2px solid var(--orange); background: var(--orange-bg); color: var(--orange-dk); font-weight: 700; }
.answer.selected.fav { border-color: var(--teal); background: var(--green-bg); color: var(--green-dk); }

/* Encadré « En bref » */
.feedback {
  border-radius: 14px; padding: 22px 24px;
  display: flex; flex-direction: column; gap: 12px;
  animation: fadeIn .25s ease;
}
.feedback.vigilance { background: var(--orange-bg); border: 1.5px solid var(--orange-brd); }
.feedback.verifier  { background: var(--yellow-bg); border: 1.5px solid var(--yellow-brd); }
.feedback.favorable { background: var(--green-bg);  border: 1.5px solid var(--green-brd); }
.feedback.na        { background: var(--note-bg);   border: 1.5px solid var(--card-brd); }
.fb-head { display: flex; align-items: center; gap: 10px; }
.fb-badge { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font: 800 14px var(--title); flex: none; }
.feedback.vigilance .fb-badge { background: var(--orange); }
.feedback.verifier  .fb-badge { background: var(--yellow-dk); }
.feedback.favorable .fb-badge { background: var(--teal); }
.feedback.na        .fb-badge { background: var(--muted); }
.fb-label { font: 700 13px var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.feedback.vigilance .fb-label { color: var(--orange-dk); }
.feedback.verifier  .fb-label { color: var(--yellow-dk); }
.feedback.favorable .fb-label { color: var(--green-dk); }
.feedback.na        .fb-label { color: var(--muted); }
.fb-strong { margin: 0; font: 700 15.5px/1.5 var(--sans); color: var(--navy); }
.fb-text { margin: 0; font: 400 15px/1.6 var(--sans); color: var(--slate); }
.fb-fiche-btn {
  align-self: flex-start; padding: 11px 20px; border-radius: 10px;
  background: var(--orange); color: #fff; font: 600 14px var(--sans);
}
.fb-fiche-btn:hover { background: #e5920f; color: #fff; }
.feedback.verifier .fb-fiche-btn { background: var(--yellow-dk); }
.feedback.verifier .fb-fiche-btn:hover { background: #866914; }

/* Barre de navigation questionnaire */
.q-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 12px; }
.btn-back {
  padding: 12px 22px; border-radius: 10px; border: 1.5px solid var(--card-brd);
  font: 600 14.5px var(--sans); color: var(--navy); background: #fff;
}
.btn-back:disabled { color: #9dbfcc; background: #e8f3f7; cursor: not-allowed; }
.btn-home-link { font: 600 14px var(--sans); color: var(--slate); text-decoration: underline; }
.btn-next {
  padding: 12px 24px; border-radius: 10px; background: var(--orange); color: #fff;
  font: 600 14.5px var(--sans); box-shadow: var(--shadow-cta);
}
.btn-next:disabled { background: #f8d9a0; box-shadow: none; cursor: not-allowed; }

/* =========================================================== SCHÉMAS ======== */
.schema-title { margin: 0 0 22px; font: 800 34px var(--title); color: var(--navy); }
.tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.tab {
  padding: 12px 24px; border-radius: 12px 12px 0 0;
  background: var(--pill-bg); font: 600 15px var(--sans); color: var(--muted);
}
.tab.active { background: #fff; border: 1.5px solid var(--card-brd); border-bottom: none; color: var(--teal-link); font-weight: 700; }

.schema-stage {
  border-radius: 0 16px 16px 16px;
  border: 1.5px solid var(--card-brd); background: #eef7f9; overflow: hidden;
}
/* Le calque des pastilles épouse exactement l'image : les % sont donc          */
/* résolus sur la boîte de l'image → alignement identique à toute taille.        */
.schema-canvas { position: relative; display: block; line-height: 0; }
.schema-canvas img { display: block; width: 100%; height: auto; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%);
  width: 8.5%; aspect-ratio: 1 / 1; max-width: 40px; min-width: 26px;
  border-radius: 50%;
  background: var(--orange); color: #fff; border: 2.5px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font: 800 clamp(12px, 1.5vw, 16px) var(--title); line-height: 1;
  box-shadow: 0 2px 8px rgba(20,60,79,.4);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  animation: pulse 2.4s infinite;
}
.hotspot:hover, .hotspot:focus-visible { transform: translate(-50%, -50%) scale(1.18); animation: none; box-shadow: 0 4px 14px rgba(247,164,29,.6); outline: none; z-index: 5; }
.hotspot .tip {
  position: absolute; bottom: 145%; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 230px; text-align: center;
  background: var(--navy); color: #fff;
  font: 600 12px/1.35 var(--sans); padding: 8px 11px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 6;
}
.hotspot .tip b { color: #f8d9a0; }
.hotspot.tip-below .tip { bottom: auto; top: 145%; }
.hotspot:hover .tip, .hotspot:focus-visible .tip { opacity: 1; }
.schema-help { margin: 16px 0 28px; text-align: center; font: 400 14.5px var(--sans); color: var(--slate); }
.schema-nav { display: flex; justify-content: center; gap: 14px; }

/* =========================================================== SYNTHÈSE ======= */
.score-card {
  background: #fff; border: 1.5px solid var(--card-brd); border-radius: 20px;
  padding: 36px 40px; display: flex; gap: 36px; align-items: center;
}
.gauge { flex: none; width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.gauge .inner { width: 114px; height: 114px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .pct { font: 800 34px var(--title); color: var(--navy); }
.gauge .lbl { font: 600 11px var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.score-body { flex: 1; }
.score-body h1 { margin: 0 0 8px; font: 800 31px var(--title); color: var(--navy); }
.score-summary { margin: 0 0 20px; font: 400 16px/1.55 var(--sans); color: var(--slate); }
.score-summary strong { color: var(--navy); }
.tiles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.tile { border-radius: 12px; padding: 14px 16px; }
.tile .t-num { display: block; font: 800 26px var(--title); }
.tile .t-lbl { font: 600 12.5px var(--sans); }
.tile.vigilance { background: var(--orange-bg); } .tile.vigilance .t-num, .tile.vigilance .t-lbl { color: var(--orange-dk); }
.tile.verifier  { background: var(--yellow-bg); } .tile.verifier  .t-num, .tile.verifier  .t-lbl { color: var(--yellow-dk); }
.tile.favorable { background: var(--green-bg);  } .tile.favorable .t-num, .tile.favorable .t-lbl { color: var(--green-dk); }

.synth-block { margin-top: 20px; background: #fff; border-radius: 16px; overflow: hidden; }
.synth-block.vigilance { border: 1.5px solid var(--orange-brd); }
.synth-block.verifier  { border: 1.5px solid var(--yellow-brd); }
.synth-block.favorable { border: 1.5px solid var(--green-brd); }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 24px; }
.synth-block.vigilance .sb-head { background: var(--orange-bg); }
.synth-block.verifier  .sb-head { background: var(--yellow-bg); }
.synth-block.favorable .sb-head { background: var(--green-bg); }
.sb-badge { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font: 800 12px var(--title); flex: none; }
.synth-block.vigilance .sb-badge { background: var(--orange); }
.synth-block.verifier  .sb-badge { background: var(--yellow-dk); }
.synth-block.favorable .sb-badge { background: var(--teal); }
.sb-head h2 { margin: 0; font: 700 17px var(--title); }
.synth-block.vigilance .sb-head h2 { color: var(--orange-dk); }
.synth-block.verifier  .sb-head h2 { color: var(--yellow-dk); }
.synth-block.favorable .sb-head h2 { color: var(--green-dk); }
.sb-row { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-top: 1px solid #eef; }
.synth-block.vigilance .sb-row { border-top-color: #f8ecd2; }
.synth-block.verifier  .sb-row { border-top-color: #eee5c2; }
.synth-block.favorable .sb-row { border-top-color: #d9ead6; }
.sb-letter { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--note-bg); display: flex; align-items: center; justify-content: center; font: 800 13px var(--title); color: var(--slate); }
.sb-text { flex: 1; font: 400 14.5px var(--sans); color: var(--navy); }
.sb-fiche { font: 600 13.5px var(--sans); color: var(--teal-link); text-decoration: underline; white-space: nowrap; background: none; }
.sb-fiche:hover { color: var(--teal-link-h); }
.sb-empty { padding: 16px 24px; border-top: 1px solid #eef; font: 400 14.5px var(--sans); color: var(--muted); }

.synth-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.btn-pdf { padding: 15px 26px; border-radius: 12px; background: var(--orange); color: #fff; font: 700 15.5px var(--sans); box-shadow: var(--shadow-cta); }
.btn-pdf:hover { background: #e5920f; }
.btn-ghost { padding: 15px 26px; border-radius: 12px; border: 1.5px solid var(--card-brd); background: #fff; font: 600 15.5px var(--sans); color: var(--navy); }
.btn-ghost:hover { border-color: var(--teal); }

.survey {
  display: flex; align-items: center; gap: 18px; margin-top: 26px;
  padding: 20px 26px; border-radius: 14px; background: var(--green-bg); border: 1.5px solid var(--green-brd);
}
.survey p { margin: 0; flex: 1; font: 600 15px var(--sans); color: var(--navy); }
.survey a { padding: 11px 22px; border-radius: 10px; background: var(--teal); color: #fff; font: 600 14px var(--sans); display: inline-flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.survey a:hover { background: #229aa6; color: #fff; }

/* =========================================================== FICHE (modale) = */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(51,48,42,.4);
  display: none; align-items: center; justify-content: center; padding: 40px;
  z-index: 50; animation: fadeIn .18s ease;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 640px; max-width: 100%; max-height: 86vh;
  background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(30,25,15,.35);
  overflow: hidden; display: flex; flex-direction: column;
  animation: popIn .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal-head { padding: 28px 32px 20px; border-bottom: 1.5px solid var(--footer-bg); position: relative; }
.modal-close {
  position: absolute; top: 20px; right: 20px; width: 36px; height: 36px; border-radius: 50%;
  background: #e8f3f7; display: flex; align-items: center; justify-content: center;
  font: 600 15px var(--sans); color: var(--slate);
}
.modal-close:hover { background: #d5e9f0; }
.modal-group { margin: 0 0 6px; font: 600 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--teal); }
.modal-title { margin: 0 0 8px; font: 800 27px var(--title); color: var(--navy); padding-right: 40px; }
.modal-meta { margin: 0; font: 400 13.5px var(--sans); color: var(--muted); }
.modal-body { padding: 24px 32px 30px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.fiche-item { display: flex; gap: 14px; }
.fiche-item .f-letter { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--icon-bg); display: flex; align-items: center; justify-content: center; font: 800 15px var(--title); color: var(--teal-link); }
.fiche-item .f-q { margin: 0 0 6px; font: 700 15px/1.45 var(--sans); color: var(--navy); }
.fiche-item .f-a { margin: 0; font: 400 14.5px/1.6 var(--sans); color: var(--slate); }
.modal-cigale {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 12px 20px; border-radius: 10px; background: var(--teal-link); color: #fff;
  font: 600 14px var(--sans); text-decoration: none;
}
.modal-cigale:hover { background: var(--teal-link-h); color: #fff; }

/* =========================================================== PDF (impression) */
#pdf-doc { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(247,164,29,.5); } 70% { box-shadow: 0 0 0 12px rgba(247,164,29,0); } 100% { box-shadow: 0 0 0 0 rgba(247,164,29,0); } }

/* --------------------------------------------------------- Responsive ------- */
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-visual { min-height: 340px; order: -1; }
  .home-copy { padding: 40px 24px; }
  .home-copy h1 { font-size: 36px; }
  .site-header, .site-footer { padding: 14px 20px; }
  .score-card { flex-direction: column; text-align: center; }
  .q-card { padding: 26px 22px; }
  .q-title { font-size: 21px; }
  .sb-row { flex-wrap: wrap; }
  .sb-fiche { white-space: normal; }
}

/* --------------------------------------------------------- Impression PDF --- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .site-header, .site-footer, .screen, .modal-overlay { display: none !important; }
  #pdf-doc { display: block !important; }
}
