/* HOWEMINE — общий мобильный слой для всех страниц.
   Подключается последним в <helmet>, поэтому перебивает постраничные правила там, где нужно. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, summary, label, select, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* На тач-экране :hover «залипает» после тапа — карточки и кнопки оставались приподнятыми.
   Гасим только сдвиг, подсветку цвета оставляем. */
@media (hover: none) {
  html [class*="scp"][class*="scp"]:hover:not(:active) { transform: none !important; }
}

@media (max-width: 640px) {
  h1, h2 { text-wrap: balance; }

  /* Подвал: ссылки сеткой в две колонки, у каждой высота под палец */
  footer { padding-bottom: env(safe-area-inset-bottom); }
  footer nav[aria-label="Разделы сайта"] {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px !important; row-gap: 0 !important;
    width: 100%; max-width: 400px !important; text-align: left; margin-bottom: 24px !important;
  }
  footer nav[aria-label="Разделы сайта"] > a {
    min-height: 46px !important; display: flex !important; align-items: center !important; padding: 0 2px !important;
    border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 13.5px !important; color: #a99697 !important;
  }
  footer div:has(> a[href*="howehelp"]) {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; width: 100%; max-width: 400px;
  }
  footer div:has(> a[href*="howehelp"]) > a {
    min-height: 46px !important; display: flex !important; align-items: center !important; justify-content: center !important;
    padding: 0 12px !important; font-size: 13.5px !important; white-space: nowrap;
  }
  footer div:has(> a[href*="howehelp"]) > a:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Шапка с бургером (все страницы, кроме магазина): строго одна строка */
@media (max-width: 1120px) {
  header .hm-row { flex-wrap: nowrap !important; }
  header .hm-row > div:last-child { flex-wrap: nowrap !important; flex-shrink: 0 !important; }
}
@media (max-width: 520px) {
  header .hm-row { gap: 10px !important; }
  header .hm-row > div:first-child > a > span:last-child { font-size: 16px !important; }
  /* «Выйти» в кабинете — только иконка, текст остаётся для скринридера */
  header .hm-logout { width: 44px !important; height: 44px !important; padding: 0 !important; justify-content: center !important; font-size: 0 !important; gap: 0 !important; }
  header .hm-logout img { width: 18px !important; height: 18px !important; }
}

/* Всплывашки внизу экрана — не шире экрана и над «домашней» полосой iPhone */
@media (max-width: 640px) {
  .hm-toast { max-width: calc(100vw - 28px) !important; width: max-content; text-align: center; bottom: calc(18px + env(safe-area-inset-bottom)) !important; }
}
