/* =========================================================
   HEADER
========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

/* =========================================================
   ACCUEIL — HEADER SUR LA VIDÉO
========================================================= */

.site-header--hero {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;

    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,.18);

    transition:
        background .3s ease,
        border-color .3s ease,
        box-shadow .3s ease;
}

.site-header--hero.scrolled {
    background: #fff;
    border-bottom-color: var(--line);
    box-shadow: 0 4px 18px rgba(7,27,41,.06);
}


/* =========================================================
   CONTENEUR
========================================================= */

.header-inner {
    max-width: 1280px;
    min-height: 78px;
    margin: 0 auto;
    padding: 0 32px;

    display: flex;
    align-items: center;
    gap: 40px;
}


/* =========================================================
   LOGO
========================================================= */

.brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;

    opacity: 1;
    visibility: visible;

    transition:
        opacity .3s ease,
        visibility .3s ease;
}

.brand img {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

/* Logo invisible au début du Hero */

.site-header--hero:not(.scrolled) .brand {
    opacity: 0;
    visibility: hidden;
}


/* =========================================================
   NAVIGATION PRINCIPALE
========================================================= */

.main-nav {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 28px;
}

.nav-item {
    position: static;
}

.has-mega {
    position: static;
}

.main-nav > a,
.nav-item > a {
    position: relative;
    z-index: 5;

    color: var(--navy);

    font-size: 18px;
    font-weight: 900;

    white-space: nowrap;

    transition: color .2s ease;
}

.main-nav > a:hover,
.nav-item > a:hover {
    color: var(--green);
}


/* =========================================================
   NAVIGATION SUR LA VIDÉO
========================================================= */

.site-header--hero:not(.scrolled) .main-nav > a,
.site-header--hero:not(.scrolled) .nav-item > a,
.site-header--hero:not(.scrolled) .languages a {
    color: #fff;
}

.site-header--hero:not(.scrolled) .main-nav > a:hover,
.site-header--hero:not(.scrolled) .nav-item > a:hover,
.site-header--hero:not(.scrolled) .languages a:hover {
    color: #fff;
}


/* =========================================================
   MEGA MENU
========================================================= */

.mega-menu {
    position: absolute;
    top: 78px;
    left: 50%;

    width: min(1100px, calc(100vw - 50px));

    transform: translateX(-50%);

    display: grid;
    grid-template-columns: 30% 70%;

    background: #fff;

    border: 1px solid var(--line);

    box-shadow: 0 18px 45px rgba(7,27,41,.14);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity .18s ease,
        visibility .18s ease;
}

/*
   Zone invisible de continuité entre le header
   et le mega-menu.
*/

.mega-menu::before {
    content: "";
    position: absolute;

    top: -14px;
    left: 0;
    right: 0;

    height: 14px;
}


/* Ouverture contrôlée par JavaScript */

.has-mega.mega-open .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


/* =========================================================
   INTRODUCTION DU MEGA MENU
========================================================= */

.mega-intro {
    padding: 42px 38px;

    background: #f5f7f6;

    border-right: 1px solid var(--line);
}

.mega-eyebrow {
    display: block;

    margin-bottom: 25px;

    color: var(--green);

    font-size: 11px;
    font-weight: 700;
    letter-spacing: .16em;
}

.mega-intro h2 {
    margin: 0 0 15px;

    color: var(--navy);

    font-size: 30px;
    line-height: 1.1;
}

.mega-intro p {
    margin: 0;

    color: #657177;

    font-size: 14px;
    line-height: 1.7;
}

.mega-discover {
    display: inline-block;

    margin-top: 28px;

    color: var(--navy);

    font-size: 13px;
    font-weight: 700;

    transition: color .2s ease;
}

.mega-discover:hover {
    color: var(--green);
}


/* =========================================================
   LIENS DU MEGA MENU
========================================================= */

.mega-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-content: start;
}

.mega-links a {
    min-height: 105px;

    padding: 25px 28px;

    border-bottom: 1px solid var(--line);
    border-left: 1px solid var(--line);

    transition: background .15s ease;
}

.mega-links a:hover {
    background: #f8faf9;
}

.mega-links strong {
    display: block;

    margin-bottom: 6px;

    color: var(--navy);

    font-size: 14px;
    line-height: 1.3;
}

.mega-links span {
    display: block;

    color: #7a8589;

    font-size: 12px;
    line-height: 1.5;
}


/* =========================================================
   MEGA MENU — UN SEUL ÉLÉMENT
========================================================= */

.mega-single {
    grid-template-columns: 1fr;
}


/* =========================================================
   LANGUES
========================================================= */

.languages {
    flex-shrink: 0;

    display: flex;
    gap: 8px;

    font-size: 11px;
    font-weight: 700;
}

.languages a {
    color: var(--navy);

    transition: color .2s ease;
}

.languages a:hover {
    color: var(--green);
}


/* =========================================================
   MENU MOBILE
========================================================= */

.menu-toggle {
    display: none;

    border: 0;
    background: transparent;

    color: var(--navy);

    font-size: 24px;

    cursor: pointer;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 1000px) {

    .header-inner {
        min-height: 70px;
        padding: 0 20px;
    }

    .brand img {
        width: 46px;
        height: 46px;
    }

    .menu-toggle {
        display: block;
        margin-left: auto;
    }

    .main-nav {
        position: absolute;

        top: 70px;
        left: 0;
        right: 0;

        display: none;

        flex-direction: column;
        align-items: stretch;

        gap: 0;

        background: #fff;

        border-bottom: 1px solid var(--line);
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav > a,
    .nav-item > a {
        display: block;

        padding: 17px 20px;

        color: var(--navy);

        border-bottom: 1px solid var(--line);
    }


    /* =====================================================
       MEGA MENU MOBILE
    ===================================================== */

    .mega-menu {
        position: static;

        width: 100%;

        display: none;

        transform: none;

        border: 0;

        box-shadow: none;
    }

    .mega-menu::before {
        display: none;
    }

    .has-mega.mega-open .mega-menu {
        display: grid;
    }

    .mega-intro {
        padding: 25px 20px;

        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .mega-links {
        grid-template-columns: 1fr;
    }

    .mega-links a {
        min-height: auto;
    }

    .languages {
        margin-left: 0;
    }


    /* Header hero en mobile */

    .site-header--hero:not(.scrolled) .main-nav > a,
    .site-header--hero:not(.scrolled) .nav-item > a,
    .site-header--hero:not(.scrolled) .languages a {
        color: var(--navy);
    }

    .site-header--hero:not(.scrolled) .main-nav > a:hover,
    .site-header--hero:not(.scrolled) .nav-item > a:hover,
    .site-header--hero:not(.scrolled) .languages a:hover {
        color: var(--green);
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 600px) {

    .brand img {
        width: 42px;
        height: 42px;
    }

    .languages {
        gap: 4px;
    }
}


/* =========================================================
   RTL
========================================================= */

html[dir="rtl"] .mega-intro {
    border-right: 0;
    border-left: 1px solid var(--line);
}

html[dir="rtl"] .mega-links a {
    border-left: 0;
    border-right: 1px solid var(--line);
}

html[dir="rtl"] .mega-links a:hover {
    background: #f8faf9;
}

html[dir="rtl"] .languages {
    direction: rtl;
}
