/* ============================================================
   IdentiBien — mise en mouvement de la page d'accueil
   Pilotée par js/accueil-mouvement.js. Chaque bloc respecte la
   préférence « réduire les animations » : l'état final, sans
   mouvement, porte le même message.
   ============================================================ */

/* ---------- Défilement doux vers les ancres ----------
   « Comment ça marche ? » glissait d'un coup jusqu'à la section : un
   raccord sec au premier clic du visiteur. Le glissement relie les deux
   endroits de la page. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
section[id] { scroll-margin-top: 12px; }

/* ---------- Boutons : la flèche avance au survol ---------- */
.fleche {
  display: inline-block;
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.bouton:hover .fleche,
.bouton:focus-visible .fleche { transform: translateX(4px); }


/* ============================================================
   Carte du héro : un résultat qui se construit sous les yeux
   ------------------------------------------------------------
   Chaque ligne passe de « en cours » à « trouvé », puis l'adresse se
   découvre. La séquence se joue UNE fois et reste sur le résultat :
   le titre voisin doit pouvoir se lire sans qu'une boucle tire l'œil.
   ============================================================ */

.etat { display: inline-grid; justify-items: end; }
.etat > span { grid-area: 1 / 1; white-space: nowrap; }
.etat-ok { opacity: 0; }

/* Libellé d'attente : un reflet le parcourt, signe qu'un calcul tourne. */
.etat-attente {
  font-weight: 600;
  color: transparent;
  background: linear-gradient(90deg, #98a2b6 0%, #98a2b6 38%, #dfe4ee 50%, #98a2b6 62%, #98a2b6 100%) 0 0 / 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: miroitement 1.15s linear infinite;
}
@keyframes miroitement { from { background-position: 100% 0; } to { background-position: 0 0; } }

.etat-commune { --quand: 1s; }
.etat-caracteristiques { --quand: 1.6s; }

.carte-sequence.joue .etat-attente {
  animation: miroitement 1.15s linear infinite, etat-sort 0.26s ease-in var(--quand) both;
}
.carte-sequence.joue .etat-ok {
  animation: etat-entre 0.36s cubic-bezier(0.2, 0.8, 0.3, 1.2) calc(var(--quand) + 0.1s) both;
}
@keyframes etat-sort { to { opacity: 0; transform: translateY(-7px); } }
@keyframes etat-entre { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* L'adresse : flou + cache rayé au départ, balayés de gauche à droite.
   Remplace la boucle de 9 s de la page actuelle. */
.carte-sequence .adresse-vraie { animation: none; filter: blur(4px); }
.carte-sequence .adresse-cache { animation: none; }
.carte-sequence.joue .adresse-vraie { animation: nettete 0.6s ease-out 2.2s both; }
.carte-sequence.joue .adresse-cache { animation: balayage 0.62s cubic-bezier(0.65, 0, 0.35, 1) 2.2s both; }
@keyframes nettete { from { filter: blur(4px); } to { filter: blur(0); } }
@keyframes balayage { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }

/* Un reflet traverse le bandeau final : la carte a fini, voici le livrable. */
.carte-sequence .carte-demo-cta { position: relative; overflow: hidden; }
.carte-sequence .carte-demo-cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  transform: translateX(-110%);
}
.carte-sequence.joue .carte-demo-cta::after { animation: reflet 0.95s ease-in-out 2.95s both; }
@keyframes reflet { to { transform: translateX(110%); } }


/* ============================================================
   « Comment ça marche » : démonstration guidée
   ------------------------------------------------------------
   La cinématique n'est plus un fond voilé : en fond, son point
   d'arrivée (parcelle, marqueur) tombait exactement derrière la carte
   de l'étape 2, et le compteur, qui porte le message, était masqué.
   Elle est cadrée à droite, les étapes à gauche s'allument à son
   rythme.
   ============================================================ */

.demonstration {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2.6rem;
  align-items: center;
  margin-top: 2.4rem;
}

/* ---------- Le rail des étapes ---------- */
.etapes-rail { position: relative; }
.etapes-liste { list-style: none; margin: 0; padding: 0; }

/* Un seul surlignage qui GLISSE d'une étape à l'autre, plutôt que trois
   cartes qui s'allument et s'éteignent : l'œil suit un objet, il ne saute
   pas entre trois. */
.etapes-rail-surlignage {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  z-index: 0;
  border-radius: 14px;
  background: #eef3ff;
  box-shadow: inset 0 0 0 1px #d6e2fb;
  transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1), height 0.6s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.etapes-rail-surlignage.sans-transition { transition: none; }

.etapes-rail-piste {
  position: absolute;
  width: 2px;
  margin-left: -1px;
  z-index: 1;
  border-radius: 2px;
  background: var(--bordure);
}
.etapes-rail-fil {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
}
.rail-saut .etapes-rail-fil { transition: transform 0.45s cubic-bezier(0.3, 0.7, 0.2, 1); }

.etape-rail {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 1rem;
  padding: 1.05rem 1.15rem;
  border-radius: 14px;
  cursor: pointer;
}
.etape-rail + .etape-rail { margin-top: 0.35rem; }
.etape-rail h3 { grid-column: 2; margin: 0.5rem 0 0.3rem; font-size: 1.08rem; }
.etape-rail p { grid-column: 2; margin: 0; font-size: 0.95rem; }
.etape-rail h3 button {
  all: unset;
  cursor: pointer;
}
.etape-rail h3 button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.etape-rail:hover h3 { color: var(--accent-fonce); }

/* Pastille : numéro, puis coche une fois l'étape franchie. Sans script,
   elle garde l'aspect de la page actuelle (bleu nuit, numéro blanc). */
.etape-pastille {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--encre);
  background: var(--encre);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  transition: background 0.35s, border-color 0.35s, color 0.35s;
}
.etape-pastille > span {
  grid-area: 1 / 1;
  transition: opacity 0.25s, transform 0.4s cubic-bezier(0.2, 0.8, 0.3, 1.3);
}
.etape-pastille-ok { opacity: 0; transform: scale(0.4); }

.etape-rail[data-etat="a-venir"] .etape-pastille { background: #fff; border-color: var(--bordure); color: #8792a8; }
.etape-rail[data-etat="en-cours"] .etape-pastille { background: var(--accent); border-color: var(--accent); color: #fff; }
.etape-rail[data-etat="fait"] .etape-pastille-num { opacity: 0; transform: scale(0.4); }
.etape-rail[data-etat="fait"] .etape-pastille-ok { opacity: 1; transform: none; }

/* Halo de l'étape en cours. */
.etape-pastille::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.etape-rail[data-etat="en-cours"] .etape-pastille::after { animation: halo 1.8s ease-out infinite; }
@keyframes halo {
  0% { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* ---------- La scène ---------- */
.scene-cadre { position: relative; }

.scene-demo {
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  border: 1px solid var(--bordure);
  box-shadow: 0 24px 60px rgba(22, 35, 59, 0.16), 0 2px 6px rgba(22, 35, 59, 0.06);
}

.scene-voile {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #dfe7f5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.23s ease;
}
.scene-fondu .scene-voile { opacity: 1; }

.scene-controle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 40px;
  min-width: 40px;
  padding: 0 0.6rem;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(22, 35, 59, 0.12);
  background: rgba(255, 255, 255, 0.95);
  color: var(--encre);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(22, 35, 59, 0.12);
  transition: background 0.2s, box-shadow 0.2s;
}
.scene-controle:hover { background: #fff; box-shadow: 0 6px 18px rgba(22, 35, 59, 0.18); }
.scene-controle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scene-controle-icone { display: inline-flex; }
.scene-controle svg { width: 18px; height: 18px; fill: currentColor; }
/* Icône dessinée au trait (« Revoir ») : sans cette règle, le remplissage
   ci-dessus l'emporte sur l'attribut fill="none" et la flèche devient une tache. */
.scene-controle svg.icone-trait { fill: none; }
.scene-controle-texte:empty { display: none; }
.scene-controle[data-etat="fin"] { padding: 0 0.85rem 0 0.7rem; }

/* ---------- Surimpressions de la scène pilotée ---------- */

/* L'annonce collée par le visiteur : son lien, et ce qu'on y a lu. */
.cine-annonce {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  width: min(19rem, calc(100% - 82px));
  padding: 0.6rem 0.7rem 0.68rem;
  border-radius: 12px;
  border: 1px solid #dde3ef;
  background: #fff;
  box-shadow: 0 10px 30px rgba(22, 35, 59, 0.16);
  opacity: 0;
  pointer-events: none;
}
.cine-annonce-lien {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
  border: 1px solid #dde3ef;
  background: #f4f6fb;
  color: #16233b;
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
}
.cine-annonce-lien svg { width: 14px; height: 14px; flex: 0 0 auto; color: #2563eb; }
.cine-annonce-url {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.7rem;
}
.cine-annonce-curseur {
  flex: 0 0 auto;
  width: 1.5px;
  height: 0.95em;
  background: #2563eb;
}
.cine-annonce-lu {
  margin: 0.5rem 0 0.32rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f9d58;
}
.cine-annonce-lu::before { content: '✓ '; }
.cine-annonce-puces { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cine-annonce-puces span {
  display: inline-block;
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
  background: #eef3ff;
  color: #1d4ed8;
  font-size: 0.74rem;
  font-weight: 600;
  opacity: 0;
}

/* Compteur en bas à gauche, fiche en bas à droite : ils ne se croisent
   jamais, et le marqueur, au centre, reste dégagé. */
.cine-hote.cine-pilotee .cine-panneau {
  top: auto;
  right: auto;
  left: 16px;
  bottom: 14px;
  transition: none;
}
.cine-hote.cine-pilotee .cine-fiche {
  top: auto;
  left: auto;
  right: 14px;
  bottom: 14px;
  margin: 0;
  width: 16.5rem;
  max-width: calc(100% - 28px);
  padding: 0.8rem 1rem 0.7rem;
  transform-origin: bottom right;
}
.cine-hote.cine-pilotee .cine-fiche-adresse { font-size: 1.12rem; }
.cine-hote.cine-pilotee .cine-fiche-detail { font-size: 0.84rem; }

/* Format étroit (scène carrée) : en haut à gauche, la carte annonce couvrait
   Rennes, c'est-à-dire l'amas que le premier critère laisse seul en bleu. Elle
   passe en bas, sur toute la largeur (ses puces tiennent sur une ligne), et le
   compteur monte en haut à gauche : il ne croise ainsi ni la carte au début,
   ni la fiche à la fin. */
.cine-hote.cine-pilotee.cine-etroite .cine-annonce {
  top: auto;
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: auto;
}
/* Le compteur s'arrête avant le milieu de la scène : la punaise tombe dans
   l'axe central, et un compteur pleine largeur se faisait traverser au début
   de sa chute, alors qu'il affiche encore « 1 ». */
.cine-hote.cine-pilotee.cine-etroite .cine-panneau { left: 12px; top: 12px; bottom: auto; max-width: calc(50% - 34px); }
.cine-hote.cine-pilotee.cine-etroite .cine-fiche {
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: auto;
  transform-origin: bottom center;
}

/* ---------- Bandeau de chapitres (téléphone et tablette) ---------- */
.scene-chapitres { display: none; }

/* ---------- Disposition sur écran étroit ---------- */
@media (max-width: 860px) {
  .demonstration { grid-template-columns: 1fr; gap: 1.2rem; }
  .scene-cadre { order: -1; }
  .scene-chapitres { display: block; margin-top: 0.8rem; }
  .scene-chapitres-barres { display: flex; gap: 5px; }
  .scene-chapitres-barres span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--bordure);
  }
  .scene-chapitres-barres i {
    display: block;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
  }
  .scene-chapitres-titre {
    margin-top: 0.45rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--encre);
  }
  .scene-chapitres-titre.change { animation: titre-chapitre 0.4s ease-out; }
}
@keyframes titre-chapitre { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .scene-demo { aspect-ratio: 1 / 1; }
  .etape-rail { padding: 0.9rem 0.8rem; column-gap: 0.85rem; }
  .scene-controle { height: 44px; min-width: 44px; }
}


/* ============================================================
   Apparitions au défilement (tarifs)
   ============================================================ */

.apparitions-actives [data-apparition] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.apparitions-actives [data-apparition].est-apparu { opacity: 1; transform: none; }


/* ============================================================
   FAQ : la réponse se déplie au lieu d'apparaître d'un bloc
   Le « + » pivote et devient « – » : un seul trait qui tourne,
   au lieu d'un caractère remplacé par un autre.
   Navigateurs récents seulement ; les autres ouvrent d'un coup,
   comme aujourd'hui.
   ============================================================ */

.faq-item summary { padding-right: 3rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before,
.faq-item summary::after,
.faq-item[open] summary::after {
  content: '';
  position: absolute;
  right: 1.25rem;
  top: 50%;
  width: 14px;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--accent);
  transition: transform 0.32s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.faq-item summary::after { transform: rotate(90deg); }
.faq-item[open] summary::after { transform: rotate(180deg); }

@media (prefers-reduced-motion: no-preference) {
  @supports (interpolate-size: allow-keywords) {
    .faq-item { interpolate-size: allow-keywords; }
    .faq-item::details-content {
      block-size: 0;
      overflow-y: clip;
      transition: block-size 0.36s cubic-bezier(0.3, 0.7, 0.2, 1), content-visibility 0.36s allow-discrete;
    }
    .faq-item[open]::details-content { block-size: auto; }
  }
}


/* ============================================================
   Préférence « réduire les animations » : état final, immobile
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fleche { transition: none; }
  .carte-sequence .etat-attente { display: none; }
  .carte-sequence .etat-ok,
  .carte-sequence.joue .etat-ok { opacity: 1; animation: none; }
  .carte-sequence .adresse-vraie,
  .carte-sequence.joue .adresse-vraie { filter: none; animation: none; }
  .carte-sequence .adresse-cache,
  .carte-sequence.joue .adresse-cache { display: none; }
  .carte-sequence .carte-demo-cta::after { display: none; }
  .etapes-rail-surlignage,
  .etape-pastille,
  .etape-pastille > span { transition: none; }
  .etape-rail[data-etat="en-cours"] .etape-pastille::after { animation: none; }
  .scene-chapitres-titre.change { animation: none; }
  .faq-item summary::before,
  .faq-item summary::after { transition: none; }
}
