/* Меню телефона: бургер перед логотипом, лист на весь экран. Краски, шрифты и кнопки — токены образца v6 (kit.css),
   поэтому обе темы приходят сами. На широкой шапке бургера нет, шапка не меняется. */
.menu-burger{display:none;flex:none;flex-direction:column;justify-content:center;align-items:center;gap:4px;width:44px;height:44px;padding:0;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer}
.menu-burger i{display:block;width:18px;height:2px;background:currentColor}

/* The mobile menu takes over where the full header gets cramped. */
@media(max-width:800px){
 .masthead .menu-burger{display:flex;border-color:transparent;align-items:flex-start;margin-right:-14px}
 .masthead .site-links,.masthead .language{display:none}
}
@media(max-width:800px){
 .s-top .menu-burger{display:flex;border-color:transparent;align-items:flex-start;margin-right:-14px}
 .s-top .s-nav,.s-top .s-lang{display:none}
 .s-top .s-top-row{flex-wrap:nowrap;height:64px;padding-top:0;padding-bottom:0;gap:14px}
}

html.menu-open,html.menu-open body{overflow:hidden}
.site-menu{position:fixed;inset:0;z-index:100;display:flex;flex-direction:column;overflow:auto;overscroll-behavior:contain;padding:0 16px 16px;
 background:var(--paper);color:var(--text);font-family:var(--font-ui);overflow-wrap:normal;word-break:normal;hyphens:manual}
.site-menu[hidden]{display:none}
.site-menu a{color:inherit;text-decoration:none}
.menu-head{flex:none;display:flex;align-items:center;justify-content:space-between;height:64px;border-bottom:1px solid var(--line-strong)}
.menu-logo{width:100px;height:auto}
:root[data-scheme="dark"] .menu-logo{filter:invert(1)}
.menu-close{display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--ink);background:transparent;color:var(--text);font:500 16px/1 var(--font-mono);cursor:pointer}
.menu-body{display:flex;flex-direction:column;gap:22px;padding:18px 0 22px}
.menu-sections .lbl{margin:0 0 6px}
/* A spare pixel keeps the 44 px hit area inside rounded row boundaries. */
.menu-section{display:grid;grid-template-columns:34px 1fr;align-items:baseline;min-height:45px;padding:10px 0;border-bottom:1px solid var(--line-soft);
 font:600 18px/1.18 var(--font-title);letter-spacing:-.02em;text-wrap:balance}
.menu-section .nowrap{white-space:nowrap}
.menu-section small{font:500 11px/1 var(--font-mono);letter-spacing:.06em;color:var(--text-3)}
.menu-links{border-top:1px solid var(--line-strong)}
.menu-link{display:flex;align-items:center;min-height:48px;border-bottom:1px solid var(--line-soft);font:500 13px/1.2 var(--font-mono);text-transform:uppercase;letter-spacing:.06em}
/* Language and theme share one row; on the narrowest phones the theme drops under the languages. */
.menu-row{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px}
.menu-lang,.menu-theme{display:flex;border:1px solid var(--line-strong)}
.menu-lang a,.menu-theme button{display:grid;place-items:center;min-width:34px;height:40px;padding:0 7px;border:0;background:transparent;color:var(--text);
 font:500 12px/1 var(--font-mono);text-transform:uppercase;letter-spacing:.06em;cursor:pointer}
.menu-lang a+a,.menu-theme button+button{border-left:1px solid var(--line-soft)}
.menu-lang a[aria-current],.menu-theme button[aria-pressed="true"]{background:var(--ink);color:var(--on-ink)}
.menu-download.btn{flex:none;margin-top:auto;width:100%;height:52px;justify-content:center;font-size:13px}
.site-menu :focus-visible{outline:2px solid var(--blue);outline-offset:2px}

/* The header uses the same theme control as the menu, with square icon buttons. */
.header-theme{flex:none}
.header-theme button{width:36px;height:36px;min-width:36px;padding:0}
/* The top bar of the inner pages is black in both themes, so the control takes the tones of the language switch beside it. */
.s-top .header-theme{border-color:#3a3c3d}
.s-top .header-theme button{width:24px;height:24px;min-width:24px;color:#8d908d}
.s-top .header-theme button+button{border-left-color:#3a3c3d}
.s-top .header-theme button[aria-pressed="true"]{background:#eeefee;color:#111212}
.header-theme button:focus-visible{outline:2px solid var(--blue);outline-offset:2px;position:relative;z-index:1}
@media(max-width:800px){.header-theme{display:none}}

/* Chinese body and control text use the bundled font after the Latin fonts. */
:root:lang(zh){--font-ui:'IBM Plex Sans','Noto Sans SC',system-ui,sans-serif;--font-mono:'IBM Plex Mono','Noto Sans SC',ui-monospace,monospace}

/* Increase the vertical hit area without changing the visible controls. */
.logo-link,.s-logo,.site-links a,.s-nav a,.s-lang a[href],.menu-lang a[href],.menu-theme button,a.s-btn{position:relative}
#chapter-nav a::before,.logo-link::before,.s-logo::before,.site-links a::before,.s-nav a::before,.s-lang a[href]::before,.menu-lang a[href]::before,.menu-theme button::before,a.s-btn::before{
 content:"";position:absolute;left:0;right:0;top:50%;height:44px;transform:translateY(-50%)}
/* The home logo overlaps the burger by two pixels; keep the burger's hit area. */
@media(max-width:800px){.masthead .logo-link::before{left:2px}}

/* Use the existing phone cards until the download table has room for its text. */
@media(min-width:721px) and (max-width:920px){
 .s-dl,.s-dl tbody,.s-dl tr,.s-dl th,.s-dl td{display:block;width:auto!important}
 .s-dl thead{display:none}
 .s-dl tbody tr{padding:16px 14px;border-bottom:1px solid var(--grid-line)}
 .s-dl tbody tr:last-child{border-bottom:0}
 .s-dl tbody :is(th,td){padding:0;border:0}
 .s-dl tbody td{margin-top:12px}
 .s-dl tbody td[data-label]::before{content:attr(data-label);display:block;margin-bottom:3px;font:500 10.5px/1.3 var(--font-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--text-3)}
 .s-dl .s-act{text-align:left}
 .s-dl .s-act > *{margin-left:0}
 .s-dl .s-act .btn{width:100%;justify-content:center}
 .s-dl .s-btn-link,.s-dl .s-btn-arch{margin-left:0}
}
