/* Bloc Étapes horizontales
   Fond bleu, titre + sous-titre centres, 1 a 5 etapes reliees.
   Typographie et couleurs via les classes du theme.
   Marges et dimensions hors @layer. */

@layer components {

    .oveo-steps-horizontal { @apply bg-bleu; }

    .oveo-steps-horizontal .sh-header { @apply text-center; }

    .oveo-steps-horizontal .sh-title { @apply m-0 text-white; }

    .oveo-steps-horizontal .sh-subtitle {
        @apply m-0 text-white font-book text-24;
    }

    .oveo-steps-horizontal .sh-steps {
        @apply flex flex-wrap justify-center list-none;
    }

    .oveo-steps-horizontal .sh-step {
        @apply relative flex flex-col items-center text-center;
    }

    /* Ligne de liaison : tracee entre deux puces voisines,
       jamais avant la premiere ni apres la derniere. */
    .oveo-steps-horizontal .sh-step:not(:last-child)::before,
    .oveo-steps-horizontal .sh-step + .sh-step::after {
        content: "";
        @apply absolute bg-gris-separateur;
    }

    .oveo-steps-horizontal .sh-bullet {
        @apply relative grid place-items-center rounded-full bg-white shrink-0;
    }

    .oveo-steps-horizontal .sh-icon { @apply object-contain; }

    .oveo-steps-horizontal .sh-label {
        @apply text-white font-book text-24;
    }

    .oveo-steps-horizontal .sh-text {
        @apply m-0 text-white font-book text-16;
    }

    .oveo-steps-horizontal.sh-placeholder {
        @apply p-6 text-white text-14;
    }
}

/* ============================================================
   HORS COUCHE : marges, dimensions, positions.
   VALEURS AJUSTABLES regroupees ici.
   ============================================================ */

.oveo-steps-horizontal {
    padding-top: 40px;
    padding-bottom: 40px;
}
.oveo-steps-horizontal.sh--no-pt { padding-top: 0; }
.oveo-steps-horizontal.sh--no-pb { padding-bottom: 0; }

/* Les textes ne debordent jamais de leur colonne */
.oveo-steps-horizontal .sh-subtitle,
.oveo-steps-horizontal .sh-title,
.oveo-steps-horizontal .sh-label,
.oveo-steps-horizontal .sh-text {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Variante pleine largeur : pas de conteneur, juste une marge laterale */
.oveo-steps-horizontal .sh-full {
    width: 100%;
    padding-left: 24px;
    padding-right: 24px;
}

/* Le thème annule le padding de .container-box au-dela de 1220px.
   Ce bloc ayant un fond colore, il pose son propre padding lateral. */
.oveo-steps-horizontal > .container-box,
.oveo-steps-horizontal > .sh-full {
    padding-left: 24px;
    padding-right: 24px;
}

.oveo-steps-horizontal .sh-header { margin-bottom: 32px; }
.oveo-steps-horizontal .sh-header > * + * { margin-top: 8px; }

.oveo-steps-horizontal .sh-steps {
    margin: 0;
    padding: 0;
    gap: 24px 0;
}

/* Chaque etape occupe une fraction egale de la largeur.
   --sh-cols pilote le nombre de colonnes par rangee. */
.oveo-steps-horizontal .sh-step {
    --sh-cols: 3;
    flex: 0 0 calc(100% / var(--sh-cols));
    max-width: calc(100% / var(--sh-cols));
    padding-left: 12px;
    padding-right: 12px;
}

/* --sh-r : demi-taille du cercle. Le trait s'arrete a cette distance
   du centre, il suit donc automatiquement la taille de la pastille. */
.oveo-steps-horizontal .sh-step { --sh-r: 32px; --sh-off: 32px; }

.oveo-steps-horizontal .sh-bullet {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
}
.oveo-steps-horizontal .sh-step--dot { --sh-r: 10px; --sh-off: 28px; }
.oveo-steps-horizontal .sh-bullet--dot {
    width: 20px;
    height: 20px;
    margin-top: 22px;
    margin-bottom: 12px;
}

.oveo-steps-horizontal .sh-icon {
    width: 32px;
    height: 32px;
}

.oveo-steps-horizontal .sh-text { margin-top: 8px; }

/* Ligne de liaison : part du bord gauche de l'etape jusqu'au
   bord gauche de sa puce, a la hauteur du centre de la puce. */
.oveo-steps-horizontal .sh-step:not(:last-child)::before,
.oveo-steps-horizontal .sh-step + .sh-step::after {
    height: 6px;
    top: 29px;
}
/* Moitie droite : du bord de la pastille jusqu'au bord de l'etape */
.oveo-steps-horizontal .sh-step:not(:last-child)::before {
    left: calc(50% + var(--sh-r));
    right: 0;
}
/* Moitie gauche : du bord de l'etape jusqu'au bord de la pastille */
.oveo-steps-horizontal .sh-step + .sh-step::after {
    left: 0;
    right: calc(50% + var(--sh-r));
}

/* ---------- Mobile (< 768 px) ----------
   Trois etapes par rangee au maximum, texte masque,
   puces et libelles reduits. */

@media (max-width: 767px) {
    .oveo-steps-horizontal .sh-label { font-size: 20px; line-height: 1.2; }
    .oveo-steps-horizontal .sh-bullet {
        width: 56px;
        height: 56px;
    }
    .oveo-steps-horizontal .sh-icon {
        width: 28px;
        height: 28px;
    }
    .oveo-steps-horizontal .sh-step { --sh-r: 20px; --sh-off: 28px; }
    .oveo-steps-horizontal .sh-step--dot { --sh-r: 8px; --sh-off: 28px; }
    .oveo-steps-horizontal .sh-bullet--dot {
        width: 16px;
        height: 16px;
        margin-top: 20px;
        margin-bottom: 6px;
    }
    .oveo-steps-horizontal .sh-step:not(:last-child)::before,
    .oveo-steps-horizontal .sh-step + .sh-step::after {
        top: 25px;
    }

    /* Jusqu'a 3 etapes : horizontal. Au-dela : vertical, une par ligne.
       sh--vertical est pose par le PHP quand il y a 4 etapes ou plus. */
    .oveo-steps-horizontal.sh--vertical .sh-steps {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    .oveo-steps-horizontal.sh--vertical .sh-step {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        column-gap: 16px;
        row-gap: 0;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 24px;
    }
    .oveo-steps-horizontal.sh--vertical .sh-step:last-child {
        padding-bottom: 0;
    }
    /* Securite : aucun trait ne part de la derniere etape */
    .oveo-steps-horizontal.sh--vertical .sh-step:last-child::before {
        display: none;
    }
    /* La pastille sort du flux texte : elle forme la colonne de gauche */
    .oveo-steps-horizontal.sh--vertical .sh-bullet {
        margin-top: 0;
        margin-bottom: 0;
    }
    .oveo-steps-horizontal.sh--vertical .sh-bullet--dot {
        margin-top: 8px;
        margin-left: 20px;
        margin-right: 20px;
    }
    /* Le libelle et le texte forment la colonne de droite */
    /* La pastille garde sa largeur, le texte occupe le reste */
    .oveo-steps-horizontal.sh--vertical .sh-bullet { flex: 0 0 auto; }
    .oveo-steps-horizontal.sh--vertical .sh-label,
    .oveo-steps-horizontal.sh--vertical .sh-text {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
    }
    /* Le libelle passe au-dessus du texte, tous deux a droite du point */
    .oveo-steps-horizontal.sh--vertical .sh-step {
        flex-wrap: wrap;
    }
    .oveo-steps-horizontal.sh--vertical .sh-label {
        flex: 1 1 calc(100% - 76px);
    }
    .oveo-steps-horizontal.sh--vertical .sh-text {
        flex: 1 1 100%;
        margin-left: 76px;
        margin-top: 2px;
    }
    .oveo-steps-horizontal.sh--vertical .sh-label {
        line-height: 1.2;
    }
    /* Trait vertical : du bas de la pastille au bas de l'etape */
    .oveo-steps-horizontal.sh--vertical .sh-step::before,
    .oveo-steps-horizontal.sh--vertical .sh-step::after {
        display: none;
    }
    .oveo-steps-horizontal.sh--vertical .sh-step:not(:last-child) {
        position: relative;
    }
    .oveo-steps-horizontal.sh--vertical .sh-step:not(:last-child)::before {
        content: "";
        display: block;
        position: absolute;
        width: 6px;
        height: auto;
        top: var(--sh-r);
        bottom: calc(var(--sh-r) - 24px);
        left: calc(var(--sh-off) - 3px);
        right: auto;
    }
}

/* ---------- Tablette et plus (>= 768 px) ----------
   Toutes les etapes sur une seule rangee. */

@media (min-width: 768px) {
    .oveo-steps-horizontal.sh--count-1 .sh-step { --sh-cols: 1; }
    .oveo-steps-horizontal.sh--count-2 .sh-step { --sh-cols: 2; }
    .oveo-steps-horizontal.sh--count-3 .sh-step { --sh-cols: 3; }
    .oveo-steps-horizontal.sh--count-4 .sh-step { --sh-cols: 4; }
    .oveo-steps-horizontal.sh--count-5 .sh-step { --sh-cols: 5; }

    .oveo-steps-horizontal .sh-bullet {
        width: 96px;
        height: 96px;
        margin-bottom: 16px;
    }
    .oveo-steps-horizontal .sh-icon {
        width: 56px;
        height: 56px;
    }
    .oveo-steps-horizontal .sh-step { --sh-r: 48px; }
    .oveo-steps-horizontal .sh-step--dot { --sh-r: 10px; }
    .oveo-steps-horizontal .sh-bullet--dot {
        width: 20px;
        height: 20px;
        margin-top: 38px;
        margin-bottom: 8px;
    }
    .oveo-steps-horizontal .sh-step:not(:last-child)::before,
    .oveo-steps-horizontal .sh-step + .sh-step::after {
        top: 45px;
    }
    .oveo-steps-horizontal .sh-header { margin-bottom: 16px; }
}

@media (min-width: 1024px) {
    .oveo-steps-horizontal {
        padding-top: 32px;
        padding-bottom: 32px;
    }
}

/* ---------- Variantes de largeur ----------
   Par defaut : fond etendu sur toute la largeur, contenu dans la marge.
   sh--boxed    : fond limite a 1015px, coins arrondis.
   sh--full-all : fond et contenu en pleine largeur. */

.oveo-steps-horizontal.sh--boxed {
    max-width: 1015px;
    border-radius: 10px;
    margin-left: 24px;
    margin-right: 24px;
}
/* Au-dela de 1015 + 2x24, le bloc se centre au lieu de coller aux bords */
@media (min-width: 1063px) {
    .oveo-steps-horizontal.sh--boxed {
        margin-left: auto;
        margin-right: auto;
    }
}

/* ============================================================
   VARIANTE SANS FOND
   Le fond bleu disparait, les textes passent en bleu/noir/gris
   et les pastilles en bleu pour rester visibles.
   ============================================================ */

.oveo-steps-horizontal.sh--light {
    background: transparent;
}

.oveo-steps-horizontal.sh--light .sh-title    { color: #2669E3; }
.oveo-steps-horizontal.sh--light .sh-subtitle { color: #000000; }
.oveo-steps-horizontal.sh--light .sh-label    { color: #000000; }
.oveo-steps-horizontal.sh--light .sh-text     { color: #6E6E6E; }

/* Pastilles : bleues au lieu de blanches */
.oveo-steps-horizontal.sh--light .sh-bullet {
    background: #2669E3;
}
