/* ============================================================
   UN APERÇU EN DÉTAIL — la reconstitution animée.

   Deux moments écrits, jamais visibles ensemble, comme dans le
   produit : l'agent au travail (les traces se déposent), puis le
   récépissé qui se pose. Entre les deux, un arrêt réel : c'est le
   visiteur qui valide la soumission.
   ============================================================ */

.lecteur { max-width: 1120px; margin-inline: auto; }

.lecteur__cadre {
  position: relative; overflow: hidden;
  height: clamp(560px, 50vw, 640px);
  border-radius: var(--r-lg);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 1px rgba(13,31,22,.5), var(--e-vert);
}

.lecteur__barre {
  height: 52px; display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5); background: var(--surface); border-bottom: 1px solid var(--line);
}
.lecteur__barre svg { width: 22px; height: 22px; color: var(--or-vif); flex: none; }
.lecteur__barre b { font-family: 'Manrope', system-ui, sans-serif; font-weight: 800; font-size: .98rem; letter-spacing: -0.024em; }
.lecteur__barre span { font-size: .8rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lecteur__barre .etat { margin-left: auto; }

.scene {
  position: absolute; inset: 52px 0 0 0;
  opacity: 0; visibility: hidden;
  transition: opacity 260ms var(--pose), visibility 0s linear 260ms;
}
.scene--active { opacity: 1; visibility: visible; transition-delay: 0s; }

/* --- Scène 1 : le registre --- */
.scene-registre { padding: var(--s7) var(--s8); overflow: hidden; }
.scene-registre h3 { font-size: 1.5rem; }
.scene-registre > p { color: var(--ink-3); font-size: .9rem; margin-top: 4px; }
.scene-registre .doc { margin-top: var(--s6); box-shadow: 0 0 0 1px var(--line), var(--e2), var(--lueur); }
.reg-demo__ligne, .reg-demo__cols {
  display: grid; grid-template-columns: 124px 104px minmax(0, 1fr) 112px 112px;
  gap: 14px; align-items: center; padding-inline: 18px;
}
.reg-demo__cols { background: var(--navy); color: var(--sur-navy); padding-block: 10px; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.reg-demo__ligne { padding-block: 14px; border-bottom: 1px solid var(--line-soft); font-size: .86rem; transition: background var(--t-etat) var(--pose), box-shadow var(--t-etat) var(--pose); }
.reg-demo__ligne:last-child { border-bottom: 0; }
.reg-demo__ligne--vise { background: var(--retrait); box-shadow: inset 0 1px 0 var(--line), inset 0 -1px 0 var(--line); }
.reg-demo__ligne .reg-code { font-size: .8rem; }
.reg-demo__ligne .reg-nom { font-size: .88rem; }
.reg-demo__ligne .btn { justify-self: end; min-height: 38px; padding: 0 14px 3px; font-size: .86rem; border-radius: var(--r-sm); }
.reg-demo__ligne .btn svg { width: 15px; height: 15px; }
/* Avant le lancement, « Déclarer » sur TRT-BIO-04 est un vrai bouton : il lance
   la démonstration. Une fois lancée, la scène est jouée et ne se clique plus. */
.lecteur--lance .scene-registre .btn { pointer-events: none; }
.btn--presse { transform: translateY(2px) !important; background: linear-gradient(180deg, var(--accent) 0%, var(--accent-fonce) 100%) !important; box-shadow: 0 0 0 1px var(--accent-ink), inset 0 1px 2px var(--enfonce), inset 0 -1px 0 var(--arete) !important; }
.reg-demo__consulter { justify-self: end; font-size: .82rem; color: var(--ink-3); }

/* --- Scène 2 : la télédéclaration --- */
.scene-decl { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
.decl-demo__gauche { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.decl-demo__titre { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.decl-demo__titre b { display: block; font-family: 'Manrope', system-ui, sans-serif; font-size: .98rem; font-weight: 700; letter-spacing: -0.02em; }
.decl-demo__titre span { font-size: .78rem; color: var(--ink-3); }

.agent-etat { display: flex; align-items: center; gap: 11px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--retrait); transition: background var(--t-etat) var(--pose); }
.agent-etat--actif { background: var(--agent-wash); }
.agent-etat--fini { background: var(--ok-wash); }
.agent-etat .pastille { background: var(--ink-3); }
.agent-etat--actif .pastille { background: var(--agent); animation: pulse 1.5s cubic-bezier(.4,0,.6,1) infinite; }
.agent-etat--fini .pastille { background: var(--ok); }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(46,143,214,.5); }
  50%      { opacity: .75; box-shadow: 0 0 0 6px rgba(46,143,214,0); }
}
.agent-etat__texte { font-size: .8rem; font-weight: 600; }
.agent-etat__detail { font-size: .76rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-etat > div { min-width: 0; }
.agent-etat__compte { margin-left: auto; font-size: .8rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.journal-demo { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.journal-demo .trace { padding: 7px 18px; animation: entree .28s cubic-bezier(.2,.8,.3,1) both; }
.trace--etape { background: var(--retrait-2); }
.trace--etape .trace__champ { color: var(--ink-2); }
.trace__marque--nav { background: var(--neutre); color: var(--ink-2); }
@keyframes entree { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.decl-demo__pied { border-top: 1px solid var(--line); padding: 12px 18px 14px; background: var(--surface); }
.validation-demo {
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 10px;
  padding: 9px 11px; border-radius: var(--r); border: 1px solid var(--line); background: var(--retrait);
  font-size: .78rem; line-height: 1.45; color: var(--ink-2);
}
.validation-demo svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--ink-3); }
.decl-demo__pied .btn { width: 100%; min-height: 48px; font-size: .96rem; }
.decl-demo__pied--attente .btn--primaire { animation: appeler 1.6s var(--pose) 2; }
/* L'appel reprend toute la pile d'ombres du bouton vert, arête comprise. */
@keyframes appeler {
  0%, 100% { box-shadow: 0 0 0 1px var(--navy-deep), inset 0 1px 0 rgba(255,255,255,.18), inset 0 -3px 0 var(--navy-deep), var(--e2), 0 0 0 0 rgba(234,144,16,0); }
  45% { box-shadow: 0 0 0 1px var(--navy-deep), inset 0 1px 0 rgba(255,255,255,.18), inset 0 -3px 0 var(--navy-deep), var(--e2), 0 0 0 6px rgba(234,144,16,.35); }
}

/* ---------- Hors système : le portail tiers reconstitué ----------
   Ces valeurs n'appartiennent pas à la charte. Elles imitent un autre
   système, administratif et daté, pour qu'on voie qu'on regarde « leur »
   formulaire et non notre outil. Ne pas les rapprocher des jetons. */
.portail-demo { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #DFE4E9; }
.portail-demo__url { display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: #CBD3DA; border-bottom: 1px solid #B4BEC7; font-size: .74rem; color: #445466; }
.portail-demo__url span:last-child { flex: 1; min-width: 0; background: #fff; border: 1px solid #B4BEC7; border-radius: 3px; padding: 2px 8px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portail-demo__page { flex: 1; min-height: 0; overflow: hidden; background: #eef0f3; color: #1a1a1a; font-family: Tahoma, Arial, 'Helvetica Neue', sans-serif; font-size: 12px; line-height: 1.45; }
.portail-demo__sim { background: #7a2e2e; color: #fff; padding: 4px 10px; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; text-align: center; font-weight: bold; }
.portail-demo__gov { background: #1F4E79; color: #fff; padding: 9px 14px; }
.portail-demo__gov b { display: block; font-size: 13px; }
.portail-demo__gov span { font-size: 10.5px; opacity: .9; }
.portail-demo__corps { padding: 12px 14px; }
.p-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin-bottom: 10px; }
.p-steps li { list-style: none; background: #d5dbe3; color: #4a5462; padding: 5px 4px; text-align: center; font-size: 10px; line-height: 1.25; border-bottom: 3px solid #b6bfcb; overflow: hidden; }
.p-steps li b { display: block; font-size: 12.5px; }
.p-steps li.fait { background: #e3eaf2; color: #1F4E79; border-bottom-color: #5a83aa; }
.p-steps li.actif { background: #fff; color: #1F4E79; border-bottom-color: #1F4E79; }
.p-panel { background: #fff; border: 1px solid #b6bfcb; }
.p-panel h4 { margin: 0; padding: 7px 12px; background: #f1f4f8; border-bottom: 1px solid #b6bfcb; font-size: 12px; color: #153A5C; font-weight: bold; }
.p-champs { padding: 10px 12px 2px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.p-fld { margin-bottom: 9px; min-width: 0; }
.p-fld--large { grid-column: 1 / -1; }
.p-fld label { display: block; margin-bottom: 3px; font-size: 11px; font-weight: bold; color: #333; }
.p-fld label i { color: #a11; font-style: normal; }
.p-fld div { min-height: 25px; padding: 4px 7px; border: 1px solid #98a4b3; background: #fff; font-size: 12px; color: #111; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background 160ms, border-color 160ms; }
.p-fld.en-cours div { background: #eaf4fd; border-color: #3E8FD6; outline: 2px solid #3E8FD6; outline-offset: -1px; }
.p-fld.rempli div { background: #f5f9fc; border-color: #5a83aa; }
.p-actions { display: flex; justify-content: space-between; padding: 7px 12px; background: #f1f4f8; border-top: 1px solid #b6bfcb; }
.p-actions span { padding: 3px 11px; border: 1px solid #1F4E79; font-size: 11.5px; }
.p-actions span:first-child { color: #1F4E79; background: #fff; }
.p-actions span:last-child { color: #fff; background: #1F4E79; }

/* --- Scène 3 : le récépissé --- */
.scene-recu { display: grid; place-items: center; padding: var(--s6); overflow: hidden; }
.recu-demo { width: min(560px, 100%); box-shadow: 0 0 0 1px var(--line), var(--e4), var(--lueur); }
.recu-demo .recu__bandeau { padding: 22px 26px; gap: 18px; animation: poser-court 260ms var(--pose) both; }
.recu-demo .sceau { width: 56px; height: 56px; animation: sceller 380ms 60ms var(--pose) both; }
.recu-demo .sceau svg { width: 26px; height: 26px; }
.recu-demo .recu__titre { font-size: 1.28rem; }
.recu-demo .recu__sous { font-size: .86rem; }
.recu-demo .recu__corps { padding: 20px 26px 18px; }
.recu-demo .cachet { font-size: 1.6rem; padding: 16px; margin-bottom: 12px; animation: reveler-numero 420ms 110ms var(--pose) both; }
.recu-demo .recu__ligne { font-size: .88rem; animation: poser-court 240ms var(--pose) both; }
.recu-demo .recu__ligne:nth-child(2) { animation-delay: 180ms; }
.recu-demo .recu__ligne:nth-child(3) { animation-delay: 215ms; }
.recu-demo .recu__ligne:nth-child(4) { animation-delay: 250ms; }
.recu-demo .recu__ligne:nth-child(n+5) { animation-delay: 285ms; }
.archives { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); list-style: none; display: grid; gap: 5px; animation: poser-court 260ms 300ms var(--pose) both; }
.archives li { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: .8rem; color: var(--ink-2); background: var(--retrait-2); border: 1px solid var(--line-soft); border-radius: var(--r); }
.archives svg { width: 15px; height: 15px; color: var(--ok); flex: none; }
@keyframes poser-court { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes sceller { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
@keyframes reveler-numero { from { opacity: 0; transform: translateY(5px); letter-spacing: .16em; } to { opacity: 1; transform: none; letter-spacing: .06em; } }

/* --- Le voile d'attente --- */
/* L'attente tient dans une bande pleine au pied du cadre : le registre reste
   visible au-dessus, sur son papier, et rien ne transparaît sous la légende. */
.lecteur__voile {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s5);
  padding: var(--s5) var(--s7);
  color: #fff;
  background:
    radial-gradient(50% 140% at 0% 0%, rgba(198,138,33,.14) 0%, transparent 60%),
    linear-gradient(172deg, var(--navy-soft) 0%, var(--navy) 50%, var(--navy-deep) 100%);
  box-shadow: 0 -1px 0 rgba(13,31,22,.45), 0 -14px 32px rgba(13,31,22,.16);
  transition: opacity 300ms var(--pose), visibility 0s linear 300ms;
}
.lecteur__voile[data-cache] { opacity: 0; visibility: hidden; }
.lecteur__voile-marque { width: 36px; height: 36px; color: var(--or-vif); }
.lecteur__voile-titre {
  color: #fff; font-family: 'Manrope', system-ui, sans-serif; font-weight: 800;
  font-size: 1.14rem; line-height: 1.22; letter-spacing: -0.022em;
}
.lecteur__voile-note { margin-top: 3px; font-size: .86rem; line-height: 1.45; color: var(--sur-navy); }
.lecteur__voile .btn--action { min-height: 56px; padding: 0 26px 3px; font-size: 1.0625rem; }
.lecteur__voile .btn--action svg { width: 20px; height: 20px; }
/* Avant le lancement, le registre se resserre pour ne rien cacher sous la bande. */
@media (max-width: 1180px) {
  .lecteur:not(.lecteur--lance) .reg-demo__ligne:nth-child(n+6) { display: none; }
}

/* --- Sous-titres et chapitres --- */
.lecteur__sous-titre {
  min-height: 3.2em; margin-top: var(--s5);
  display: flex; align-items: flex-start; justify-content: center; text-align: center;
  font-size: 1.02rem; color: var(--sur-navy); max-width: 50rem; margin-inline: auto;
}
.lecteur__commandes { margin-top: var(--s4); display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.chapitres { list-style: none; flex: 1; min-width: 280px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); counter-reset: chap; }
.chapitres li { counter-increment: chap; font-size: .82rem; color: var(--sur-navy-3); padding-top: 10px; position: relative; }
.chapitres li::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px; background: rgba(255,255,255,.16); }
.chapitres li::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px; background: var(--sur-navy); transform: scaleX(0); transform-origin: left center; transition: transform 400ms var(--pose); }
.chapitres li.fait { color: var(--sur-navy); }
.chapitres li.fait::after { transform: scaleX(1); }
.chapitres li.en-cours { color: #fff; font-weight: 600; }
.chapitres li.en-cours::after { transform: scaleX(.5); background: var(--accent-clair); }
.lecteur__boutons { display: flex; gap: var(--s2); }
.lecteur__apres { margin-top: var(--s8); display: flex; justify-content: center; }

@media (max-width: 860px) {
  .lecteur__cadre { height: 700px; }
  .scene-registre { padding: var(--s5) var(--s4); }
  .reg-demo__cols { display: none; }
  .reg-demo__ligne { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "code etat" "nom nom" "regime action"; row-gap: 6px; }
  .reg-demo__ligne > :nth-child(1) { grid-area: etat; justify-self: end; }
  .reg-demo__ligne > :nth-child(2) { grid-area: code; }
  .reg-demo__ligne > :nth-child(3) { grid-area: nom; }
  .reg-demo__ligne > :nth-child(4) { grid-area: regime; }
  .reg-demo__ligne > :nth-child(5) { grid-area: action; }
  .lecteur__cadre { height: 780px; }
  .lecteur__voile { grid-template-columns: auto minmax(0, 1fr); gap: var(--s3) var(--s4); padding: var(--s4); }
  .lecteur__voile .btn--action { grid-column: 1 / -1; width: 100%; }
  .lecteur__voile-marque { width: 30px; height: 30px; }
  .scene-decl { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 380px; }
  .portail-demo__gov span { display: none; }
  .validation-demo { font-size: .74rem; padding: 7px 10px; }
  .decl-demo__gauche { border-right: 0; border-bottom: 1px solid var(--line); }
  .decl-demo__titre { display: none; }
  .p-champs { grid-template-columns: minmax(0, 1fr); }
  .p-steps li { font-size: 0; padding: 4px 2px; }
  .p-steps li b { font-size: 12px; }
  .chapitres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lecteur__barre span { display: none; }
}
@media (max-width: 480px) {
  .recu-demo .recu__bandeau { padding: 16px; gap: 12px; }
  .recu-demo .recu__corps { padding: 14px 16px; }
  .recu-demo .cachet { font-size: 1.2rem; }
  .recu-demo .recu__titre { font-size: 1.05rem; }
}

/* Mouvement réduit : la pastille continue de battre, en opacité seule.
   Un « en cours » qui ne se distingue plus d'un état figé est une régression. */
@media (prefers-reduced-motion: reduce) {
  .agent-etat--actif .pastille { animation: pulse-sobre 2s ease-in-out infinite !important; }
  @keyframes pulse-sobre { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
}
