/* Sélecteur de langue et réglages typographiques par écriture. Chargé par toutes les pages traduites ou traduisibles. */

/* ---------- sélecteur ---------- */
.jc-langues { position: relative; flex: none; font-family: var(--f-body, system-ui, sans-serif); }
.jc-langues > summary {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px 0 11px;
  border: 1px solid var(--line, rgba(19, 17, 22, .14)); border-radius: 999px; background: transparent; color: inherit;
  font: 600 .78rem/1 var(--f-mono, ui-monospace, monospace); letter-spacing: .06em; cursor: pointer; list-style: none;
  user-select: none; -webkit-user-select: none; transition: background .25s, border-color .25s;
}
.jc-langues > summary::-webkit-details-marker { display: none; }
.jc-langues > summary:hover { background: rgba(19, 17, 22, .05); }
.jc-langues > summary:focus-visible { outline: 2px solid var(--orange, #FF5A1F); outline-offset: 3px; }
.jc-langues-globe { flex: none; }
.jc-langues-chevron { flex: none; opacity: .6; transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.jc-langues[open] .jc-langues-chevron { transform: rotate(180deg); }

.jc-langues-panneau {
  position: absolute; z-index: 300; top: calc(100% + 10px); inset-inline-end: 0;
  width: min(440px, calc(100vw - 32px)); max-height: min(72vh, 560px); overflow: auto; overscroll-behavior: contain;
  padding: 10px; border-radius: 20px; border: 1px solid rgba(19, 17, 22, .1);
  background: #FBFBF9; color: #131116; box-shadow: 0 24px 60px -18px rgba(19, 17, 22, .35), 0 2px 6px rgba(19, 17, 22, .06);
  transform-origin: top right;
}
[dir="rtl"] .jc-langues-panneau { transform-origin: top left; }
.jc-langues[open] .jc-langues-panneau { animation: jc-langues-ouvrir .28s cubic-bezier(.16, 1, .3, 1); }
@keyframes jc-langues-ouvrir { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.jc-langues-titre {
  margin: 4px 10px 8px; font: 600 .7rem/1.4 var(--f-mono, ui-monospace, monospace); letter-spacing: .08em;
  text-transform: uppercase; color: #65616C;
}
.jc-langues-panneau ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.jc-langues-panneau a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 8px 12px;
  border-radius: 12px; color: inherit; text-decoration: none; font: 500 .92rem/1.25 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: normal; transition: background .2s;
}
.jc-langues-panneau a:hover { background: rgba(19, 17, 22, .06); }
.jc-langues-panneau a:focus-visible { outline: 2px solid var(--orange, #FF5A1F); outline-offset: -2px; }
.jc-langues-panneau a[aria-current="true"] { background: #131116; color: #F2F2EF; }
.jc-l-nom { min-width: 0; overflow-wrap: anywhere; }
.jc-l-code { flex: none; font: 500 .66rem/1 var(--f-mono, ui-monospace, monospace); letter-spacing: .06em; opacity: .55; }
@media (max-width: 520px) {
  .jc-langues-panneau { position: fixed; top: 84px; inset-inline: 16px; width: auto; max-height: calc(100dvh - 110px); }
  .jc-langues > summary { padding: 0 10px; }
  .jc-langues-chevron { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .jc-langues[open] .jc-langues-panneau { animation: none; }
  .jc-langues-chevron { transition: none; }
}

/* Place dans les en-têtes existants. */
.nav-in .jc-langues > summary { height: 44px; background: rgba(255, 255, 255, .45); }
.nav-in .jc-langues ~ .burger { margin-left: 0; margin-inline-start: 0; }
@media (max-width: 420px) { .nav-in .jc-langues { margin-inline-start: auto; } }
.top .wrap > .jc-langues { margin-inline-start: auto; }
.top .wrap > .top-note + .jc-langues { margin-inline-start: 0; }

/* Avis des pages juridiques traduites. */
.jc-avis-traduction {
  margin: 0 0 28px; padding: 14px 18px; border-radius: 14px; border: 1px solid rgba(255, 90, 31, .35);
  background: rgba(255, 90, 31, .07); font-size: .95rem; line-height: 1.5;
}

/* ---------- écritures ---------- */
/* Les polices du site couvrent le latin. Les autres écritures prennent une police adaptée, chargée seulement sur leurs pages
   (grec, cyrillique, vietnamien, arabe, thaï, devanagari) ou celle du système (chinois, japonais, coréen : plusieurs Mo sinon). */
:root:lang(el), :root:lang(ru), :root:lang(uk) {
  --f-display: "Mona Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Instrument Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}
:root:lang(vi) {
  --f-body: "Mona Sans", "Be Vietnam Pro", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Be Vietnam Pro", "Mona Sans", Arial, sans-serif;
}
:root:lang(ar) {
  --f-display: "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", sans-serif;
  --f-body: "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", sans-serif;
  --f-serif: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
:root:lang(th) {
  --f-display: "Mona Sans", "Noto Sans Thai", "Leelawadee UI", Thonburi, sans-serif;
  --f-body: "Instrument Sans", "Noto Sans Thai", "Leelawadee UI", Thonburi, sans-serif;
  --f-serif: "Noto Sans Thai", "Leelawadee UI", Thonburi, sans-serif;
}
:root:lang(hi) {
  --f-display: "Mona Sans", "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", sans-serif;
  --f-body: "Instrument Sans", "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", sans-serif;
  --f-serif: "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", sans-serif;
}
:root:lang(zh) {
  --f-display: "Mona Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --f-body: "Instrument Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --f-serif: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}
:root:lang(ja) {
  --f-display: "Mona Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --f-body: "Instrument Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --f-serif: "Hiragino Sans", "Yu Gothic UI", Meiryo, "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}
:root:lang(ko) {
  --f-display: "Mona Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
  --f-body: "Instrument Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
  --f-serif: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
}

/* Étiquettes en police à chasse fixe (Geist Mono, latin seulement) : ces écritures prennent la police du texte, une police
   à chasse fixe de repli casserait les liaisons de l'arabe et l'équilibre des autres. */
:root:is(:lang(ar), :lang(zh), :lang(ja), :lang(ko), :lang(th), :lang(hi)) { --f-mono: var(--f-body); }

/* Pas d'italique ni d'espacement entre les lettres pour ces écritures : l'arabe se lie, les idéogrammes et les écritures
   indiennes n'ont pas d'italique ; le navigateur en fabriquerait une version penchée. */
:root:is(:lang(ar), :lang(zh), :lang(ja), :lang(ko), :lang(th), :lang(hi)) * { letter-spacing: normal !important; font-synthesis-style: none; }
:root:is(:lang(ar), :lang(zh), :lang(ja), :lang(ko), :lang(th), :lang(hi)) :is(em, .hl) { font-style: normal; }

/* Signes hauts (thaï, devanagari, arabe, vietnamien) : les titres serrés ont besoin d'un peu plus d'interligne. */
:root:is(:lang(th), :lang(hi)) :is(h1, h2, h3, .h1, .h2, .h-contact) { line-height: 1.32 !important; }
:root:lang(ar) :is(h1, h2, h3, .h1, .h2, .h-contact) { line-height: 1.38 !important; }
:root:lang(vi) :is(h1, h2, .h1, .h2, .h-contact) { line-height: 1.16 !important; }
:root:is(:lang(zh), :lang(ja), :lang(ko)) :is(h1, h2, h3, .h1, .h2, .h-contact) { line-height: 1.24 !important; }
:root:lang(ko) body { word-break: keep-all; }
:root:is(:lang(zh), :lang(ja)) body { line-break: strict; }

/* Langues aux mots longs : césure plutôt que débordement ou texte réduit. */
:root:is(:lang(de), :lang(nl), :lang(fi), :lang(hu), :lang(sv), :lang(da), :lang(nb), :lang(pl), :lang(cs), :lang(el), :lang(ru), :lang(uk), :lang(ro), :lang(tr)) :is(h1, h2, h3, p, li, dd, dt, label, legend, small, b) {
  hyphens: auto; overflow-wrap: break-word;
}
:root:not(:lang(fr)) .btn { white-space: normal; text-align: center; }

/* ---------- droite à gauche ---------- */
[dir="rtl"] svg:has(> use[href="#arr"]) { transform: scaleX(-1); }
[dir="rtl"] #wprev svg { transform: none !important; }
[dir="rtl"] .svc-arrow, [dir="rtl"] .fleche { display: inline-block; transform: scaleX(-1); }

/* ---------- accueil ---------- */
/* Les trois lignes du grand titre sont insécables en français (longueurs connues). Traduites, une ligne peut dépasser
   la largeur de l'écran (« verdient eine Website ») : elle passe à la ligne au lieu d'être coupée. */
:root:not(:lang(fr)) .h1 .line > span.in { white-space: normal; }
:root:not(:lang(fr)) .h1 .rot { max-width: 100%; }
/* Lien d'évitement caché à left:-9999px : de droite à gauche, ce côté devient défilable (page large de 10 000 px). */
[dir="rtl"] .pas-pdf[style*="-9999px"]:not(:focus) { left: auto !important; right: -9999px; }
