/* Мобильная шапка и меню (вариант A, 18.11.2026). Разметка — inc/mobile-nav.php, поведение — assets/js/mobile-nav.js.
   На ПК (от 992 px) новые блоки скрыты и старая шапка не меняется; до 991 px — наоборот. */
.ps-mbar, .ps-mtabs, .ps-mspacer, .ps-mmenu { display: none; }

@media (max-width: 991px) {
  :root { --ps-bar: 60px; --ps-navy: #153352; --ps-ink: #1d2c47; --ps-blue: #0073e6; --ps-line: #e4e8ef; --ps-soft: #f2f5fa; }
  html { scroll-padding-top: calc(var(--ps-bar) + 12px); }
  html.ps-mmenu-open { overflow: hidden; }

  /* старая шапка на телефоне не выводится */
  .site-header .header-inner, .site-header .header__menu { display: none !important; }
  .site-header.dynamic-header { padding-block-start: 0; }

  .ps-mbar *, .ps-mtabs *, .ps-mmenu * { box-sizing: border-box; font-family: 'FuturaPT PS', 'FuturaPT', Arial, sans-serif !important; -webkit-tap-highlight-color: transparent; }
  .ps-mbar a, .ps-mtabs a, .ps-mmenu a { text-decoration: none !important; }

  .ps-mspacer { display: block; width: 100%; height: var(--ps-bar); }

  /* ── панель ── */
  .ps-mbar { display: block; position: fixed; inset: 0 0 auto 0; z-index: 9990; background: #fff; box-shadow: 0 1px 0 var(--ps-line); transition: box-shadow .2s; padding-top: env(safe-area-inset-top); }
  .admin-bar .ps-mbar { top: 32px; }
  .ps-mbar.is-stuck { box-shadow: 0 1px 0 var(--ps-line), 0 6px 16px rgba(21, 51, 82, .10); }
  .ps-mbar__row { display: flex; align-items: center; gap: 8px; height: var(--ps-bar); padding: 0 8px 0 14px; max-width: 900px; margin: 0 auto; }
  .ps-mbar__logo { flex: none; display: block; margin-right: auto; }
  .ps-mbar__logo img { display: block; width: auto; height: 40px; max-width: none; }
  .ps-mbar__name { color: var(--ps-navy); font-size: 18px; font-weight: 700; }
  .ps-mbar .ps-mbar__call { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 6px; color: #253f75 !important; font-size: 17px; font-weight: 600; letter-spacing: .1px; white-space: nowrap; }
  .ps-mbar__call svg { flex: none; width: 18px; height: 18px; fill: var(--ps-blue); }

  .ps-mmenu button, .ps-mbar button, .ps-mtabs button { appearance: none; margin: 0; cursor: pointer; }
  .ps-mbar button.ps-mbar__toggle, .ps-mmenu button.ps-mbar__toggle {
    flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 56px; height: 48px; padding: 0; border: 0; border-radius: 10px; background: var(--ps-soft) !important; color: var(--ps-navy) !important;
    font-size: 11px; line-height: 1; font-weight: 600; text-transform: none; letter-spacing: 0;
  }
  .ps-burger { display: block; width: 20px; height: 13px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; position: relative; }
  .ps-burger::after { content: ""; position: absolute; left: 0; right: 0; top: 3.5px; height: 2px; background: currentColor; }
  .ps-cross { display: block; width: 16px; height: 13px; position: relative; }
  .ps-cross::before, .ps-cross::after { content: ""; position: absolute; left: -1px; right: -1px; top: 5.5px; height: 2px; background: currentColor; transform: rotate(45deg); }
  .ps-cross::after { transform: rotate(-45deg); }

  /* ── строка разделов (уезжает вместе со страницей) ── */
  .ps-mtabs { display: flex; width: 100%; background: var(--ps-navy); }
  .ps-mtabs a, .ps-mtabs button { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; height: 46px; padding: 0 6px; border: 0; background: transparent !important; color: #fff !important; font-size: 16px; font-weight: 600; line-height: 1.1; text-align: center; white-space: nowrap; text-transform: none; letter-spacing: 0; border-radius: 0; position: relative; }
  .ps-mtabs .is-current::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: 0; height: 3px; background: #39a7df; }

  /* ── меню на весь экран ── */
  dialog.ps-mmenu[open] { display: grid; grid-template-rows: auto 1fr auto; position: fixed; inset: 0; z-index: 10000; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; color: var(--ps-ink); animation: ps-mmenu-in .22s ease-out; overflow: hidden; }
  dialog.ps-mmenu::backdrop { background: rgba(10, 26, 43, .4); }
  @keyframes ps-mmenu-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .ps-mmenu__head { border-bottom: 1px solid var(--ps-line); padding-top: env(safe-area-inset-top); }
  .ps-mmenu__body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 0 20px; }
  .ps-mmenu p { margin: 0; }
  .ps-mmenu .ps-mmenu__slogan { padding: 14px 16px 6px; font-size: 15px; line-height: 1.3; color: #5b6a82; }

  .ps-mlist details, .ps-mlist > a { border-bottom: 1px solid var(--ps-line); }
  .ps-mlist summary, .ps-mlist > a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 8px 16px; color: var(--ps-navy) !important; font-size: 20px; line-height: 1.2; font-weight: 600; list-style: none; cursor: pointer; }
  .ps-mlist summary::-webkit-details-marker { display: none; }
  .ps-mlist summary svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--ps-blue); stroke-width: 2.2; transition: transform .18s; }
  .ps-mlist details[open] summary svg { transform: rotate(180deg); }
  .ps-mlist > a[aria-current] { box-shadow: inset 3px 0 0 var(--ps-blue); }
  .ps-mlist__sub { padding: 0 0 10px; }
  .ps-mlist__sub a { display: flex; align-items: center; min-height: 46px; padding: 8px 16px 8px 28px; color: var(--ps-ink) !important; font-size: 17px; line-height: 1.25; }
  .ps-mlist__sub a.is-all { color: var(--ps-blue) !important; font-weight: 600; }
  .ps-mlist__sub a[aria-current] { background: #eaf3fd; color: var(--ps-navy) !important; font-weight: 600; box-shadow: inset 3px 0 0 var(--ps-blue); }

  .ps-mcontacts { padding: 18px 16px 0; }
  .ps-mmenu .ps-mcontacts__title { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: #5b6a82; letter-spacing: .2px; }
  .ps-msocials { display: flex; gap: 12px; margin-bottom: 18px; }
  .ps-msocials a { display: block; width: 46px; height: 46px; }
  .ps-msocials img { display: block; width: 46px; height: 46px; max-width: none; }
  .ps-mmenu .ps-mcontacts p { margin: 0 0 6px; font-size: 15px; line-height: 1.35; color: var(--ps-ink); }
  .ps-mmenu .ps-memail .email-reveal-btn { color: #253f75 !important; font-size: 16px; font-weight: 600; min-height: 32px; }
  .ps-mmenu .ps-memail .email-reveal-link { color: #253f75 !important; font-size: 16px; font-weight: 600; }
  .ps-mlang .header__languages { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
  .ps-mlang .header__languages a { display: flex; align-items: center; justify-content: center; width: 48px; height: 36px; margin: 0; border-radius: 8px; color: var(--ps-navy) !important; font-size: 15px; font-weight: 600; text-decoration: none !important; }
  .ps-mlang .header__languages a.is-active, .ps-mlang .header__languages a[aria-current] { background: var(--ps-soft); }

  .ps-mmenu__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ps-line); background: #fff; box-shadow: 0 -6px 16px rgba(21, 51, 82, .06); }
  .ps-mmenu .ps-mbtn, .ps-mmenu button.ps-mbtn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; margin: 0; padding: 4px 8px; border: 2px solid var(--ps-blue); border-radius: 10px; font-size: 17px; line-height: 1.15; font-weight: 600; text-align: center; text-transform: none; letter-spacing: 0; white-space: normal; }
  .ps-mbtn svg { flex: none; width: 18px; height: 18px; fill: currentColor; }
  .ps-mmenu .ps-mbtn--fill { background: var(--ps-blue) !important; color: #fff !important; }
  .ps-mmenu .ps-mbtn--line { background: #fff !important; color: var(--ps-blue) !important; }

  @media (max-width: 782px) {
    .admin-bar .ps-mbar { top: 46px; }
  }
  @media (max-width: 349px) {
    .ps-mbar__call span { display: none; }
    .ps-mbar .ps-mbar__call { width: 48px; justify-content: center; border-radius: 10px; background: var(--ps-soft); padding: 0; }
    .ps-mtabs a, .ps-mtabs button { font-size: 14px; padding: 0 4px; }
  }
  @media (prefers-reduced-motion: reduce) {
    dialog.ps-mmenu[open] { animation: none; }
  }
}

/* Подвал: телефон и «Показать email» в одну строку не влезают при 360 px и растягивают страницу вбок */
@media (max-width: 400px) {
  .site-footer .footer__contacts { flex-wrap: wrap; justify-content: center; }
}
