/**
 * Styles de l'en-tête : top bar, navbar sticky, sous-menus, burger mobile.
 * Thème Jacques Fleuret.
 */

/* --- Variables : à supprimer si déjà déclarées dans theme-base.css --- */
:root {
    --jf-color-primary: #1b5e5a;
    --jf-color-primary-dark: #14453f;
    --jf-color-accent: #c9a227;
    --jf-color-text: #23282d;
    --jf-color-muted: #6b7280;
    --jf-color-bg: #ffffff;
    --jf-color-topbar-bg: #14453f;
    --jf-color-border: #e5e7eb;
    --jf-container: 1200px;
    --jf-header-height: 76px;
    --jf-radius: 6px;
    --jf-transition: 0.25s ease;
}

/* --- Conteneur --- */
.jf-container {
    width: 100%;
    max-width: var(--jf-container);
    margin-inline: auto;
    padding-inline: 20px;
}

/* --- Lien d'évitement --- */
.jf-skip-link:focus {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    display: block;
    padding: 12px 20px;
    clip: auto;
    width: auto;
    height: auto;
    background: var(--jf-color-bg);
    color: var(--jf-color-primary);
    font-weight: 600;
    border-radius: var(--jf-radius);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

/* --- Top bar --- */
.jf-topbar {
    background: var(--jf-color-topbar-bg);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

.jf-topbar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    min-height: 40px;
    padding-block: 6px;
}

.jf-topbar__notice {
    margin: 0;
    font-weight: 500;
}

.jf-topbar__contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.jf-topbar__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    transition: color var(--jf-transition);
}

.jf-topbar__link:hover,
.jf-topbar__link:focus-visible {
    color: #fff;
    text-decoration: underline;
}

/* Icônes en CSS pur : pas de dépendance à une police d'icônes. */
.jf-icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    background-color: currentColor;
    flex-shrink: 0;
}

.jf-icon--phone {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.5.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.4 21 3 13.6 3 4.5c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.2.2 2.4.6 3.5.1.3 0 .7-.2 1l-2.3 1.8z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.5.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.4 21 3 13.6 3 4.5c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.2.2 2.4.6 3.5.1.3 0 .7-.2 1l-2.3 1.8z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.jf-icon--mail {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* --- Header sticky --- */
.jf-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--jf-color-bg);
    border-bottom: 1px solid var(--jf-color-border);
    transition: box-shadow var(--jf-transition), padding var(--jf-transition);
}

.jf-header.is-scrolled {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}

.jf-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: var(--jf-header-height);
    transition: min-height var(--jf-transition);
}

.jf-header.is-scrolled .jf-header__inner {
    min-height: 62px;
}

.jf-header__brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.jf-header__brand .custom-logo-link {
    display: block;
    line-height: 0;
}

.jf-header__brand .custom-logo {
    width: auto;
    max-height: 52px;
    transition: max-height var(--jf-transition);
}

.jf-header.is-scrolled .jf-header__brand .custom-logo {
    max-height: 42px;
}

.jf-header__site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--jf-color-primary);
    text-decoration: none;
    line-height: 1.2;
}

/* --- Navigation --- */
.jf-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-left: auto;
}

.jf-nav__list {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.jf-nav__list li {
    position: relative;
}

.jf-nav__list a {
    display: block;
    padding: 10px 14px;
    color: var(--jf-color-text);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--jf-radius);
    transition: color var(--jf-transition), background-color var(--jf-transition);
}

.jf-nav__list a:hover,
.jf-nav__list a:focus-visible {
    color: var(--jf-color-primary);
    background: rgba(27, 94, 90, 0.07);
}

.jf-nav__list .current-menu-item > a,
.jf-nav__list .current-menu-ancestor > a,
.jf-nav__list .current_page_item > a {
    color: var(--jf-color-primary);
    font-weight: 600;
}

.jf-nav__empty {
    margin: 0;
    font-size: 0.875rem;
    color: var(--jf-color-muted);
}

/* --- Sous-menus (desktop) --- */
.jf-nav__list .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 950;
    min-width: 230px;
    margin: 0;
    padding: 8px;
    list-style: none;
    background: var(--jf-color-bg);
    border: 1px solid var(--jf-color-border);
    border-radius: var(--jf-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--jf-transition), transform var(--jf-transition), visibility var(--jf-transition);
}

.jf-nav__list li:hover > .sub-menu,
.jf-nav__list li:focus-within > .sub-menu,
.jf-nav__list li.jf-submenu-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.jf-nav__list .sub-menu a {
    padding: 9px 12px;
    font-weight: 400;
    white-space: normal;
}

/* Chevron sur les éléments à sous-menu. */
.jf-nav__list .menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--jf-transition);
}

/* --- Bouton CTA --- */
.jf-btn {
    display: inline-block;
    padding: 12px 22px;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--jf-radius);
    cursor: pointer;
    transition: background-color var(--jf-transition), border-color var(--jf-transition), transform var(--jf-transition);
}

.jf-btn--primary {
    background: var(--jf-color-primary);
    border-color: var(--jf-color-primary);
    color: #fff;
}

.jf-btn--primary:hover,
.jf-btn--primary:focus-visible {
    background: var(--jf-color-primary-dark);
    border-color: var(--jf-color-primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.jf-nav__cta {
    flex-shrink: 0;
}

/* --- Burger : masqué en desktop --- */
.jf-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 1px solid var(--jf-color-border);
    border-radius: var(--jf-radius);
    cursor: pointer;
}

.jf-burger__bar {
    display: block;
    width: 22px;
    height: 2px;
    margin-inline: auto;
    background: var(--jf-color-text);
    transition: transform var(--jf-transition), opacity var(--jf-transition);
}

.jf-burger[aria-expanded="true"] .jf-burger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.jf-burger[aria-expanded="true"] .jf-burger__bar:nth-child(2) {
    opacity: 0;
}

.jf-burger[aria-expanded="true"] .jf-burger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Bouton d'ouverture de sous-menu injecté par le JS --- */
.jf-submenu-toggle {
    display: none;
    position: absolute;
    top: 3px;
    right: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
}

.jf-submenu-toggle::before {
    content: "";
    display: block;
    width: 9px;
    height: 9px;
    margin: 0 auto;
    border-right: 2px solid var(--jf-color-text);
    border-bottom: 2px solid var(--jf-color-text);
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--jf-transition);
}

.jf-submenu-toggle[aria-expanded="true"]::before {
    transform: rotate(-135deg) translateY(-2px);
}

/* --- Responsive : menu plein écran sous 1024px --- */
@media (max-width: 1024px) {

    .jf-burger {
        display: flex;
    }

    .jf-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 940;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        width: min(340px, 88vw);
        margin: 0;
        padding: calc(var(--jf-header-height) + 16px) 20px 32px;
        overflow-y: auto;
        background: var(--jf-color-bg);
        border-left: 1px solid var(--jf-color-border);
        box-shadow: -8px 0 28px rgba(0, 0, 0, 0.12);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease;
    }

    .jf-nav.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .jf-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .jf-nav__list li {
        border-bottom: 1px solid var(--jf-color-border);
    }

    .jf-nav__list a {
        padding: 14px 44px 14px 4px;
        border-radius: 0;
        font-size: 1rem;
    }

    /* Le chevron CSS est remplacé par le bouton accessible. */
    .jf-nav__list .menu-item-has-children > a::after {
        display: none;
    }

    .jf-submenu-toggle {
        display: block;
    }

    .jf-nav__list .sub-menu {
        position: static;
        display: none;
        min-width: 0;
        padding: 0 0 8px 16px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .jf-nav__list li.jf-submenu-open > .sub-menu {
        display: block;
    }

    /* Neutralise l'ouverture au survol en tactile. */
    .jf-nav__list li:hover > .sub-menu,
    .jf-nav__list li:focus-within > .sub-menu {
        display: none;
    }

    .jf-nav__list li.jf-submenu-open > .sub-menu {
        display: block;
    }

    .jf-nav__list .sub-menu li:last-child {
        border-bottom: 0;
    }

    .jf-nav__cta {
        margin-top: 24px;
    }

    .jf-nav__cta .jf-btn {
        display: block;
        width: 100%;
    }

    /* Voile sombre derrière le menu ouvert. */
    .jf-nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 930;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--jf-transition), visibility var(--jf-transition);
    }

    .jf-nav-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }

    body.jf-nav-locked {
        overflow: hidden;
    }
}

@media (max-width: 720px) {

    .jf-topbar__inner {
        justify-content: center;
        text-align: center;
    }

    .jf-topbar__contact {
        justify-content: center;
        gap: 14px;
    }
}

/* --- Respect de la préférence de mouvement réduit --- */
@media (prefers-reduced-motion: reduce) {

    .jf-header,
    .jf-header__inner,
    .jf-nav,
    .jf-nav__list .sub-menu,
    .jf-btn,
    .jf-burger__bar {
        transition: none;
    }
}