/* Variables

   `--bottombar-height` valait 48px ici et n'a jamais rien mesuré : les trois
   feuilles communes la déclaraient, et `base.html.twig` les charge dans
   l'ordre topbar → bottombar → homepage. C'est donc la dernière qui gagnait,
   partout, avec 43. Retirée le 1er septembre 2026 (A4) : une variable qui a
   trois valeurs n'en a aucune, et il devenait impossible de la faire varier
   sur téléphone sans que la déclaration suivante l'écrase.

   Chaque barre possède désormais sa hauteur : celle du bas vit dans
   `bottombar.css`, avec la barre qu'elle mesure. */
:root {
    --topbar-height: 43px;
    --bar-bg: rgba(0, 0, 0, 0.75);
}

.top-bar {
    font-family: 'Funnel Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Barre haute */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    z-index: 1000;
    background: var(--bar-bg);
    color: #ddd;
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    width: 100%;
    height: 100%;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

/* Zone gauche */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
}

.topbar-left > a {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 100%;
}

/* Même relief que le blason du hero, à l'échelle de la barre. */
.site-logo-img {
    height: 36px;
    width: auto;
    flex-shrink: 0;
    transform: perspective(300px) rotateY(-9deg) rotateX(5deg);
    transform-origin: 60% 50%;
    filter:
        drop-shadow(-1px -1px 0 rgba(255, 255, 255, 0.45))
        drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.45))
        drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.6))
        contrast(1.06)
        saturate(1.08);
}

.topbar-identity {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    font-family: 'Funnel Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.identity-domain {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.identity-phone {
    font-size: 12px;
    color: #bbb;
    text-decoration: none;
    transition: color 0.2s;
}

.identity-phone:hover {
    color: #fff;
}

.topbar-brand {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    font-family: 'Funnel Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Les deux liens de marque portent désormais un SVG et non du texte.
   `display: inline-flex` aligne le tracé sur la ligne de base des libellés
   voisins — un SVG en `inline` s'assoit sur la ligne de base comme une lettre
   et dépasse de trois pixels sous le téléphone et le nom du site. */
.topbar-social {
    display: inline-flex;
    align-items: center;
    color: #bbb;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
    font-family: 'Funnel Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.topbar-social svg {
    display: block;
}

.topbar-social:hover {
    color: #fff;
}

/* Hamburger button */
.topbar-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1010;
    height: 40px;
    width: 40px;
}

.topbar-burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    transition: transform 0.2s, opacity 0.2s;
}

.topbar-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar-burger.open span:nth-child(2) { opacity: 0; }
.topbar-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Zone droite */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

/* Boutons nav — CARRES, border-radius: 0 */
.topbar-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 12px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.18);
    height: 18px;
    min-width: 22px;
    font-family: 'Funnel Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
}

.topbar-pill:hover {
    background: rgba(255, 255, 255, 0.20);
}

.topbar-pill:focus {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

/* Bouton client : au MEME poids que les autres liens depuis le 10 septembre
   2026 (D86). Le bleu en faisait l element le plus visible du premier ecran,
   devant les formations — c est ce qu un audit externe a vu en premier. La
   classe reste pour le menu de compte, qui n a pas change. */
.topbar-pill.client-btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.topbar-pill.client-btn:hover {
    background: rgba(255, 255, 255, 0.20);
}

/* Sélecteur de langue — seulement si mécanisme PostgreSQL actif */
.lang-selector {
    display: flex;
    gap: 2px;
    height: 100%;
    margin-right: 8px;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 0;
    background: transparent;
    color: #ccc;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    height: 36px;
    min-width: 40px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Responsive tablette */
@media (max-width: 992px) {
    .topbar-inner {
        padding: 0 16px;
    }
    .topbar-pill {
        padding: 6px 10px;
        font-size: 12px;
        height: 32px;
        min-width: 40px;
    }
    .identity-name, .identity-trade { display: none; }
    .identity-contact { display: none; }
}

/* Mobile: hamburger */
@media (max-width: 768px) {
    .topbar-burger {
        display: flex;
    }

    .topbar-right {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 33, 57, 0.98);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 0;
        z-index: 1005;
        padding: calc(var(--topbar-height) + 20px) 0 0;
        overflow-y: auto;
    }
    .topbar-right.open {
        display: flex;
    }

    .topbar-right::before {
        content: "LuxHawk";
        display: block;
        font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        font-weight: 600;
        font-size: 22px;
        letter-spacing: 0.12em;
        color: #ffffff;
        padding: 20px 0;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
    }

    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        width: 100%;
        padding: 0 0 20px;
    }
    .topbar-pill {
        font-size: 15px;
        padding: 12px 0;
        border: none;
        background: none;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0;
        height: auto;
        min-width: auto;
    }
    .topbar-pill:hover {
        background: rgba(255, 255, 255, 0.06);
    }
    .topbar-pill.client-btn {
        background: rgba(0, 100, 200, 0.30);
        border-bottom: 1px solid rgba(0, 120, 220, 0.40);
    }
    .lang-selector {
        flex-direction: row;
        margin-bottom: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 16px;
    }
    .lang-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile A11Y */
@media (max-width: 768px) {
    .topbar-burger {
        min-width: 44px;
        min-height: 44px;
        padding: 12px;
        box-sizing: border-box;
    }

    .topbar-pill {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .topbar-right {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
        box-sizing: border-box;
    }
}

/* Sélecteur de langue — <details> natif : clavier et pouce, aucun survol requis */

.lang-switch {
    position: relative;
}

.lang-switch > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.lang-switch > summary::-webkit-details-marker {
    display: none;
}

.lang-switch > summary::after {
    content: " \25BE";
}

.lang-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1100;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 100%;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.lang-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    color: #ddd;
    text-decoration: none;
    white-space: nowrap;
}

/* Menu du compte : dernier element de la barre, donc ancre a DROITE. Avec le
   `left: 0` du selecteur de langue, il sortait de l ecran. Et ses entrees se
   calent sur la taille des boutons de la barre — elles etaient nettement plus
   grosses que tout ce qui les entoure. */
.account-switch .lang-menu {
    left: auto;
    right: 0;
    min-width: max-content;
}

.account-switch .lang-item {
    justify-content: flex-start;
    min-height: 34px;
    padding: 0 14px;
    font-size: 12px;
    line-height: 1.2;
}

/* Le type de compte : une information, pas une action. Il porte donc les
   memes marges que les entrees pour rester aligne, mais ni curseur, ni survol,
   ni couleur d appel — et une ligne qui le separe de ce qui se clique. Sans
   cette separation, un etat pose au-dessus de trois liens se prend pour un
   quatrieme lien qui ne repond pas. */
.account-switch .account-role {
    padding: 8px 14px 6px;
    color: #9a9a9a;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.lang-item:hover,
.lang-item:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.lang-item.is-active {
    color: #fff;
    font-weight: 600;
}

@media (max-width: 900px) {
    .lang-menu {
        position: static;
        border: none;
        background: transparent;
        display: flex;
    }
}
