/* Animation de chargement : une petite bougie dont la flamme vacille.
   Feuille autonome, chargée dans <head> avant tout le reste : elle s'affiche
   dès l'ouverture de la page, avant même que le site ne démarre, puis le
   composant <Chargement> la réutilise pendant le chargement des données. */

.chargement {
  display: grid;
  place-items: center;
  min-height: 60vh;
  padding: 3rem 1rem;
}

.chargement__bougie {
  position: relative;
  display: block;
  width: 34px;
  height: 78px;
}

/* Halo chaud autour de la flamme */
.chargement__bougie::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 2px;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(232 176 92 / 0.28), rgb(232 176 92 / 0) 68%);
  animation: chargement-halo 2.4s ease-in-out infinite;
}

.chargement__flamme {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 14px;
  height: 24px;
  margin-left: -7px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 78%, #fff6dc 0 22%, #f4c46a 46%, #d98b33 78%, rgb(217 139 51 / 0) 100%);
  transform-origin: 50% 90%;
  animation: chargement-flamme 1.6s ease-in-out infinite;
}

.chargement__meche {
  position: absolute;
  left: 50%;
  top: 30px;
  width: 2px;
  height: 7px;
  margin-left: -1px;
  border-radius: 1px;
  background: #3a2f22;
}

.chargement__cire {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 0;
  height: 42px;
  border-radius: 5px 5px 7px 7px;
  background: linear-gradient(90deg, #e9e1d2, #f8f4ec 45%, #ddd3c0);
  box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .chargement__cire {
    background: linear-gradient(90deg, #4a443a, #6a6255 45%, #3d382f);
    box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.12);
  }
}

:root[data-theme='dark'] .chargement__cire {
  background: linear-gradient(90deg, #4a443a, #6a6255 45%, #3d382f);
  box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.12);
}

/* Texte réservé aux lecteurs d'écran */
.chargement__texte {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@keyframes chargement-flamme {
  0%, 100% { transform: scale(1, 1) rotate(-1.5deg); opacity: 0.95; }
  25% { transform: scale(0.94, 1.08) rotate(2deg); opacity: 1; }
  50% { transform: scale(1.04, 0.95) rotate(-2.5deg); opacity: 0.9; }
  75% { transform: scale(0.97, 1.05) rotate(1.5deg); opacity: 1; }
}

@keyframes chargement-halo {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.12); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chargement__flamme,
  .chargement__bougie::before {
    animation-duration: 4s;
    animation-name: chargement-halo;
  }
}

/* Avant le démarrage du site : le résumé destiné aux moteurs de recherche
   reste dans la page, mais seule l'animation est montrée aux visiteurs. Sans
   JavaScript (la classe « js » est posée par theme.js), c'est l'inverse. */
.chargement--initial { display: none; }
html.js .chargement--initial { display: grid; }
html.js .seo-resume { display: none; }
