/* Bloc Hero à chiffres (hero-figures) */

@layer components {

    .oveo-hero-figures .hf-eyebrow {
        @apply text-14 font-bold uppercase text-bleu;
        letter-spacing: 0.08em;
    }

    .oveo-hero-figures .hf-title strong {
        color: var(--hf-accent);
        font-weight: inherit;
    }

    .oveo-hero-figures .hf-text {
        @apply text-20 font-book text-gris-texte;
    }

    .oveo-hero-figures .hf-reassurance {
        @apply text-14 font-book text-gris-texte;
    }

    .oveo-hero-figures .hf-reassurance strong {
        @apply font-bold;
    }

    .oveo-hero-figures .hf-figure-value {
        @apply text-28 font-heavy;
        color: var(--hf-figure-color);
    }

    .oveo-hero-figures .hf-figure-label {
        @apply text-14 font-book text-gris-texte;
    }
}

/* ============================================================
   HORS COUCHE : marges, espacements, dimensions, flex
   ============================================================ */

.oveo-hero-figures {
    padding-top: var(--hf-pad-mobile);
    padding-bottom: var(--hf-pad-mobile);
}

.oveo-hero-figures.hf--no-pt { padding-top: 0; }
.oveo-hero-figures.hf--no-pb { padding-bottom: 0; }

.oveo-hero-figures .hf-inner {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.oveo-hero-figures .hf-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
}

.oveo-hero-figures .hf-text { max-width: 540px; }

.oveo-hero-figures .hf-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.oveo-hero-figures .hf-cta {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.oveo-hero-figures .hf-link {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-gris-texte);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-align: center;
}

.oveo-hero-figures .hf-link:hover { color: var(--color-noir); }

.oveo-hero-figures .hf-figures {
    list-style: none;
    margin: 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--color-gris-separateur);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 32px;
}

.oveo-hero-figures .hf-figure {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: var(--hf-figure-align);
    text-align: var(--hf-figure-align);
}

.oveo-hero-figures .hf-media {
    margin: 0 auto;
    display: flex;
    justify-content: var(--hf-media-align);
    width: 100%;
    max-width: 640px;
}

.oveo-hero-figures .hf-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: var(--hf-img-mobile);
    object-fit: contain;
}

/* Moins de 560 px : un chiffre seul sur sa ligne est centré */
@media (max-width: 559.98px) {
    .oveo-hero-figures .hf-figure:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

/* 560 px : jusqu'à 3 chiffres sur une ligne */
@media (min-width: 560px) {
    .oveo-hero-figures .hf-figures:not(:has(> .hf-figure:nth-child(4))) {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
    }
}

/* 768 px : boutons côte à côte, chiffres sur une ligne */
@media (min-width: 768px) {
    .oveo-hero-figures .hf-actions {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 16px 28px;
    }

    .oveo-hero-figures .hf-cta { width: auto; }
    .oveo-hero-figures .hf-link { text-align: left; }

    .oveo-hero-figures .hf-figures {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 8px 32px;
    }

    .oveo-hero-figures .hf-image {
        max-width: 480px;
        max-height: var(--hf-img-tablet);
    }
}

/* 1024 px : deux colonnes */
@media (min-width: 1024px) {
    .oveo-hero-figures {
        padding-top: var(--hf-pad-desktop);
        padding-bottom: var(--hf-pad-desktop);
    }

    .oveo-hero-figures .hf-inner {
        flex-direction: row;
        align-items: center;
        gap: 48px;
    }

    .oveo-hero-figures.hf--media-left .hf-inner { flex-direction: row-reverse; }

    .oveo-hero-figures .hf-content {
        flex: 0 0 calc((100% - 48px) * var(--hf-content-ratio));
        max-width: none;
        min-width: 0;
        width: auto;
        margin-inline: 0;
    }

    .oveo-hero-figures .hf-media {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        justify-content: center;
        width: auto;
        margin: 0;
    }

    .oveo-hero-figures .hf-image {
        max-width: 100%;
        max-height: var(--hf-img-desktop);
    }
}

/* ============================================================
   IMAGE PLEINE LARGEUR (classe hf--has-bg, champ hf_bg_image)
   ============================================================ */

/* <picture> transparent pour la mise en page : l'image reste l'élément flex */
.oveo-hero-figures .hf-media picture { display: contents; }

/* Image large seule : rien sous 1024 px */
@media (max-width: 1023.98px) {
    .oveo-hero-figures.hf--bg-only .hf-media { display: none; }
}

/* 1024 px : image en fond, rognée sur les côtés, texte au premier plan */
@media (min-width: 1024px) {
    .oveo-hero-figures.hf--has-bg {
        position: relative;
        overflow: hidden;
        background: var(--color-gris-fond);
    }

    .oveo-hero-figures.hf--has-bg:not(.hf--no-pt) { padding-top: var(--hf-bg-pad); }
    .oveo-hero-figures.hf--has-bg:not(.hf--no-pb) { padding-bottom: var(--hf-bg-pad); }

    .oveo-hero-figures.hf--has-bg .hf-media {
        position: absolute;
        inset: 0;
        z-index: 0;
        display: block;
        width: auto;
        max-width: none;
        margin: 0;
    }

    .oveo-hero-figures.hf--has-bg .hf-image {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: cover;
        object-position: var(--hf-bg-position);
    }

    .oveo-hero-figures.hf--has-bg .hf-content {
        position: relative;
        z-index: 1;
    }

    .oveo-hero-figures.hf--has-bg .hf-text,
    .oveo-hero-figures.hf--has-bg .hf-reassurance,
    .oveo-hero-figures.hf--has-bg .hf-link,
    .oveo-hero-figures.hf--has-bg .hf-figure-label {
        color: var(--hf-bg-text-color);
    }
}

/* ============================================================
   VALEURS AJUSTABLES
   ============================================================ */

.oveo-hero-figures {
    --hf-accent: var(--color-bleu);         /* partie en gras du titre */
    --hf-figure-color: var(--color-bleu);   /* chiffres ; var(--color-noir) pour du noir */
    --hf-pad-mobile: 40px;                  /* marges haut et bas, mobile */
    --hf-pad-desktop: 64px;                 /* marges haut et bas, à partir de 1024 px */
    --hf-img-mobile: 280px;                 /* hauteur max du visuel, mobile */
    --hf-img-tablet: 360px;                 /* hauteur max du visuel, 768 à 1023 px */
    --hf-img-desktop: 360px;                /* hauteur max du visuel, à partir de 1024 px */
    --hf-content-ratio: 0.65;               /* colonne texte dès 1024 px : 0.65 = 65 % */
    --hf-figure-align: center;              /* chiffres : center, ou start pour aligner à gauche */
    --hf-media-align: center;               /* visuel sous 1024 px : center (sous le texte) ou start (à gauche) */
    --hf-bg-position: center;               /* image large : point de centrage du rognage, ex. 60% center */
    --hf-bg-pad: 80px;                      /* image large : marges haut et bas dès 1024 px */
    --hf-bg-text-color: var(--color-gris-sous-titres); /* image large : couleur des textes secondaires */
}
