/* =============================================================
   CIPAC Districts Accordion — cipac-districts-accordion.css
   ============================================================= */

/* ── Variables ────────────────────────────────────────────────── */
.cipac-dist {
    --navy:             #14346B;
    --lime:             #8DC63F;
    --lime-deep:        #6FA82B;
    --text-dark:        #1f2937;
    --text-mid:         #6b7280;
    --item-bg:          #ffffff;
    --item-bg-open:     #ffffff;
    --item-border:      #e5e7eb;
    --item-radius:      16px;
    --item-gap:         12px;
    --body-indent:      20px;
    --chevron-bg:       #14346B;
    --chevron-color:    #ffffff;
    --chevron-size:     32px;
}

/* ── Protection débordements texte ───────────────────────────── */
.cipac-dist__name,
.cipac-dist__tagline,
.cipac-dist__desc,
.cipac-dist__tag,
.cipac-dist__footer-title,
.cipac-dist__footer-sub {
    overflow-wrap: break-word;
    word-break:    break-word;
}

/* ── En-tête ─────────────────────────────────────────────────── */
.cipac-dist__header {
    text-align:    center;
    margin-bottom: 48px;
}

.cipac-dist__eyebrow {
    display:        inline-flex;
    align-items:    center;
    gap:            8px;
    font-size:      13px;
    font-weight:    700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color:          var(--lime);
    margin-bottom:  14px;
}
.cipac-dist__eyebrow-dot {
    display:       inline-block;
    width:         8px;
    height:        8px;
    border-radius: 50%;
    background:    currentColor;
    flex-shrink:   0;
}

.cipac-dist__title {
    font-size:   clamp(26px, 4vw, 48px);
    font-weight: 700;
    color:       var(--navy);
    line-height: 1.15;
    margin:      0 0 16px;
}

.cipac-dist__subtitle {
    font-size:   16px;
    color:       var(--text-mid);
    max-width:   640px;
    margin:      0 auto;
    line-height: 1.6;
}

/* ── Accordéon ───────────────────────────────────────────────── */
.cipac-dist__accordion {
    display:        flex;
    flex-direction: column;
    gap:            var(--item-gap);
}

/* ── Item ─────────────────────────────────────────────────────── */
.cipac-dist__item {
    background:    var(--item-bg);
    border:        1px solid var(--item-border);
    border-radius: var(--item-radius);
    overflow:      hidden;
    transition:    box-shadow .25s;
}
.cipac-dist__item.is-open {
    box-shadow: 0 4px 24px rgba(20,52,107,.12);
    background: var(--item-bg-open);
}

/* ── Toggle ───────────────────────────────────────────────────── */
.cipac-dist__toggle {
    width:       100%;
    display:     flex;
    align-items: center;
    gap:         16px;
    padding:     20px;
    background:  none;
    border:      none;
    cursor:      pointer;
    text-align:  left;
    -webkit-appearance: none;
    appearance:  none;
}
.cipac-dist__toggle:focus-visible {
    outline:        2px solid var(--lime);
    outline-offset: -2px;
}


/* ── Meta (titre + tagline) ──────────────────────────────────── */
.cipac-dist__meta {
    flex:      1;
    min-width: 0; /* permet le retrait du texte si besoin */
}
.cipac-dist__name {
    display:     block;
    font-size:   18px;
    font-weight: 700;
    color:       var(--navy);
    line-height: 1.3;
}
.cipac-dist__tagline {
    display:     block;
    font-size:   14px;
    color:       var(--text-mid);
    margin-top:  3px;
    line-height: 1.4;
}

/* ── Numéro ───────────────────────────────────────────────────── */
.cipac-dist__num {
    font-size:      14px;
    font-weight:    700;
    color:          var(--navy);
    letter-spacing: .04em;
    flex-shrink:    0;
    white-space:    nowrap; /* empêche "01" de se comprimer */
}

/* ── Chevron ──────────────────────────────────────────────────── */
.cipac-dist__chevron {
    width:           var(--chevron-size);
    height:          var(--chevron-size);
    border-radius:   50%;
    background:      var(--chevron-bg);
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    transition:      transform .32s cubic-bezier(.4,0,.2,1);
    color:           var(--chevron-color);
}
.cipac-dist__item.is-open .cipac-dist__chevron {
    transform: rotate(180deg);
}
.cipac-dist__chevron::after {
    content:       '';
    display:       block;
    width:         8px;
    height:        8px;
    border-right:  2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform:     rotate(45deg) translate(-2px, 0);
}

/* ── Corps (accordéon) ───────────────────────────────────────── */
.cipac-dist__body {
    max-height: 0;
    overflow:   hidden;
    transition: max-height .4s cubic-bezier(.4,0,.2,1);
}

.cipac-dist__body-inner {
    display:               grid;
    grid-template-columns: 1fr 280px;
    gap:                   32px;
    padding:               4px 20px 24px var(--body-indent);
}

/* ── Description ─────────────────────────────────────────────── */
.cipac-dist__desc {
    font-size:   15px;
    line-height: 1.7;
    color:       var(--text-dark);
    margin:      0 0 16px;
}

/* ── Bullets ──────────────────────────────────────────────────── */
.cipac-dist__bullets {
    list-style:     none;
    margin:         0 0 20px;
    padding:        0;
    display:        flex;
    flex-direction: column;
    gap:            8px;
}
.cipac-dist__bullet {
    display:     flex;
    align-items: flex-start;
    gap:         10px;
    font-size:   14px;
    color:       var(--text-dark);
    line-height: 1.5;
}
.cipac-dist__bullet-icon {
    width:           18px;
    height:          18px;
    border-radius:   50%;
    background:      var(--lime);
    flex-shrink:     0;
    margin-top:      1px;
    display:         flex;
    align-items:     center;
    justify-content: center;
}
.cipac-dist__bullet-icon::before {
    content:       '';
    display:       block;
    width:         5px;
    height:        8px;
    border-right:  1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    transform:     rotate(45deg) translate(-1px, -1px);
}

/* ── Marques ──────────────────────────────────────────────────── */
.cipac-dist__brands-label {
    display:        block;
    font-size:      11px;
    font-weight:    700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color:          var(--text-mid);
    margin-bottom:  10px;
}
.cipac-dist__tags {
    display:   flex;
    flex-wrap: wrap;
    gap:       8px;
}
.cipac-dist__tag {
    display:         inline-block;
    padding:         5px 14px;
    border:          1.5px solid var(--navy);
    border-radius:   999px;
    font-size:       13px;
    font-weight:     600;
    color:           var(--navy);
    line-height:     1.4;
    text-decoration: none;
    transition:      background .2s, color .2s;
}
a.cipac-dist__tag:hover {
    background:      var(--navy);
    color:           #fff;
    text-decoration: none;
}

/* ── Droite : image + CTA ─────────────────────────────────────── */
.cipac-dist__body-right {
    display:        flex;
    flex-direction: column;
    gap:            16px;
}
.cipac-dist__img {
    width:         100%;
    aspect-ratio:  4/3;
    object-fit:    cover;
    border-radius: 12px;
    display:       block;
}
.cipac-dist__cta {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             8px;
    padding:         13px 24px;
    background:      var(--navy);
    color:           #fff;
    font-size:       15px;
    font-weight:     600;
    text-decoration: none;
    border-radius:   999px;
    transition:      opacity .2s;
}
.cipac-dist__cta:hover {
    opacity:         .85;
    color:           #fff;
    text-decoration: none;
}

/* ── Footer CTA ───────────────────────────────────────────────── */
.cipac-dist__footer {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             24px;
    margin-top:      48px;
    padding:         36px 48px;
    background:      var(--navy);
    border-radius:   16px;
}
.cipac-dist__footer-text {
    display:        flex;
    flex-direction: column;
    gap:            6px;
    min-width:      0;
}
.cipac-dist__footer-title {
    display:     block;
    font-size:   24px;
    font-weight: 700;
    color:       #fff;
}
.cipac-dist__footer-sub {
    display:   block;
    font-size: 15px;
    color:     rgba(255,255,255,.75);
}
.cipac-dist__footer-cta {
    display:         inline-flex;
    align-items:     center;
    gap:             8px;
    padding:         13px 28px;
    background:      var(--lime);
    color:           #fff;
    font-size:       15px;
    font-weight:     600;
    text-decoration: none;
    border-radius:   999px;
    white-space:     nowrap;
    flex-shrink:     0;
    transition:      background .2s;
}
.cipac-dist__footer-cta:hover {
    background:      var(--lime-deep);
    color:           #fff;
    text-decoration: none;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */

/*
 * 3 seuils :
 *  ≤ 899px  — 2 colonnes → 1 colonne (évite la colonne texte trop étroite)
 *  ≤ 767px  — ajustements espacements + footer en colonne
 *  ≤ 479px  — petits téléphones : réduction des composants UI
 */

/* ── ≤ 899px : grid 1 colonne ────────────────────────────────── */
@media (max-width: 899px) {

    /*
     * !important nécessaire : Elementor génère ses styles avec
     * .elementor-element-XXXXX .cipac-dist__body-inner (spécificité 0,2,0),
     * ce qui écrase les media queries sans préfixe widget (0,1,0).
     * Le double sélecteur + !important garantit la priorité responsive.
     */
    .cipac-dist .cipac-dist__body-inner {
        grid-template-columns: 1fr !important;
        gap:          20px;
        padding-left: 20px;
    }

    /* Colonne droite pleine largeur une fois la grille empilée */
    .cipac-dist .cipac-dist__body-right {
        width: 100%;
    }

    /* CTA pleine largeur sur tablette */
    .cipac-dist .cipac-dist__cta {
        justify-content: center;
        text-align:      center;
    }

    /* Limite la hauteur de l'image en mode pleine largeur */
    .cipac-dist__img {
        max-height:   280px;
        aspect-ratio: auto;
    }

    /* Footer : padding moins dense sur tablettes */
    .cipac-dist__footer {
        padding: 28px 32px;
    }
}

/* ── ≤ 767px : mobile ────────────────────────────────────────── */
@media (max-width: 767px) {

    .cipac-dist__header {
        margin-bottom: 32px;
    }

    .cipac-dist__subtitle {
        font-size: 15px;
    }

    /* Footer : empile texte + bouton, bouton pleine largeur */
    .cipac-dist__footer {
        flex-direction: column;
        align-items:    stretch;   /* bouton s'étire sur toute la largeur */
        padding:        28px 24px;
        gap:            20px;
        margin-top:     36px;
    }
    .cipac-dist__footer-cta {
        justify-content: center;
        text-align:      center;
        white-space:     normal;
    }
}

/* ── ≤ 479px : petit téléphone ───────────────────────────────── */
@media (max-width: 479px) {

    /* Réduction des composants via les variables */
    .cipac-dist {
        --chevron-size: 28px;
    }

    /* Toggle : padding et gap réduits */
    .cipac-dist__toggle {
        gap:     10px;
        padding: 14px 16px;
    }

    /* Nom et tagline : taille réduite mais texte toujours lisible */
    .cipac-dist__name {
        font-size:   16px;
        white-space: normal;
        overflow:    visible;
    }
    .cipac-dist__tagline {
        white-space: normal;
        overflow:    visible;
    }

    /* Corps : aligne sur le padding du toggle — propriétés longues pour éviter
       d'écraser silencieusement un futur padding-top/bottom du bloc 899px */
    .cipac-dist__body-inner {
        padding-top:    4px;
        padding-right:  16px;
        padding-bottom: 20px;
        padding-left:   16px;
    }

    /* Titre section */
    .cipac-dist__title {
        font-size: clamp(22px, 6.5vw, 30px);
    }

    /* Footer */
    .cipac-dist__footer {
        padding:    20px 16px;
        margin-top: 28px;
    }
    .cipac-dist__footer-title {
        font-size: 20px;
    }
    .cipac-dist__footer-sub {
        font-size: 13px;
    }
}

/* ── Mode édition Elementor : fallback CSS pour l'accordéon ─── */
.elementor-editor-active .cipac-dist__item.is-open .cipac-dist__body {
    max-height: 2000px;
}
