/* Mobile experience shared by every public route. */
.hd-mobile-actions,
.hd-mobile-menu,
.hd-mobile-menu-overlay {
  display: none;
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: calc(var(--mobile-header-height) + 12px);
  }

  .btn,
  button,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  /* Compact header and mobile navigation. */

  .hd-logo {
    min-width: 0;
    gap: 2px;
  }

  .hd-nav,
  .hd-phone,
  .hd-cart-button,
  .hd-call {
    display: none;
  }

  .hd-mobile-cart svg,
  .hd-mobile-menu-toggle svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .hd-mobile-cart__count[hidden] {
    display: none;
  }

  .hd-mobile-menu-toggle__close {
    display: none;
  }

  body.is-mobile-menu-open .hd-mobile-menu-toggle__open {
    display: none;
  }

  body.is-mobile-menu-open .hd-mobile-menu-toggle__close {
    display: block;
  }

  .hd-mobile-menu {
    position: fixed;
    top: var(--mobile-header-height);
    right: 0;
    left: 0;
    z-index: 93;
    height: calc(100dvh - var(--mobile-header-height));
    display: block;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: var(--surface);
    color: var(--ink);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  }

  body.is-mobile-menu-open .hd-mobile-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .hd-mobile-menu__scroll {
    height: 100%;
    padding: 16px var(--mobile-edge) max(28px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .hd-mobile-menu__catalog svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  .hd-mobile-menu__categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .hd-mobile-menu__categories a {
    min-width: 0;
    min-height: 58px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 5px 9px 5px 5px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--ink);
    background: var(--surface);
  }

  .hd-mobile-menu__categories img {
    width: 42px;
    height: 42px;
    display: block;
    object-fit: contain;
    background: var(--surface);
  }

  .hd-mobile-menu__solutions a {
    display: grid;
    gap: 3px;
    padding: 13px 2px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
  }

  .hd-mobile-menu__contacts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 20px;
  }

  .hd-mobile-menu__contacts a {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: var(--r-md);
    color: var(--on-dark);
    background: var(--brand-deep);
    font-size: var(--fs-meta);
    font-weight: var(--fw-medium);
  }

  .hd-mobile-menu-overlay {
    position: fixed;
    inset: var(--mobile-header-height) 0 0;
    z-index: 89;
    display: block;
    border: 0;
    background: rgba(5, 18, 11, .48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }

  body.is-mobile-menu-open .hd-mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Fixed controls no longer cover page content. */
  .floating-contacts,
  .mobile-cart-fab {
    display: none !important;
  }

  .toast,
  body.is-category-view .toast {
    right: var(--mobile-edge);
    bottom: max(16px, env(safe-area-inset-bottom));
    width: calc(100vw - (var(--mobile-edge) * 2));
  }

  /* Home hero and first-screen readability. */

  .hd-slide h1,
  .hd-slide .hd-h1 {
    font-size: 37px;
    line-height: 1.05;
    /* Длинное слово из админки (или склеенное с предлогом неразрывным пробелом)
       переносится, а не обрезается краем экрана. Дефис - только в словах от 12 букв:
       они и так занимают почти всю строку, а «ЗАГОЛО-ВОК» в заголовке ни к чему */
    overflow-wrap: break-word;
    hyphens: auto;
    hyphenate-limit-chars: 12 5 5;
  }

  /* Catalog route. */

  #view-category .layout-split,
  #view-category .category-board,
  #view-category .category-hero,
  #view-category .toolbar,
  #view-category .product-grid,
  #view-category .product-card {
    min-width: 0;
    width: 100%;
  }

  #view-category .chips,
  #view-category .sort {
    min-width: 0;
    width: 100%;
  }

  #view-category .sort {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    white-space: normal;
  }

  .category-metrics {
    gap: 7px;
  }

  #view-category .product-media-image {
    max-height: 174px;
  }

  /* Product route. */

  #view-product .gallery {
    min-width: 0;
  }

  #view-product .gallery .main-photo img {
    max-height: 276px;
  }

  #view-product .product-cta .btn {
    width: 100%;
    justify-content: center;
  }

  /* Quote becomes a true one-column checkout. */

  .quote-page,
  .quote-main,
  .quote-section,
  .quote-table-wrap,
  .quote-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .quote-table thead {
    display: none;
  }

  .quote-table tbody {
    display: grid;
    gap: 10px;
  }

  .quote-table td:nth-child(n + 2) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .quote-table .qty {
    width: 132px;
    grid-template-columns: 40px 50px 40px;
  }

  /* About and long-form pages. */
  .about-page,
  .about-main {
    gap: 22px;
  }

  .about-hero .hero-actions .btn {
    min-width: 0;
    min-height: 46px;
    padding: 0 10px;
    font-size: 11.5px;
    text-align: center;
  }

  .about-visual {
    display: none;
  }

  .about-section {
    gap: 14px;
  }

  .legal-page,
  .legal-main,
  .news-page,
  .search-page {
    min-width: 0;
  }

  /* Solution pages retain their full-width image hero. */

  .sol-hero,
  .sol-hero__content {
    min-height: 600px;
  }

  .sol-hero__content {
    width: calc(100% - (var(--mobile-edge) * 2));
    padding: 20px 0 18px;
  }

  .sol-info,
  .sol-info > *,
  .sol-info__intro,
  .sol-info__list {
    min-width: 0;
  }
}

@media (max-width: 374px) {
  :root {
    --mobile-edge: 14px;
  }

  .hd-logo img {
    width: 132px;
  }

  .hd-mobile-cart,
  .hd-mobile-menu-toggle {
    width: 42px;
    height: 42px;
  }

  .hd-mobile-menu__categories {
    grid-template-columns: 1fr;
  }

  .hd-slide h1,
  .hd-slide .hd-h1 {
    font-size: 34px;
  }

  .hd-subtitle {
    font-size: 23px;
  }

  #view-category .product-grid {
    grid-template-columns: 1fr;
  }

  #view-category .product-card__media {
    min-height: 232px;
  }

  #view-category .product-media-image {
    max-height: 214px;
  }

  .category-metrics {
    grid-template-columns: 1fr;
  }

  .about-kpis,
  .about-steps {
    grid-template-columns: 1fr;
  }

  .quote-section__head {
    flex-direction: column;
  }
}
