/* =========================================================
    HEADER PRINCIPAL
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(7, 10, 18, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Header en thème clair */
[data-theme="light"] .site-header {
    background: rgba(247, 248, 252, 0.92);
    border-bottom-color: var(--es-border-subtle);
}

.header-inner {
    min-height: var(--es-header-height);
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    gap: var(--es-space-5);
}

.header-logo {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    flex-shrink: 0;
}

.header-logo svg,
.header-logo img {
    width: auto;
    height: 36px;
}

.header-logo span {
    font-size: var(--es-fs-lg);
    font-weight: var(--es-fw-bold);
    text-indent: var(--es-space-1);
    font-family: var(--es-font-heading);
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--es-space-5);
    white-space: nowrap;
}

/* =========================================================
    NAVIGATION DESKTOP
   ========================================================= */

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--es-space-2);
}

.header-nav__link {
    padding: var(--es-space-2) var(--es-space-3);
    color: var(--es-text-secondary);
    border-radius: var(--es-radius-sm);
    font-size: var(--es-fs-sm);
    font-weight: var(--es-fw-medium);
    transition:
        color var(--es-transition-fast),
        background-color var(--es-transition-fast);
}

/* Hover d'un onglet non actif */
.header-nav__link:hover {
    color: var(--es-text);
    background: var(--es-primary-subtle);
}

/* Onglet correspondant à la section actuellement affichée */
.header-nav__link.is-active {
    background: var(--es-primary);
    color: #ffffff;
}

/* On supprime l'ancien indicateur sous forme de ligne */
.header-nav__link.is-active::after {
    display: none;
}

.header-actions {
    min-width: max-content;
    display: flex;
    align-items: center;
    justify-self: end;
    gap: var(--es-space-3);
}

/* Dark/Light */

.theme-toggle {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--es-surface);
    color: var(--es-text-secondary);
    border: var(--es-border-thin) solid var(--es-border-subtle);
    border-radius: var(--es-radius-md);
    transition: color var(--es-transition-fast), background-color var(--es-transition-fast), border-color var(--es-transition-fast);
}

.theme-toggle:hover {
    color: var(--es-secondary);
    background: var(--es-surface-hover);
    border-color: var(--es-border);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* CTA free */

.header-cta {
    min-height: var(--es-button-height);
    min-width: max-content;
    /* padding: 0 var(--es-space-5); */
    padding: var(--es-space-1) var(--es-space-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
    background: var(--es-primary);
    color: #ffffff;
    border: var(--es-border-thin) solid var(--es-primary);
    border-radius: var(--es-radius-md);
    font-size: var(--es-fs-sm);
    font-weight: var(--es-fw-medium);
    box-shadow: var(--es-glow-primary);
    transition: background-color var(--es-transition-fast), transform var(--es-transition-fast), box-shadow var(--es-transition-fast);
}

.header-cta:hover {
    background: var(--es-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--es-glow-primary-strong);
}

/* Menu hamburger */

.mobile-menu-toggle {
    width: 42px;
    height: 42px;
    padding: 0 11px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: var(--es-surface);
    border: var(--es-border-thin) solid var(--es-border-subtle);
    border-radius: var(--es-radius-md);
}

.mobile-menu-toggle span {
    width: 18px;
    height: 2px;
    background: var(--es-text);
    border-radius: var(--es-radius-pill);
    transition: transform var(--es-transition-base), opacity var(--es-transition-fast);
}

.mobile-menu-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =========================================================
    NAVIGATION MOBILE
   ========================================================= */

/*
 * Le menu reste présent dans le DOM.
 * Son ouverture est contrôlée avec max-height, opacity
 * et transform afin d'obtenir une transition progressive.
 */
.mobile-navigation {
    max-height: 0;
    padding-block: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    border-top: 1px solid transparent;
    transition:
        max-height var(--es-transition-slow),
        opacity var(--es-transition-base),
        transform var(--es-transition-base),
        padding var(--es-transition-base),
        border-color var(--es-transition-base),
        visibility 0s linear 400ms;
}

/*
 * État ouvert du menu mobile.
 */
.mobile-navigation.is-open {
    max-height: 520px;
    padding-top: var(--es-space-3);
    padding-bottom: var(--es-space-5);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    border-top-color: var(--es-border-subtle);
    transition:
        max-height var(--es-transition-slow),
        opacity var(--es-transition-base),
        transform var(--es-transition-base),
        padding var(--es-transition-base),
        border-color var(--es-transition-base),
        visibility 0s;
}

.mobile-navigation__cta {
    margin-top: var(--es-space-4);
    display: flex;
    align-items: center;
    padding: var(--es-space-3);
    justify-content: center;
    background: var(--es-primary);
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--es-radius-md);
}

.mobile-navigation__cta:hover {
    background: var(--es-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--es-glow-primary-strong);
}

/* Liens standards du menu mobile */
.mobile-navigation__link {
    display: flex;
    align-items: center;
    min-height: 46px;
    margin-bottom: var(--es-space-1);
    padding: var(--es-space-3);
    color: var(--es-text-secondary);
    border-bottom: var(--es-border-thin) solid var(--es-border-subtle);
    border-radius: var(--es-radius-sm);
    font-size: var(--es-fs-sm);
    font-weight: var(--es-fw-medium);
    transition:
        color var(--es-transition-fast),
        background-color var(--es-transition-fast),
        border-color var(--es-transition-fast);
}

/* Survol / interaction tactile */
.mobile-navigation__link:hover {
    color: var(--es-text);
    background: var(--es-primary-subtle);
}

/*
 * Même logique visuelle que Desktop :
 * la section actuellement consultée passe en violet.
 */
.mobile-navigation__link.is-active {
    background: var(--es-primary);
    color: #ffffff;
    border-bottom-color: transparent;
}

/* Responsive header */

@media (max-width: 991.98px) {
    .header-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--es-space-3);
    }

    .header-nav {
        display: none;
    }

    .header-cta {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 767.98px) {
    .header-inner {
        min-height: 68px;
        gap: var(--es-space-3);
    }

    .header-logo svg,
    .header-logo img {
        height: 32px;
    }

    .theme-toggle,
    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }
}

@media (min-width: 1200px) {
    .header-nav {
        position: relative;
        right: 30px;
    }
}