/* D-003: адаптивная вёрстка поверх legacy style.css.
   ≥1024px — вид эталона (таблица 1000px); ниже — одна колонка, touch-зоны 44×44. */

/* Legacy без doctype работал в quirks mode: таблица не наследовала text-align:center от .container.
   С <!DOCTYPE html> наследует — возвращаем как было. */
.m-table { text-align: left; }

/* Телефоны стали ссылками tel:, на desktop выглядят как прежний текст. */
span.tel a:link, span.tel a:visited { color: inherit; text-decoration: none; }
span.tel a:hover { text-decoration: underline; }

@media (max-width: 1023px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { overflow-wrap: anywhere; }

  .container { padding: 8px 16px 0; text-align: left; }

  /* Таблица-вёрстка -> блоки */
  .m-table,
  .m-table > tbody,
  .m-table > tbody > tr,
  .m-table > tbody > tr > td { display: block; width: auto !important; }
  .m-table { max-width: 100%; }
  .m-table > tbody > tr > td { border-right: 0 !important; }
  .m-table > tbody > tr.r-top { display: none; }

  /* Первый экран: логотип + заметная кнопка звонка */
  .m-table > tbody > tr > td.h-logo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px !important; }
  .h-logo .call-btn {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 48px; padding: 0 14px;
    background: #005531; color: #fff !important; border-radius: 8px;
    font: bold 16px/1 Arial, sans-serif; text-decoration: none !important;
  }

  /* Контакты */
  .header_menu { font-size: 16px; line-height: 1.5; }
  .header_menu > div { padding: 0; }
  .header_menu .hm-col {
    float: none !important; width: auto !important; height: auto !important;
    border-right: 0 !important; padding: 8px 0 !important;
    border-top: 1px solid #d5e3dc;
  }
  .header_menu .hm-col:nth-child(2) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .header_menu .hm-col:nth-child(2) br { display: none; }
  .header_menu hr:first-of-type { display: none; }
  .header_menu hr { margin: 0 !important; }

  span.tel, span.tel a { font-size: 16px; }
  span.tel a:link, span.tel a:visited,
  .header_menu a.mail-link {
    display: inline-flex; align-items: center; min-height: 44px; line-height: 1.2;
    padding: 0 12px; border: 1px solid #005531; border-radius: 6px;
    color: #005531; text-decoration: none;
  }

  /* Меню: кнопки под палец */
  .side .pages { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 4px; line-height: normal; }
  .side br { display: none; }
  .side a:link, .side a:visited {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
    border: 1px solid #005531; border-radius: 6px;
    color: #005531; text-decoration: none; font-size: 16px; line-height: 1.2;
  }

  /* Контент */
  .brand { margin-left: 0 !important; padding-top: 8px; line-height: 1.2; }
  .brand span[style*="font-size:60px"] { font-size: 34px !important; }
  .title { padding-left: 0; }
  .title h1 { font-size: 22px; }
  .content { min-height: 0; padding-left: 0; }

  img { max-width: 100%; height: auto; }
  .content img,
  .product-photo {
    float: none !important; display: block;
    width: 100%; max-width: 100% !important;
    margin: 0 0 12px 0 !important; padding-right: 0 !important;
  }

  #files_box { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 0 0; }

  /* Главная: карточки товаров */
  .p-content main > div[style*="float:left"] { float: none !important; display: flex; flex-wrap: wrap; gap: 16px; }
  .pf-title { float: none; width: auto; flex: 1 1 260px; padding: 12px 0 0; }
  .pf-title b a { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; }

  /* Подвал */
  .footer { text-align: right; padding-top: 16px !important; }
  .footer table { margin-left: auto; }
  .footer * { font-size: 14px !important; }
  .footer a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
}
