/* Shared navigation legibility fixes. Only the existing menu/header is affected.
   The approved homepage hero, its side labels and layout are untouched. */
html[lang="ru"] .menu-btn .mb{width:auto;min-width:max-content;overflow:hidden;flex-shrink:0}
html[lang="ru"] .menu-btn .mb > span{width:max-content;max-width:none}
html[lang="ru"] .menu-btn{flex-shrink:0}
@media(max-width:760px){
  html[lang="ru"] .toc-list .t{font-size:clamp(23px,7vw,42px);line-height:1.09;letter-spacing:0}
  html[lang="ru"] .toc-list a{grid-template-columns:1.7em minmax(0,1fr) 2em;gap:.45em}
  html[lang="ru"] .toc-list .p{white-space:nowrap;font-size:10px}
  html[lang="ru"] .toc-list .t>span{max-width:100%;overflow:visible}
}
@media(max-width:350px){
  html[lang="ru"] .toc-list .t{font-size:clamp(21px,6.85vw,24px)}
  html[lang="ru"] .toc-list a{gap:.4em}
}

/* Page-independent navigation overlay and language visibility. */
.menu-open .bar > .sec,.menu-open .bar > .menu-btn,.menu-open .bar > .lang{color:var(--red);background:transparent;box-shadow:none}
.menu-open .bar .lang{opacity:1!important;transform:none!important;visibility:visible!important}
.menu-open .bar .menu-btn{visibility:visible!important;opacity:1!important}
.menu-open .toc{overscroll-behavior:contain}
.toc-list a:focus-visible{outline:2px solid var(--red);outline-offset:3px}

/* Accessibility: a system request for less motion also covers menu/page transitions. */
@media (prefers-reduced-motion:reduce){
  .toc,.toc-list li,.toc-list a,.bar .roll>span,.menu-btn .mb>span,.bar>.sec,.bar>.menu-btn,.bar>.lang{transition:none!important;animation:none!important}
}
/* Only very narrow Russian headers: preserve the approved three-part bar without collisions. */
@media(max-width:350px){
  html[lang="ru"] .bar{gap:12px}
  html[lang="ru"] .bar .sec,html[lang="ru"] .bar .menu-btn{font-size:12px}
  html[lang="ru"] .bar .lang{font-size:11px}
}
@media(max-width:350px){
  html[lang="ru"] .bar{gap:8px}
  html[lang="ru"] .bar>.sec,html[lang="ru"] .bar>.menu-btn{margin:0;padding:.25em .1em}
  html[lang="ru"] .bar>.lang{margin:0 0 0 auto;padding:.25em .1em}
}

/* v2: compact shared overlay typography, preserving the original grid and animation. */
.toc-list .t{font-size:clamp(34px,4.7vw,88px);line-height:1}
.toc-list li:nth-child(5) .t>span{white-space:nowrap;overflow-wrap:normal;hyphens:none;word-break:keep-all}
@media(max-width:760px){
 .toc-list .t{font-size:clamp(26px,7.2vw,42px)}
 html[lang="ru"] .toc-list .t{font-size:clamp(22px,6.65vw,37px);line-height:1.06}
 html[lang="ru"] .toc-list li:nth-child(5) .t>span{white-space:nowrap;overflow-wrap:normal;hyphens:none;word-break:keep-all}
}
@media(max-width:350px){html[lang="ru"] .toc-list .t{font-size:clamp(21px,6.55vw,24px)}}

/* Legible label above text while retaining the approved adaptive treatment. */
.bar > [data-tone="pill"]{background-color:var(--paper);color:var(--ink)}
.bar > [data-tone="pill"] sup{color:inherit}
.bar [aria-disabled="true"]{cursor:default}
