/* Языки: меню выбора языка, письменности (арабская, деванагари, японская), зеркалирование для арабского,
   перенос длинных немецких и испанских слов. Подключается на всех страницах после остальных стилей. */

/* ---------- меню языков в шапке ---------- */
.lsw{position:relative;display:inline-flex;flex:none}
.lsw-b{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:6px 10px;border:0;border-radius:9999px;background:var(--s2);color:var(--tx);
 font:600 13px/20px var(--font,Manrope,system-ui,sans-serif);cursor:pointer;transition:background-color .3s var(--ease,ease)}
.lsw-b:hover{background:var(--line)}
.lsw-b .ic,.lsw-b svg{width:16px;height:16px;flex:none}
.lsw-b b{font-weight:600;letter-spacing:.02em}
.lsw-m{position:absolute;top:calc(100% + 8px);inset-inline-end:0;z-index:60;display:none;flex-direction:column;min-width:168px;padding:6px;
 background:var(--s1);border:1px solid var(--line);border-radius:16px;box-shadow:0 16px 48px rgba(0,0,0,.4)}
.lsw[data-open] .lsw-m{display:flex}
.lsw-m a{display:block;padding:8px 12px;border-radius:10px;color:var(--tx);text-decoration:none;font-size:14px;line-height:20px;white-space:nowrap;text-align:start}
.lsw-m a:hover,.lsw-m a:focus-visible{background:var(--s2)}
.lsw-m a[aria-current]{color:var(--accent);font-weight:600}
.lsw-m a[lang="ar"]{direction:rtl}

/* строка языков в мобильном меню: обычные ссылки, а не крупные пункты меню */
.menu .lrow{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid var(--line)}
.menu .lrow a{font-size:14px;line-height:20px;font-weight:500;padding:6px 12px;border-radius:9999px;background:var(--s2);color:var(--tx)}
.menu .lrow a[aria-current]{background:var(--accent);color:var(--accent-ink)}
.lrow{display:flex;flex-wrap:wrap;gap:8px}

/* ---------- письменности ---------- */
html[lang="ar"] body,html[lang="ar"] button,html[lang="ar"] input,html[lang="ar"] textarea{font-family:Manrope,"Noto Sans Arabic",system-ui,sans-serif}
html[lang="ja"] body,html[lang="ja"] button,html[lang="ja"] input,html[lang="ja"] textarea{font-family:Manrope,"Noto Sans JP",system-ui,sans-serif}
html[lang="hi"] body,html[lang="hi"] button,html[lang="hi"] input,html[lang="hi"] textarea{font-family:Manrope,"Noto Sans Devanagari",system-ui,sans-serif}
/* у арабского, деванагари и японского нет разрядки: она рвёт связное письмо */
html:is([lang="ar"],[lang="ja"],[lang="hi"]) *{letter-spacing:0!important}
/* крупные заголовки с межстрочным 1: у деванагари и арабского выносные элементы обрезаются, даём воздух */
html:is([lang="ar"],[lang="hi"]) :is(h1,h2,h3,.h1,.h2,.tag p){line-height:1.35!important;padding-bottom:.08em}
html:is([lang="ar"],[lang="hi"]) body{line-height:1.6}
html[lang="ja"] :is(h1,h2,h3,.h1,.h2,.tag p){line-height:1.3!important;word-break:auto-phrase}
html[lang="ja"] body{line-break:strict}

/* ---------- длинные слова (немецкий, испанский) и длинные подписи ---------- */
:where(h1,h2,h3,h4,p,li,dt,dd,figcaption,blockquote,summary,label,td,th,a,button,.btn,span,b,strong,em){overflow-wrap:break-word}
:where(html[lang="de"],html[lang="es"],html[lang="en"]) :where(h1,h2,h3,h4,p,li,dd,blockquote,summary,td,.btn){hyphens:auto;-webkit-hyphens:auto}
:where(html:not([lang="ru"])) :where(.btn){white-space:normal;text-align:center;max-width:100%}
/* поля, кнопки и плашки внутри гибких рядов не должны распирать ряд */
:where(html:not([lang="ru"])) :where(.btn,.chip,button){min-width:0}

/* ---------- зеркалирование для арабского ---------- */
/* общий слой держит шапку и меню слева направо; на арабском им нужен порядок справа налево */
html[dir="rtl"] :is(nav.top,.menu){direction:rtl}
html[dir="rtl"] .skip{left:auto;right:16px}
html[dir="rtl"] .typist{right:auto;left:16px;padding:4px 4px 4px 12px}
html[dir="rtl"] .m .b ul{padding-left:0;padding-right:16px}
html[dir="rtl"] #hint img{margin-right:0;margin-left:8px}
html[dir="rtl"] .bbar i{transform-origin:100% 50%}
/* стрелки «вперёд/назад» и шевроны направления */
html[dir="rtl"] :is(.ic.flip,[data-flip]){scale:-1 1}
/* цифры, время, коды и форматы файлов внутри арабского текста читаются слева направо */
html[dir="rtl"] :is(time,code,kbd,.ts,.tm){unicode-bidi:isolate;direction:ltr}

/* полоса «бросьте файл» в статьях: если подписи тесно, кнопка уходит на следующую строку, а не сжимает текст в столбик */
:where(html:not([lang="ru"])) .drop{flex-wrap:wrap}
:where(html:not([lang="ru"])) .drop .dt{flex:1 1 180px}
