/* ---------- Traduction : sélecteur, polices, droite-à-gauche ---------- */
html.ilf-i18n-pending body { opacity: 0; }
body { transition: opacity .25s ease; }

.ilf-lang { position: relative; display: flex; align-items: center; margin-left: 1.6rem; z-index: 120; }
.ilf-lang-btn {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  padding: .42rem .8rem .42rem .65rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.04); color: rgba(255,255,255,.85); font: 600 .78rem/1 inherit; letter-spacing: 1.5px;
  transition: border-color .25s, background .25s, color .25s;
}
.ilf-lang-btn:hover, .ilf-lang-btn[aria-expanded="true"] { border-color: rgba(45,147,255,.6); background: rgba(45,147,255,.1); color: #fff; }
.ilf-lang-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ilf-lang-btn .ilf-lang-chev { width: 13px; height: 13px; transition: transform .25s; }
.ilf-lang-btn[aria-expanded="true"] .ilf-lang-chev { transform: rotate(180deg); }
.ilf-lang-menu {
  position: absolute; top: calc(100% + 10px); right: 0; width: min(380px, 92vw); max-height: 72vh; overflow: auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: .5rem;
  background: rgba(8, 10, 18, .96); border: 1px solid rgba(120,170,255,.16); border-radius: 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 24px 60px -20px rgba(0,0,0,.9);
}
.ilf-lang-menu[hidden] { display: none; }
.ilf-lang-menu button {
  text-align: start; padding: .6rem .8rem; border: 0; border-radius: 10px; background: transparent; color: #c9cbd6;
  font: 500 .92rem/1.25 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; letter-spacing: normal; cursor: pointer;
  transition: background .2s, color .2s;
}
.ilf-lang-menu button:hover, .ilf-lang-menu button:focus-visible { background: rgba(45,147,255,.14); color: #fff; outline: none; }
.ilf-lang-menu button[aria-checked="true"] { color: #fff; background: rgba(45,147,255,.2); }
.ilf-lang-menu button[aria-checked="true"]::after { content: " ✓"; color: #2d93ff; }
.ilf-lang-menu .ilf-lang-auto { grid-column: 1 / -1; border-bottom: 1px solid rgba(255,255,255,.08); border-radius: 10px 10px 4px 4px; margin-bottom: .25rem; }
.ilf-lang-menu .ilf-lang-auto::before { content: "◎ "; color: #2d93ff; }
@media (max-width: 781px) {
  .ilf-lang { margin-left: auto; margin-right: .8rem; order: 2; }
  .ilf-topbar .wp-block-navigation { order: 3; }
  .ilf-lang-btn { padding: .38rem .6rem; }
  .ilf-lang-menu { position: fixed; top: 64px; right: 4vw; }
}

/* Écritures qui ne supportent pas l'espacement des lettres */
html:is([lang="ar"], [lang="hi"], [lang="zh"], [lang="ja"], [lang="ko"]) body *:not(.ilf-term *):not(.ilf-marquee *) { letter-spacing: normal !important; }
/* Polices adaptées */
html[lang="zh"] :is(body, h1, h2, h3, h4, h5, h6, p, a, li, span, button):not(.ilf-term *) { font-family: "Instrument Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif !important; }
html[lang="ja"] :is(body, h1, h2, h3, h4, h5, h6, p, a, li, span, button):not(.ilf-term *) { font-family: "Instrument Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif !important; }
html[lang="ko"] :is(body, h1, h2, h3, h4, h5, h6, p, a, li, span, button):not(.ilf-term *) { font-family: "Instrument Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif !important; }
html[lang="ar"] :is(body, h1, h2, h3, h4, h5, h6, p, a, li, span, button):not(.ilf-term *) { font-family: "Instrument Sans", "Segoe UI", "Geeza Pro", "Noto Sans Arabic", Tahoma, sans-serif !important; }
html[lang="hi"] :is(body, h1, h2, h3, h4, h5, h6, p, a, li, span, button):not(.ilf-term *) { font-family: "Instrument Sans", "Nirmala UI", "Kohinoor Devanagari", "Noto Sans Devanagari", sans-serif !important; }
html:is([lang="zh"], [lang="ja"], [lang="ko"]) .ilf-hero-lead, html:is([lang="zh"], [lang="ja"], [lang="ko"]) .ilf-text { line-break: strict; word-break: normal; }
html:is([lang="ar"], [lang="hi"]) .ilf-hero-lead, html:is([lang="ar"], [lang="hi"]) .ilf-text, html:is([lang="ar"], [lang="hi"]) .ilf-desc { line-height: 1.9; }

/* Arabe : lecture de droite à gauche */
[dir="rtl"] .ilf-term, [dir="rtl"] .ilf-marquee { direction: ltr; text-align: left; }
[dir="rtl"] .ilf-stats li { padding: 1.4rem 0 0 1.5rem; }
[dir="rtl"] .ilf-stats li + li { border-left: 0; border-right: 1px solid var(--ilf-line); padding-left: 0; padding-right: 1.5rem; }
[dir="rtl"] .ilf-live { margin-left: 0; margin-right: auto; }
[dir="rtl"] .ilf-lang { margin-left: 0; margin-right: 1.6rem; }
[dir="rtl"] .ilf-lang-menu { right: auto; left: 0; }
[dir="rtl"] .ilf-topbar .wp-block-site-title::before { margin-right: 0; margin-left: .7rem; }
[dir="rtl"] .ilf-badge .ilf-dot { margin-right: 0; margin-left: .6rem; }
[dir="rtl"] .ilf-topbar .wp-block-navigation-item__content::after { transform-origin: right; }
[dir="rtl"] .ilf-arrow .wp-block-button__link::after { content: " ↖"; }
@media (max-width: 781px) { [dir="rtl"] .ilf-lang { margin-left: .8rem; margin-right: auto; } [dir="rtl"] .ilf-lang-menu { left: 4vw; right: auto; } }
html:is([lang="ar"], [lang="hi"]) .ilf-hero-title .ilf-grad { padding-bottom: .18em; line-height: 1.25; }

/* ILF_NAVFIX : espace entre le menu et le sélecteur de langue */
@media (min-width: 782px) {
  body .navbar > .ilf-lang, body .row-navbar > .ilf-lang { margin-left: clamp(1.2rem, 2.2vw, 2.2rem); padding-left: clamp(1.2rem, 2.2vw, 2.2rem); border-left: 1px solid rgba(255,255,255,.12); align-self: center; flex: 0 0 auto; }
  body .navbar > .row-navbar { flex: 1 1 auto; min-width: 0; }
  body .navbar .wp-block-navigation-item__content { white-space: nowrap; }
}
