/* Écran de reconnexion du circuit Blazor.
 *
 * Blazor pilote cet écran en posant des classes sur #components-reconnect-modal. Il n'y a
 * aucun code applicatif derrière : le circuit est justement coupé au moment où l'écran
 * s'affiche, donc rien de C# ne peut s'exécuter. Le contenu est écrit et traduit au prérendu
 * dans App.razor, et c'est le CSS seul qui décide de l'état visible.
 *
 *   (aucune classe)                  circuit vivant, rien ne s'affiche
 *   .components-reconnect-show       connexion perdue, tentatives en cours
 *   .components-reconnect-failed     tentatives épuisées, un geste est demandé
 *   .components-reconnect-rejected   circuit jeté par le serveur, rechargement obligatoire
 */

#components-reconnect-modal {
  display: none;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(26, 23, 18, 0.55);
  backdrop-filter: blur(3px);
}

.reconnexion-panneau {
  background: #ece4d4;
  color: #1a1712;
  border-top: 4px solid #a31d2c;
  border-radius: 4px;
  box-shadow: 0 18px 48px rgba(26, 23, 18, 0.32);
  padding: 1.9rem 2rem;
  max-width: 26rem;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.reconnexion-titre {
  font-family: "Lora", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
  color: #a31d2c;
}

.reconnexion-texte {
  margin: 0;
  color: #5c5347;
  line-height: 1.6;
}

.reconnexion-essai {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #8a7f6e;
}

.reconnexion-action {
  font: inherit;
  font-weight: 600;
  color: #fdfbf6;
  background: #a31d2c;
  border: none;
  border-radius: 3px;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  align-self: center;
  margin-top: 0.3rem;
}

.reconnexion-action:hover {
  background: #8a1825;
}

.reconnexion-action:focus-visible {
  outline: 2px solid #8b6f3d;
  outline-offset: 3px;
}

/* Chaque état ne montre que son propre bloc. */
.reconnexion-etat {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.components-reconnect-show .reconnexion-etat-attente,
.components-reconnect-failed .reconnexion-etat-echec,
.components-reconnect-rejected .reconnexion-etat-expire {
  display: flex;
}

/* Sablier discret pendant les tentatives. */
.reconnexion-jauge {
  height: 3px;
  border-radius: 3px;
  background: rgba(163, 29, 44, 0.18);
  overflow: hidden;
}

.reconnexion-jauge::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: #a31d2c;
  animation: reconnexion-va-et-vient 1.5s ease-in-out infinite;
}

@keyframes reconnexion-va-et-vient {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  .reconnexion-jauge::after {
    animation: none;
    width: 100%;
  }
}
