/*
 * Page d'accueil — secteurs d'application (templates/app/home/testimonials.html.twig).
 * Mobile : accordéon. À partir de 1000 px : liste des secteurs à gauche, contenu à droite.
 * Fichier écrit à la main (il ne passe pas par la compilation Sass du dossier assets/).
 */

.sectors {
    --sectors-blue: #0101b7;
    --sectors-blue-light: #247bff;
    --sectors-cyan: #1ac5ff;
    --sectors-ink: #222222;
    --sectors-muted: #5c5e61;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* De l'air entre les secteurs et le pied de page */
.testimonials {
    padding-bottom: 56px;
}

@media (min-width: 850px) {
    .testimonials { padding-bottom: 80px; }
}

@media (min-width: 1200px) {
    .testimonials { padding-bottom: 110px; }
}

.sectors__item {
    border-radius: 18px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
    transition: background-color .3s;
}

.sectors__item.is-open {
    background-color: #ffffff;
    box-shadow: 0 18px 40px rgba(0, 0, 40, .22);
}

.sectors__heading {
    margin: 0;
    font: inherit;
}

/* ------------------------------------------------------------------ onglet */

.sectors__tab {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    margin: 0;
    padding: 18px 20px;
    border: 0;
    background: none;
    color: #ffffff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sectors__tab:focus-visible {
    outline: 2px solid var(--sectors-cyan);
    outline-offset: -4px;
    border-radius: 18px;
}

/* Pictogramme du secteur, dans une pastille */
.sectors__tab__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .14);
    color: var(--sectors-cyan);
    transition: background-color .3s, color .3s;
}

.sectors__tab__icon .icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.sectors__item.is-open .sectors__tab__icon {
    background-color: #e8eeff;
    color: var(--sectors-blue);
}

.sectors__tab__label {
    flex: 1;
    min-width: 0;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sectors__tab__name {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.sectors__tab__detail {
    font-size: 13px;
    line-height: 1.45;
    opacity: .78;
}

.sectors__tab__arrow {
    flex: none;
    width: 14px;
    height: 14px;
    margin-top: 5px;
    fill: currentColor;
    transition: transform .3s;
}

.sectors__item.is-open .sectors__tab {
    color: var(--sectors-blue);
}

.sectors__item.is-open .sectors__tab__detail {
    color: var(--sectors-muted);
    opacity: 1;
}

.sectors__item.is-open .sectors__tab__arrow {
    transform: rotate(180deg);
}

/* ----------------------------------------------------------------- contenu */

.sectors__panel {
    display: none;
    background-color: #ffffff;
    color: var(--sectors-ink);
}

.sectors__item.is-open .sectors__panel {
    display: block;
    animation: sectors-in .35s ease both;
}

@keyframes sectors-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .sectors__item.is-open .sectors__panel { animation: none; }
    .sectors__tab__arrow, .sectors__item { transition: none; }
}

.sectors__pic {
    display: block;
    margin: 0 20px;
    height: 190px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #eef1fb;
}

.sectors__pic__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sectors__body {
    padding: 22px 20px 26px;
}

.sectors__text {
    font-size: 15px;
    line-height: 1.65;
}

/* Les textes saisis dans l'ancien éditeur portent des styles en ligne : on les neutralise */
.sectors__text p,
.sectors__text li {
    margin: 0 !important;
    padding: 0 0 16px !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
    color: var(--sectors-ink) !important;
}

.sectors__text > :last-child {
    padding-bottom: 0 !important;
}

.sectors__text ul,
.sectors__text ol {
    margin: 0;
    padding: 0 0 0 20px;
}

.sectors__text h2,
.sectors__text h3 {
    margin: 0;
    padding: 6px 0 10px;
    color: var(--sectors-blue);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
}

.sectors__text a {
    color: var(--sectors-blue) !important;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sectors__text a:hover {
    color: var(--sectors-blue-light) !important;
}

.sectors__btn {
    display: flex;
    padding-top: 22px;
}

.sectors__btn__link {
    padding: 12px 22px;
    border-radius: 999px;
    background-color: var(--sectors-blue);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .3s;
}

.sectors__btn__link:hover {
    background-color: var(--sectors-blue-light);
}

@media (min-width: 600px) {
    .sectors__tab { padding: 22px 28px; gap: 18px; }
    .sectors__tab__name { font-size: 19px; }
    .sectors__pic { margin: 0 28px; height: 280px; }
    .sectors__body { padding: 26px 28px 32px; }
}

/* ------------------------------------- grand écran : liste à gauche, contenu à droite */

@media (min-width: 1000px) {
    .sectors {
        display: grid;
        grid-template-columns: minmax(270px, 310px) minmax(0, 1fr);
        grid-template-rows: repeat(var(--sectors-count, 3), auto) 1fr;
        column-gap: 24px;
        row-gap: 12px;
        align-items: start;
    }

    /* L'onglet et le contenu deviennent deux cases de la grille */
    .sectors__item {
        display: contents;
    }

    .sectors__heading {
        grid-column: 1;
        border-radius: 18px;
        background-color: rgba(255, 255, 255, .08);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
        transition: background-color .3s, box-shadow .3s;
    }

    .sectors__heading:hover {
        background-color: rgba(255, 255, 255, .16);
    }

    .sectors__item.is-open .sectors__heading {
        background-color: #ffffff;
        box-shadow: 0 12px 30px rgba(0, 0, 40, .2);
    }

    .sectors__tab {
        padding: 22px 24px;
        border-radius: 18px;
    }

    .sectors__tab__arrow,
    .sectors__item.is-open .sectors__tab__arrow {
        transform: rotate(-90deg);
    }

    .sectors__tab__arrow {
        opacity: .55;
    }

    .sectors__item.is-open .sectors__tab__arrow {
        opacity: 1;
    }

    .sectors__panel {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: stretch;
        min-height: 380px;
        border-radius: 24px;
        overflow: hidden;
        box-shadow: 0 18px 40px rgba(0, 0, 40, .22);
    }

    /* Image en bandeau au-dessus du texte : elle prend la hauteur que le texte laisse libre */
    .sectors__item.is-open .sectors__panel {
        display: flex;
        flex-direction: column;
    }

    .sectors__pic {
        /* quand la place manque, c'est l'image qui se réduit en premier, pas le texte */
        flex: 1 1000 200px;
        margin: 0;
        height: auto;
        min-height: 100px;
        border-radius: 0;
    }

    /*
     * Le texte défile dans le bloc s'il est plus long que la place disponible.
     * Pas de overscroll-behavior: contain ici : arrivé au bout du texte, la molette doit
     * reprendre le défilement de la page, sinon la page semble bloquée quand la souris est sur le texte.
     */
    .sectors__body {
        flex: 0 1 auto;
        min-height: 0;
        padding: 24px 40px 26px;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .sectors__text {
        font-size: 14px;
        line-height: 1.55;
    }

    .sectors__text p,
    .sectors__text li {
        padding-bottom: 12px !important;
        font-size: 14px !important;
        line-height: 1.55 !important;
    }

    .sectors__btn {
        padding-top: 18px;
    }
}

/*
 * Grand écran : en bas de page, tout le bloc des secteurs reste visible au-dessus du pied de page.
 * Sa hauteur = hauteur de la fenêtre − menu fixe − pied de page − marges
 * (--sectors-header-h et --sectors-footer-h sont mesurés par home-sectors.js).
 */
@media (min-width: 1000px) and (min-height: 600px) {
    .testimonials {
        /* 28 px d'air + les 40 px que le pied de page recouvre */
        padding-bottom: 68px;
    }

    .sectors {
        /* 32 px d'air sous le menu fixe, 28 px au-dessus du pied de page */
        height: clamp(380px, calc(100vh - var(--sectors-header-h, 104px) - var(--sectors-footer-h, 100px) - 60px), 620px);
    }
}

@media (min-width: 1000px) and (min-height: 600px) and (max-width: 1199px) {
    /* le pied de page ne recouvre que 30 px à cette largeur */
    .testimonials { padding-bottom: 58px; }
}

/* --------------------------------------------------- aides visibles dans l'éditeur */

html.tce-on .sectors__tab__name:empty::before {
    content: "Titre du secteur";
    opacity: .5;
}

html.tce-on .sectors__tab__name {
    min-width: 60px;
    cursor: text;
}

html.tce-on .sectors__pic:empty {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #b9c2e6;
    height: 140px;
}

html.tce-on .sectors__pic:empty::before {
    content: "Survolez pour ajouter une image";
    color: #5c5e61;
    font-size: 13px;
}
