/**
 * Header Warein
 * Override complet du header parent via parts/header.html
 */

/* ==========================================================================
   Wrapper — pas sticky (seule la nav principale l'est)
   ========================================================================== */

/* Le <header> template-part doit être sticky (pas son enfant .warein-header,
   car sticky ne fonctionne pas quand le parent a la même hauteur que l'enfant) */
header.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.admin-bar header.site-header {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar header.site-header {
        top: 0;
    }
}

.warein-header {
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Top Bar — fond vert Hemlock
   ========================================================================== */

.warein-topbar {
    background-color: var(--wp--preset--color--primary, #505A3D);
    color: var(--wp--preset--color--white, #fff);
    padding: 8px 0;
}

.warein-topbar__container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--warein-container-padding);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Secondary nav links */
.warein-topbar__nav .leb-site-nav__list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.warein-topbar__nav .leb-site-nav__list li {
    display: flex;
    align-items: center;
}

.warein-topbar__nav .leb-site-nav__list a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    transition: color 0.2s ease;
}

.warein-topbar__nav .leb-site-nav__list a:hover {
    color: var(--wp--preset--color--white, #fff);
}

/* Dernier lien en gras */
.warein-topbar__nav .leb-site-nav__list li:last-child a {
    font-weight: 700;
    color: var(--wp--preset--color--white, #fff);
}

/* Separateurs | entre les liens */
.warein-topbar__nav .leb-site-nav__list li + li::before {
    content: '|';
    color: rgba(255, 255, 255, 0.4);
    margin: 0 16px;
    font-size: 12px;
}

.warein-topbar__nav .leb-site-nav__list .sub-menu {
    display: none;
}

/* ==========================================================================
   Navigation principale — sticky glassmorphism
   ========================================================================== */

.warein-header__main {
    position: relative;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s ease;
}

.warein-header__main:hover {
    background: #fff;
}

.warein-header__container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--warein-container-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* ==========================================================================
   Logo — 200x60
   ========================================================================== */

.warein-header__left {
    flex-shrink: 0;
}

.warein-header__left .leb-site-logo-block {
    display: flex;
    align-items: center;
}

.warein-header__left .leb-site-logo {
    max-width: 200px;
    max-height: 60px;
    width: auto;
    height: auto;
}

.warein-header__left .leb-site-logo-link {
    display: block;
    line-height: 0;
}

.warein-header__left .leb-site-logo-link--text {
    font-family: var(--wp--preset--font-family--heading, serif);
    font-size: var(--wp--preset--font-size--xl, 1.5rem);
    font-weight: 700;
    color: var(--wp--preset--color--dark, #4B5563);
    text-decoration: none;
}

/* ==========================================================================
   Navigation — Inter Medium 14px uppercase
   ========================================================================== */

.warein-header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-self: stretch;
}

.warein-header__nav .leb-site-nav {
    display: flex;
    align-items: stretch;
}

.warein-header__nav .leb-site-nav__list {
    display: flex;
    align-items: stretch;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.warein-header__nav .leb-site-nav__list > li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
}

.warein-header__nav .leb-site-nav__list > li > a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    line-height: 20px;
    color: var(--wp--preset--color--dark, #4B5563);
    text-decoration: none;
    transition: color 0.2s ease;
}


.warein-header__nav .leb-site-nav__list > li > a:hover {
    color: var(--wp--preset--color--primary, #505A3D);
}

.warein-header__nav .leb-site-nav__list .current-menu-item > a,
.warein-header__nav .leb-site-nav__list .current_page_item > a {
    color: var(--wp--preset--color--primary, #505A3D);
}

/* Sous-titre (libellé) sous les liens de niveau 0 */
.warein-header__nav .menu-item__label {
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 7.3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    line-height: 13px;
    color: var(--wp--preset--color--gray, #9CA3AF);
}

/* Bloquer l'ouverture des sous-menus au chargement (curseur déjà en place) */
@keyframes submenu-load-delay {
    from, to { visibility: hidden; opacity: 0; }
}

/* ==========================================================================
   Sous-menus standard (dropdown simple — items SANS mega-menu)
   ========================================================================== */

.warein-header__nav .leb-site-nav__list .sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 240px;
    background: var(--wp--preset--color--white, #fff);
    border-radius: 0 0 15px 15px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.04);
    padding: 20px 0;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100;
    animation: submenu-load-delay 0.5s;
}

.warein-header__nav .leb-site-nav__list > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
}

.warein-header__nav .leb-site-nav__list .sub-menu li {
    margin: 0;
}

.warein-header__nav .leb-site-nav__list .sub-menu a {
    display: block;
    padding: 10px 24px;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.35px;
    color: var(--wp--preset--color--black, #000);
    text-decoration: none;
    text-transform: none;
    transition: color 0.2s ease;
}

.warein-header__nav .leb-site-nav__list .sub-menu a:hover {
    color: var(--wp--preset--color--primary-light, #899477);
    text-decoration: underline;
}

/* Indicateur — background-image pour tous les items */
.warein-header__nav .leb-site-nav__list > li {
    background-image: linear-gradient(var(--wp--preset--color--primary, #505A3D), var(--wp--preset--color--primary, #505A3D));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}

/* Page active — 1px, pas de transition au hover */
.warein-header__nav .leb-site-nav__list > li.current-menu-item,
.warein-header__nav .leb-site-nav__list > li.current-menu-ancestor {
    background-size: 100% 1px;
    transition: none;
}

/* Hover — 2px animé (sauf page active) */
.warein-header__nav .leb-site-nav__list > li:not(.current-menu-item):not(.current-menu-ancestor):hover {
    background-size: 100% 2px;
}

/* ==========================================================================
   Mega-menu — panneau 3 colonnes (pur CSS, :hover)
   ========================================================================== */

/* Les items mega-menu sont static : le panneau se positionne
   par rapport a .warein-header__main (position: relative) */
.warein-header__nav .leb-site-nav__list > li.menu-item--has-megamenu {
    position: static;
}

/* Panneau mega-menu — centré sous la nav, pleine largeur container */
.warein-megamenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1280px;
    padding: 0 var(--warein-container-padding);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 100;
    animation: submenu-load-delay 0.5s;
}

/* Afficher au hover du <li> parent (CSS pur, pas de JS) */
.warein-header__nav .menu-item--has-megamenu:hover > .warein-megamenu {
    opacity: 1;
    visibility: visible;
}

/* Panneau interieur blanc */
.warein-megamenu__panel {
    display: flex;
    gap: 52px;
    padding: 40px;
    background: var(--wp--preset--color--white, #fff);
    border-radius: 0 0 25px 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.04);
    overflow: clip;
}

/* Colonne liens */
.warein-megamenu__links {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px 15px;
}

.warein-megamenu__title {
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    line-height: 20px;
    color: var(--wp--preset--color--dark, #4B5563);
}

.warein-megamenu__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.warein-megamenu__list {
    padding: 6px 0;
}

.warein-megamenu__list li {
    display: flex;
}

.warein-megamenu__list a {
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.35px;
    color: var(--wp--preset--color--black, #000);
    text-decoration: none;
    text-transform: none;
    transition: color 0.2s ease;
}

.warein-megamenu__list a:hover {
    color: var(--wp--preset--color--primary-light, #899477);
    text-decoration: underline;
}

/* Colonne image */
.warein-megamenu__image {
    flex: 1;
    min-height: 310px;
    min-width: 0;
    border-radius: 0 15px 15px 0;
    overflow: hidden;
}

.warein-megamenu__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Colonne promo */
.warein-megamenu__promo {
    flex-shrink: 0;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
}

.warein-megamenu__promo-text,
.warein-megamenu__promo-text p {
    font-family: var(--wp--preset--font-family--heading, 'Minion Pro', serif);
    font-size: 36px;
    font-weight: 400;
    line-height: 40px;
    color: var(--wp--preset--color--black, #000);
    margin: 0;
}

.warein-megamenu__promo-text strong,
.warein-megamenu__promo-text b {
    color: var(--wp--preset--color--primary-light, #899477);
    font-weight: 500;
}

.warein-megamenu__promo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 400;
    color: var(--wp--preset--color--primary-light, #899477);
    text-decoration: none;
    transition: color 0.2s ease;
}

.warein-megamenu__promo-link:hover {
    color: var(--wp--preset--color--primary, #505A3D);
}

/* ==========================================================================
   Bouton CTA — pill vert
   ========================================================================== */

.warein-header__right {
    flex-shrink: 0;
}

.warein-header__right .leb-cta,
a.warein-header__cta,
a.warein-header__mobile-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 700;
    line-height: 16px;
    color: var(--wp--preset--color--white, #fff) !important;
    background-color: var(--wp--preset--color--primary-light, #899477) !important;
    border: none !important;
    border-radius: 100px;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.warein-header__right .leb-cta:hover,
a.warein-header__cta:hover,
a.warein-header__mobile-cta:hover {
    background-color: var(--wp--preset--color--primary, #505A3D) !important;
    color: var(--wp--preset--color--white, #fff) !important;
}

/* ==========================================================================
   Burger menu mobile
   ========================================================================== */

.warein-header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    order: 10;
}

.warein-header__burger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--wp--preset--color--dark, #4B5563);
    transition: all 0.3s ease;
    border-radius: 1px;
}

/* Burger ouvert : X */
.warein-header__burger[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.warein-header__burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.warein-header__burger[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   Menu mobile
   ========================================================================== */

/* Le menu mobile se positionne sous le header sticky complet (topbar + nav) */
.warein-header__mobile {
    display: none;
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--wp--preset--color--white, #fff);
    z-index: 999;
    padding: 32px;
    overflow-y: auto;
    flex-direction: column;
    gap: 32px;
}

.warein-header__mobile.is-open {
    display: flex;
}


.warein-header__mobile-nav .leb-site-nav__list {
    display: flex;
    flex-direction: column;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.warein-header__mobile-nav .leb-site-nav__list > li {
    position: relative;
    border-bottom: 1px solid var(--wp--preset--color--gray-50, #F3F4F6);
}

.warein-header__mobile-nav .leb-site-nav__list > li.menu-item-has-children > a {
    padding-right: 48px;
}

.warein-header__mobile-nav .leb-site-nav__list a {
    display: block;
    padding: 16px 0;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 500;
    color: var(--wp--preset--color--dark, #4B5563);
    text-decoration: none;
}

/* Label sous le lien (ex: "Confectionneur & Assembleur") */
.warein-header__mobile-nav .leb-site-nav__list > li > a {
    text-transform: uppercase;
}

.warein-header__mobile-nav .menu-item__label {
    display: block;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    line-height: 13px;
    color: var(--wp--preset--color--gray, #9CA3AF);
    margin-top: 2px;
}

.warein-header__mobile-nav .menu-item__label::before {
    content: '\2014';
    margin-right: 6px;
}

/* Bouton toggle sous-menu */
.warein-submenu-toggle {
    position: absolute;
    top: 8px;
    right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--wp--preset--color--gray, #9CA3AF);
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.warein-submenu-toggle[aria-expanded="true"] {
    transform: rotate(180deg);
}

.warein-header__mobile-nav .leb-site-nav__list .sub-menu,
.warein-mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0 0 8px 16px;
}

.warein-header__mobile-nav .leb-site-nav__list .sub-menu a,
.warein-mobile-submenu a {
    font-size: 14px;
    font-weight: 400;
    padding: 10px 0;
    color: var(--wp--preset--color--gray, #9CA3AF);
    display: block;
    text-decoration: none;
    font-family: var(--wp--preset--font-family--body, 'Inter', sans-serif);
}

a.warein-header__mobile-cta {
    align-self: flex-start;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
    .warein-topbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        overflow-y: auto;
    }

    .warein-header__mobile {
        padding-bottom: 67.5px;
    }

    .warein-header__nav {
        display: none;
    }

    .warein-header__container > .warein-header__right {
        margin-left: auto;
        margin-right: 16px;
    }

    .warein-header__burger {
        display: flex;
    }

    .admin-bar .warein-header__mobile {
        top: 110px;
    }
}

@media (max-width: 600px) {
    .warein-header__main {
        height: 64px;
    }

    .warein-header__mobile {
        top: 64px;
    }

    .warein-header__left .leb-site-logo {
        max-width: 150px;
        max-height: 45px;
    }
}

@media (max-width: 430px) {
    .warein-header__container > .warein-header__right {
        display: none;
    }
}
