/* En-tête commun du site (includes/site_nav.php). Préfixe tl-nav : aucune collision avec
   les règles .header / .nav des feuilles existantes (will.css, industrial-home.css, studio.css). */
:root { --tl-nav-h: 60px; }
/* Ancres (#matieres, #scan…) dégagées sous la barre collante ; le Studio garde ses propres valeurs (studio.css). */
html:has(.tl-nav--site) { scroll-padding-top: calc(var(--tl-nav-h) + 16px); }

.tl-nav { position: sticky; top: 0; z-index: 180; height: var(--tl-nav-h); margin: 0; padding: 0; background: rgba(12, 16, 21, .78); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); border-bottom: 1px solid rgba(255, 255, 255, .07); box-shadow: none; color: #e6edf3; font-family: "DM Sans", "DM Sans Fallback", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.2; -webkit-font-smoothing: antialiased; }
.tl-nav *, .tl-nav *::before, .tl-nav *::after { box-sizing: border-box; }
.tl-nav a { text-decoration: none; color: inherit; }
.tl-nav__inner { position: relative; display: flex; align-items: center; gap: 12px; height: 100%; max-width: 1400px; margin: 0 auto; padding: 0 22px; }

/* Marque */
.tl-nav__brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; color: #f1f5f9; font-weight: 800; font-size: 15.5px; letter-spacing: -.02em; white-space: nowrap; }
.tl-nav__brand picture { display: contents; }
.tl-nav__brand img { display: block; width: 30px; height: 30px; object-fit: contain; }
.tl-nav__brand:hover span { color: #fff; }
/* Lien de retour (pages secondaires du Studio : compte, impression, modèle partagé) */
.tl-nav__back { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .1); color: #c3cdd8; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tl-nav__back:hover { color: #fff; border-color: rgba(94, 234, 212, .45); }

/* Liens */
.tl-nav__menu { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; margin-left: 8px; }
.tl-nav__link { position: relative; display: inline-flex; align-items: center; height: 36px; padding: 0 11px; border-radius: 8px; color: #a9b6c4; font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: color .15s, background-color .15s; }
.tl-nav__link:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.tl-nav__link:focus-visible, .tl-nav__cta:focus-visible, .tl-nav__burger:focus-visible, .tl-nav__brand:focus-visible { outline: 2px solid #5eead4; outline-offset: 2px; }
.tl-nav__link.is-current { color: #fff; }
.tl-nav__link.is-current::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 5px; height: 1px; background: #2dd4bf; opacity: .9; }
.tl-nav__end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tl-nav__more { display: none; }

/* Appel à l'action (pages hors Studio) : dégradé teal -> violet des boutons principaux */
.tl-nav__cta { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 15px; border-radius: 999px; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; background: linear-gradient(135deg, #14b8a6, #8b5cf6 60%, #ec4899); background-size: 160% 100%; background-position: 0 0; transition: background-position .35s, transform .18s; }
.tl-nav__cta:hover { background-position: 100% 0; color: #fff; transform: translateY(-1px); }
.tl-nav__cta svg { flex-shrink: 0; }

/* Sélecteur de langue (will_lang_switcher), version compacte */
.tl-nav .lang-switch__btn { height: 32px; padding: 0 9px; border-radius: 8px; border-color: rgba(255, 255, 255, .1); background: transparent; color: #c3cdd8; font-size: 12px; font-weight: 700; }
.tl-nav .lang-switch__btn:hover { border-color: rgba(94, 234, 212, .45); color: #fff; }
.tl-nav .lang-switch__btn i { font-size: 11px; }

/* Bloc compte (Studio) : ids et classes inchangés, seul l'habillage est repris ici */
.tl-nav__account { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tl-nav .btn--account { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 9px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); color: #e6edf3; font: inherit; font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; box-shadow: none; cursor: pointer; transition: border-color .15s; }
.tl-nav .btn--account:hover { border-color: rgba(94, 234, 212, .45); color: #fff; transform: none; }
.tl-nav .btn--account > i { font-size: 14px; color: #a9b6c4; }
.tl-nav .account-btn__avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(45, 212, 191, .5); }
.tl-nav .pill { height: 22px; padding: 0 8px; font-size: 11px; }
.tl-nav .notif-bell__btn { width: 36px; height: 36px; border-radius: 999px; border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); color: #c3cdd8; }
.tl-nav .notif-bell__btn:hover { border-color: rgba(94, 234, 212, .45); color: #fff; }
/* Variante mobile du compte (coin + solde / Connexion), affichée par app.js sous 640 px seulement */
.tl-nav .header-credits:not([hidden]), .tl-nav .header-login:not([hidden]) { display: none; }
/* Pages secondaires du Studio (studio_topbar) : solde et compte rendus côté serveur */
.tl-nav .st-credits, .tl-nav .st-account, .tl-nav .st-login { height: 36px; }
.tl-nav .st-account img { width: 26px; height: 26px; }

/* Bouton menu (mobile) */
.tl-nav__burger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 4px; width: 36px; height: 36px; margin: 0; padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; background: rgba(255, 255, 255, .04); cursor: pointer; }
.tl-nav__burger span { display: block; width: 16px; height: 1.5px; border-radius: 2px; background: #d5deea; transition: transform .2s, opacity .2s; }
.tl-nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.tl-nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.tl-nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Voile sous le panneau mobile (fermeture au clic). Positionné dans l'en-tête : backdrop-filter
   en fait le bloc conteneur des descendants fixes, d'où un placement absolu sous la barre. */
.tl-nav__overlay { position: absolute; top: 100%; left: 0; right: 0; z-index: 1; height: 100dvh; background: rgba(5, 8, 12, .55); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility 0s .2s; }

/* ── Mobile / tablette : burger + panneau sous la barre ─────────────────────────────── */
@media (max-width: 1099px) {
  .tl-nav__inner { padding: 0 16px; gap: 8px; }
  .tl-nav__burger { display: inline-flex; margin-left: auto; }
  .tl-nav__account { margin-left: auto; }
  .tl-nav__account + .tl-nav__burger { margin-left: 0; }
  .tl-nav__menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 2; display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin: 0; padding: 10px 14px 18px; max-height: calc(100dvh - var(--tl-nav-h)); overflow-y: auto; background: #0e131a; border-bottom: 1px solid rgba(255, 255, 255, .08); opacity: 0; visibility: hidden; transform: translateY(-6px); pointer-events: none; transition: opacity .18s, transform .18s, visibility 0s .18s; }
  .tl-nav__menu.is-open { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity .18s, transform .18s; }
  .tl-nav__menu.is-open ~ .tl-nav__overlay, .tl-nav__overlay.is-visible { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .2s; }
  .tl-nav__link { height: 46px; padding: 0 12px; border-radius: 10px; font-size: 15.5px; }
  .tl-nav__link.is-current::after { left: 12px; right: auto; width: 28px; bottom: 7px; }
  .tl-nav__end { flex-wrap: wrap; justify-content: space-between; gap: 10px; margin: 12px 0 0; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .tl-nav .lang-switch__btn { height: 40px; padding: 0 12px; font-size: 13px; }
  .tl-nav__cta { flex: 1 1 auto; justify-content: center; height: 44px; font-size: 14.5px; }
  .tl-nav__more { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; padding: 0 12px; }
  .tl-nav__more a { color: #7f8da0; font-size: 12.5px; font-weight: 600; }
  .tl-nav__more a:hover { color: #c3cdd8; }
}
@media (max-width: 640px) {
  .tl-nav__back { padding: 0 8px; }
  .tl-nav__back span { display: none; }
  /* Compte toujours accessible sur téléphone (espace Studio, paramètres, back-office) : rond avatar seul.
     Masqué seulement hors connexion, où « Connexion » (.header-login) le remplace. */
  .tl-nav .btn--account { width: 36px; padding: 0; justify-content: center; gap: 0; }
  .tl-nav .btn--account #accountBtnLabel, .tl-nav .btn--account .pill { display: none !important; }
  .tl-nav .btn--account .account-btn__avatar { width: 28px; height: 28px; }
  .tl-nav__account:has(.header-login:not([hidden])) .btn--account { display: none; }
  .tl-nav .header-credits:not([hidden]), .tl-nav .header-login:not([hidden]) { display: inline-flex; margin-left: 0; height: 36px; }
  .tl-nav .st-account span, .tl-nav .st-credits i { display: none; }
}
@media (max-width: 420px) {
  .tl-nav__inner { padding: 0 12px; }
  /* Le nom ne cède la place qu'aux pages avec bloc compte (cloche + solde) ou lien de retour */
  .tl-nav:has(.tl-nav__account, .tl-nav__back) .tl-nav__brand span { display: none; }
}

/* ── Intégration Studio ─────────────────────────────────────────────────────────────── */
/* Colonne latérale de l'atelier : collée sous la barre */
.workspace-nav { top: var(--tl-nav-h); }
@media (min-width: 851px) { .workspace-nav { height: calc(100vh - var(--tl-nav-h)); } }
/* Pièce ouverte en plein écran : la barre reste visible au-dessus de l'atelier (voir app.js, atelierTop) */
html.atelier-open .tl-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 200; }
/* Application native : encoche */
.is-native-app .tl-nav { padding-top: env(safe-area-inset-top); height: calc(var(--tl-nav-h) + env(safe-area-inset-top)); }

@media (prefers-reduced-motion: reduce) {
  .tl-nav__menu, .tl-nav__overlay, .tl-nav__cta, .tl-nav__burger span { transition: none; }
}

/* Onglet « VR » (Timelapse Studio VR) */
.tl-nav__link[href$="?vr=1"] { color: #2ee6d0; font-weight: 800; letter-spacing: .06em; }

/* Bloc compte des pages secondaires du Studio et du marketplace (studio_topbar) : copie des styles
   .st-credits / .st-account / .st-login de studio-theme.css, pour les pages qui ne chargent pas ce thème. */
.tl-nav__account .st-credits { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px 0 8px; border-radius: 999px; border: 1px solid rgba(245, 179, 1, .4); background: rgba(245, 179, 1, .08); color: #fcd34d; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: none; }
.tl-nav__account .st-credits img { width: 18px; height: 18px; }
.tl-nav__account .st-credits i { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #8b5cf6 60%, #ec4899); color: #fff; font-size: 10px; }
.tl-nav__account .st-credits:hover { border-color: #fcd34d; }
.tl-nav__account .st-account, .tl-nav__account .st-login { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 4px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); color: #e6edf3; font-size: 13px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.tl-nav__account .st-login { padding: 0 14px; border-color: rgba(94, 234, 212, .4); background: rgba(45, 212, 191, .08); }
.tl-nav__account .st-account img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(45, 212, 191, .55); }
.tl-nav__account .st-account i { width: 30px; text-align: center; }
.tl-nav__account .st-credits:focus-visible, .tl-nav__account .st-account:focus-visible, .tl-nav__account .st-login:focus-visible { outline: 2px solid #5eead4; outline-offset: 2px; }
@media (max-width: 640px) { .tl-nav__account .st-account { padding: 0 4px; } .tl-nav__account .st-account span { display: none; } }
