/*
 * Cross-page responsive and accessibility fixes.
 * Loaded after the page-specific styles so the rules below are the final,
 * predictable mobile layer instead of more edits to the legacy minified CSS.
 */

html,
body {
  min-width: 0 !important;
  max-width: 100%;
}

html {
  overflow-x: clip;
}

body {
  overflow-x: hidden;
}

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

/* Form validation ------------------------------------------------------- */
.cs-field-error {
  display: block;
  margin: 7px 18px 0;
  color: #b42318;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}

input[aria-invalid="true"] {
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .2) !important;
}

input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .3) !important;
}

/* Modal focus and unobstructed forms ----------------------------------- */
html.cs-form-modal-open #jcont,
html.cs-form-modal-open #jivo_container,
html.cs-form-modal-open #jivo-iframe-container,
html.cs-form-modal-open jdiv[class*="globalClass"],
html.cs-form-modal-open .manager,
html.cs-form-modal-open .manager-icon {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.fancybox__container .popup-close {
  cursor: pointer;
}

.fancybox__container .popup-close:focus-visible,
.fancybox__container :is(a, button, input, select, textarea):focus-visible,
.choices:focus-visible {
  outline: 3px solid #3aabe2 !important;
  outline-offset: 3px;
}

/* Portfolio slider controls must stay above its counter/dots layer. */
.cs-portfolio__slider-arrow {
  z-index: 13 !important;
  min-width: 44px;
  min-height: 44px;
}

.cs-portfolio__slider-meta {
  pointer-events: none;
}

.cs-portfolio__slider-dots button {
  pointer-events: auto;
}

/* Choices.js configurator controls ------------------------------------- */
.configurator .choices:focus-visible .choices__inner,
.configurator .choices.is-focused .choices__inner {
  box-shadow: 0 0 0 3px rgba(58, 171, 226, .3);
}

@media (max-width: 767px) {
  .container {
    padding-right: 16px;
    padding-left: 16px;
  }

  .wrapper {
    padding-top: 92px;
  }

  /* One compact, stable row at every supported phone width. */
  .header,
  .header.nofixed {
    left: 10px;
    right: 10px;
    width: auto;
    height: 72px;
    margin: 0;
    padding: 7px 10px;
    flex-wrap: nowrap !important;
    gap: 6px;
    border-radius: 18px;
    box-sizing: border-box;
  }

  .header-logo {
    width: 52px;
    height: auto;
    flex: 0 0 52px;
    margin: 0;
  }

  .header-logo img {
    display: block;
    width: 100%;
    height: auto;
  }

  .header-city {
    width: auto;
    min-width: 0;
    margin: 0;
    flex: 1 1 auto;
    font-size: 9px;
    line-height: 1.35;
  }

  .header-city a {
    white-space: nowrap;
  }

  /* Social links remain available in the mobile menu. */
  .header-social {
    display: none !important;
  }

  .header-phone,
  .header-burger {
    width: 44px !important;
    min-width: 44px;
    height: 44px !important;
    flex: 0 0 44px;
    margin: 0 !important;
  }

  .header-phone {
    background-size: 28px;
  }

  .header-burger {
    border-radius: 12px;
  }

  /* The legacy arrows crossed the promo copy on 320–430 px screens. */
  .promo .splide__arrows {
    top: auto;
    bottom: 158px;
    height: 44px;
    padding: 0 18px;
    pointer-events: none;
  }

  .promo .splide__arrow {
    width: 44px;
    height: 44px;
    pointer-events: auto;
  }

  .btn,
  .input,
  .cs-mobile-menu__cta {
    min-height: 48px;
  }

  .fancybox__slide {
    padding: 8px !important;
  }

  .fancybox__container .popup {
    width: min(100%, 475px);
    max-width: calc(100vw - 16px);
    padding: 18px;
    box-sizing: border-box;
  }

  .fancybox__container .popup-wrapper {
    gap: 18px;
  }

  .fancybox__container .popup-name,
  .fancybox__container .popup-title {
    overflow-wrap: anywhere;
  }

  .manager-icon {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
  }

  .manager-icon img {
    width: 52px;
    height: 52px;
  }

  html.cs-manager-collision .manager-icon {
    visibility: hidden;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
  }

  .manager {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
  }
}

@media (max-width: 359px) {
  .header,
  .header.nofixed {
    left: 6px;
    right: 6px;
    padding-right: 7px;
    padding-left: 7px;
    gap: 4px;
  }

  .header-logo {
    width: 48px;
    flex-basis: 48px;
  }

  .header-city {
    font-size: 8px;
  }

  .header-phone,
  .header-burger {
    width: 42px !important;
    min-width: 42px;
    height: 42px !important;
    flex-basis: 42px;
  }

  .promo .splide__arrows {
    padding: 0 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .manager-icon,
  .cs-portfolio__slider-arrow,
  .choices__inner {
    transition: none !important;
  }
}
