/**
 * Aratice — Chiffres : section stats avec cards animées
 *
 * Layout :
 *   Top  → grid 3 cols × 2 rows, carte salles span 2 rows
 *   Bottom → grid 2 cols (chart 2fr / répartition 1fr)
 *
 * Animations (.is-animated) :
 *   - counters : déclenchés par JS (data-counter)
 *   - barres chart : transition height
 *   - bar % répartition : transition width
 */

.aratice-chiffres {
    --ac-green: #8FB960;
    --ac-blue: #163C79;
    --ac-blue-dark: #0E2348;
    --ac-radius: 22px;
    --ac-gap: 18px;
    font-family: 'Lexend Deca', 'Lexend', sans-serif;
    color: #1d2327;
}

.aratice-chiffres * {
    font-family: inherit;
}

/* ===== Top grid =====
   Rows en auto plutôt que 1fr 1fr : chaque rangée se cale sur le contenu
   au lieu de s'aligner sur la plus grande, ce qui évitait que la carte Salles
   (span 2 rows) hérite du double de la hauteur de l'image et soit énorme. */
.aratice-chiffres__top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--ac-gap);
    margin-bottom: var(--ac-gap);
}

.ac-card--salles { grid-column: 1; grid-row: 1 / 3; }
.ac-card--image  { grid-column: 2; grid-row: 1; }
.ac-card--certif { grid-column: 2; grid-row: 2; }
.ac-card--annee  { grid-column: 3; grid-row: 1; }
.ac-card--capital{ grid-column: 3; grid-row: 2; }

/* ===== Bottom grid ===== */
.aratice-chiffres__bottom {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--ac-gap);
}

/* ===== Card base ===== */
.ac-card {
    position: relative;
    border-radius: var(--ac-radius);
    padding: 24px 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ac-card--green { background: var(--ac-green); color: #fff; }
.ac-card--blue { background: var(--ac-blue); color: #fff; }
.ac-card--certif { background: transparent; padding: 24px 8px; gap: 8px; }
.ac-card--chart { background: #fff; padding: 38px 30px 20px; }

/* Sur-titre uppercase */
.ac-card__surtitre {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}
.ac-card--certif .ac-card__surtitre { color: var(--ac-green); text-align: left; }
.ac-card__surtitre--green { color: var(--ac-green); }
.ac-card__surtitre--blue { color: var(--ac-blue); }

/* Description */
.ac-card__desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.95);
}
.ac-card--certif .ac-card__desc { color: var(--ac-blue); text-align: left; font-size: 13px; }

/* ===== Card 1 : Salles ===== */
.ac-card--salles .ac-card__nombre {
    font-size: clamp(64px, 6.5vw, 100px);
    line-height: 0.95;
    font-weight: 800;
    letter-spacing: -2px;
    color: #fff;
    margin-top: 2px;
}
.ac-card--salles .ac-card__desc { max-width: 280px; }

.ac-card__link {
    position: absolute;
    bottom: 20px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 6px 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}
.ac-card__link:hover { color: #fff; opacity: 0.9; }
.ac-card__link-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    transition: transform 0.2s ease, background 0.2s ease;
}
.ac-card__link:hover .ac-card__link-arrow {
    background: rgba(255, 255, 255, 0.32);
    transform: translate(2px, -2px);
}

.ac-card__annee {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
}
.ac-card__annee-arrow { font-size: 18px; }

/* ===== Card 2 : Image ===== */
.ac-card--image {
    padding: 0;
    background: #ddd;
    min-height: 150px;
}
.ac-card--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Card 3 / 5 : Année / Capital ===== */
.ac-card--annee .ac-card__nombre,
.ac-card--capital .ac-card__nombre {
    font-size: clamp(40px, 4vw, 58px);
    line-height: 1;
    font-weight: 800;
    color: #fff;
    margin: 2px 0 4px;
}
.ac-card__nombre--green { color: var(--ac-green) !important; }

/* ===== Card 4 : Certification ===== */
.ac-card__cert {
    text-align: left;
    font-size: clamp(34px, 3.4vw, 48px);
    font-weight: 800;
    color: var(--ac-blue);
    line-height: 1;
    margin: 4px 0;
}
.ac-card__dashes {
    margin-top: 6px;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
}
.ac-card__dash {
    width: 28px;
    height: 4px;
    background: var(--ac-green);
    border-radius: 2px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.aratice-chiffres.is-animated .ac-card__dash {
    opacity: 1;
    transform: translateY(0);
}
/* Délai en cascade pour chaque tiret */
.aratice-chiffres.is-animated .ac-card__dash:nth-child(1) { transition-delay: 0.1s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(2) { transition-delay: 0.18s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(3) { transition-delay: 0.26s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(4) { transition-delay: 0.34s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(5) { transition-delay: 0.42s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(6) { transition-delay: 0.5s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(7) { transition-delay: 0.58s; }
.aratice-chiffres.is-animated .ac-card__dash:nth-child(8) { transition-delay: 0.66s; }

/* ===== Card 5 décor : ondes concentriques ===== */
.ac-card__waves {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 110px;
    height: 110px;
    pointer-events: none;
}

/* ===== Card 6 : Chart ===== */
.ac-card__chart-titre {
    font-size: 24px;
    font-weight: 700;
    color: var(--ac-blue);
    margin: 0 0 30px;
}

/* grid-auto-flow: column + grid-auto-columns: 1fr → s'adapte automatiquement
   à n'importe quel nombre de barres sans wrap. */
.ac-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 14px;
    align-items: end;
    height: 220px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.ac-chart__col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    position: relative;
}

.ac-chart__value {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.ac-chart__bar {
    width: 100%;
    height: 0;
    background: #e5e7eb;
    border-radius: 4px 4px 0 0;
    transition: height 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.ac-chart__bar--highlight {
    background: var(--ac-blue);
}
.aratice-chiffres.is-animated .ac-chart__bar {
    height: var(--bar-target-height, 0%);
}

.ac-chart__label {
    position: absolute;
    bottom: -22px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ac-blue);
    letter-spacing: 0.4px;
}

/* ===== Card 7 : Répartition =====
   Pas de z-index ici : sans stacking context, le SVG enfant en z-index:-1
   peut passer DERRIÈRE le fond de la card (et seulement la portion qui
   déborde reste visible), tout en restant au-dessus du fond du body. */
.ac-card--repartition {
    overflow: visible; /* pour les bulles décoratives qui débordent */
    color: #fff;
}

.ac-card__rep-titre {
    font-size: 22px;
    font-weight: 700;
    color: var(--ac-blue);
    margin: 0 0 16px;
}

.ac-rep-bar {
    display: flex;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.4);
    margin: 4px 0 18px;
}
.ac-rep-bar__seg {
    display: block;
    width: 0;
    height: 100%;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.aratice-chiffres.is-animated .ac-rep-bar__seg {
    width: var(--seg-target);
}

.ac-rep-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ac-rep-legend__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}
.ac-rep-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.ac-rep-legend__pct {
    font-weight: 700;
    color: #fff;
}

/* Bulles décoratives sous la carte répartition (SVG inline)
   z-index:-1 + parent sans stacking context → le SVG passe derrière le fond
   de la card répartition tout en restant visible où il déborde du conteneur. */
.ac-card__bubbles {
    position: absolute;
    bottom: -180px;
    left: -180px;
    width: 374px;
    height: 356px;
    pointer-events: none;
    z-index: -1;
    display: block;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .aratice-chiffres__top {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    .ac-card--salles { grid-column: 1 / 3; grid-row: 1; }
    .ac-card--image  { grid-column: 1; grid-row: 2; }
    .ac-card--annee  { grid-column: 2; grid-row: 2; }
    .ac-card--certif { grid-column: 1; grid-row: 3; }
    .ac-card--capital{ grid-column: 2; grid-row: 3; }

    .aratice-chiffres__bottom { grid-template-columns: 1fr; }

    /* Carte image en responsive : on retire le fond gris + le min-height +
       le padding, et on laisse l'image s'afficher naturellement (pas de crop
       cover). Border-radius hérité de .ac-card via overflow:hidden + appliqué
       aussi sur l'img directement par sécurité. */
    .ac-card--image {
        background: transparent;
        min-height: 0;
        padding: 0;
    }
    .ac-card--image img {
        height: auto;
        object-fit: initial;
        border-radius: var(--ac-radius);
    }
}

@media (max-width: 640px) {
    .aratice-chiffres__top {
        grid-template-columns: 1fr;
    }
    .ac-card--salles, .ac-card--image, .ac-card--annee,
    .ac-card--certif, .ac-card--capital {
        grid-column: 1; grid-row: auto;
    }

    .ac-card { padding: 24px 22px; }
    /* Override : le padding global ne s'applique pas à la carte image (qui
       doit afficher l'image bord à bord, sans encadrement). */
    .ac-card--image { padding: 0; }
    .ac-card__chart-titre { font-size: 20px; }
    .ac-card__rep-titre { font-size: 18px; }

    .ac-chart { gap: 6px; height: 180px; }
    .ac-chart__value { font-size: 9px; }
    .ac-chart__label { font-size: 10px; }
}
