/* ============================================================================
   COMPOSANT — Barre de navigation
   Barre fixe, nom, sélecteur FR/EN, icône Instagram, menu burger et menu plein écran mobile.
   ============================================================================ */

html.lang-fr .i18n-en {
    display: none !important;
}

html.lang-en .i18n-fr {
    display: none !important;
}

@media print {
    .burger-menu, .lang-switch {
        display: none !important;
    }
}

/* Barre de navigation, logo, sélecteur FR/EN, menu burger */

.lang-btn:focus-visible, .nav-link:focus-visible, .burger-menu:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .nav-link, .burger-menu span, .lang-btn {
        transition: none;
    }
}

/* Tailles de la barre de navigation (aussi utilisées par la page Méthode : texte = --fs-nav, titres = × --phi, nom = × --phi²) */

:root {
    --phi: 1.618;                                       /* nombre d'or */
    --fs-nav: clamp(10px, 0.78vw, 12px);               /* police des liens de la barre ; = texte de la page Méthode */
    --logo-fs: calc(var(--fs-nav) * var(--phi) * var(--phi));   /* « FLORENT HINFRAY » = titres de page (texte × φ) × φ */
}

html.nav-light { --fg-nav: var(--paper); }

/* --- Barre de navigation : liens à gauche, nom centré, liens + langue + Instagram à droite --- */

.bar {
    position: fixed; top: var(--margin-y); left: 0; right: var(--sbw, 0px); z-index: 30;
    height: var(--bar-h); padding-inline: var(--margin-x);
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 24px;
    font-family: var(--font-sans);
    color: var(--ink); background-color: rgb(253 255 255 / 0);   /* transparente : la feuille de page s'arrête sous elle, le fond (photo + panneau) reste visible */
    border-bottom: 1px solid transparent;                        /* trait de 1 px sous la barre : limite où la page qui défile est masquée (la feuille commence juste dessous) */
    transition: color 0.4s var(--ease), background-color 0.4s var(--ease), border-color 0.4s var(--ease);
}

html:not(.is-home) .bar { border-bottom-color: rgb(13 13 13 / 0.38); }   /* encre à 38 % d'opacité ; visible sur les pages, pas sur la photo d'accueil */

html.is-home .bar { color: var(--fg-nav); }

html.panel-up .bar { color: var(--ink); }

/* pendant la montée du panneau clair : la barre repasse en encre */

/* Retour à l'accueil : la couleur du texte se fond avec la même durée et la même courbe que l'apparition de la photo
   (fondu du panneau), et démarre en même temps qu'elle (--home-image-delay) ; le trait du bas, lui, suit le fondu de la page.
   --page-fade, --page-fade-ease et --home-image-delay sont posées par js/component/navigation.js (FADE_IN_MS, FADE_EASE, HOME_IMAGE_DELAY_MS) */
html.to-home .bar {
    transition: color var(--page-fade, 0.8s) var(--page-fade-ease, ease) var(--home-image-delay, 0s),
                background-color var(--page-fade, 0.8s) var(--page-fade-ease, ease) var(--home-image-delay, 0s),
                border-color var(--page-fade, 0.8s) var(--page-fade-ease, ease);
}

html.is-instant .bar { transition: none; }

/* Place de la barre de défilement toujours réservée : la barre fixe (right: var(--sbw)) garde la même largeur
   avant et après le premier clic depuis l'accueil, donc plus aucun élément de droite ne se décale */
.sheet { scrollbar-gutter: stable; }

.bar-left, .bar-right { display: flex; align-items: center; gap: clamp(14px, 1.7vw, 30px); min-width: 0; }

.bar-right { justify-content: flex-end; }

.bar ul { list-style: none; display: flex; gap: clamp(14px, 1.7vw, 30px); }

.bar li { display: flex; }

.logo {
    justify-self: center; margin: 0; padding-left: 0.2em;
    font-family: var(--font-sans); font-weight: 400; font-size: min(var(--logo-fs), 2.1vw);   /* plafonné à 2,1 vw pour ne pas toucher les liens de la barre */
    letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap;
    color: inherit; text-decoration: none;
}

.nav-link, .lang-btn {
    font-family: var(--font-sans); 
	font-size: var(--fs-nav); 
	font-weight: 400; line-height: 1;
    letter-spacing: 0.12em; 
	text-transform: uppercase; 
	white-space: nowrap;
    color: inherit; 
	text-decoration: none; 
	background: none; 
	border: 0; 
	padding: 10px 0; 
	cursor: pointer;
    transition: opacity 0.6s ease; 
	opacity: 0.35;
	touch-action: manipulation;   /* fondu doux au survol et à l'activation */
}

.nav-link.active { opacity: 1;}   /* page courante : nom éclairci, comme au survol (plus de caractère devant, donc plus aucun décalage des liens voisins) */

.lang-switch { display: flex; align-items: center; gap: 8px; }

.lang-btn { padding: 10px 2px; opacity: 0.5; }

.lang-btn.active { opacity: 1; }

.lang-sep { width: 1px; height: 10px; background: currentColor; opacity: 0.4; }

.bar-icon { display: inline-flex; width: 18px; height: 18px; color: inherit; transition: opacity 0.3s ease; }

.bar-icon svg { width: 100%; height: 100%; display: block; }

.bar a:focus-visible, .bar button:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }

@media (hover: hover) {
    .nav-link:hover, .bar-icon:hover { opacity: 1; }
    .lang-btn:not(.active):hover { opacity: 1; }
}

.burger-menu {
    display: none; width: 44px; height: 44px; margin-left: -12px; flex-direction: column; justify-content: center; align-items: center;
    gap: 7px; background: none; border: 0; cursor: pointer; color: inherit; touch-action: manipulation;
}

.burger-menu span { width: 22px; height: 1px; background: currentColor; transition: transform 0.4s var(--ease); }

.burger-menu.active span:nth-child(1) { transform: translateY(4px) rotate(45deg); }

.burger-menu.active span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

#menu { display: none; }

@media (max-width: 1024px) {
    .logo { font-size: min(var(--logo-fs), 3.6vw); }   /* menu burger : plus de liens à côté du nom */
    .bar-left .bar-nav, .bar-right .bar-nav { display: none; }
    .burger-menu { display: flex; }
    #menu {
        display: flex; flex-direction: column; justify-content: center; gap: 26px;
        position: fixed; inset: calc(var(--margin-y) + var(--bar-h)) 0 0 0; padding: 0 var(--margin-x); z-index: 25;
        background: var(--paper); opacity: 0; visibility: hidden;
        transition: opacity 0.4s var(--ease), visibility 0s linear 0.4s;
    }
    #menu.active { opacity: 1; visibility: visible; transition-delay: 0s; }
    #menu .nav-link { color: var(--ink); font-size: 15px; letter-spacing: 0.16em; padding: 6px 0; }
    html.is-home .bar:has(#menu.active) { color: var(--ink); background-color: var(--paper); box-shadow: 0 calc(-1 * var(--margin-y)) 0 2px var(--paper); }
}

@media (max-width: 640px) {
    .bar-icon { display: none; }
    .logo { font-size: 13px; letter-spacing: 0.26em; padding-left: 0.26em; }   /* petit mobile : taille réduite pour tenir avec le menu et la langue */
}
