/* ==========================================================
   TOP SERVICES
   Familles de services avec panneau descriptif au survol
   ========================================================== */

.top-services {
    position: relative;
    z-index: 155;
    width: 100%;
    overflow: visible;
    background: var(--color-turquoise-dark);
}

.top-services__inner {
    width: 100%;
    padding: 0.5rem 1rem 0.65rem;
}

.top-services__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.top-services__item {
    position: relative;
    text-align: center;
}

.top-services__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.42rem 1rem;
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 999px;
    background: transparent;
    color: var(--color-white);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: default;
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease,
        transform 180ms ease;
}

.top-services__button:hover,
.top-services__button:focus-visible,
.top-services__item:focus-visible .top-services__button {
    border-color: var(--color-coral-soft);
    background: var(--color-coral-soft);
    color: var(--color-turquoise-dark);
    transform: translateY(-1px);
}

.top-services__button:focus-visible {
    outline: 2px solid var(--color-white);
    outline-offset: 2px;
}

/* ---------- Panneau ---------- */

.top-services__panel {
    position: absolute;
    top: calc(100% + 0.15rem);
    left: 50%;
    z-index: 120;
    display: grid;
    gap: 0.4rem;
    min-width: 220px;
    max-width: min(320px, 90vw);
    margin: 0;
    padding: 0.85rem 1rem ;
    border: 1px solid var(--color-line);
    border-radius: 16px;
    background: var(--color-white);
    color: var(--color-turquoise-dark);
    box-shadow: 0 14px 30px rgb(15 111 116 / 20%);
    list-style: none;
    visibility: hidden;
    opacity: 0;
    transform: translate(-50%, -6px);
    pointer-events: none;
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        visibility 180ms ease;
}

.top-services__panel li {
    padding: 0;
    font-size: 0.92rem;
    line-height: 1.35;
}

.top-services__panel li:last-child {
    padding-bottom: 0.65rem;
}

.top-services__item:hover .top-services__panel,
.top-services__button:focus-visible + .top-services__panel {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.top-services__intro {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 1px solid rgb(0 0 0 / 10%);
    font-size: .82rem;
    font-style: italic;
    color: tomato;
}

/* Évite que les panneaux extrêmes sortent de l’écran */

.top-services__item:first-child .top-services__panel {
    left: 0;
    transform: translate(0, -6px);
}

.top-services__item:first-child:hover .top-services__panel,
.top-services__item:first-child:focus-visible .top-services__panel {
    transform: translate(0, 0);
}

.top-services__item:last-child .top-services__panel {
    right: 0;
    left: auto;
    transform: translate(0, -6px);
}

.top-services__item:nth-last-child(-n + 2):hover .top-services__panel,
    .top-services__item:nth-last-child(-n + 2):focus-visible .top-services__panel {
        min-width: 240px;
    max-width: min(240px, 90vw);
    }


.top-services__item:last-child:hover .top-services__panel,
.top-services__item:last-child:focus-visible .top-services__panel {
    transform: translate(0, 0);
}

/* ---------- Séparateur ---------- */

.top-services__separator {
    height: 3px;
    background: linear-gradient(
        135deg,
        #27c5ca 0%,
        #33d3d5 25%,
        #ff8a73 55%,
        #ff6f5c 100%
    );
}

/* ---------- Mobile ---------- */

@media (max-width: 991px) {
    .top-services__inner {
        padding: 0.45rem 0.75rem 0.6rem;
    }

    .top-services__list {
        gap: 0.4rem;
    }

    .top-services__button {
        min-height: 32px;
        padding: 0.38rem 0.75rem;
        font-size: 0.88rem;
    }


     .top-services__item:nth-last-child(-n + 2) .top-services__panel {
        right: 0;
        left: auto;
        transform: translate(0, -6px);
    }

    .top-services__item:nth-last-child(-n + 2):hover .top-services__panel,
    .top-services__item:nth-last-child(-n + 2):focus-within .top-services__panel {
        transform: translate(0, 0);
    }
}