/* =========================================================
   CMX MOBILE PRIORITY V4 — 2026-11-16
   Phone-first consistency layer. Desktop remains unchanged.
   Loaded after page/localized styles on every HTML page.
   ========================================================= */

@media (max-width: 860px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  html, body {
    max-width: 100%;
    overflow-x: hidden;
  }

  *, *::before, *::after { box-sizing: border-box; }

  img, svg, video, iframe {
    max-width: 100%;
    height: auto;
  }

  table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  pre, code { max-width: 100%; overflow-x: auto; }

  a, p, li, span, small, h1, h2, h3, h4 {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .container {
    width: calc(100% - 28px) !important;
    max-width: 1160px !important;
  }

  section { padding: 46px 0 !important; }

  /* Header / language bar */
  .topbar { padding: 6px 0 !important; font-size: .77rem !important; }
  .topbar .container {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px 10px !important;
    text-align: center !important;
  }
  .topbar .container > span {
    width: 100% !important;
    line-height: 1.35 !important;
  }
  .topbar-actions {
    width: 100% !important;
    margin: 0 !important;
    justify-content: center !important;
    gap: 6px 10px !important;
  }
  .lang-switch {
    white-space: normal !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 5px 7px !important;
  }

  header {
    position: relative !important;
    top: auto !important;
    background: #fff !important;
  }
  header .container.nav, .nav {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 9px 0 !important;
  }
  header .brand, .brand {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 56px) !important;
    gap: 8px !important;
  }
  .brand-mark {
    flex: 0 0 auto !important;
    padding: 7px 9px !important;
  }
  .brand > span:last-child {
    min-width: 0 !important;
    font-size: .92rem !important;
    line-height: 1.08 !important;
    letter-spacing: .055em !important;
  }
  .brand small {
    white-space: normal !important;
    font-size: .62rem !important;
    line-height: 1.2 !important;
    letter-spacing: .07em !important;
    margin-top: 3px !important;
  }
  header .call-btn { display: none !important; }
  header .mobile-note { display: none !important; }

  .mobile-menu-toggle {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    min-width: 48px !important;
    min-height: 46px !important;
    padding: 0 12px !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation;
  }
  .mobile-menu-icon { font-size: 1.25rem !important; }

  header nav { width: 100% !important; }
  header nav ul {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 8px !important;
    padding-top: 10px !important;
  }
  header nav a {
    min-height: 48px !important;
    padding: 10px 8px !important;
    border-radius: 12px !important;
    font-size: .94rem !important;
    touch-action: manipulation;
  }

  /* Hero sections */
  .hero {
    min-height: auto !important;
    padding: 42px 0 40px !important;
    background-position: center center !important;
  }
  .hero h1 {
    font-size: clamp(2rem, 9.2vw, 2.75rem) !important;
    line-height: 1.04 !important;
    letter-spacing: -.035em !important;
    margin-bottom: 14px !important;
  }
  .hero p, .hero .mobile-hero-copy {
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }
  .page-hero {
    padding: 52px 0 !important;
    background-position: center center !important;
  }
  .page-hero h1 {
    font-size: clamp(2rem, 8.7vw, 2.8rem) !important;
    line-height: 1.06 !important;
    letter-spacing: -.03em !important;
  }
  .page-hero p { font-size: 1rem !important; line-height: 1.55 !important; }
  .eyebrow { font-size: .72rem !important; letter-spacing: .09em !important; }

  .hero-actions, .form-actions, .pl-cta-inline, .ru-cta-inline {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  .btn, button, .social-link {
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Typography / sections */
  .section-head { margin-bottom: 24px !important; }
  .section-head h2, .cta h2 {
    font-size: clamp(1.8rem, 7.5vw, 2.35rem) !important;
    line-height: 1.1 !important;
  }
  .section-head p, .cta p { font-size: 1rem !important; }

  /* Grids / cards */
  .cards, .area-grid, .blog-grid, .team, .gallery-grid,
  .split, .cta .container, .article-layout, .article-wrap,
  .local-links, .license-strip .container, .service-strip .container,
  .pl-license-box, .ru-license-box, .pl-bbb, .ru-bbb {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
  .card, .area-card, .article-main, .article-content,
  .article-side-box, .sidebar-card, .contact-box, .notice-box {
    padding: 20px !important;
    border-radius: 18px !important;
  }
  .card h3, .area-card h3 { font-size: 1.22rem !important; }
  .wide { grid-column: auto !important; }
  .tall { grid-row: auto !important; min-height: 240px !important; }

  /* Images and media */
  .image-card img, .team-card img {
    height: auto !important;
    max-height: 420px !important;
    aspect-ratio: 4 / 3;
    object-fit: cover !important;
  }
  .area-hero-image img { height: auto !important; max-height: 320px !important; aspect-ratio: 16 / 9; object-fit: cover; }
  .gallery-item { min-height: 220px !important; }
  .gallery-item img { min-height: 220px; object-fit: cover; }
  .video-box video { width: 100% !important; height: auto !important; }

  /* License / trust sections */
  .license-strip { padding: 26px 0 !important; }
  .license-strip .container > div { padding: 4px 0 !important; }
  .license-strip b { font-size: .78rem !important; letter-spacing: .08em !important; }
  .license-strip span { font-size: 1rem !important; }
  .license-trust-bar { margin-top: 20px !important; padding: 14px !important; }
  .license-trust-items { display: grid !important; grid-template-columns: 1fr !important; gap: 8px !important; }
  .license-trust-items span {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    align-items: baseline !important;
    gap: 8px !important;
    font-size: .88rem !important;
  }
  .license-trust-items span + span::before { display: none !important; }

  /* Forms: 16px prevents iOS Safari zoom */
  .form-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
  .estimate-form { padding: 18px !important; border-radius: 18px !important; }
  .form-field input, .form-field select, .form-field textarea,
  input, select, textarea {
    font-size: 16px !important;
  }
  .form-field input, .form-field select { min-height: 48px !important; }
  .form-field textarea { min-height: 140px !important; }
  #estimate-form { scroll-margin-top: 12px !important; }

  /* Article/blog readability */
  .article-content h2, .article-main h2 {
    font-size: 1.55rem !important;
    line-height: 1.2 !important;
    margin-top: 28px !important;
  }
  .article-content h3, .article-main h3 { font-size: 1.2rem !important; }
  .article-content p, .article-main p, .pl-content p, .ru-content p {
    font-size: 1rem !important;
    line-height: 1.65 !important;
  }
  .article-side, .sidebar-card { position: static !important; top: auto !important; }
  .article-bottom-nav { gap: 10px !important; }

  /* Contact credentials / medals / badges */
  .medal-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
  .medal-item img {
    width: min(58vw, 210px) !important;
    max-width: 210px !important;
    margin: 0 auto 10px !important;
  }
  .cmx-bbb-contact a, .pl-bbb img, .ru-bbb img { max-width: 100% !important; }
  .cmx-bbb-contact img { width: 100% !important; height: auto !important; }
  .bz-bdg { width: min(230px,100%) !important; max-width: 100% !important; }
  .bz-bdg img { max-width: 100% !important; height: auto !important; }

  /* Social / online profiles */
  .social-links, .contact-social, .footer-social .social-links {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .social-link { padding: 9px 11px !important; }

  /* Footer and floating call */
  .footer-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  footer { padding: 28px 0 max(92px, env(safe-area-inset-bottom)) !important; }
  .footer-social { min-width: 0 !important; }
  .floating-call {
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    max-width: calc(100vw - 24px) !important;
    min-height: 46px !important;
    padding: 10px 14px !important;
    z-index: 200 !important;
  }
  body.cmx-nav-open .floating-call { opacity: 0 !important; pointer-events: none !important; }
}

@media (max-width: 560px) {
  .container { width: calc(100% - 22px) !important; }
  section { padding: 40px 0 !important; }

  .brand > span:last-child { font-size: .85rem !important; letter-spacing: .04em !important; }
  .brand small { font-size: .58rem !important; letter-spacing: .045em !important; }
  .mobile-menu-label { display: none !important; }
  .mobile-menu-toggle { width: 46px !important; min-width: 46px !important; padding: 0 !important; }

  .hero { padding: 36px 0 34px !important; }
  .hero h1 { font-size: clamp(1.9rem, 9.7vw, 2.45rem) !important; }
  .page-hero { padding: 42px 0 !important; }
  .page-hero h1 { font-size: clamp(1.85rem, 9.2vw, 2.4rem) !important; }

  .hero-actions, .form-actions, .pl-cta-inline, .ru-cta-inline,
  .article-bottom-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }
  .hero-actions .btn, .form-actions .btn, .pl-cta-inline .btn,
  .ru-cta-inline .btn, .article-bottom-nav .btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .card, .area-card, .article-main, .article-content,
  .article-side-box, .sidebar-card, .contact-box, .notice-box,
  .estimate-form { padding: 17px !important; }

  .social-link { flex: 1 1 calc(50% - 5px) !important; justify-content: center !important; }
  .medal-item img { width: min(56vw, 185px) !important; }

  .license-trust-items span {
    grid-template-columns: 1fr !important;
    gap: 1px !important;
  }
}

@media (max-width: 380px) {
  .container { width: calc(100% - 18px) !important; }
  header .brand, .brand { max-width: calc(100% - 50px) !important; }
  .brand-mark { padding: 6px 7px !important; font-size: .9rem !important; }
  .brand > span:last-child { font-size: .8rem !important; }
  .brand small { font-size: .54rem !important; }
  header nav ul { grid-template-columns: 1fr !important; }
  .social-link { flex-basis: 100% !important; }
}


/* ==========================================================
   CMX MOBILE CONVERSION PRIORITY V5
   Fixed 3-action dock + short form + thumb-friendly details
   ========================================================== */
.floating-call{display:none!important;}
.mobile-action-dock{display:none;}
.mobile-form-intro{display:flex;justify-content:space-between;gap:10px;align-items:center;margin:0 0 16px;padding:12px 14px;border-radius:14px;background:#f7f2e8;border:1px solid #eadcc3;color:#101820;}
.mobile-form-intro strong{font-size:1rem;}
.mobile-form-intro span{font-size:.86rem;color:#667085;text-align:right;}
.optional-project-details{margin:18px 0 0;border:1px solid #e6e1d8;border-radius:14px;background:#fff;overflow:hidden;}
.optional-project-details summary{cursor:pointer;list-style:none;min-height:48px;display:flex;align-items:center;justify-content:space-between;padding:12px 14px;font-weight:800;color:#101820;touch-action:manipulation;}
.optional-project-details summary::-webkit-details-marker{display:none;}
.optional-project-details summary::after{content:'+';font-size:1.35rem;color:#9c7a3f;}
.optional-project-details[open] summary::after{content:'−';}
.optional-project-details[open] summary{border-bottom:1px solid #e6e1d8;}
.optional-project-grid{padding:14px;}
.camera-field input[type=file]{background:#fffaf2;}

@media(max-width:860px){
  body{padding-bottom:calc(66px + env(safe-area-inset-bottom))!important;}
  .mobile-action-dock{
    position:fixed;left:0;right:0;bottom:0;z-index:9998;
    display:grid;grid-template-columns:repeat(3,1fr);
    padding:7px max(8px,env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-right));
    gap:7px;background:rgba(16,24,32,.97);box-shadow:0 -8px 24px rgba(0,0,0,.18);
    transform:translateY(120%);transition:transform .18s ease,opacity .18s ease;opacity:0;
  }
  .mobile-action-dock.show{transform:translateY(0);opacity:1;}
  .mobile-action-dock.keyboard-hidden, body.cmx-nav-open .mobile-action-dock{transform:translateY(120%)!important;opacity:0!important;pointer-events:none!important;}
  .dock-action{min-width:0;min-height:48px;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;text-decoration:none;font-size:.72rem;line-height:1.05;font-weight:800;touch-action:manipulation;}
  .dock-action span{font-size:1.05rem;line-height:1;}
  .dock-call,.dock-text{background:#fff;color:#101820;}
  .dock-estimate{background:#cfa861;color:#101820;}
  footer{padding-bottom:max(26px,env(safe-area-inset-bottom))!important;}
  .optional-project-details{margin-top:15px;}
  .mobile-photo-grid{grid-template-columns:1fr!important;}
  .mobile-form-intro{align-items:flex-start;flex-direction:column;gap:2px;}
  .mobile-form-intro span{text-align:left;}
  .estimate-form .form-actions{grid-template-columns:1fr!important;}
}
