/* Help / FAQ pages in the mail-app shell: dark header on top (logo + actions),
   lighter navigation on the left, content on the right, thin dividers between.
   Sizes and colours mirror the mail app (.mail-header, .sidebar, .folder-button). */
.help-shell {
  /* Everything derives from the app palette (style-system.css + customization), so
     theme, accent and user customization match the mail app. */
  --help-header-bg: var(--bl-help-header, #0d0d0d);
  --help-nav-bg: var(--panel);
  --help-content-bg: var(--page);
  --help-line: var(--border);
  --help-control: var(--control);
  --help-control-active: var(--selected);
  --help-active-border: var(--style-button-border);
  --help-text: var(--text);
  --help-muted: var(--muted);
  --help-glow: var(--style-glow);  --help-side: 244px;
  min-height: 100vh;
  margin: 0;
  background: var(--help-content-bg);
  color: var(--help-text);
  font-family: Inter, system-ui, sans-serif;
}
.help-shell [hidden] { display: none !important; }

/* Header */
.help-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  height: 68px;
  align-items: center;
  border-bottom: 1px solid var(--help-line);
  background: var(--help-header-bg);
  padding-right: 18px;
}
.help-brand-block {
  display: flex;
  flex: 0 0 var(--help-side);
  width: var(--help-side);
  height: 100%;
  align-items: center;
  gap: 8px;
  padding-left: 18px;
  border-right: 1px solid var(--help-line);
}
.help-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--help-text); font: 800 18px/1 Inter, sans-serif; text-decoration: none; }
.help-brand img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }
.help-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.help-control-wrap { position: relative; }

.help-action {
  display: inline-flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--help-line);
  border-radius: 8px;
  background: var(--help-control);
  color: var(--help-text);
  font: 700 13px/1 Onest, Inter, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .25s ease, border-color .25s ease, box-shadow .3s ease;
}
.help-action img { flex: 0 0 20px; width: 20px; height: 20px; filter: brightness(0) invert(1); }
.help-action:is(:hover, :focus-visible, [aria-expanded="true"]) {
  outline: none;
  border-color: var(--help-active-border);
  background: var(--help-control-active);
  box-shadow: var(--help-glow);
}
.help-menu-toggle { display: none; width: 42px; height: 42px; padding: 0; }

/* Dropdown menus (help, donations, language) */
.help-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 4px;
  width: max-content;
  min-width: 240px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 90px);
  max-height: calc(100dvh - 90px);
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--help-line);
  border-radius: 12px;
  background: var(--help-nav-bg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}
.help-menu-title { margin: 8px 10px 2px; color: var(--help-muted); font: 800 11px/1.4 Onest, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.help-menu-title:first-child { margin-top: 2px; }
.help-menu :is(a, button) {
  display: flex;
  min-height: 40px;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid var(--help-line);
  border-radius: 8px;
  background: var(--help-control);
  color: var(--help-text);
  font: 600 13px/1.3 Onest, sans-serif;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.help-menu :is(a, button) img { flex: 0 0 20px; width: 20px; height: 20px; filter: brightness(0) invert(1); }
.help-menu :is(a, button):is(:hover, :focus-visible, [aria-current="page"], [aria-pressed="true"]) { outline: none; border-color: var(--help-active-border); background: var(--help-control-active); }
.help-language-menu { width: 280px; }
.help-language-search {
  min-height: 40px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--help-line);
  border-radius: 8px;
  background: var(--help-content-bg);
  color: var(--help-text);
  font: 500 13px/1 Inter, sans-serif;
  outline: none;
}
.help-language-search:focus-visible { border-color: var(--help-active-border); }
.help-language-list { display: grid; gap: 4px; }
.help-language-list button span:last-child { margin-left: auto; color: var(--help-muted); font-size: 11px; }

/* Layout: navigation + content */
.help-layout { display: grid; grid-template-columns: var(--help-side) minmax(0, 1fr); min-height: calc(100vh - 69px); }
.help-sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  height: calc(100dvh - 68px);
  overflow-y: auto;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--help-line);
  background: var(--help-nav-bg);
}
/* Navigation scrolls without showing scrollbars and never scrolls sideways. */
.help-sidebar, .public-sidebar, .public-drawer { overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.help-sidebar::-webkit-scrollbar, .public-sidebar::-webkit-scrollbar, .public-drawer::-webkit-scrollbar { display: none; width: 0; height: 0; }
.help-nav a > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.help-nav { display: grid; gap: 3px; min-width: 0; }
.help-nav-title { margin: 16px 10px 6px; color: var(--help-muted); font: 800 11px/1.4 Onest, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.help-nav-divider { height: 1px; margin: 12px 0 2px; background: var(--help-line); }
.help-nav a {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--help-line);
  border-radius: 8px;
  background: var(--help-control);
  color: var(--help-text);
  font: 500 14px/1.25 Onest, sans-serif;
  text-decoration: none;
  transition: background-color .25s ease, border-color .25s ease, box-shadow .3s ease;
}
.help-nav .nav-sticker { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; }
.help-nav .nav-sticker img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.help-nav a:is(:hover, :focus-visible) { outline: none; border-color: var(--help-active-border); background: var(--help-control-active); }
.help-nav a[aria-current="page"] { border-color: var(--help-active-border); background: var(--help-control-active); box-shadow: var(--help-glow); }

.help-main { min-width: 0; }
.help-main .public-article { width: min(850px, calc(100% - 64px)); margin: 0 auto; padding: 48px 0 96px; }

.help-scrim { position: fixed; z-index: 34; inset: 0; background: rgba(0, 0, 0, .55); }

/* Tablet & phone: navigation becomes a drawer, header actions turn icon-only. */
@media (max-width: 860px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-menu-toggle { display: inline-flex; }
  .help-brand-block { flex: 0 1 auto; width: auto; padding-left: 12px; border-right: 0; }
  .help-header { padding-right: 12px; }
  .help-sidebar {
    position: fixed;
    z-index: 35;
    top: 0;
    left: 0;
    width: min(var(--help-side), 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform .28s ease;
  }
  .help-sidebar.open { transform: none; }
  .help-action[data-collapse] > span { display: none; }
  .help-action[data-collapse] { width: 38px; padding: 0; }
  .help-main .public-article { width: calc(100% - 32px); padding-top: 28px; }
}
@media (max-width: 560px) {
  .help-auth-link > span { display: none; }
  .help-auth-link { width: 38px; padding: 0; }
}
@media (max-width: 420px) {
  .help-brand > strong { display: none; }
  .help-auth-link { width: 36px; height: 36px; }
  .help-actions { gap: 4px; }
  .help-action { padding: 0 8px; font-size: 12px; }
  .help-action[data-collapse] { width: 36px; height: 36px; }
  .help-menu-toggle { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .help-shell * { transition: none !important; }
}
html[data-theme="light"] .help-shell { --bl-help-header: #ffffff; }
html[data-theme="light"] .help-shell :is(.help-action, .help-menu a, .help-menu button, .nav-sticker, .help-card) > img,
html[data-theme="light"] .help-shell :is(.help-action, .help-menu a, .help-menu button) img,
html[data-theme="light"] .help-shell .nav-sticker img { filter: brightness(0); }
.help-avatar { width: 42px; padding: 0; justify-content: center; border-radius: 50%; font: 800 15px/1 Onest, sans-serif; overflow: hidden; }
.help-avatar img { width: 100%; height: 100%; flex: none; filter: none !important; object-fit: cover; }
.help-cards-title { margin: 32px 0 14px; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.help-card { display: grid; gap: 6px; align-content: start; padding: 16px; border: 1px solid var(--help-line); border-radius: 12px; background: var(--help-control); color: var(--help-text); text-decoration: none; transition: border-color .28s ease, background-color .28s ease, box-shadow .34s cubic-bezier(.2, .8, .2, 1); }
.help-card img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
html[data-theme="light"] .help-card img { filter: brightness(0); }
.help-card strong { font: 700 15px/1.3 Onest, sans-serif; }
.help-card span { color: var(--help-muted); font-size: 13px; line-height: 1.45; }
.help-card:is(:hover, :focus-visible) { outline: none; border-color: var(--help-active-border); background: var(--help-control-active); box-shadow: var(--help-glow); }
.help-main .public-intro { color: var(--help-muted); }

/* Fixed app frame: header and navigation never move, only the content column scrolls. */
html:has(body.help-shell) { height: 100%; overflow: hidden; }
body.help-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.help-shell > .site-header { position: relative; flex: 0 0 auto; top: auto; }
body.help-shell .help-layout { flex: 1 1 auto; min-height: 0; height: auto; overflow: hidden; }
html.has-site-header body.help-shell .help-layout { min-height: 0; }
body.help-shell .help-sidebar { position: static; top: auto; height: 100%; }
body.help-shell .help-main { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 860px) {
  /* Phones and tablets: the drawer starts under the header (--help-drawer-top, set by help-shell.js), so its first entry (Главное меню) is not hidden behind it. */
  body.help-shell .help-sidebar { position: fixed; top: var(--help-drawer-top, var(--header-height, 68px)); height: auto; bottom: 0; }
}
