/* ==========================================================================
   LGL Transport — En-tête, menu principal et menu mobile
   --------------------------------------------------------------------------
   Ce fichier est chargé EN DERNIER sur toutes les pages. Il remplace les
   règles du thème pour l'en-tête, parce que :
     - css/revolution/settings.css est une copie de style.css chargée après
       lui : toute correction faite dans style.css y est écrasée ;
     - la position du menu dépendait du JavaScript du thème (top calculé en
       JS) : si le JS ne charge pas, la barre du haut recouvre le menu.
   Pour modifier l'en-tête, modifier CE fichier.
   ========================================================================== */

:root {
    --lgl-navy: #0c1239;
    --lgl-red: #E5213F;
    --lgl-topbar-h: 60px;
}

/* --------------------------------------------------------------------------
   1. Barre du haut (langue, actualités, recrutement, réseaux sociaux)
   -------------------------------------------------------------------------- */

@media (min-width: 1200px) {
    .topbar {
        height: var(--lgl-topbar-h);
        line-height: normal;
    }

    .topbar > .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 100%;
    }

    .topbar > .container::before,
    .topbar > .container::after {
        content: none;
    }

    .topbar .topbar-left,
    .topbar .topbar-right {
        float: none;
        display: flex;
        align-items: center;
    }

    .topbar .widget {
        line-height: normal;
    }

    .topbar .topbar-right > a {
        font-size: 15px;
        font-weight: 600;
        color: #fff;
        opacity: .9;
        transition: color .2s, opacity .2s;
    }

    .topbar .topbar-right > a:hover,
    .topbar .topbar-right > a:focus {
        color: #fff;
        opacity: 1;
        text-decoration: underline;
        text-underline-offset: 4px;
    }

    .topbar .cargohub-social-links-widget {
        padding-left: 16px;
    }

    .topbar .list-social {
        display: flex;
        gap: 8px;
    }

    .topbar .list-social a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        margin: 0;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, .3);
        border-radius: 50%;
        color: #fff;
        font-size: 14px;
        line-height: 1;
        transition: background-color .2s, border-color .2s;
    }

    .topbar .list-social a:hover,
    .topbar .list-social a:focus {
        background-color: var(--lgl-red);
        border-color: var(--lgl-red);
        color: #fff;
    }
}

/* Sélecteur de langue (même composant en FR / EN / DE) */
.lang-switch {
    position: relative;
    display: inline-block;
    line-height: normal;
}

.lang-switch__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    font-family: 'Mulish', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: border-color .2s;
}

.lang-switch__toggle .fa-angle-down {
    transition: transform .2s;
}

.lang-switch:hover .lang-switch__toggle,
.lang-switch.is-open .lang-switch__toggle {
    border-color: rgba(255, 255, 255, .7);
}

.lang-switch:hover .lang-switch__toggle .fa-angle-down,
.lang-switch.is-open .lang-switch__toggle .fa-angle-down {
    transform: rotate(180deg);
}

.lang-switch__toggle:focus-visible,
.lang-switch__menu a:focus-visible {
    outline: 2px solid var(--lgl-red);
    outline-offset: 2px;
}

.lang-switch__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 10001;
    min-width: 170px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 12px 30px rgba(12, 18, 57, .2);
    /* masqué par l'opacité (et non visibility) : les liens restent
       atteignables au clavier, même si le JavaScript ne charge pas */
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .2s, transform .2s;
}

/* zone invisible pour ne pas perdre le survol entre le bouton et la liste */
.lang-switch__menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.lang-switch:hover .lang-switch__menu,
.lang-switch.is-open .lang-switch__menu,
.lang-switch__menu:focus-within {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.lang-switch__menu li {
    display: block;
    margin: 0;
    padding: 0;
}

.lang-switch__menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    color: var(--lgl-navy);
    font-family: 'Mulish', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.lang-switch__menu a:hover,
.lang-switch__menu a:focus {
    background-color: #f3f5fb;
    color: var(--lgl-red);
}

.lang-switch__menu a[aria-current] {
    color: var(--lgl-red);
}

.lang-switch__menu a[aria-current]::after {
    content: '\f00c';
    font-family: 'FontAwesome';
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   2. En-tête et menu principal — ordinateur (≥ 1200 px)
   -------------------------------------------------------------------------- */

@media (min-width: 1200px) {

    /* Le menu se place sous la barre du haut, avec ou sans JavaScript.
       (!important : le JS du thème écrit un "top" en ligne sur l'élément.) */
    body.header-transparent .site-header:not(.minimized) {
        top: var(--lgl-topbar-h) !important;
    }

    /* Logo à gauche, menu à droite, sur une seule ligne */
    .site-header .header-main .container > .row {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }

    .site-header .header-main .container > .row::before,
    .site-header .header-main .container > .row::after {
        content: none;
    }

    .site-header .site-logo {
        flex: 0 0 auto;
        width: auto;
        float: none;
    }

    .site-header .site-logo img {
        width: 260px;
        max-width: none;
        height: auto;
        transition: width .25s;
    }

    .site-header .site-menu {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        float: none;
        padding-left: 40px;
    }

    .site-header .site-menu .nav ul.menu {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }

    .site-header .site-menu .nav ul.menu::before,
    .site-header .site-menu .nav ul.menu::after {
        content: none;
    }

    .site-header .site-menu .nav ul.menu > li {
        flex: 0 0 auto;
        float: none;
        padding: 10px 0;
        margin-right: 34px;
    }

    .site-header .site-menu .nav ul.menu > li > a {
        font-size: 17px;
        letter-spacing: .01em;
        white-space: nowrap;
    }

    /* Flèche des sous-menus : comprise dans la largeur du lien,
       elle ne peut plus chevaucher l'élément suivant */
    .site-header .site-menu .nav ul.menu > li.has-children > a {
        padding-right: 18px;
    }

    .site-header .site-menu .nav ul.menu > li.has-children > a::before {
        right: 0;
        font-size: 16px;
        transition: transform .2s;
    }

    .site-header .site-menu .nav ul.menu > li.has-children:hover > a::before {
        transform: translateY(-50%) rotate(180deg);
    }

    /* Pas de flèche sur un lien actif qui n'a pas de sous-menu */
    .site-header .site-menu .nav ul.menu > li.active:not(.has-children) > a::before {
        content: none;
    }

    /* Sous-menus alignés sur le texte de leur parent */
    .site-header .site-menu .nav ul.menu > li > ul {
        left: -30px;
        border-top: 3px solid var(--lgl-red);
        box-shadow: 0 12px 30px rgba(12, 18, 57, .15);
    }

    .site-header .site-menu .nav ul.menu > li > ul a {
        font-size: 16px;
        white-space: nowrap;
    }

    /* Bouton Contact, toujours à droite et sur la même ligne */
    .site-header .site-menu .nav .menu li.extra-menu-item.menu-item-button-link {
        float: none;
        margin-left: auto;
        margin-right: 0;
        padding: 0;
    }

    .site-header .site-menu .nav .menu li.menu-item-button-link a {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 0 24px;
        height: 50px;
        line-height: 50px;
        font-size: 17px;
        white-space: nowrap;
    }

    .site-header .site-menu .nav .menu li.menu-item-button-link a i::before {
        margin: 0;
        font-size: 18px;
    }

    /* En-tête fixe au défilement : plus compact */
    body.header-sticky .site-header.minimized {
        padding: 12px 0;
        box-shadow: 0 2px 20px rgba(12, 18, 57, .08);
    }

    body.header-sticky .site-header.minimized .site-logo img {
        width: 220px;
    }
}

/* Écrans 1200–1399 px : on resserre un peu pour que l'allemand tienne */
@media (min-width: 1200px) and (max-width: 1399px) {
    .site-header .site-logo img {
        width: 230px;
    }

    body.header-sticky .site-header.minimized .site-logo img {
        width: 200px;
    }

    .site-header .site-menu {
        padding-left: 28px;
    }

    .site-header .site-menu .nav ul.menu > li {
        margin-right: 26px;
    }

    .site-header .site-menu .nav ul.menu > li > a,
    .site-header .site-menu .nav .menu li.menu-item-button-link a {
        font-size: 16px;
    }

    .site-header .site-menu .nav .menu li.menu-item-button-link a {
        padding: 0 20px;
    }
}

/* --------------------------------------------------------------------------
   3. Tablette et mobile (< 1200 px) : menu "burger"
   La barre du haut est masquée sous 1200 px ; le menu complet n'y tient pas
   non plus, on bascule donc sur le menu mobile dès cette largeur.
   -------------------------------------------------------------------------- */

@media (max-width: 1199px) {
    .site-header .site-menu {
        display: none;
    }

    .site-header .navbar-toggle {
        display: inline-block;
    }

    body.header-transparent .site-header:not(.minimized) {
        top: 0 !important;
    }

    body.header-sticky .site-header.minimized {
        box-shadow: 0 2px 20px rgba(12, 18, 57, .08);
    }
}

/* Panneau du menu mobile */
.primary-mobile-nav {
    max-width: 100%;
}

.primary-mobile-nav ul.menu > li:not(.menu-item-button-link) > a {
    color: var(--lgl-navy);
    font-weight: 600;
}

.primary-mobile-nav ul.menu li.menu-item-button-link > a {
    color: #fff;
}

.primary-mobile-nav ul.menu > li.current-menu-item > a {
    color: var(--lgl-red);
}

.primary-mobile-nav ul.menu li.menu-item-button-link {
    margin-top: 24px;
}

.primary-mobile-nav ul.menu li.mobile-secondary {
    padding-top: 10px;
    padding-bottom: 10px;
}

.primary-mobile-nav ul.menu li.mobile-secondary.is-first {
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #eef0f6;
}

.primary-mobile-nav ul.menu li.mobile-secondary > a {
    color: #5b6079;
    font-weight: 600;
    font-size: 15px;
}

.primary-mobile-nav ul.menu li.mobile-lang {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.primary-mobile-nav ul.menu li.mobile-lang a {
    flex: 1 1 0;
    padding: 9px 0;
    border: 1px solid #dde2f0;
    border-radius: 4px;
    color: var(--lgl-navy);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    letter-spacing: .04em;
}

.primary-mobile-nav ul.menu li.mobile-lang a[aria-current] {
    background-color: var(--lgl-navy);
    border-color: var(--lgl-navy);
    color: #fff;
}

.primary-mobile-nav .close-canvas-mobile-panel {
    color: var(--lgl-navy);
}
