/* Float nav */
.hide-nav .js-header-float {
    transform: translateY(-100%);
}

/* Nav link typography */
.menu-trigger {
    font-size: 1rem;
    font-weight: 700;
    line-height: 138%;
    color: rgb(var(--textcolor));
}
span.menu-trigger {
    cursor: default;
    user-select: none;
}

/* Bridge invisible sous le trigger pour couvrir le gap entre nav et panel */
.menu-item-top.menu-item-has-children > .menu-trigger {
    position: relative;
    display: inline-block;
}
.menu-item-top.menu-item-has-children > .menu-trigger::after {
    content: '';
    position: absolute;
    height: 250%;
    width: calc(100% + 44px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.menu-item-top.menu-item-has-children.is-open > .menu-trigger::before {
    content: '';
    position: absolute;
    height: 6rem;
    width: calc(100% + 44px);
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
}

/* +/- indicator animé */
.menu-trigger-icon {
    display: inline-block;
    position: relative;
    width: 0.625rem;
    height: 0.625rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    margin-bottom: 0.1em;
}
.menu-trigger-icon::before,
.menu-trigger-icon::after {
    content: '';
    position: absolute;
    background: currentColor;
    border-radius: 1px;
    transition:
        transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.25s ease;
}
/* Barre horizontale */
.menu-trigger-icon::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}
/* Barre verticale */
.menu-trigger-icon::after {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}
/* État ouvert : barre verticale disparaît → devient − */
.menu-item-top:hover > .menu-trigger .menu-trigger-icon::after,
.menu-item-top.is-open > .menu-trigger .menu-trigger-icon::after {
    transform: translateX(-50%) scaleY(0);
    opacity: 0;
}

/* Neutralise le position:relative du .wrapper pour que le panel se positionne sur la <nav> */
.menu-nav-wrapper {
    position: static;
}

/* Mega-menu panel — positionné sur la <nav> (relative/fixed, full-width) */
.mega-menu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding-top: 2.25rem;
    padding-bottom: 2.25rem;
    background: rgb(var(--background));
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-0.5rem);
    transition:
    opacity 0.3s ease,
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.menu-item-top.is-open > .mega-menu-panel {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}
.mega-menu-panel .wrapper {
    max-width: 1200px;
}

/* ============================================================
   Contenu du mega-menu
   - 3 niveaux : catégories (titre h4 accent + flèche) côte à côte,
     enfants en 2 colonnes.
   - 2 niveaux : liens simples répartis en 3 colonnes.
   Le layout est choisi via :has() selon la présence de catégories.
   ============================================================ */
.mega-menu-columns,
.mega-menu-sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 3 niveaux : catégories en colonnes égales */
.mega-menu-columns:has(.mega-menu-column) {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 2.5rem;
}
/* 2 niveaux : liens répartis en 3 colonnes */
.mega-menu-columns:not(:has(.mega-menu-column)) {
    columns: 3;
    column-gap: 2.5rem;
}

/* Titre de catégorie (niveau 2 en mode 3 niveaux) */
.mega-menu-col-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #e65300;
    text-decoration: none;
}
/* Flèche 1rem réutilisant l'animation swap du bouton primary */
.btn-arrow-wrap.mega-menu-col-arrow {
    width: 1rem;
    height: 1rem;
}
.mega-menu-col-title:hover .btn-arrow:first-child {
    transform: translateX(200%);
}
.mega-menu-col-title:hover .btn-arrow:last-child {
    transform: translateX(0);
}

/* Enfants d'une catégorie : 2 colonnes */
.mega-menu-sub {
    /* columns: 2; */
    /* column-gap: 1.5rem; */
    margin-top: 1.75rem;
}

/* Liens (enfants niveau 3 + liens du menu 2 niveaux) */
.mega-menu-item {
    break-inside: avoid;
    margin-bottom: 0.9rem;
}
.mega-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgb(var(--textcolor));
    text-decoration: none;
    transition: color 0.25s ease;
}
.mega-menu-link:hover {
    color: #e65300;
}
.mega-menu-link-arrow {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    flex-shrink: 0;
    background-color: #e65300;
    -webkit-mask: url(../../../assets/svg/arrow-button.svg) no-repeat 50% / contain;
    mask: url(../../../assets/svg/arrow-button.svg) no-repeat 50% / contain;
    opacity: 0;
    transform: translateX(-0.35rem);
    transition:
        opacity 0.25s ease,
        transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.mega-menu-link:hover .mega-menu-link-arrow {
    opacity: 1;
    transform: translateX(0);
}
.mega-menu-item.menu-button .mega-menu-link-arrow{
    display: none;
}
.menu-link-underline {
    margin-top: 32px;
}
.m-item.menu-link-underline {
    margin-top: 24px;
}
.menu-link-underline a {
    color: #e65300;
    text-decoration: underline;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-underline-offset: 4px;
    background: none !important
}


/* ============================================================
   Liens ACF de droite
   ============================================================ */

/* Lien « Espace client » : chevron arrow-simple à droite, suit la
   couleur du texte (currentColor), passe en #e65300 au hover. */
.menu-link-primary {
    transition: color 0.25s ease;
}
.menu-link-primary::after {
    content: '';
    display: inline-block;
    width: 0.5625rem;
    height: 0.5625rem;
    margin-left: 0.4rem;
    background-color: currentColor;
    flex-shrink: 0;
    -webkit-mask: url(../../../assets/svg/arrow-simple.svg) no-repeat 50% / contain;
    mask: url(../../../assets/svg/arrow-simple.svg) no-repeat 50% / contain;
}
.menu-link-primary:hover {
    color: #e65300;
}

/* Bouton téléphone (btn-primary.phone.back) : caché en mobile,
   icône à gauche, l'icône suit la couleur du texte sans translate. */
.menu-link-button.btn-primary {
    display: none;
}
@media (min-width: 1024px) {
    .menu-link-button.btn-primary {
        display: inline-flex;
    }
}
.btn-primary.phone .btn-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.btn-primary.phone .btn-icon svg {
    width: 1.0625rem;
    height: 1.0625rem;
}
.btn-primary.phone .btn-icon svg path {
    fill: currentColor;
    transition: fill 0.3s ease;
}

/* Fond du nav quand un mega-menu est ouvert */
.header {
    transition: background-color 0.3s ease;
}
.header:has(.menu-item-top.is-open),
nav.js-header-float:has(.menu-item-top.is-open) {
    background-color: rgb(var(--background));
}

#wpadminbar ~ .js-header-float {
    top: 2rem !important;
}

.menu-on .line1 {
    transform: translateY(0.5625rem) rotate(45deg);
}

.menu-on .line2 {
    opacity: 0;
}

.menu-on .line3 {
    transform: translateY(-0.5625rem) rotate(-45deg);
}

.menu-on .overlay {
    transform: translateX(0);
    pointer-events: auto;
}

#search-toggle svg,
.enter-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   Menu mobile (overlay accordéon)
   ============================================================ */
.m-menu-overlay {
    top: var(--header-h, 5rem);
    height: calc(100vh - var(--header-h, 5rem));
    height: calc(100svh - var(--header-h, 5rem));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.m-menu-inner {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
}

/* Header opaque quand le menu mobile est ouvert */
.menu-on .header,
.menu-on .js-header-float {
    background-color: rgb(var(--background));
}

/* Liste du menu primaire */
.m-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-top: 1.5rem;
}

/* Rangée top-level : label (lien ou span) + carré orange / lien simple */
.m-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    min-height: 3.5rem;
    border-top: 1px solid rgb(var(--textcolor) / 0.15);
    color: rgb(var(--textcolor));
    text-decoration: none;
}
a.m-row,
a.m-row-label {
    cursor: pointer;
}
.m-menu .m-menu-item:first-child > .m-row {
    border-top: 0;
}
.m-row-label {
    color: rgb(var(--textcolor));
}

/* Carré orange contenant le +/− : cible du toggle */
.m-accordion-square {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    background: #e65300;
    color: #fff;
    cursor: pointer;
}

/* Icône +/− de l'accordéon */
.m-accordion-icon {
    position: relative;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}
.m-accordion-icon::before,
.m-accordion-icon::after {
    content: '';
    position: absolute;
    background: currentColor;
    border-radius: 1px;
}
.m-accordion-icon::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    transform: translateY(-50%);
}
.m-accordion-icon::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    transition:
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.3s ease;
}
.m-menu-item.is-open .m-accordion-icon::after {
    transform: translateX(-50%) scaleY(0);
    opacity: 0;
}

/* Chevron (liens row sans enfants + Espace client) */
.m-chevron {
    width: 0.75rem;
    height: 0.75rem;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url(../../../assets/svg/arrow-simple.svg) no-repeat 50% / contain;
    mask: url(../../../assets/svg/arrow-simple.svg) no-repeat 50% / contain;
}

/* Corps de l'accordéon : animation de hauteur via grid-template-rows */
.m-accordion-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.m-menu-item.is-open > .m-accordion-body {
    grid-template-rows: 1fr;
}
.m-accordion-content {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: hidden;
}
.m-menu-item.is-open > .m-accordion-body > .m-accordion-content {
    padding-bottom: 1.75rem;
}

/* 2 niveaux : liens en 2 colonnes */
.m-accordion-content:not(:has(.m-category)) {
    columns: 2;
    column-gap: 1rem;
}

/* 3 niveaux : catégories empilées verticalement */
.m-category {
    margin-bottom: 1.75rem;
}
.m-category:first-child {
    margin-top: 2.75rem;
}
.m-category:last-child {
    margin-bottom: 0;
}
.m-category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
    color: #e65300;
    text-decoration: none;
}
.btn-arrow-wrap.m-category-arrow {
    width: 1rem;
    height: 1rem;
}

/* Enfants de catégorie : 2 colonnes */
.m-sub {
    list-style: none;
    margin: 0;
    padding: 0;
    /* columns: 2; */
    /* column-gap: 1rem; */
}

/* Liens simples (niveau 2 et niveau 3) — flèche visible en permanence */
.m-item {
    break-inside: avoid;
    margin-bottom: 0.9rem;
}
.m-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgb(var(--textcolor));
    text-decoration: none;
    transition: color 0.25s ease;
}
.m-link-arrow {
    width: 0.7rem;
    height: 0.7rem;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url(../../../assets/svg/arrow-button.svg) no-repeat 50% / contain;
    mask: url(../../../assets/svg/arrow-button.svg) no-repeat 50% / contain;
}
/* Hover desktop sur les liens niveau 3 (et 2 niveaux) : texte + flèche → accent */
.m-link:hover {
    color: #e65300;
}
/* Hover desktop sur le titre de catégorie : swap de la flèche */
.m-category-title:hover .btn-arrow:first-child {
    transform: translateX(200%);
}
.m-category-title:hover .btn-arrow:last-child {
    transform: translateX(0);
}

.wpml-ls,
.wpml-ls ul,
.wpml-ls li {
    margin: 0;
    padding: 0;
    border: 0;
    list-style: none;
    background: none;
}
.wpml-ls-link {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0 !important;
    font-weight: 400 !important;
    font-size: 1rem !important;
    line-height: 138% !important;
    color: rgb(var(--textcolor)) !important;
    text-decoration: none !important;
    transition: opacity 0.3s ease !important;
}
.wpml-ls-link .wpml-ls-native {
    color: inherit;
}
.wpml-ls-link:hover {
    opacity: 0.7;
}
