@charset "UTF-8";
/* ==========================================================================
   Article « Ramonage : ce que le maire peut vous imposer »
   Visuels et animations sur mesure (motion design)
   ========================================================================== */

.maire {
  --maire-bleu: #2B4C7E;
  --maire-bleu-pale: #E8EEF7;
  --maire-rouge: #D6323F;
  --maire-vert: #0F766E;
  --maire-papier: #FFFDF8;
}

.maire .prose {
  max-width: 720px;
}

.maire__section {
  margin-top: 20px;
}

.maire__surtitre {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Apparition au défilement
   -------------------------------------------------------------------------- */
.maire.anime-ok [data-apparition] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.maire.anime-ok [data-apparition].est-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   1. Scène d'ouverture : de la mairie au conduit
   -------------------------------------------------------------------------- */
.maire-scene {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(180deg, #CFE6F5 0%, #EAF4FA 62%, #F6F2EA 62%, #F6F2EA 100%);
}

.maire-scene > svg {
  display: block;
  width: 100%;
  height: auto;
}

.maire-scene__legende {
  position: absolute;
  left: 18px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(21, 23, 27, 0.82);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
}

.maire-scene__legende svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.maire-scene__legende span {
  display: inline-block;
  min-width: 190px;
}

/* Drapeau qui flotte */
.ms-drapeau {
  transform-origin: 0 50%;
  animation: ms-flotte 2.4s ease-in-out infinite;
}

@keyframes ms-flotte {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50%      { transform: skewY(-4deg) scaleX(0.92); }
}

/* Nuages */
.ms-nuage { animation: ms-nuage 28s linear infinite; }
.ms-nuage--2 { animation-duration: 40s; animation-delay: -12s; }

@keyframes ms-nuage {
  from { transform: translateX(-160px); }
  to   { transform: translateX(860px); }
}

/* L'arrêté part de la mairie et rejoint la maison (cycle de 10 s) */
.ms-arrete {
  animation: ms-arrete 10s cubic-bezier(0.45, 0, 0.25, 1) infinite;
}

@keyframes ms-arrete {
  0%, 6%   { transform: translate(0, 0) rotate(0deg) scale(0.6); opacity: 0; }
  10%      { transform: translate(0, -10px) rotate(-4deg) scale(1); opacity: 1; }
  30%      { transform: translate(190px, -70px) rotate(8deg) scale(1); opacity: 1; }
  40%, 48% { transform: translate(330px, 4px) rotate(0deg) scale(1); opacity: 1; }
  56%      { transform: translate(330px, 4px) rotate(0deg) scale(0.9); opacity: 0; }
  100%     { transform: translate(330px, 4px) scale(0.9); opacity: 0; }
}

/* Tampon « ARRÊTÉ » */
.ms-tampon {
  transform-origin: 50% 50%;
  animation: ms-tampon 10s ease-out infinite;
}

@keyframes ms-tampon {
  0%, 38%  { transform: scale(2.4); opacity: 0; }
  42%      { transform: scale(0.92); opacity: 1; }
  45%, 52% { transform: scale(1); opacity: 1; }
  57%, 100%{ transform: scale(1); opacity: 0; }
}

/* Le hérisson descend dans le conduit puis remonte */
.ms-herisson {
  animation: ms-herisson 10s ease-in-out infinite;
}

@keyframes ms-herisson {
  0%, 54%  { transform: translateY(-40px); opacity: 0; }
  58%      { transform: translateY(0); opacity: 1; }
  70%      { transform: translateY(96px); opacity: 1; }
  80%      { transform: translateY(0); opacity: 1; }
  84%, 100%{ transform: translateY(-40px); opacity: 0; }
}

.ms-cable {
  transform-origin: 50% 0;
  animation: ms-cable 10s ease-in-out infinite;
}

@keyframes ms-cable {
  0%, 54%  { transform: scaleY(0); opacity: 0; }
  58%      { transform: scaleY(0.06); opacity: 1; }
  70%      { transform: scaleY(1); opacity: 1; }
  80%      { transform: scaleY(0.06); opacity: 1; }
  84%, 100%{ transform: scaleY(0); opacity: 0; }
}

/* La suie disparaît du conduit pendant le ramonage */
.ms-suie {
  animation: ms-suie 10s ease-in-out infinite;
}

@keyframes ms-suie {
  0%, 60%  { opacity: 1; }
  76%, 94% { opacity: 0; }
  100%     { opacity: 1; }
}

/* Fumée : noire avant, claire après */
.ms-fumee circle {
  animation: ms-fumee 3s ease-out infinite;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.ms-fumee circle:nth-child(2) { animation-delay: -1s; }
.ms-fumee circle:nth-child(3) { animation-delay: -2s; }

@keyframes ms-fumee {
  0%   { transform: translate(0, 0) scale(0.5); opacity: 0; }
  20%  { opacity: 0.9; }
  100% { transform: translate(18px, -70px) scale(1.8); opacity: 0; }
}

.ms-fumee--sale  { animation: ms-sale 10s step-end infinite; }
.ms-fumee--propre{ animation: ms-propre 10s step-end infinite; }

@keyframes ms-sale   { 0% { opacity: 1; } 78% { opacity: 0; } 98% { opacity: 1; } }
@keyframes ms-propre { 0% { opacity: 0; } 78% { opacity: 1; } 98% { opacity: 0; } }

/* Coche finale « Conforme » */
.ms-conforme {
  animation: ms-conforme 10s ease-out infinite;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

@keyframes ms-conforme {
  0%, 80%  { transform: scale(0); opacity: 0; }
  84%      { transform: scale(1.15); opacity: 1; }
  87%, 96% { transform: scale(1); opacity: 1; }
  100%     { transform: scale(1); opacity: 0; }
}

/* Fenêtre qui s'allume dans la maison */
.ms-fenetre {
  animation: ms-fenetre 10s step-end infinite;
}

@keyframes ms-fenetre { 0% { fill: #D9E2EA; } 84% { fill: #FDBA74; } 99% { fill: #D9E2EA; } }

/* --------------------------------------------------------------------------
   2. Les trois niveaux de règles (empilement)
   -------------------------------------------------------------------------- */
.maire-niveaux {
  display: grid;
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.maire-niveau {
  position: relative;
  --decalage: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--trait);
  border-radius: 18px;
  background: var(--blanc);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.maire.anime-ok .maire-niveau {
  opacity: 0;
  transform: translateX(-36px);
}

.maire.anime-ok .maire-niveaux.est-visible .maire-niveau {
  opacity: 1;
  transform: none;
}

.maire-niveaux.est-visible .maire-niveau:nth-child(2) { transition-delay: 0.25s; }
.maire-niveaux.est-visible .maire-niveau:nth-child(3) { transition-delay: 0.5s; }

.maire-niveau:nth-child(1) { margin-right: 0; }
.maire-niveau:nth-child(2) { margin-left: 18px; }
.maire-niveau:nth-child(3) { margin-left: 36px; border: 2px solid var(--accent); background: var(--orange-pale); }

.maire-niveau__echelle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--maire-bleu-pale);
}

.maire-niveau:nth-child(3) .maire-niveau__echelle { background: var(--blanc); }

.maire-niveau__titre {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--encre);
}

.maire-niveau__texte {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--texte);
}

.maire-niveau__badge {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--encre);
  color: var(--blanc);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Icônes qui se dessinent */
.trace path,
.trace rect,
.trace circle,
.trace line,
.trace polyline {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 1.4s ease;
}

.est-visible .trace path,
.est-visible .trace rect,
.est-visible .trace circle,
.est-visible .trace line,
.est-visible .trace polyline {
  stroke-dashoffset: 0;
}

/* --------------------------------------------------------------------------
   3. Les pouvoirs du maire (cartes animées)
   -------------------------------------------------------------------------- */
.maire-pouvoirs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.maire-pouvoir {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--trait);
  border-radius: 18px;
  background: var(--blanc);
}

.maire-pouvoir__visuel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  background: var(--fond);
}

.maire-pouvoir__visuel svg {
  width: 150px;
  height: 120px;
  overflow: visible;
}

.maire-pouvoir__corps {
  padding: 16px 18px 18px;
}

.maire-pouvoir__titre {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}

.maire-pouvoir__texte {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--texte);
}

/* Carte 1 : le stylo signe l'arrêté */
.mp-signature path {
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
}

.est-visible .mp-signature path {
  animation: mp-signe 3.6s ease-in-out infinite;
}

@keyframes mp-signe {
  0%       { stroke-dashoffset: 160; }
  45%, 80% { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 160; }
}

.est-visible .mp-stylo {
  animation: mp-stylo 3.6s ease-in-out infinite;
}

@keyframes mp-stylo {
  0%       { transform: translate(0, 0); }
  15%      { transform: translate(14px, -4px); }
  30%      { transform: translate(30px, 3px); }
  45%, 80% { transform: translate(52px, -2px); }
  100%     { transform: translate(0, 0); }
}

/* Carte 2 : la loupe inspecte le conduit */
.est-visible .mp-loupe {
  animation: mp-loupe 4s ease-in-out infinite;
}

@keyframes mp-loupe {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(-18px, 26px); }
  66%      { transform: translate(10px, 46px); }
}

.est-visible .mp-periode rect {
  animation: mp-periode 4s ease-in-out infinite;
}

.mp-periode rect:nth-child(2) { animation-delay: 0.2s !important; }
.mp-periode rect:nth-child(3) { animation-delay: 0.4s !important; }

@keyframes mp-periode {
  0%, 100% { fill: #DCE3E8; }
  40%, 60% { fill: #FB923C; }
}

/* Carte 3 : la fissure se répare */
.mp-fissure {
  stroke-dasharray: 80;
}

.est-visible .mp-fissure {
  animation: mp-fissure 4.4s ease-in-out infinite;
}

@keyframes mp-fissure {
  0%, 15%  { stroke-dashoffset: 0; stroke: #D6323F; }
  55%, 85% { stroke-dashoffset: 80; stroke: #D6323F; }
  100%     { stroke-dashoffset: 0; stroke: #D6323F; }
}

.est-visible .mp-cle {
  transform-box: fill-box;
  transform-origin: 20% 80%;
  animation: mp-cle 4.4s ease-in-out infinite;
}

@keyframes mp-cle {
  0%, 15%, 100% { transform: rotate(0deg); }
  25%           { transform: rotate(-28deg); }
  35%           { transform: rotate(6deg); }
  45%           { transform: rotate(-28deg); }
  55%           { transform: rotate(0deg); }
}

/* --------------------------------------------------------------------------
   4. Le calendrier du ramonage (anneau des 12 mois)
   -------------------------------------------------------------------------- */
.maire-calendrier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 36px;
}

.maire-calendrier__anneau {
  flex: 0 0 auto;
  width: 260px;
  max-width: 100%;
}

.maire-calendrier__anneau svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.mc-progression {
  stroke-dasharray: 690.8;
  stroke-dashoffset: 690.8;
  transition: stroke-dashoffset 2.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.est-visible .mc-progression {
  stroke-dashoffset: 0;
}

.mc-repere {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transform: scale(0);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.est-visible .mc-repere { opacity: 1; transform: scale(1); }
.est-visible .mc-repere--1 { transition-delay: 1.1s; }
.est-visible .mc-repere--2 { transition-delay: 2.1s; }

.est-visible .mc-flamme {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: mc-flamme 1.2s ease-in-out infinite alternate;
}

@keyframes mc-flamme {
  from { transform: scaleY(1) scaleX(1); }
  to   { transform: scaleY(1.12) scaleX(0.92); }
}

.maire-calendrier__legende {
  flex: 1 1 260px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.maire-calendrier__legende li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texte);
}

.maire-calendrier__puce {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 999px;
}

/* --------------------------------------------------------------------------
   5. Sanction : la balance
   -------------------------------------------------------------------------- */
.maire-sanction {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 32px;
}

.maire-sanction__visuel {
  flex: 0 0 auto;
  width: 200px;
}

.maire-sanction__visuel svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.maire-sanction__texte {
  flex: 1 1 300px;
  min-width: 0;
}

.est-visible .mb-fleau {
  transform-origin: 100px 40px;
  animation: mb-fleau 5s ease-in-out infinite;
}

.est-visible .mb-plateau-g { animation: mb-plateau-g 5s ease-in-out infinite; }
.est-visible .mb-plateau-d { animation: mb-plateau-d 5s ease-in-out infinite; }

@keyframes mb-fleau     { 0%, 100% { transform: rotate(0deg); } 30%, 70% { transform: rotate(-10deg); } }
@keyframes mb-plateau-g { 0%, 100% { transform: translateY(0); } 30%, 70% { transform: translateY(14px); } }
@keyframes mb-plateau-d { 0%, 100% { transform: translateY(0); } 30%, 70% { transform: translateY(-14px); } }

/* --------------------------------------------------------------------------
   6. Liste de réflexes qui se coche
   -------------------------------------------------------------------------- */
.maire-reflexes {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.maire-reflexe {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--trait);
  border-radius: 14px;
  background: var(--blanc);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texte);
}

.maire-reflexe strong {
  color: var(--encre);
}

.maire-reflexe__case {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
}

.maire-reflexe__case rect {
  fill: var(--blanc);
  stroke: var(--gris-clair);
  stroke-width: 2;
  transition: fill 0.3s ease, stroke 0.3s ease;
}

.maire-reflexe__case path {
  fill: none;
  stroke: var(--blanc);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  transition: stroke-dashoffset 0.4s ease 0.15s;
}

.maire-reflexe.est-coche .maire-reflexe__case rect {
  fill: var(--maire-vert);
  stroke: var(--maire-vert);
}

.maire-reflexe.est-coche .maire-reflexe__case path {
  stroke-dashoffset: 0;
}

/* Sources */
.maire-sources {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.maire-sources li {
  padding: 8px 0;
  border-bottom: 1px solid var(--trait);
}

.maire-sources li:last-child {
  border-bottom: 0;
}

.maire-avertissement {
  margin-top: 12px;
  font-size: 14px;
  color: var(--discret);
}

/* --------------------------------------------------------------------------
   Mobile et mouvement réduit
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  .maire-niveau:nth-child(2),
  .maire-niveau:nth-child(3) {
    margin-left: 0;
  }

  .maire-niveau {
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 14px;
  }

  .maire-niveau__echelle {
    width: 48px;
    height: 48px;
  }

  .maire-scene__legende span {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maire [data-apparition],
  .maire-niveau {
    opacity: 1 !important;
    transform: none !important;
  }

  .maire *,
  .maire *::before,
  .maire *::after {
    animation: none !important;
    transition: none !important;
  }

  .trace path, .trace rect, .trace circle, .trace line, .trace polyline,
  .mc-progression, .mp-signature path {
    stroke-dashoffset: 0 !important;
  }

  .mc-repere, .ms-arrete, .ms-tampon, .ms-conforme {
    opacity: 1 !important;
    transform: none !important;
  }

  .ms-herisson, .ms-cable, .ms-fumee--sale {
    opacity: 0 !important;
  }

  .ms-suie {
    opacity: 0 !important;
  }

  .maire-reflexe .maire-reflexe__case rect { fill: var(--maire-vert); stroke: var(--maire-vert); }
  .maire-reflexe .maire-reflexe__case path { stroke-dashoffset: 0; }
}
