/**
 * Thème Kaalytics 2026 : barre de navigation, sélecteur de langue, bouton menu et panneau mobile.
 * Demande de Mamoun du 28/11/2026 sur téléphone : « la barre nav n'est pas du tout jolie, pas très ergonomique ».
 * Zones de toucher gardées à 44 px (tests nav mobile) : le dessin est plus fin que la zone, porté par des pseudo-éléments.
 */

/* ---------- Sélecteur de langue : deux briques séparées (Studio bt3-07, choix de Mamoun du 28/11) ----------
   Langue active : brique émeraude allumée ; l'autre : brique sombre. Dessin porté par ::before, zone de toucher 44 px. */
.navbar .navbar__lang {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    height: 44px; padding: 0; margin-right: 8px; background: none; border: 0; box-shadow: none;
}
.navbar .navbar__lang-btn {
    position: relative; isolation: isolate;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 44px; padding: 0 8px;
    background: none; border: 0; border-radius: 6px; box-shadow: none;
    font: 700 0.74rem/1 var(--font-primary, 'Inter', sans-serif); letter-spacing: 0.08em;
    color: #6f8a80; transition: color 0.2s ease;
}
.navbar .navbar__lang-btn::before {
    content: ''; position: absolute; inset: 6px 2px 8px; z-index: -1; border-radius: 6px;
    background: linear-gradient(180deg, #12261f, #0a1814);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(52, 211, 153, 0.16), 0 2px 0 #050d0a, 0 3px 0 #010403;
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.navbar .navbar__lang-btn:hover { color: #ecfdf5; }
.navbar .navbar__lang-btn:hover::before { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(52, 211, 153, 0.5), 0 2px 0 #050d0a, 0 3px 0 #010403; }
.navbar .navbar__lang .navbar__lang-btn--active { color: #ffffff; background: none; text-shadow: 0 1px 0 rgba(2, 61, 43, 0.6); }
.navbar .navbar__lang .navbar__lang-btn--active::before {
    background: linear-gradient(180deg, #5eeaa8 0%, #22c98d 45%, #0fa877 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 0 0 1px rgba(167, 243, 208, 0.5), 0 2px 0 #065f46, 0 3px 0 #03281d, 0 0 16px -2px rgba(52, 211, 153, 0.75);
}
.navbar .navbar__lang-btn:active::before { transform: translateY(2px); }
.navbar--scrolled .navbar__lang { border-color: transparent; }
.navbar--scrolled .navbar__lang-btn:not(.navbar__lang-btn--active) { color: #6f8a80; }

/* ---------- Bouton menu : brique carrée à coins coupés, trois barres lumineuses (Studio bt3-08) ---------- */
.navbar .navbar__mobile-toggle {
    position: relative; isolation: isolate;
    width: 46px; height: 46px; place-items: center; padding: 0;
    border-radius: 0; border: 0; color: #5eeaa8; background: none; box-shadow: none;
}
.navbar .navbar__mobile-toggle::before, .navbar .navbar__mobile-toggle::after {
    content: ''; position: absolute; z-index: -1;
    clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
}
/* Tranche et arête */
.navbar .navbar__mobile-toggle::before { inset: 0; background: linear-gradient(180deg, #2b7d63, #0b3a2c 70%, #03140f); }
/* Face */
.navbar .navbar__mobile-toggle::after { inset: 1px 1px 4px; background: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.1), transparent 60%), linear-gradient(180deg, #17493b, #0e2f26); transition: background 0.25s ease; }
.navbar .navbar__mobile-toggle svg { width: 22px; height: 22px; margin-top: -3px; stroke-width: 3; stroke-linecap: round; }
.navbar .navbar__mobile-toggle:hover { color: #ecfdf5; }
.navbar .navbar__mobile-toggle:hover::after, .navbar--menu-ouvert .navbar__mobile-toggle::after {
    background: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.3), transparent 60%), linear-gradient(180deg, #4fd79e, #1c9e74);
}
.navbar .navbar__mobile-toggle:active::after { inset: 3px 1px 2px; }
/* Visible seulement là où le site l'affiche déjà (sous 1025 px, _navbar.css) : on ne touche pas à display ailleurs */
@media (max-width: 1024px) { .navbar .navbar__mobile-toggle { display: inline-grid; } }

/* Téléphone : l'en-tête illustré de chaque page commence sous la barre (étiquette de page plus masquée) */
@media (max-width: 1024px) { body :has(> .visuel-page) { padding-top: 112px; } }
.navbar--menu-ouvert .navbar__mobile-toggle { color: #ecfdf5; }

/* ---------- Panneau mobile ---------- */
.navbar__mobile-menu {
    background:
        radial-gradient(120% 55% at 100% 0%, rgba(16, 185, 129, 0.2), transparent 62%),
        radial-gradient(90% 50% at 0% 100%, rgba(24, 76, 61, 0.55), transparent 70%),
        #040a08;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.navbar__mobile-menu .navbar__mobile-nav { padding: 18px 20px 8px; display: flex; flex-direction: column; }

/* Entrées principales : grandes, en Inter Tight, filet fin */
.navbar__mobile-menu .mobile-link--top, .navbar__mobile-menu .mobile-group__title {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 60px; padding: 0 4px;
    font: 600 1.45rem/1.15 var(--font-titre, 'Inter Tight', sans-serif); letter-spacing: -0.02em;
    color: #ecfdf5; border-bottom: 1px solid rgba(143, 165, 156, 0.13);
    list-style: none; cursor: pointer;
}
.navbar__mobile-menu .mobile-group { border: 0; margin: 0; padding: 0; }
.navbar__mobile-menu .mobile-group__title::-webkit-details-marker { display: none; }

/* Chevron dans une pastille, qui tourne à l'ouverture */
.navbar__mobile-menu .mobile-group__title::after {
    content: ''; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
    border: 0; transform: none;
    background: rgba(16, 185, 129, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / 14px no-repeat;
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35);
    transition: transform 0.3s var(--sortie, ease);
}
.navbar__mobile-menu .mobile-group[open] .mobile-group__title::after { transform: rotate(180deg); }
.navbar__mobile-menu .mobile-group[open] .mobile-group__title { color: #34d399; border-bottom-color: transparent; }

/* Sous-menus : tuiles en deux colonnes */
.navbar__mobile-menu .mobile-group__items {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
    padding: 4px 0 16px; border-bottom: 1px solid rgba(143, 165, 156, 0.13);
}
.navbar__mobile-menu .mobile-group__items .mobile-link {
    min-height: 52px; padding: 10px 12px; margin: 0;
    border-radius: 14px; font: 500 0.88rem/1.25 var(--font-primary, 'Inter', sans-serif); color: #d6e6de;
    background: linear-gradient(180deg, rgba(19, 42, 36, 0.85), rgba(10, 21, 18, 0.85));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 0 0 1px rgba(143, 165, 156, 0.16);
}
.navbar__mobile-menu .mobile-group__items .mobile-link:active { box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.6); color: #ecfdf5; }

/* Pied du panneau : bouton d'appel en relief, pleine largeur */
.navbar__mobile-menu .navbar__mobile-actions { padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 0; }
.navbar__mobile-menu .navbar__mobile-actions .btn { width: 100%; min-height: 56px; border-radius: 6px; font-size: 1.02rem; }

/* Entrée du contenu à l'ouverture : en décalé, transform et opacity seulement */
@media (prefers-reduced-motion: no-preference) {
    .navbar__mobile-menu.active .navbar__mobile-nav > *,
    .navbar__mobile-menu.active .navbar__mobile-actions {
        animation: menu-entree 0.5s var(--sortie, ease) both;
    }
    .navbar__mobile-menu.active .navbar__mobile-nav > :nth-child(2) { animation-delay: 0.04s; }
    .navbar__mobile-menu.active .navbar__mobile-nav > :nth-child(3) { animation-delay: 0.08s; }
    .navbar__mobile-menu.active .navbar__mobile-nav > :nth-child(4) { animation-delay: 0.12s; }
    .navbar__mobile-menu.active .navbar__mobile-nav > :nth-child(5) { animation-delay: 0.16s; }
    .navbar__mobile-menu.active .navbar__mobile-nav > :nth-child(6) { animation-delay: 0.2s; }
    .navbar__mobile-menu.active .navbar__mobile-actions { animation-delay: 0.24s; }
}
@keyframes menu-entree { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Barre dynamique au défilement (Mamoun, 28/11 : « hyper sexy, hyper dynamique au scroll ») ----------
   En haut de page : transparente sur le film. Dès qu'on défile (navigation.js) : capsule flottante sombre, détachée
   des bords. Sous la capsule, un fil de lumière se remplit avec la lecture ; sa tête est une perle lumineuse
   (équivalent sobre du dragon perché de Daedalia). Tout passe par opacity et transform. */
.navbar, .navbar.scrolled, .navbar--scrolled {
    background: transparent; border-bottom: 0; box-shadow: none;
}
.navbar { isolation: isolate; }
.navbar::before {
    content: ''; position: absolute; z-index: -1; inset: 8px 12px; border-radius: 20px;
    background: linear-gradient(180deg, #0e1c18, #050c0a);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(143, 165, 156, 0.16), 0 18px 40px -18px rgba(0, 0, 0, 0.9);
    opacity: 0; transform: scale(0.985) translateY(-4px); will-change: opacity, transform;
    transition: opacity 0.35s ease, transform 0.45s var(--sortie, ease);
}
.navbar--capsule::before { opacity: 1; transform: none; }
/* Fil et perle : éléments ajoutés par navigation.js, couche à part, déplacés par transform seulement */
.navbar .navbar__container { position: relative; }
.navbar .navbar__fil, .navbar .navbar__perle {
    position: absolute; pointer-events: none; opacity: 0; transition: opacity 0.35s ease; will-change: transform;
}
.navbar .navbar__fil {
    left: 20px; right: 20px; bottom: 8px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0) 0%, #10b981 70%, #a7f3d0 100%);
    transform-origin: left center; transform: scaleX(0);
}
.navbar .navbar__perle {
    left: 16px; bottom: 5px; width: 8px; height: 8px; border-radius: 50%;
    background: radial-gradient(circle, #ecfdf5 0%, #6ee7b7 45%, rgba(16, 185, 129, 0) 75%);
    box-shadow: 0 0 10px 2px rgba(52, 211, 153, 0.7);
}
.navbar--capsule .navbar__fil, .navbar--capsule .navbar__perle { opacity: 1; }
/* Liens : trait de lumière au survol */
.navbar .navbar__link { position: relative; }
.navbar .navbar__link:not(.navbar__link--dropdown)::after {
    content: ''; position: absolute; left: 10%; right: 10%; bottom: -6px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, transparent, #34d399, transparent);
    transform: scaleX(0); transition: transform 0.3s var(--sortie, ease);
}
.navbar .navbar__link:not(.navbar__link--dropdown):hover::after,
.navbar .navbar__link--active:not(.navbar__link--dropdown)::after { transform: scaleX(1); }
@media (max-width: 1024px) {
    .navbar::before { inset: 6px 8px; border-radius: 18px; }
    .navbar .navbar__fil { bottom: 6px; }
    .navbar .navbar__perle { bottom: 3px; }
}
/* Menu ouvert : la capsule s'efface derrière le panneau plein écran */
.navbar--menu-ouvert::before, .navbar--menu-ouvert .navbar__fil, .navbar--menu-ouvert .navbar__perle { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .navbar::before { transition: none; } }
