/* Sélecteur de langue — composant commun Justes Mesures / Atelier Dongmo.
   Usage : <link rel="stylesheet" href="/shared/lang.css"> + <script src="/shared/lang.js"></script>
   FR / EN / TR / AR — arabe en RTL, logo noir sur blanc.
   Les textes traduisibles viennent de /shared/i18n.json (clé = texte français). */

/* ---------- le sélecteur ---------- */
.lang{position:absolute;top:14px;right:16px;left:auto;z-index:60;
  display:flex;gap:3px;padding:4px;border-radius:999px;
  background:rgba(11,11,11,.55);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border:1px solid rgba(244,242,236,.18)}
.lang button{width:34px;height:26px;padding:0;border:0;border-radius:6px;background:transparent;
  cursor:pointer;opacity:.5;transition:opacity .15s, box-shadow .15s;display:flex;align-items:center;justify-content:center}
.lang button svg{width:26px;height:18px;display:block;border-radius:2px}
.lang button:hover{opacity:.85}
.lang button[aria-pressed="true"],.lang button.on{opacity:1;box-shadow:0 0 0 1.5px rgba(244,242,236,.85)}

/* accroché dans un en-tête : plus de position fixe, la pastille suit la charte */
.lang.dans-entete{position:static;transform:none;top:auto;left:auto;margin:0 0 0 6px;
  width:max-content;max-width:100%;flex:none;align-self:center;
  padding:3px;background:transparent;border:1px solid rgba(11,11,11,.16);
  backdrop-filter:none;-webkit-backdrop-filter:none}
.lang.dans-entete button{width:28px;height:21px}
.lang.dans-entete button svg{width:22px;height:15px}
.lang.dans-entete button[aria-pressed="true"],.lang.dans-entete button.on{
  box-shadow:0 0 0 1.5px rgba(11,11,11,.6)}
header .lang.dans-entete,header .lang{flex:none}

/* ---------- arabe : typographie et sens de lecture ---------- */
html.lang-ar{--police-ar:'Noto Naskh Arabic','Geeza Pro','Segoe UI',Tahoma,'Arial Unicode MS',sans-serif}
html.lang-ar body,html.lang-ar button,html.lang-ar input,html.lang-ar select,html.lang-ar textarea{
  font-family:var(--police-ar),'Inter',system-ui,sans-serif}
html.lang-ar h1,html.lang-ar h2,html.lang-ar h3,html.lang-ar .brand .n{
  font-family:var(--police-ar),'Anton',Impact,sans-serif;letter-spacing:0}
html[dir="rtl"] body{text-align:right}
html[dir="rtl"] .lang{left:14px;right:auto;transform:none}
html[dir="rtl"] .lang.dans-entete{position:static;right:auto;margin:0 6px 0 0}
html[dir="rtl"] .champ label,html[dir="rtl"] .kick,html[dir="rtl"] .pl{letter-spacing:0}
html[dir="rtl"] input[type="tel"],html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],html[dir="rtl"] .code{direction:ltr;text-align:left}

/* ---------- arabe : le logo en noir sur blanc ---------- */
html.lang-ar .brand{background:#fff;color:#0B0B0B;border:1.5px solid #0B0B0B;
  border-radius:26px;padding-bottom:13px;height:auto;max-width:100%}
html.lang-ar .brand .bt span{border-color:rgba(11,11,11,.35)}
html.lang-ar .brand .bt{padding-bottom:2px}
html.lang-ar .brand .s{margin-top:5px;padding-top:4px;line-height:1.4}
html.lang-ar .brand svg path[fill="#F4F2EC"]{fill:#fff}
html.lang-ar .brand svg path[fill="#FBFAF6"]{fill:#fff}
html.lang-ar .brand svg path[stroke="#F4F2EC"]{stroke:#0B0B0B}
html.lang-ar .brand img{background:#fff;filter:none}
html.lang-ar .marque{color:#0B0B0B}
html.lang-ar .marque img,html.lang-ar .blogo{background:#fff}

/* pastille claire (pages à fond sombre) : le drapeau reste lisible */
html.lang-ar .lang{background:rgba(255,255,255,.92);border-color:rgba(11,11,11,.18)}
html.lang-ar .lang button[aria-pressed="true"],html.lang-ar .lang button.on{
  box-shadow:0 0 0 1.5px rgba(11,11,11,.65)}

/* sous 700 px : le sélecteur reste en haut, côté libre */
@media(max-width:700px){
  .lang{top:10px;right:10px;left:auto}
  html[dir="rtl"] .lang{left:10px;right:auto}
  /* le sélecteur flotte au-dessus : on décale la marque pour ne pas la couvrir */
  html.lang-flottant .brand{margin-top:40px}
}

@media(max-width:640px){
  .lang{top:8px}
  .lang button{width:31px;height:24px}
  .lang button svg{width:23px;height:16px}
  .lang.dans-entete button{width:26px;height:20px}
  .lang.dans-entete button svg{width:20px;height:14px}
}
