/* ==========================================================================
   « Nos chiffres clés » — page À propos
   --------------------------------------------------------------------------
   Design repris de la section « Key Figures » de la page d'accueil du modèle
   (projet romi) : graphique en barres + anneau de satisfaction + liste
   cochée + barres de progression.
   Couleurs transposées à la charte de ce site (bleu nuit #001f3f / #001428,
   accent bleu #0074d9, or #d4af37) au lieu du vert du modèle.
   Les DONNÉES viennent de `growth` (about.json) : aucune valeur inventée.
   ========================================================================== */

.section-chiffres {
    --c-primaire: #001f3f;
    --c-primaire-fonce: #001428;
    --c-accent: #0074d9;
    --c-bordure: #eef1f6;
    --c-texte-muet: #6b7280;

    background-color: #ffffff;
}

/* ==========================================================================
   CARTES
   ========================================================================== */
.carte-avantage {
    background: #ffffff;
    border: 1px solid var(--c-bordure);
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
}

.icone-avantage {
    flex: 0 0 45px;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: rgba(0, 31, 63, 0.08);
    color: var(--c-primaire);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carte-avantage h5 {
    font-weight: 700;
    color: var(--c-primaire-fonce);
    /* !important : neutralise la taille globale des h5 */
    font-size: 1.05rem !important;
}

/* ==========================================================================
   GRAPHIQUES
   ========================================================================== */
.chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.donut-svg {
    width: 100%;
    max-width: 210px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ==========================================================================
   LISTE À PUCES COCHÉES
   ========================================================================== */
.liste-chiffres {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem !important;
}

.liste-chiffres li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    color: #46505f;
}

.liste-chiffres li:last-child {
    margin-bottom: 0;
}

.liste-chiffres i {
    color: var(--c-accent);
    margin-top: 0.15rem;
    flex: 0 0 auto;
}

/* ==========================================================================
   BARRES DE PROGRESSION
   ========================================================================== */
.progress-campagne {
    height: 8px;
    border-radius: 999px;
    background: var(--c-bordure);
    overflow: hidden;
}

.progress-campagne-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--c-accent), var(--c-primaire));
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 575.98px) {

    /* L'anneau et la liste passent l'un sous l'autre : on garde l'axe
       horizontal AVEC retour à la ligne et des enfants en largeur 100 %.
       ⚠️ Ne pas mettre `flex-direction: column` ici : la ligne garde
       `flex-wrap: wrap` et les enfants partent alors dans une 2e colonne
       (la liste sort de la carte). */
    .bloc-donut {
        flex-direction: row;
    }

    .bloc-donut > [class*="col-"] {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
}

/* ==========================================================================
   ANIMATIONS (déclenchées par la classe .anime ajoutée par IntersectionObserver)
   ========================================================================== */

/* Barres du graphique : elles montent depuis la ligne de base */
.chart-svg .barre-chiffre {
    transform-box: fill-box;
    transform-origin: bottom center;
    transform: scaleY(0);
    transition: transform 0.85s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition-delay: var(--retard, 0s);
}

.section-chiffres.anime .chart-svg .barre-chiffre {
    transform: scaleY(1);
}

/* Valeurs et années : apparition en fondu */
.chart-svg .txt-chiffre,
.donut-svg .txt-chiffre {
    opacity: 0;
    transition: opacity 0.5s ease;
    transition-delay: var(--retard, 0s);
}

.section-chiffres.anime .chart-svg .txt-chiffre,
.section-chiffres.anime .donut-svg .txt-chiffre {
    opacity: 1;
}

/* Anneau de satisfaction : il se dessine (stroke-dashoffset) */
.anneau-chiffre {
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 1.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.25s;
}

.section-chiffres.anime .anneau-chiffre {
    stroke-dashoffset: var(--offset, 0);
}

/* Barres de progression : elles se remplissent */
.progress-campagne-bar {
    width: 0;
    transition: width 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.35s;
}

.section-chiffres.anime .progress-campagne-bar {
    width: var(--largeur, 0%);
}

/* ==========================================================================
   REJEU AU SURVOL
   Le graphique se redessine quand la souris passe sur sa carte.
   Des @keyframes sont nécessaires : après l'animation d'entrée les valeurs
   sont déjà à leur état final, donc une simple transition ne rejouerait rien.
   Le rejeu n'a lieu qu'après la révélation de la section (.anime).
   `backwards` maintient la valeur de départ pendant le décalage (--retard),
   puis la valeur revient naturellement à l'état final (pas de saut).
   ========================================================================== */
@keyframes cb-barres {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

@keyframes cb-anneau {
    from { stroke-dashoffset: 326.7; }
    to   { stroke-dashoffset: var(--offset, 0); }
}

@keyframes cb-remplissage {
    from { width: 0; }
    to   { width: var(--largeur, 0%); }
}

@keyframes cb-fondu {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.section-chiffres.anime .carte-avantage:hover {
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
}

.section-chiffres.anime .carte-avantage:hover .chart-svg .barre-chiffre {
    animation: cb-barres 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
    animation-delay: var(--retard, 0s);
}

.section-chiffres.anime .carte-avantage:hover .anneau-chiffre {
    animation: cb-anneau 1.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s backwards;
}

.section-chiffres.anime .carte-avantage:hover .progress-campagne-bar {
    animation: cb-remplissage 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.2s backwards;
}

.section-chiffres.anime .carte-avantage:hover .chart-svg .txt-chiffre,
.section-chiffres.anime .carte-avantage:hover .donut-svg .txt-chiffre {
    animation: cb-fondu 0.5s ease backwards;
    animation-delay: var(--retard, 0s);
}

/* Accessibilité : pas d'animation si l'utilisateur les a désactivées */
@media (prefers-reduced-motion: reduce) {

    .chart-svg .barre-chiffre,
    .chart-svg .txt-chiffre,
    .donut-svg .txt-chiffre,
    .anneau-chiffre,
    .progress-campagne-bar {
        transition: none !important;
    }

    .section-chiffres.anime .carte-avantage:hover .chart-svg .barre-chiffre,
    .section-chiffres.anime .carte-avantage:hover .anneau-chiffre,
    .section-chiffres.anime .carte-avantage:hover .progress-campagne-bar,
    .section-chiffres.anime .carte-avantage:hover .chart-svg .txt-chiffre,
    .section-chiffres.anime .carte-avantage:hover .donut-svg .txt-chiffre {
        animation: none !important;
    }
}
/* ==========================================================================
   Le graphique remplit la hauteur de sa carte
   (la carte est une colonne flex, le SVG prend l'espace restant et son dessin
   reste proportionné, aligné en bas : preserveAspectRatio="xMidYMax meet")
   ========================================================================== */
.carte-avantage {
    display: flex;
    flex-direction: column;
}

.chart-svg {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 270px;
    display: block;
}