/* =====================================================
   LEH · Process Steps - CSS
   3 layouts : horizontal | timeline-vertical | numbered-cards
   ===================================================== */

.leh-process-steps {
    position: relative;
    --leh-line-color: #7AB55C;
    --leh-accent: #4A7C3B;
    --leh-accent-dark: #1B4D2E;
}

/* ---------- EN-TÊTE ---------- */
.leh-process-header {
    text-align: center;
    margin-bottom: 60px;
}

.leh-process-pretitle {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 13px;
    font-weight: 600;
    color: #4A7C3B;
    margin-bottom: 16px;
    position: relative;
    padding: 0 30px;
}

.leh-process-pretitle::before,
.leh-process-pretitle::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 20px;
    height: 1px;
    background: currentColor;
}
.leh-process-pretitle::before { left: 0; }
.leh-process-pretitle::after  { right: 0; }

.leh-process-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.2;
    color: #1B4D2E;
    margin: 0 0 16px 0;
}

.leh-process-subtitle {
    font-size: 16px;
    line-height: 1.6;
    color: #5A5A5A;
    max-width: 720px;
    margin: 0 auto;
}

/* =====================================================
   LISTE COMMUNE
   ===================================================== */
.leh-process-steps-list {
    position: relative;
    display: grid;
    gap: 32px;
}

/* =====================================================
   LAYOUT 1 : HORIZONTAL
   ===================================================== */
.leh-process-horizontal .leh-process-steps-list {
    grid-template-columns: repeat(4, 1fr);
}

/* Ligne SVG horizontale, derrière les cards */
.leh-process-line-horizontal {
    position: absolute;
    top: 80px; /* aligné au centre des icônes */
    left: 12%;
    right: 12%;
    height: 20px;
    z-index: 0;
    pointer-events: none;
}

.leh-process-line-horizontal svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.leh-process-line-horizontal svg path {
    stroke-dasharray: 8 6;
}

/* Animation : la ligne se dessine */
.leh-process-line.is-animated svg path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.leh-process-steps.is-animated .leh-process-line.is-animated svg path {
    stroke-dashoffset: 0;
}

/* =====================================================
   LAYOUT 2 : TIMELINE VERTICAL
   ===================================================== */
.leh-process-timeline-vertical .leh-process-steps-list {
    grid-template-columns: 1fr;
    padding-left: 50px;
    gap: 48px;
}

@media (min-width: 768px) {
    .leh-process-timeline-vertical .leh-process-steps-list {
        padding-left: 0;
        grid-template-columns: 1fr 60px 1fr;
        gap: 0 32px;
    }

    .leh-process-timeline-vertical .leh-process-step[data-side="left"] {
        grid-column: 1;
        text-align: right;
    }

    .leh-process-timeline-vertical .leh-process-step[data-side="right"] {
        grid-column: 3;
        margin-top: 80px; /* décalage pour effet zigzag */
    }

    /* Décalage progressif des cards de gauche aussi pour zigzag */
    .leh-process-timeline-vertical .leh-process-step[data-side="left"]:nth-child(n+2) {
        margin-top: -40px;
    }
    .leh-process-timeline-vertical .leh-process-step[data-side="left"]:first-of-type {
        margin-top: 0;
    }
}

/* Ligne verticale (timeline) */
.leh-process-line-vertical {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 25px;
    width: 4px;
    z-index: 0;
    pointer-events: none;
}

@media (min-width: 768px) {
    .leh-process-line-vertical {
        left: 50%;
        transform: translateX(-50%);
    }
}

.leh-process-line-vertical svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.leh-process-line-vertical svg path {
    stroke-dasharray: 8 6;
}

.leh-process-line-vertical.is-animated svg path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.leh-process-steps.is-animated .leh-process-line-vertical.is-animated svg path {
    stroke-dashoffset: 0;
}

/* Cercle de la timeline (sur la ligne) */
.leh-process-timeline-vertical .leh-process-step {
    position: relative;
}

.leh-process-timeline-vertical .leh-process-step::before {
    content: "";
    position: absolute;
    top: 32px;
    left: -41px;
    width: 18px;
    height: 18px;
    background-color: var(--leh-line-color);
    border: 4px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--leh-line-color);
    z-index: 2;
}

@media (min-width: 768px) {
    .leh-process-timeline-vertical .leh-process-step[data-side="left"]::before {
        left: auto;
        right: -47px;
    }
    .leh-process-timeline-vertical .leh-process-step[data-side="right"]::before {
        left: -47px;
    }
}

/* =====================================================
   LAYOUT 3 : NUMBERED CARDS
   ===================================================== */
.leh-process-numbered-cards .leh-process-steps-list {
    grid-template-columns: repeat(4, 1fr);
}

.leh-process-numbered-cards .leh-process-step {
    position: relative;
    overflow: hidden;
}

/* Grand numéro en fond */
.leh-process-numbered-cards .leh-process-step-number {
    position: absolute;
    top: -10px;
    right: 8px;
    font-size: 120px;
    font-weight: 800;
    line-height: 1;
    color: var(--leh-accent);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.leh-process-numbered-cards .leh-process-step-content {
    position: relative;
    z-index: 1;
}

/* =====================================================
   STEP CARD (commun à tous les layouts)
   ===================================================== */
.leh-process-step {
    position: relative;
    padding: 32px 24px;
    border-radius: 16px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease,
                background-color 0.4s ease,
                border-color 0.4s ease;
    z-index: 1;
    background-color: #FFFFFF;
    box-shadow: 0 8px 24px rgba(27,77,46,0.08);
}

.leh-process-step:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(27,77,46,0.15);
}

/* Variantes de cards */
.leh-process-step[data-card-style="bordered"] {
    box-shadow: none;
    border: 2px solid #4A7C3B;
}

.leh-process-step[data-card-style="gradient"] {
    /* Hover styles définis dans Elementor */
}

.leh-process-step[data-card-style="gradient"]:hover {
    color: #FFFFFF;
}

.leh-process-step[data-card-style="minimal"] {
    background: transparent;
    box-shadow: none;
    padding: 16px;
}

.leh-process-step[data-card-style="minimal"]:hover {
    transform: translateY(-2px);
}

/* Contenu interne */
.leh-process-step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

/* Quand timeline-vertical et card à gauche, on aligne à droite */
.leh-process-timeline-vertical .leh-process-step[data-side="left"] .leh-process-step-content {
    align-items: flex-end;
    text-align: right;
}

@media (max-width: 767px) {
    .leh-process-timeline-vertical .leh-process-step[data-side="left"] .leh-process-step-content,
    .leh-process-timeline-vertical .leh-process-step[data-side="right"] .leh-process-step-content {
        align-items: flex-start;
        text-align: left;
    }
}

/* Icône wrapper */
.leh-process-step-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    max-width: 80px;
    max-height: 80px;
    flex: 0 0 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1B4D2E 0%, #4A7C3B 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 6px 16px rgba(27,77,46,0.2);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.leh-process-step:hover .leh-process-step-icon-wrapper {
    transform: scale(1.08) rotate(-5deg);
}

.leh-process-step-icon {
    color: #FFFFFF;
    font-size: 32px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leh-process-step-icon i { line-height: 1; }
.leh-process-step-icon svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

/* Badge numéro sur l'icône */
.leh-process-step-number-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background-color: #FFFFFF;
    color: var(--leh-accent-dark);
    font-size: 13px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(27,77,46,0.15);
    border: 2px solid var(--leh-accent);
}

/* Numéro seul (quand pas d'icône) */
.leh-process-step-number-wrap {
    margin-bottom: 16px;
}

.leh-process-step:not(.leh-process-numbered-cards .leh-process-step) .leh-process-step-number-wrap .leh-process-step-number {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    color: var(--leh-accent);
}

/* Titre & description */
.leh-process-step-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--leh-accent-dark);
    margin: 0 0 10px 0;
    transition: color 0.4s ease;
}

.leh-process-step-description {
    font-size: 14px;
    line-height: 1.6;
    color: #5A5A5A;
    margin: 0;
    transition: color 0.4s ease;
}

/* Bouton lien (optionnel) */
.leh-process-step-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #1B4D2E 0%, #4A7C3B 100%);
    color: #FFFFFF;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.leh-process-step-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(27,77,46,0.25);
}

.leh-process-step-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.leh-process-step-btn:hover svg {
    transform: translateX(3px);
}

/* Flèche entre étapes (horizontal/numbered) */
.leh-process-arrow {
    position: absolute;
    top: 80px;
    right: -28px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.leh-process-arrow svg {
    width: 24px;
    height: 24px;
    fill: var(--leh-line-color);
}

.leh-process-steps.is-animated .leh-process-arrow {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 1.2s;
}

/* =====================================================
   ANIMATIONS DES CARDS (apparition au scroll)
   ===================================================== */
.leh-anim-enabled .leh-process-step {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease,
                background-color 0.4s ease,
                border-color 0.4s ease;
    transition-delay: var(--leh-anim-delay, 0ms);
}

.leh-process-steps.is-animated.leh-anim-enabled .leh-process-step {
    opacity: 1;
    transform: translateY(0);
}

/* Animation icône : pop avec rebond */
.leh-anim-enabled .leh-process-step-icon-wrapper {
    transform: scale(0);
}

.leh-process-steps.is-animated.leh-anim-enabled .leh-process-step-icon-wrapper {
    animation: leh-icon-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--leh-anim-delay, 0ms) + 200ms);
}

@keyframes leh-icon-pop {
    0%   { transform: scale(0) rotate(-180deg); }
    100% { transform: scale(1) rotate(0); }
}

/* Animation numéro (numbered-cards) : grossit en sortant */
.leh-anim-enabled .leh-process-numbered-cards .leh-process-step-number {
    transform: scale(0.5) translateY(20px);
    opacity: 0;
}

.leh-process-steps.is-animated.leh-anim-enabled .leh-process-numbered-cards .leh-process-step-number {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.6s ease;
    transition-delay: calc(var(--leh-anim-delay, 0ms) + 300ms);
    transform: scale(1) translateY(0);
    opacity: 0.15;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .leh-process-horizontal .leh-process-steps-list {
        grid-template-columns: repeat(2, 1fr);
    }
    .leh-process-numbered-cards .leh-process-steps-list {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Ligne horizontale masquée sur tablet (cards en 2 colonnes) */
    .leh-process-line-horizontal {
        display: none;
    }

    /* Flèches masquées */
    .leh-process-horizontal .leh-process-arrow,
    .leh-process-numbered-cards .leh-process-arrow {
        display: none;
    }
}

@media (max-width: 767px) {
    html body .leh-process-steps .leh-process-header {
        margin-bottom: 40px !important;
    }
    html body .leh-process-steps .leh-process-title {
        font-size: clamp(24px, 6vw, 32px) !important;
    }
    html body .leh-process-steps .leh-process-subtitle {
        font-size: 14px !important;
    }

    html body .leh-process-horizontal .leh-process-steps-list,
    html body .leh-process-numbered-cards .leh-process-steps-list {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    html body .leh-process-steps .leh-process-step {
        padding: 24px 20px !important;
    }

    html body .leh-process-steps .leh-process-step-icon-wrapper {
        width: 64px !important;
        height: 64px !important;
        min-width: 64px !important;
        min-height: 64px !important;
        max-width: 64px !important;
        max-height: 64px !important;
        flex: 0 0 64px !important;
        margin-bottom: 16px !important;
    }

    html body .leh-process-steps .leh-process-step-icon {
        font-size: 26px !important;
    }
    html body .leh-process-steps .leh-process-step-icon svg {
        width: 26px !important;
        height: 26px !important;
    }

    html body .leh-process-steps .leh-process-step-title {
        font-size: 18px !important;
    }
    html body .leh-process-steps .leh-process-step-description {
        font-size: 13px !important;
    }

    /* Numbered cards : numéro plus petit */
    html body .leh-process-numbered-cards .leh-process-step-number {
        font-size: 80px !important;
    }

    /* Padding latéral pour ne pas coller aux bords */
    html body .leh-process-steps {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* =====================================================
   ACCESSIBILITÉ (prefers-reduced-motion)
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .leh-process-step,
    .leh-process-step-icon-wrapper,
    .leh-process-arrow,
    .leh-process-line svg path,
    .leh-process-numbered-cards .leh-process-step-number {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
        stroke-dashoffset: 0 !important;
    }
    .leh-process-numbered-cards .leh-process-step-number {
        opacity: 0.15 !important;
    }
}
