/* =========================================================================
   Copilote Commercial — Système graphique
   Atmosphère livre : papier neutre, encre, rouge de reliure.
   Typographie : serif éditoriale (titres) + system sans (interface).
   Source : Web-Prototype/assets/styles.css — extension aux écrans applicatifs.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg:            #f9f9f8;
  --surface:       #ffffff;
  --encre:         #1c1e21;
  --fg-2:          #40434a;
  --fg-sec:        #585d66;
  --muted:         #6b707a;
  --border:        #e7e8ea;
  --border-strong: #d5d7db;

  --accent:        #7d2332;
  --accent-fonce:  #631a26;
  --accent-voile:  rgba(125, 35, 50, 0.06);
  --accent-filet:  rgba(125, 35, 50, 0.32);
  --accent-halo:   rgba(125, 35, 50, 0.25);

  --vert:       #15803d;
  --vert-fonce: #11632f;
  --vert-voile: rgba(21, 128, 61, 0.08);
  --vert-filet: rgba(21, 128, 61, 0.28);
  --ambre:      #a16207;
  --ambre-voile: rgba(161, 98, 7, 0.09);
  --ambre-filet: rgba(161, 98, 7, 0.3);
  --rouge:      #b91c1c;
  --rouge-voile: rgba(185, 28, 28, 0.06);
  --rouge-filet: rgba(185, 28, 28, 0.28);

  --serif: "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-bulle: 16px;
  --r-bouton: 10px;
  --r-carte: 12px;

  --ombre: 0 1px 2px rgba(24, 26, 29, .05), 0 4px 14px rgba(24, 26, 29, .05);

  --maxw: 680px;
  --gouttiere: 24px;

  --courbe: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--encre);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
ul, ol { list-style: none; padding: 0; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.08; letter-spacing: -0.015em; color: var(--encre); text-wrap: balance; }
p { text-wrap: pretty; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: #efeff0;
  padding: 1px 5px;
  border-radius: 5px;
}

:focus-visible { outline: 3px solid var(--accent-halo); outline-offset: 1px; border-radius: 4px; }
::selection { background: rgba(125, 35, 50, .15); }

/* ---------- Champs (formulaire) ----------
   Styling par élément : les widgets Django se rendent sans classe.
   .champ reste la classe canonique du prototype (alias sémantique). */
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="tel"], input[type="url"], input[type="search"],
select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-bouton);
  padding: 12px 16px; font-size: 16px; color: var(--encre); width: 100%;
  box-shadow: var(--ombre);
  transition: border-color .15s var(--courbe), box-shadow .15s var(--courbe);
}
textarea { resize: vertical; line-height: 1.55; }
::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-halo);
}
input[disabled], select[disabled], textarea[disabled] { opacity: .5; cursor: not-allowed; }
.champ { /* alias canonique du prototype */ }

input[type="checkbox"], input[type="radio"] {
  width: 18px; height: 18px; margin: 0; flex-shrink: 0;
  accent-color: var(--accent); box-shadow: none; cursor: pointer;
}
input[type="file"] {
  display: block; width: 100%; font-size: 14.5px; color: var(--fg-2);
  background: var(--surface); border: 1px dashed var(--border-strong);
  border-radius: var(--r-bouton); padding: 14px 16px; box-shadow: var(--ombre);
}
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 14px; color: #fff;
  background: var(--encre); border: 0; border-radius: 8px;
  padding: 9px 14px; margin-right: 14px; cursor: pointer;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23585d66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}

.erreur-champ { font-size: 13px; color: var(--rouge); margin-top: 4px; }
.aide { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Structure ---------- */
.colonne { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gouttiere); }
main { flex: 1; }
.trait { border: 0; border-top: 1px solid var(--border); margin: 0; }

.page { padding-block: 30px 52px; display: flex; flex-direction: column; gap: 20px; }
.rangee { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.etiquettes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pile { display: flex; flex-direction: column; gap: 12px; }
.pile-serre { display: flex; flex-direction: column; gap: 8px; }
.centre { text-align: center; }
.texte-doux { color: var(--fg-sec); }
.petit { font-size: 12.5px; color: var(--muted); }
.texte-pre { white-space: pre-line; }

.page-tete h1 { font-size: clamp(26px, 4.5vw, 32px); }
.sous-titre { font-size: 15px; color: var(--fg-sec); margin-top: 8px; }
.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entete-page h1 { font-size: clamp(26px, 4.5vw, 32px); }
.titre-section {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--fg-sec);
}
.titre-section-alerte { color: var(--rouge); }

/* ---------- Bandeau d'encre ---------- */
.bandeaux { background: var(--encre); color: #f7f7f6; }
.bandeaux-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gouttiere);
}
.marque { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: #f7f7f6; text-decoration: none; }
.marque:hover { text-decoration: none; color: #fff; }
.marque small { font-family: var(--sans); font-weight: 400; font-size: 13px; color: #9aa0a6; margin-left: 8px; letter-spacing: 0; }
.lien-doux {
  color: #d8dadd; font-size: 14.5px; text-decoration: underline;
  text-decoration-color: rgba(216, 218, 221, .4); text-underline-offset: 3px;
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
}
.lien-doux:hover { color: #fff; text-decoration-color: #fff; }
.compte-nom { font-size: 13.5px; color: #9aa0a6; margin-right: 14px; }
.bandeaux-compte { display: flex; align-items: center; }

/* Nav applicative (connecté) */
.nav-app { background: #27292d; }
.nav-app-inner {
  display: flex; gap: 4px; overflow-x: auto;
  max-width: var(--maxw); margin-inline: auto; padding-block: 6px; padding-inline: var(--gouttiere);
}
.nav-app a {
  color: #d8dadd; font-size: 13.5px; text-decoration: none;
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
}
.nav-app a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-app a.active { color: #fff; background: rgba(125, 35, 50, .55); }

/* ---------- Messages & alertes ---------- */
.zone-messages { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gouttiere); padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.alerte { border-radius: var(--r-carte); padding: 12px 16px; font-size: 14.5px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--ombre); }
.alerte p + p { margin-top: 4px; }
.alerte-succes { background: var(--vert-voile); border-color: var(--vert-filet); color: var(--vert-fonce); }
.alerte-erreur { background: var(--rouge-voile); border-color: var(--rouge-filet); color: var(--rouge); }
.alerte-info { background: var(--accent-voile); border-color: var(--accent-filet); color: var(--accent-fonce); }
.alerte-demo { background: var(--ambre-voile); border-color: var(--ambre-filet); color: var(--ambre); font-size: 13px; }

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600; letter-spacing: -.002em;
  padding: 12px 22px; border-radius: var(--r-bouton);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s var(--courbe), border-color .15s var(--courbe), transform .15s var(--courbe), box-shadow .15s var(--courbe);
}
.bouton:active { transform: translateY(1px); }
.bouton:hover { transform: translateY(-1px); }
.bouton-primaire { background: var(--accent); color: #fff; }
.bouton-primaire:hover { background: var(--accent-fonce); box-shadow: 0 6px 18px rgba(99, 26, 38, .25); }
.bouton-encre { background: var(--encre); color: #f7f7f6; }
.bouton-encre:hover { background: #2b2d31; }
.bouton-ligne { background: transparent; color: var(--encre); border-color: var(--border-strong); }
.bouton-ligne:hover { border-color: var(--encre); background: var(--surface); }
.bouton-vert { background: var(--vert); color: #fff; }
.bouton-vert:hover { background: var(--vert-fonce); box-shadow: 0 6px 18px rgba(17, 99, 47, .22); }
.bouton-rouge-ligne { background: var(--surface); color: var(--rouge); border-color: var(--rouge-filet); }
.bouton-rouge-ligne:hover { border-color: var(--rouge); }
.bouton-plein { width: 100%; }
.bouton-lg { padding: 14px 28px; font-size: 16px; }
.bouton-sm { padding: 8px 14px; font-size: 14px; }
.bouton:disabled { opacity: .45; cursor: not-allowed; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions-pleines { display: flex; flex-direction: column; gap: 10px; }
.lien-simple { font-size: 14.5px; }

/* ---------- Pastilles (statuts) ---------- */
.pastille {
  display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 9999px; white-space: nowrap; vertical-align: middle;
}
.pastille-neutre { background: #e9eaec; color: var(--fg-2); }
.pastille-vert { background: var(--vert-voile); color: var(--vert); }
.pastille-ambre { background: var(--ambre-voile); color: var(--ambre); }
.pastille-rouge { background: var(--rouge-voile); color: var(--rouge); }
.pastille-encre { background: var(--encre); color: #f7f7f6; }
.pastille-acc { background: var(--accent-voile); color: var(--accent-fonce); }

/* ---------- Cartes & listes ---------- */
.carte {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-carte); box-shadow: var(--ombre);
  padding: 18px 20px;
}
.carte-lien { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.carte-lien:hover { border-color: var(--border-strong); transform: translateY(-1px); text-decoration: none; }
.carte-verte { background: var(--vert-voile); border-color: var(--vert-filet); }
.carte-ambre { background: var(--ambre-voile); border-color: var(--ambre-filet); }
.carte-alerte { background: var(--rouge-voile); border-color: var(--rouge-filet); }
.carte-acc { background: var(--accent-voile); border-color: var(--accent-filet); }
.titre-carte { font-family: var(--sans); font-size: 15.5px; font-weight: 650; letter-spacing: -.005em; }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.carte-tete:last-child { margin-bottom: 0; }
.corps-carte { font-size: 14.5px; color: var(--fg-2); }
.corps-carte strong { color: var(--encre); }
.ligne-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

.liste-divisee { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-carte); box-shadow: var(--ombre); overflow: hidden; }
.liste-divisee > * + * { border-top: 1px solid var(--border); }
.ligne-liste { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 16px; font-size: 14.5px; }
.ligne-liste .ligne-date { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.vide {
  border: 1px dashed var(--border-strong); background: var(--surface);
  border-radius: var(--r-carte); padding: 22px 20px;
  color: var(--fg-sec); font-size: 14.5px; text-align: center;
}
.vide a { color: var(--accent-fonce); }

.encart-encre {
  background: var(--encre); color: #f7f7f6;
  border-radius: var(--r-carte); padding: 20px 22px; box-shadow: var(--ombre);
}
.encart-encre .texte-doux { color: #b9bdc3; }
.encart-encre a { color: #fff; }

/* Grilles & mesures (stats, crédits) */
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mesure { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-carte); box-shadow: var(--ombre); padding: 16px 18px; }
.mesure-nombre { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.15; }
.mesure-libelle { font-size: 12.5px; color: var(--fg-sec); margin-top: 2px; }
.mesure-verte { background: var(--vert-voile); border-color: var(--vert-filet); }
.mesure-verte .mesure-nombre { color: var(--vert-fonce); }
.mesure-verte .mesure-libelle { color: var(--vert); }
.encart-encre .mesure-nombre { color: #fff; font-size: 34px; }

/* Cases à cocher rondes (touches de relance) */
.case {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 9999px;
  border: 2px solid var(--border-strong); background: var(--surface);
  color: transparent; font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s var(--courbe), background .15s var(--courbe), transform .15s var(--courbe);
}
.case:hover { border-color: var(--vert); transform: translateY(-1px); }
.case-fait { background: var(--vert); border-color: var(--vert); color: #fff; }
/* Z17 — touche faite = fait historique: coche figée (non cliquable sans
   casser le rendu HTMX d'un éventuel re-poll de la carte) */
.case-figee { pointer-events: none; cursor: default; }
/* Z17 — retour d'une touche faite, affiché sous la touche */
.encart-retour {
  margin-top: 8px; padding: 8px 12px; font-size: 13px; color: var(--fg-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.encart-retour p { margin: 2px 0; }
.case-mort {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 9999px; flex-shrink: 0;
  border: 2px solid var(--border); color: var(--muted); font-size: 18px;
}

/* ---------- Héros ---------- */
.heros { padding-block: 72px 20px; }
.kicker {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-sec);
}
.heros h1 { font-size: clamp(38px, 7.5vw, 60px); margin-top: 18px; }
.heros .lead { font-size: 18.5px; color: var(--fg-sec); margin-top: 18px; max-width: 34ch; }
.point-acc { color: var(--accent); }

/* ---------- Conversation ---------- */
.conversation { margin-top: 44px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.conversation form { display: flex; flex-direction: column; gap: 10px; }

.bulle {
  max-width: 86%;
  padding: 12px 17px;
  font-size: 15.5px;
  line-height: 1.5;
  border-radius: var(--r-bulle);
}
.bulle-copilote {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--fg-2);
  box-shadow: var(--ombre);
}
.bulle-artisan {
  align-self: flex-end;
  background: var(--encre);
  color: #f7f7f6;
  border-bottom-right-radius: 4px;
}

/* F15 — bulle « tape… » : 3 points animés façon SMS pendant que la
   réaction se prépare. htmx pose htmx-request sur le formulaire
   émetteur, la bulle vit donc DANS le formulaire (1er enfant). */
@keyframes discu-point { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.discu-points { display: flex; gap: 6px; align-items: center; padding: 4px 2px; }
.discu-points span {
  width: 8px; height: 8px; border-radius: 9999px; background: var(--fg-sec);
  display: inline-block; animation: discu-point 1s infinite;
}
.discu-points span:nth-child(2) { animation-delay: .2s; }
.discu-points span:nth-child(3) { animation-delay: .4s; }
.bulle-reflexion { display: none; }
.bulle-reflexion .bulle { display: inline-flex; align-items: center; }
form.htmx-request .bulle-reflexion { display: block; }
form.htmx-request .discu-continuer { opacity: .5; }

.saisie { display: flex; gap: 10px; align-items: stretch; margin-top: 6px; }
.saisie .champ { flex: 1; width: auto; min-width: 0; }
.discu-continuer { padding-inline: 20px; }

/* ---------- Livrables ---------- */
.livrables { padding-block: 64px 8px; }
.livrables h2 { font-size: clamp(24px, 4vw, 30px); }
.livrables-liste { margin-top: 28px; }
.livrable {
  display: grid; grid-template-columns: 52px 1fr; gap: 16px;
  padding: 18px 0; border-top: 1px solid var(--border);
  align-items: baseline;
}
.livrable:last-child { border-bottom: 1px solid var(--border); }
.livrable .num { font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--muted); line-height: 1; }
.livrable h3 { font-family: var(--sans); font-size: 16px; font-weight: 650; letter-spacing: -.005em; }
.livrable p { font-size: 14.5px; color: var(--fg-sec); margin-top: 2px; }

/* ---------- Objections ---------- */
.objections { padding-block: 40px 24px; }
.objections p {
  font-family: var(--serif); font-style: italic;
  font-size: 17px; line-height: 1.7; color: var(--fg-sec);
}
.objections p + p { margin-top: 6px; }
.objections b { color: var(--encre); font-weight: 700; }

/* ---------- Authentification ---------- */
.auth { padding-block: 56px 32px; }
.auth-carte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-carte);
  box-shadow: var(--ombre);
  padding: 36px 32px 30px;
}
.auth h1 { font-size: clamp(26px, 4.5vw, 32px); }
.auth .sous-titre { font-size: 15px; color: var(--fg-sec); margin-top: 8px; }
.auth-carte form { margin-top: 26px; }
.champ-bloc { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.champ-bloc label { font-size: 14px; font-weight: 600; color: var(--fg-2); }
.champ-bloc .aide { margin-top: 2px; }
.champ-bloc .erreur-champ { margin-top: 0; }
.auth-pied { font-size: 14px; color: var(--fg-sec); text-align: center; margin-top: 16px; }
.auth-pied a { color: var(--accent-fonce); }
.discu-compte-titre { font-size: 15.5px; font-weight: 600; margin-bottom: 4px; }

/* Choix (radios Django : ul > li > label) */
.choix ul, .choix > div { display: flex; flex-wrap: wrap; gap: 16px; }
.choix li, .choix label { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.choix-case { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; color: var(--fg-2); cursor: pointer; }
.choix-case input { margin-top: 3px; }
.choix-case .petit { display: block; }

/* ---------- Pied de page ---------- */
.pied { background: var(--encre); color: #9aa0a6; text-align: center; padding-block: 26px; font-size: 13px; }

/* ---------- Modale (retour d'une touche) ---------- */
.voile {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(24, 26, 29, .45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
  animation: apparition .2s var(--courbe) both;
}
@media (min-width: 640px) { .voile { align-items: center; } }
.modale {
  background: var(--surface); border-radius: 18px;
  width: 100%; max-width: 440px;
  padding: 22px 22px 20px;
  box-shadow: 0 20px 60px rgba(24, 26, 29, .25);
  animation: montee .25s var(--courbe) both;
}
@keyframes montee { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.modale h3 { font-size: 20px; }
.modale form { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.modale .champ-bloc { margin-bottom: 0; }

/* ---------- Divers ---------- */
details.pli { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-carte); padding: 14px 18px; font-size: 14.5px; box-shadow: var(--ombre); }
details.pli summary { cursor: pointer; color: var(--fg-sec); }
details.pli summary:hover { color: var(--encre); }
details.pli[open] summary { margin-bottom: 10px; }

.pouls { display: inline-block; animation: pouls 1.2s ease-in-out infinite; }
@keyframes pouls { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.attente { font-size: 14.5px; color: var(--fg-sec); display: flex; align-items: center; gap: 8px; }

.titre-edit { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--border-strong); text-underline-offset: 5px; }
.titre-edit:hover { text-decoration-color: var(--accent); }
.saisie-titre { width: 100%; font-family: var(--serif); font-weight: 700; font-size: clamp(24px, 4vw, 30px); background: transparent; border: 0; border-bottom: 2px solid var(--border-strong); border-radius: 0; box-shadow: none; padding: 2px 0 6px; }
.saisie-titre:focus { box-shadow: none; border-bottom-color: var(--accent); }

.note-bas { font-size: 12.5px; color: var(--muted); text-align: center; }
.liste-puces { list-style: disc; padding-left: 20px; }
.liste-puces li { margin-bottom: 6px; }

/* ---------- Mouvement ---------- */
@keyframes apparition { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.apparait { animation: apparition .5s var(--courbe) both; }
.delai-1 { animation-delay: 60ms; }
.delai-2 { animation-delay: 120ms; }
.delai-3 { animation-delay: 190ms; }

.revele { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--courbe), transform .5s var(--courbe); }
.revele.vu { opacity: 1; transform: none; }
.livrables-liste .livrable:nth-child(2).vu { transition-delay: 60ms; }
.livrables-liste .livrable:nth-child(3).vu { transition-delay: 120ms; }

/* ===================================================================
 * L'accueil animé : « la démo qui se donne ».
 * Un calque fantôme superposé au champ, des bulles simulées dont la
 * place est RÉSERVÉE dès le rendu (opacité, jamais display) : zéro
 * layout shift. Animations en transform/opacity uniquement (seule
 * exception : le repli de la zone simulée, APRÈS le relais, jamais
 * pendant) ; l'accent porte le curseur d'insertion simulé, seul
 * élément accent qui bouge pendant la démo. Le markup n'existe que
 * sur l'accueil vierge (drapeau demo_accueil → discu_formulaire.html
 * + accueil.html).
 * =================================================================== */

/* L'accroche à deux états superposés (fondu croisé piloté en classes) :
   le HTML servi reste l'accroche d'origine, « À vous. » n'existe qu'en
   opacité zéro jusqu'au relais. */
.accroche-demo { display: grid; }

.accroche-etat {
  grid-area: 1 / 1;
  transition: opacity 0.6s ease;
}

.accroche-relais { opacity: 0; }

.accroche-demo.est-relais .accroche-initiale { opacity: 0; }

.accroche-demo.est-relais .accroche-relais { opacity: 1; }

/* Pendant la démo, les sections sous la conversation s'estompent (la
   méthode ne se lit pas encore : elle se montre) ; le relais les
   révèle. La classe est posée sur la section parente de #discussion. */
.livrables,
.objections { transition: opacity 0.4s ease; }

section.demo-en-cours ~ .livrables,
section.demo-en-cours ~ .objections { opacity: 0.25; }

/* Le calque fantôme : même géométrie que le champ (padding, bordure,
   rayon), fond opaque (il couvre le placeholder pendant la frappe
   simulée), infrapable — le vrai input reste dessous, vide et
   fonctionnel. La zone .zone-champ-demo (accueil vierge seulement)
   porte le positionnement. */
.zone-champ-demo { position: relative; flex: 1; display: flex; min-width: 0; }

.calque-demo {
  position: absolute;
  inset: 0;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-bouton);
  font: inherit;
  font-size: 16px;
  line-height: normal; /* même hauteur de ligne que le moteur donne au vrai input */
  display: flex; /* et même centrage : la ligne simulée se place dans la */
  align-items: center; /* boîte de contenu exactement comme le texte de l'input */
  color: var(--encre);
  background: var(--surface);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  box-shadow: var(--ombre);
}

/* La ligne unique du calque (texte + curseur sur la MÊME ligne) : le
   pre ne survit pas aux items d'un conteneur flex, il vit ici. */
.ligne-calque { white-space: pre; }

.calque-demo.demo-active { opacity: 1; }

/* Le curseur d'insertion simulé : l'accent, clignotement sobre. */
.curseur-demo {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: clignement-demo 1.1s steps(2, start) infinite;
}

@keyframes clignement-demo { to { opacity: 0; } }

/* Les bulles simulées : la grammaire des vraies bulles (.bulle-copilote /
   .bulle-artisan) — une conversation, pas un artefact. Leur hauteur est
   occupée dès le rendu : l'apparition est un fondu, rien ne se déplace. */
.demo-bulles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-bulle {
  max-width: 86%;
  padding: 12px 17px;
  font-size: 15.5px;
  line-height: 1.5;
  border-radius: var(--r-bulle);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.demo-bulle[data-role="copilote"] {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--fg-2);
  box-shadow: var(--ombre);
}

.demo-bulle[data-role="visiteur"] {
  align-self: flex-end;
  background: var(--encre);
  color: #f7f7f6;
  border-bottom-right-radius: 4px;
}

.demo-bulle.demo-visible {
  opacity: 1;
  transform: translateY(0);
}

/* La réserve de texte des répliques visiteur : jamais affichée dans la
   zone — c'est le calque qui les tape dans le champ. */
.demo-replique-visiteur { display: none; }

/* Le micro-état réflexion : trois points discrets (mêmes points que la
   bulle « tape… » du vrai formulaire) ; hauteur réservée d'emblée,
   apparition en fondu. */
.demo-reflexion {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 1.4rem;
  margin: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.demo-reflexion.demo-visible { opacity: 1; }

.demo-reflexion span {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--fg-sec);
  animation: discu-point 1s ease-in-out infinite;
}

.demo-reflexion span:nth-child(2) { animation-delay: .2s; }

.demo-reflexion span:nth-child(3) { animation-delay: .4s; }

/* « Revoir la présentation » : discret par conception, jamais un gros
   bouton accent. */
.bouton-rejouer { margin-top: 12px; align-self: center; font-size: 13.5px; }

/* Le relais (« À vous. ») : la conversation simulée s'efface en fondu
   puis se replie — seule exception autorisée à transform/opacity, et
   uniquement APRÈS le relais, jamais pendant : zéro layout shift
   pendant la démo, pas de trou vide après. Les deux classes sont
   posées par le JS seul (jamais servies) ; le repli est conduit en
   max-height mesurée une fois par le JS (hauteur naturelle → 0). */
.demo-accueil {
  transition: opacity 0.6s ease, max-height 0.45s ease;
}

.demo-accueil.demo-estompee { opacity: 0; }

.demo-accueil.demo-repliee { overflow: hidden; }

/* Mouvement réduit : PAS de démo du tout — calque, zone des bulles et
   bouton disparaissent du flux ; l'accueil standard est servi intact. */
@media (prefers-reduced-motion: reduce) {
  .demo-accueil,
  .calque-demo,
  .bouton-rejouer { display: none; }

  .accroche-demo { display: block; }

  .accroche-relais { display: none; }
}

/* La démo ne s'imprime pas : elle vit dans l'écran d'accueil. */
@media print {
  .demo-accueil,
  .calque-demo,
  .bouton-rejouer { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --gouttiere: 18px; }
  .heros { padding-block: 52px 16px; }
  .livrables { padding-block: 48px 8px; }
  .auth-carte { padding: 28px 20px 24px; border-radius: 0; border-left: 0; border-right: 0; }
  .saisie { flex-direction: row; }
  .discu-continuer { padding-inline: 16px; }
  .case, .case-mort { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .apparait { animation: none; }
  .revele { opacity: 1; transform: none; }
}
