/* Мобильная версия: компактные сетки по 2 в ряд, короче отступы, подвал, карта, тап-цели.
   Подключается ПОСЛЕДНИМ на всех страницах, кроме /kalkulyator/. Десктоп (> 720 px) не затрагивает. */

/* ---------- поля форм: 16 px, чтобы iOS не приближал страницу ---------- */
@media(max-width:900px){
  input:not([type=checkbox]):not([type=radio]),select,textarea,
  .field input,.kmodal input,.kmodal select,.kmodal textarea{font-size:16px!important}
}

/* ---------- ритм секций ---------- */
@media(max-width:720px){
  .sec:not(#calculator){padding:48px 0}
  .sec.sec-slider{padding-top:44px;padding-bottom:44px}
  .beams{padding:44px 0 48px}
  .ksec{padding:44px 0}
  .cs-sec{padding:44px 0}
  .cs-sec.tight{padding-top:12px}
  .phero{padding:96px 0 32px}
  #stats .wrap{padding-top:32px!important;padding-bottom:32px!important}
  .sec-head,.ksec-head,.cs-sec .sec-head{margin-bottom:22px;gap:10px}
  .sec-head .eyebrow{margin-bottom:10px}
  .sec-head p{font-size:15px;line-height:1.5}
  .sec-title{font-size:clamp(22px,5.8vw,34px);line-height:1.1}
  .beams .sec-title{font-size:clamp(28px,8.4vw,44px);margin-bottom:14px}
  .beams-top{gap:20px;margin-bottom:22px}
  .beams-sub{margin-bottom:18px;font-size:15px}
  .beams-media img{aspect-ratio:16/10}
  .hero{padding:88px 0 36px}
  .hero-grid{gap:28px}
  .hero-photo{aspect-ratio:16/10}
  .hero-mini{margin-top:26px}
  .about-grid{gap:36px}
  .about-photo{aspect-ratio:16/10}
  .cta-inner{gap:24px}
  .cta-form{padding:22px 18px}
  .cta-form .fh{margin-bottom:16px}
  .field{margin-bottom:12px}
  .svc-detail{margin-bottom:34px;gap:18px}
  .sd-media{aspect-ratio:16/9}
  .sd-body p{margin-bottom:14px}
  footer{padding:36px 0 96px}
}

/* ---------- плитки по 2 в ряд ---------- */
@media(max-width:720px){
  /* общий вид компактных карточек */
  .hc-grid,.kcat-grid,.svc-grid,.steps-grid,.adv-cards,.mights,.proj-grid,.contact-grid,.cs-grid,.cs-grid.three,.cs-gallery,.kprod-grid--mini,.contact-cards{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}

  /* Что мы производим (главная) и каталог */
  .hc-card:first-child,.kcat--main{grid-column:1/-1}
  .hc-photo,.kcat-photo{aspect-ratio:4/3}
  .hc-card:first-child .hc-photo,.kcat--main .kcat-photo{aspect-ratio:16/9}
  .hc-badge,.kcat-count,.kcat-main{top:8px;left:8px;padding:5px 8px;font-size:11px;letter-spacing:.05em}
  .kcat-main{left:auto;right:8px}
  .hc-info,.kcat-info{padding:10px 10px;min-height:56px}
  .hc-info h3,.kcat-info h3{font-size:13px;line-height:1.2;margin:0;letter-spacing:-.015em;text-transform:none}
  .kcat-info p{display:none}
  .kgal{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .hc-arrow,.kcat-arrow{display:none}
  .hc-card:first-child .hc-arrow,.kcat--main .kcat-arrow{display:flex;width:34px;height:34px;right:12px;bottom:auto;top:50%}
  .hc-card:first-child .hc-info,.kcat--main .kcat-info{padding-right:58px}
  .hc-more{margin-top:22px}

  /* Что мы делаем */
  .svc-photo{aspect-ratio:4/3}
  .svc-num{top:8px;left:8px;font-size:11px;padding:4px 8px}
  .svc-info,.svc-info{padding:12px 12px 14px!important;min-height:0}
  .svc-info h3{font-size:14px;line-height:1.2;margin-bottom:6px;letter-spacing:-.01em;overflow-wrap:anywhere;text-transform:none}
  .svc-info p{font-size:13px;line-height:1.35;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
  .svc-arrow{display:none}

  /* этапы, преимущества, возможности */
  .step{padding:16px 14px 16px!important}
  .step .sn{width:34px;height:34px;margin-bottom:10px;font-size:13px}
  .step h3{font-size:14px;margin-bottom:6px;overflow-wrap:anywhere;text-transform:none}
  .step p{font-size:13px;line-height:1.4}
  .might{flex-direction:column;gap:10px;padding:16px 14px!important}
  .might .mi{width:40px;height:40px}
  .might .mi svg{width:20px;height:20px}
  .might h3{font-size:14px;margin-bottom:4px;overflow-wrap:anywhere}
  .might p{font-size:13px;line-height:1.4}
  .adv-cards>*{padding:16px 14px!important}
  .adv-cards h3,.adv-cards h4{font-size:14px;overflow-wrap:anywhere}
  .adv-cards p{font-size:13px;line-height:1.4}

  /* карточки проектов */
  .cs-photo{aspect-ratio:4/3}
  .cs-badges{top:8px;gap:4px;right:8px}
  .cs-badge{font-size:10.5px;padding:4px 7px;letter-spacing:.03em}
  .cs-body{padding:12px 12px 14px;gap:8px}
  .cs-body h3{font-family:'Proxima Nova',system-ui,sans-serif;font-size:14.5px;line-height:1.22;overflow-wrap:break-word}
  .cs-sub{font-size:13px;margin-top:-2px}
  .cs-loc{font-size:13px}
  .cs-params{gap:8px 14px;padding-top:10px}
  .cs-p .v{font-size:14px}
  .cs-p .v.big{font-size:15px}
  .cs-more{font-size:12.5px}
  .proj-grid .proj{min-width:0}

  /* контакты */
  .cc{padding:18px 14px!important}
  .cc-ico{width:40px;height:40px;margin-bottom:12px}
  .cc .val,.cc.email .val{font-size:14px!important;overflow-wrap:anywhere}
  .contact-grid{gap:10px}
  .cc.email .val{font-size:13px!important}
  .cc .lbl,.cc .sub{font-size:13px}

  /* блок цифр 2x2 */
  .stat{padding:16px 10px!important}
  .stat .n{font-size:clamp(30px,9vw,44px)!important}
  .stat .l{margin-top:4px;font-size:13px}
  .cs-stats{grid-template-columns:repeat(3,1fr)}
  .cs-stat{padding:16px 6px}

  /* галерея кейсов */
  .cs-gallery{gap:8px!important}

  /* плитки с характеристиками кейса */
  .cs-tiles{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .cs-tile{padding:14px 12px 16px}
  .cs-tile .k{font-size:11px;letter-spacing:.05em;overflow-wrap:anywhere}
  .cs-tile .v{font-size:clamp(15px,4.4vw,20px);margin-top:6px}
}
@media(max-width:360px){
  .svc-info h3,.step h3{font-size:13px}
}

/* ---------- карусель проектов на главной: одна карточка, ниже ---------- */
@media(max-width:720px){
  .sl-photo{aspect-ratio:16/9}
  .sl-body{padding:14px 16px 16px;gap:2px}
  .sl-name{font-size:17px;margin-bottom:2px}
  .sl-loc{font-size:14px}
  .sl-date{font-size:14px}
  .sl-body .sl-btn{margin-top:10px}
  .sl-tons{bottom:12px;padding:10px 16px 10px 14px}
  .sl-tons b{font-size:22px}
  .sl-ctrl{margin-top:14px}
  .sl-all{margin-top:0}
  /* точки: область нажатия 44x44, вид прежний */
  .sl-dots{gap:0}
  .sl-dots button{width:44px;height:44px;background:transparent!important;clip-path:none;position:relative}
  .sl-dots button[aria-current="true"]{width:44px}
  .sl-dots button::before{content:"";position:absolute;left:50%;top:50%;width:10px;height:10px;margin:-5px 0 0 -5px;background:#C9D3CC;
    clip-path:polygon(3px 0,100% 0,100% calc(100% - 3px),calc(100% - 3px) 100%,0 100%,0 3px);transition:width .4s,margin .4s,background .3s}
  .sl-dots button[aria-current="true"]::before{width:30px;margin-left:-15px;background:var(--green)}
}

/* ---------- подвал ---------- */
@media(max-width:720px){
  footer .foot-top{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:20px 16px!important}
  footer .foot-brand,footer .foot-prod,footer .foot-top>.foot-col:last-child{grid-column:1/-1}
  footer .foot-brand{order:-1}footer .foot-prod{order:3}footer .foot-top>.foot-col:last-child{order:4}
  footer .foot-brand p{font-size:14px;line-height:1.5;margin-top:10px}
  footer .foot-brand .logo img{height:38px}
  .foot-mapbox{aspect-ratio:16/9;max-width:none;margin-top:14px}
  .map-live{aspect-ratio:16/9}
  footer .foot-col h5{margin-bottom:6px}
  footer .foot-col a{display:block;font-size:14px;line-height:20px;padding:12px 0}
  footer .foot-col .big{font-size:20px}
  footer .foot-prod-links{gap:0 16px}
  footer .foot-prod-links a{font-size:14px;padding:12px 0}
  footer .foot-bottom{gap:2px;padding-top:16px}
  footer .foot-bottom a{display:inline-block;padding:12px 0}
}

/* ---------- карта: прокрутка проходит поверх, управление включается нажатием ---------- */
.foot-mapbox,.map-live{position:relative}
.map-guard{display:none}
.mg-on .map-guard{display:flex;position:absolute;inset:0;z-index:4;width:100%;align-items:flex-end;justify-content:center;padding:0 0 12px;margin:0;border:0;cursor:pointer;
  background:linear-gradient(to top,rgba(13,47,51,.55),rgba(13,47,51,0) 55%);-webkit-tap-highlight-color:transparent;touch-action:pan-y}
.mg-on .map-guard span{display:inline-block;min-height:44px;line-height:44px;padding:0 18px;background:#00A144;color:#fff;font:800 13px/44px "Proxima Nova",system-ui,sans-serif;letter-spacing:.02em}
.mg-on iframe{pointer-events:none}

/* ---------- каталог: фильтры и листаемые списки, длинные таблицы ---------- */
@media(max-width:720px){
  .ktable-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
}

/* ---------- переключатель фонов и cookie не закрывают контент, пока не нажали ---------- */
@media(max-width:640px){
  #bgsw button{width:44px!important;height:44px!important}
  #bgsw .tg{width:44px!important;height:44px!important}
  #bgsw.min{width:52px!important;height:52px!important}
}

/* ---------- уменьшенное движение ---------- */
@media(prefers-reduced-motion:reduce){
  .reveal{opacity:1!important;transform:none!important;filter:none!important;transition:none!important}
  *{scroll-behavior:auto!important}
}

/* Сварные балки на главной: карточки по 2 в ряд */
@media(max-width:720px){
  .beam-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .beam-card{flex-direction:column!important}
  .beam-card-ph{width:auto!important;aspect-ratio:4/3!important}
  .beam-card-body{padding:10px 12px 12px!important}
  .beam-card h3{font-size:13px;margin-bottom:6px;text-transform:none}
  .beam-card ul{margin-bottom:8px}
  .beam-card li{font-size:13px;padding:4px 0;flex-wrap:wrap;gap:0 6px}
  .beam-price{font-size:12px}
  .beam-go{width:36px;height:36px}
}

@media(max-width:720px){.adv-cards>:last-child:nth-child(odd),.mights>:last-child:nth-child(odd){grid-column:1/-1}}

/* ---------- тап-цели не меньше 44 px (область нажатия расширена, вид прежний) ---------- */
@media(max-width:900px){
  .logo,.burger,.sl-all,.cc a,.crumbs a,#bpck a{position:relative}
  .logo::after{content:"";position:absolute;left:0;right:0;top:-6px;bottom:-6px}
  .burger::after{content:"";position:absolute;inset:-10px -8px}
  .sl-all::after{content:"";position:absolute;left:-4px;right:-4px;top:50%;height:48px;transform:translateY(-50%)}
  .cc .val a,.phone-lg a{display:inline-block;padding:14px 0;margin:-14px 0}
  .crumbs a{display:inline-block;padding:14px 4px;margin:-14px -4px}
  .cs-more{padding:13px 0;margin:-13px 0}
  #bpck button{min-height:44px!important}
  .filter,.cs-filter{min-height:44px}
  .kprod-thumbs{gap:8px}
  .kprod-thumbs button{width:48px;height:44px}
  footer .foot-col .big a,footer .foot-col a.big{display:block;padding:10px 0}
}
@media(max-width:720px){
  footer{padding-bottom:96px}
  footer .foot-bottom p{font-size:14px}
  footer .foot-bottom .flinks a{font-size:14px}
}
@media(max-width:900px){.cta-form .note a{display:inline-block;padding:12px 0;margin:-12px 0}}

/* карточки продукции в категории: характеристики по 2 в ряд, ниже фото */
@media(max-width:720px){
  .kprod-grid:not(.kprod-grid--mini) .kspecs{display:grid;grid-template-columns:1fr 1fr;gap:0 16px}
  .kprod-grid:not(.kprod-grid--mini) .kspecs>div{flex-direction:column;gap:0;padding:6px 0}
  .kprod-grid:not(.kprod-grid--mini) .kspecs dd{text-align:left}
  .kprod-media{aspect-ratio:16/10}
  .kprod-body{gap:10px}
}
@media(max-width:640px){.ktable td:empty{display:none!important}}

/* переход по якорю: заголовок не прячется под фиксированной шапкой */
@media(max-width:980px){
  section[id]{scroll-margin-top:24px}
  .svc-detail[id],.psec[id],.kprod[id]{scroll-margin-top:84px}
}

/* первый экран главной: кнопки видны без прокрутки даже на 320x568 */
@media(max-width:720px){
  .hero .adv{grid-template-columns:1fr 1fr!important;gap:10px 12px!important;margin-bottom:20px}
  .hero .adv-item{gap:8px}
  .hero .adv-item p{font-size:14px;line-height:1.25}
  .hero .adv-ico{width:34px;height:34px}
  .hero .lead{margin-bottom:16px}
  .hero-cta .btn{padding-top:14px;padding-bottom:14px}
}

/* контраст мелкого текста на тёмном: подпись подвала и метки в карточках */
@media(max-width:720px){
  footer .foot-bottom p,footer .foot-bottom a,footer .foot-bottom .flinks a{color:rgba(255,255,255,.72)!important}
  .cs-p .k{color:rgba(255,255,255,.68)}
}

/* плашка cookie компактнее, меньше закрывает экран */
@media(max-width:640px){
  /* размеры и место у низа экрана задаёт сам cookie.js */
  #bpck .bpck-row{gap:6px 18px!important}
}

/* добавки по результатам повторного прогона */
@media(max-width:720px){
  .mobile-menu .mobile-phone{padding:12px 0!important}
  .cs-tile .v small,.cs-stat .n small,.cs-p .v small{font-size:13px}
  .crumbs{font-size:14px}
  .kprod-grid--mini .btn-sm{padding:12px 10px;gap:6px;justify-content:center}
}
@media(max-width:420px){
  .kprod-grid--mini .btn-sm .ico{display:none}
}
