/* Адаптив. Инлайновые стили страниц перебиваются !important.
   Десктоп >=1024px не затронут ни одним правилом ниже. */

/* --- Таблицы: горизонтальный скролл внутри собственного контейнера --- */
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;position:relative;min-width:0;max-width:100%}
.table-scroll table{min-width:560px}

/* --- Бургер и оверлей меню (по умолчанию скрыты) --- */
/* --- Схемы и графики (SVG): текст масштабируется вместе с viewBox,
   поэтому в исходных единицах он задан крупнее, чтобы на экране читался
   наравне с обычным текстом. Десктопная компоновка при этом не меняется. --- */
.figure-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;min-width:0;max-width:100%}
figcaption{font-size:13px !important;line-height:1.5}

@media (max-width:1023px){
  /* на узких экранах не даём схеме ужиматься до нечитаемого — включаем прокрутку */
  .figure-scroll > svg{min-width:600px}
}

#nav-burger{display:none}
#nav-overlay{display:none;position:fixed;inset:0;z-index:120;background:#f2f2f3;overflow-y:auto;padding:18px 16px 32px;font-family:'Barlow',sans-serif}
#nav-overlay a{display:block;padding:14px 8px;min-height:48px;font-size:16px;color:#1d1f20;text-decoration:none;border-bottom:1px solid color-mix(in srgb,#1d1f20 12%,transparent)}
#nav-overlay .nav-ov-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
#nav-overlay .nav-ov-cta{margin-top:18px;display:block;text-align:center;background:#5980a6;color:#f2f2f3;border-bottom:0}

/* ============ ПЛАНШЕТ И МОБИЛЬНЫЙ: <=1023px ============ */
@media (max-width:1023px){
  /* Ключевое: снимаем min-width:auto у flex/grid-потомков, иначе min-width таблицы
     "всплывает" вверх по дереву и растягивает article/nav шире экрана. */
  main,article,aside,section,figure,header,footer,nav{min-width:0}
  [style*="display:grid"] > *,[style*="display:flex"] > *{min-width:0}
  [style*="grid-template-columns"] > *{min-width:0}
  .card,.blueprint{min-width:0}

  /* сетки */
  [style*="repeat(4,1fr)"],[style*="repeat(4, 1fr)"]{grid-template-columns:repeat(2,1fr) !important}
  [style*="1.6fr 1fr 1fr 1fr"]{grid-template-columns:1fr 1fr !important}
  /* hero и другие асимметричные пары — в одну колонку уже на планшете */
  [style*="1.15fr 0.85fr"],[style*="0.9fr 1.1fr"],[style*="1fr 2fr"],[style*="2fr 1fr"]{grid-template-columns:1fr !important}

  [style*="max-width:1240px"]{padding-left:20px !important;padding-right:20px !important}
  h1{font-size:42px !important;line-height:1.08 !important;max-width:none !important}
  [style*="position:sticky"]{position:relative !important;top:auto !important}
  /* подстраховка: правило по элементу, а не только по инлайн-атрибуту */
  nav.blueprint{position:relative !important;top:auto !important;background:#f2f2f3}
  /* --- Таблицы на телефоне и планшете: строка становится карточкой, горизонтальный
     скролл не нужен. Заголовок колонки подставляется из data-label. Десктоп не затронут. --- */
  .table-scroll{overflow-x:visible !important;margin-inline:0 !important;padding-inline:0 !important}
  .table-scroll table,.table-scroll thead,.table-scroll tbody,.table-scroll tr,.table-scroll td{display:block}
  .table-scroll table{min-width:0 !important;width:100% !important;table-layout:auto !important}
  .table-scroll thead{display:none}
  .table-scroll caption{display:block;font-size:13px !important;line-height:1.5;padding-bottom:10px}
  .table-scroll tbody tr{padding:12px 0 14px;border-bottom:1px solid color-mix(in srgb,#1d1f20 16%,transparent)}
  .table-scroll tbody tr:last-child{border-bottom:0;padding-bottom:2px}
  .table-scroll tbody tr:hover{background:none}
  .table-scroll td{display:grid !important;grid-template-columns:minmax(0,40%) minmax(0,1fr);gap:12px;align-items:baseline;padding:4px 0 !important;border:0 !important;font-size:15px !important;line-height:1.45}
  .table-scroll td::before{content:attr(data-label);font-size:12px;letter-spacing:0.06em;text-transform:uppercase;color:color-mix(in srgb,#1d1f20 55%,transparent)}
  .table-scroll td:first-child{display:block !important;font-weight:700;font-size:16px !important;margin-bottom:4px;padding-top:0 !important}
  .table-scroll td:first-child::before{display:none}

}

/* ============ МОБИЛЬНЫЙ: <=599px ============ */
@media (max-width:599px){
  /* шапка */
  #nav-burger{display:grid !important;place-items:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;margin-left:auto;padding:0;background:none;border:1px solid color-mix(in srgb,#1d1f20 22%,transparent);cursor:pointer;color:#1d1f20;line-height:0}
  #nav-burger svg,#nav-close svg{display:block}
  header nav{display:none !important}
  header{padding:10px 16px !important;gap:10px !important}
  [data-topbar-address]{display:none !important}
  /* верхняя тёмная строка (единственный блок с padding:6px 24px): одна строка вместо трёх */
  [style*="padding:6px 24px"]{padding:5px 16px !important;gap:10px !important;flex-wrap:nowrap !important}
  [style*="padding:6px 24px"] > span:first-child{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px !important;letter-spacing:0 !important}
  [style*="padding:6px 24px"] > span:last-child{flex:0 0 auto !important;gap:10px !important}
  [style*="padding:6px 24px"] a[href^="tel:"]{white-space:nowrap;font-size:12px !important}

  /* сетки в одну колонку */
  [style*="grid-template-columns"]{grid-template-columns:1fr !important}
  /* плитки с цифрами (единственная сетка, у которой style заканчивается на repeat(4,1fr)) — в две */
  [style$="repeat(4,1fr)"]{grid-template-columns:repeat(2,1fr) !important}

  /* контейнеры и отступы */
  [style*="max-width:1240px"]{padding-left:16px !important;padding-right:16px !important}
  [style*="padding:56px 24px"],[style*="padding:48px 24px"],[style*="padding:44px 24px"]{padding:28px 16px !important}
  [style*="gap:48px"],[style*="gap:40px"],[style*="gap:36px"]{gap:24px !important}
  main [style*="padding-inline:10px"]{padding-inline:0 !important}

  /* типографика */
  h1{font-size:31px !important;line-height:1.1 !important;letter-spacing:0 !important;hyphens:auto;word-break:normal;max-width:none !important}
  h2{font-size:23px !important;line-height:1.15 !important;letter-spacing:0 !important}
  h3{font-size:18px !important;line-height:1.2 !important}
  h4,h5,h6{letter-spacing:0.04em !important}
  p,li,td,th,span,div,a{max-width:none !important}
  main p,main li{font-size:16px !important;line-height:1.6 !important}
  [style*="font-size:19px"],[style*="font-size:18px"]{font-size:17px !important}
  [style*="font-size:10px"],[style*="font-size:11px"],[style*="font-size:12px"]{font-size:13px !important}
  main table{font-size:14px !important}
  .table-scroll table{font-size:14px !important}
  .table-scroll th,.table-scroll td{padding:8px 10px !important}
  main table th,.table-scroll th{font-size:13px !important}
  main table td,.table-scroll td{font-size:14px !important}
  .table-scroll{margin-inline:-16px;padding-inline:16px}

  /* длинные технические строки не должны рвать сетку */
  main a,main code,main td,main th{overflow-wrap:anywhere}

  /* svg-схемы вписываем по ширине */
  figure svg,main svg{max-width:100% !important;height:auto !important}
  figure{margin-inline:0 !important}

  /* зоны нажатия */
  footer a{line-height:2 !important;display:inline-block;min-height:32px}
  .btn{min-height:44px !important;display:inline-flex !important;align-items:center;justify-content:center}

  /* cookie-баннер: не выше 30% экрана, кнопки в один ряд по 50% */
  #cookie-consent{left:6px !important;right:6px !important;bottom:6px !important;max-height:30vh !important;overflow-y:auto;padding:14px 16px !important;gap:10px !important;flex-direction:column;align-items:stretch !important;flex-wrap:nowrap !important}
  #cookie-consent > span{flex:none !important}
  #cookie-consent > span:last-of-type{display:flex !important;gap:8px;flex-wrap:nowrap !important}
  #cookie-consent > span:last-of-type > button{flex:1 1 50% !important;min-width:0 !important;min-height:44px !important;font-size:12px !important;padding-inline:6px !important;white-space:nowrap}
}
