/* ==========================================================================
   Mobile Optimization & Performance Enhancements
   Допълнителни оптимизации за мобилни устройства и производителност
   Не променя визията на десктоп — само подобрява UX на телефони и таблети
   ========================================================================== */

/* Smooth scrolling и по-добро rendering */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Подобрена работа с изображения */
img {
  max-width: 100%;
  height: auto;
}

/* Prevent layout shift при зареждане на изображения */
img[width][height] {
  height: auto;
}

/* По-удобно тапване на телефони — минимум 44x44px tap targets */
@media (max-width: 991px) {

  /* Меню линкове */
  .navbar-nav-mobile li a {
    min-height: 48px;
    line-height: 48px;
    padding: 0 18px;
    display: block;
  }

  /* Социални икони */
  .social-list li a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Internal links nav */
  .internal-links-nav a {
    min-height: 44px;
    padding: 12px 16px;
    display: inline-block;
    line-height: 1.4;
  }

  /* Бутони — по-голям tap target */
  .btn {
    min-height: 48px;
    padding: 14px 24px;
  }

  /* Telefon link — да е лесен за tap */
  .header-phone a {
    display: inline-block;
    padding: 8px 12px;
    min-height: 44px;
    line-height: 28px;
  }

  /* Form fields на mobile — поне 44px height и 16px font (anti-zoom on iOS) */
  .form-control {
    min-height: 48px;
    font-size: 16px !important; /* iOS не зумва при focus, ако е >= 16px */
    padding: 12px 14px;
  }

  textarea.form-control {
    min-height: 96px;
    line-height: 1.4;
  }

  /* Submit бутон да е по-удобен */
  .form-submit .btn {
    min-height: 52px;
    width: 100%;
    margin-top: 10px;
  }

  /* Мобилна навигация — leave space for content */
  .navbar-mobile {
    padding: 12px 16px;
  }

  .navbar-toggle {
    min-width: 48px;
    min-height: 48px;
    padding: 12px 10px;
  }

  /* По-добра четимост на проектните детайли */
  .project-details-title {
    font-size: 22px !important;
    line-height: 1.3 !important;
    margin-bottom: 14px;
  }

  .project-details-descr {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }

  /* Hero на inner страници (h1 видим и удобен) */
  .main-header h1 {
    font-size: 32px !important;
    line-height: 1.2 !important;
    word-break: break-word;
  }

  /* Section titles по-четими */
  .section-title {
    font-size: 26px !important;
    line-height: 1.25 !important;
  }

  /* Breadcrumb на мобилни */
  .breadcrumb-nav {
    font-size: 13px;
    line-height: 1.6;
    margin: 8px 0;
  }

  /* Container padding */
  .container {
    padding-left: 18px;
    padding-right: 18px;
  }

  /* FAQ въпроси по-четливи */
  .col-about-title {
    font-size: 18px !important;
    line-height: 1.35 !important;
    margin-bottom: 8px;
  }

  /* Footer brand center alignment на мобилни */
  .footer .brand,
  .footer .author-link {
    display: inline-block;
    margin: 6px 0;
  }

  .footer-legal-links {
    margin-top: 12px;
    line-height: 1.8;
  }

  .footer-legal-links a,
  .footer-legal-links span {
    display: inline-block;
    margin: 2px 4px;
  }
}

/* Малки телефони (до 480px) */
@media (max-width: 480px) {

  .main-header h1 {
    font-size: 26px !important;
  }

  .section-title {
    font-size: 22px !important;
  }

  .project-details-title {
    font-size: 20px !important;
  }

  /* Form layout на много малки екрани */
  .row-field .col-field {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* Header phone display fix на малки екрани */
  .header-phone {
    font-size: 14px;
  }

  /* Internal links nav stack vertically на много тесни */
  .internal-links-nav.internal-links-nav-center a {
    display: block;
    margin: 4px 0;
  }
}

/* Reduce motion за потребители, които предпочитат това */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Fix iOS safe area (notch) */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Предотврати хоризонтален overflow — БЕЗ да прави body втори scroll контейнер.
   (overflow-x:hidden на body форсираше overflow-y:auto → двоен скрол → на iOS
   страницата "подскачаше" обратно горе. overflow-x:clip клипва без scroll контейнер.) */
html {
  overflow-x: hidden;
}
body {
  overflow-x: visible;
  -webkit-overflow-scrolling: auto;
}

/* По-добро focus състояние за accessibility */
a:focus-visible,
button:focus-visible,
.form-control:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--primary-color, #c9a961);
  outline-offset: 2px;
}

/* Ленива загрузка hint за изображенията */
img[loading="lazy"] {
  background-color: rgba(0, 0, 0, 0.04);
}

/* Подобри контраст на текст върху изображения */
.main-inner .main-header h1 {
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* По-добър loading на slider на мобилни */
@media (max-width: 768px) {
  .rev_slider_wrapper {
    max-height: 65vh;
  }
}

/* Honeypot полето да остане скрито за всеки случай */
input[name="honeypot"] {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
