/* ============================================================================
   KIT — parts/barre.css        Dépend de : tokens.css, motion.css, bouton.css

   La barre haute, identique sur les huit écrans du portail : marque à gauche,
   navigation au centre, compte et réglages à droite.

   C'est le SEUL endroit du kit — avec le voile de modale — qui a le droit au
   `backdrop-filter` : une surface, jamais vingt-cinq cartes qui défilent.
   ========================================================================= */

.barre {
  position: sticky;
  top: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  gap: var(--pas-3);
  flex-wrap: wrap;

  padding: var(--pas-3) var(--gouttiere);
  background: color-mix(in srgb, var(--fond) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color var(--pose) var(--doux), box-shadow var(--pose) var(--doux);
}

/* Le JS pose data-defile="oui" dès que la page a quitté le haut : la barre
   se détache alors du fond par un trait et une ombre. */
.barre[data-defile="oui"] {
  border-bottom-color: var(--trait);
  box-shadow: var(--pose-1);
}

/* ── La marque ───────────────────────────────────────────────────────────── */
.marque {
  display: inline-flex;
  align-items: center;
  gap: var(--pas-2);
  font-family: var(--f-titre);
  font-weight: 600;
  font-size: var(--t-600);
  letter-spacing: -0.02em;
  color: var(--encre);
  text-decoration: none;
  font-variation-settings: "opsz" 20, "SOFT" 25;
}
.marque .jeton-marque {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--feutre);
  color: var(--sur-feutre);
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: transform var(--pose) var(--rebond);
}
.marque:hover .jeton-marque { transform: rotate(-8deg) scale(1.06); }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.barre-nav {
  display: flex;
  align-items: center;
  gap: var(--pas-1);
  flex-wrap: wrap;
}
.barre .pousse { margin-left: auto; }

.lien-nav {
  font-size: var(--t-400);
  font-weight: 500;
  color: var(--encre-2);
  text-decoration: none;
  padding: 0.42rem 0.7rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: color var(--vif) var(--doux), background-color var(--vif) var(--doux);
}
.lien-nav:hover { color: var(--encre); background: var(--fond-creux); }
.lien-nav[aria-current="page"] { color: var(--encre); background: var(--fond-creux); font-weight: 550; }

/* ── Le compte ───────────────────────────────────────────────────────────── */
.barre .nom-compte {
  font-size: var(--t-400);
  font-weight: 550;
  color: var(--encre);
  white-space: nowrap;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Le sélecteur de langue ──────────────────────────────────────────────── */
.langues {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--fond-creux);
  border: 1px solid var(--trait);
  border-radius: var(--r-pilule);
}
.langues button {
  font-family: var(--f-mono);
  font-size: var(--t-100);
  letter-spacing: 0.05em;
  padding: 0.28rem 0.5rem;
  border: 0;
  border-radius: var(--r-pilule);
  background: none;
  color: var(--encre-3);
  cursor: pointer;
  transition: color var(--vif) var(--doux), background-color var(--vif) var(--doux);
}
.langues button:hover { color: var(--encre); }
.langues button[aria-pressed="true"] { background: var(--surface); color: var(--encre); box-shadow: var(--pose-1); }

/* ── L'interrupteur de thème ─────────────────────────────────────────────
   Un seul bouton : le soleil et la lune se croisent. Les deux glyphes sont
   empilés ; on fait tourner et disparaître celui qui sort.                  */
.bascule-theme {
  position: relative;
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--trait);
  border-radius: var(--r-pilule);
  background: var(--surface);
  color: var(--encre-2);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: color var(--vif) var(--doux), border-color var(--vif) var(--doux);
}
.bascule-theme:hover { color: var(--encre); border-color: var(--trait-fort); }
.bascule-theme > span {
  position: absolute;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform var(--ample) var(--rebond), opacity var(--pose) var(--doux);
}
.bascule-theme .clair { transform: none; opacity: 1; }
.bascule-theme .sombre { transform: rotate(-90deg) scale(0.4); opacity: 0; }

:root[data-theme="dark"] .bascule-theme .clair { transform: rotate(90deg) scale(0.4); opacity: 0; }
:root[data-theme="dark"] .bascule-theme .sombre { transform: none; opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bascule-theme .clair  { transform: rotate(90deg) scale(0.4); opacity: 0; }
  :root:not([data-theme="light"]) .bascule-theme .sombre { transform: none; opacity: 1; }
}

/* ── Mobile : la navigation passe sous la marque ─────────────────────────── */
@media (max-width: 640px) {
  .barre { gap: var(--pas-2); padding-inline: var(--pas-4); }
  .barre-nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .barre-nav::-webkit-scrollbar { display: none; }
  .barre .nom-compte { max-width: 7rem; }
}

/* ── Le pied de page ─────────────────────────────────────────────────────── */
.pied-page {
  margin-top: auto;
  padding: var(--pas-6) var(--gouttiere) var(--pas-7);
  border-top: 1px solid var(--trait);
  font-size: var(--t-300);
  color: var(--encre-3);
  text-align: center;
}
