/* ================================================================
   mobile.css — Mobile & Small Screen Responsive Overrides
   Загружается ПОСЛЕДНИМ — перекрывает page-specific стили.

   Breakpoints:
     768px — планшет / большой телефон
     640px — телефон
     480px — малый телефон
     380px — очень маленький телефон
   ================================================================ */


/* ----------------------------------------------------------------
   NAVBAR — компактнее на мобилке
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .navbar {
    height: 64px;
    padding: 0 12px;
    gap: 6px;
  }

  body {
    padding-top: 64px;
  }

  .nav-left {
    gap: 6px;
  }

  .nav-right {
    gap: 8px;
  }

  .lang-switch {
    height: 34px;
    padding: 0 28px 0 10px;
    font-size: 12px;
  }

  .theme-btn,
  .user-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 768px) {
  .navbar {
    height: 64px;
  }

  body {
    padding-top: 64px;
  }

  .lang-form-desktop-custom {
    display: none;
  }

  .lang-form-mobile {
    display: block;
  }
}

@media (max-width: 380px) {
  .lang-mobile-toggle {
    min-width: 60px;
    padding: 0 10px;
  }
}


/* ----------------------------------------------------------------
   CONTAINER — меньше паддинг на маленьких экранах
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }
}


/* ----------------------------------------------------------------
   SECTION PADDING — 100px слишком много на мобилке
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .section-categories,
  .section-cases,
  .section-contacts,
  .section-faq {
    /*padding: var(--space-2xl) 0;*/ /* 60px вместо 100px */
  }

  .section-head {
    margin-bottom: var(--space-lg); /* 24px */
  }

  .section-title {
    font-size: clamp(22px, 6vw, 32px);
  }

  .section-subtitle {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: clamp(20px, 7vw, 28px);
    margin-bottom: 8px;
  }

  .section-subtitle {
    font-size: 15px;
  }
}


/* ----------------------------------------------------------------
   HERO — font-size 25px на hero-doc-btn — критическая ошибка
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .hero-fullwidth {
    --hero-pt: 11%;
    min-height: 100svh;
  }

  .hero-center-content {
    text-align: center;
    align-items: center;
    justify-content: center;
  }

  .hero-big-title {
    font-size: clamp(38px, 11vw, 56px);
    line-height: 1.02;
  }

  .hero-small-text {
    margin-top: 16px;
    letter-spacing: 0.12em;
    font-size: 15px;
    opacity: 0.9;
  }

  .hero-doc-btn {
    width: auto;
    max-width: 100%;
    min-height: 0;
    padding: 10px 18px;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(var(--blur-md));
    color: rgba(255, 255, 255, 0.92);
    font-size: 25px;
    font-weight: 600;
    box-shadow: none;
  }

  .hero-doc-buttons {
    width: 100%;
    justify-content: center;
    margin: 30px 0 20px;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .hero-fullwidth {
    --hero-pt: 10%;
  }

  .hero-big-title {
    font-size: clamp(34px, 11.5vw, 46px);
  }

  .hero-doc-btn {
    width: auto;
    max-width: 100%;
    min-height: 0;
    font-size: 25px;
    padding: 10px 18px;
  }

  .hero-doc-buttons {
    align-items: stretch;
    justify-content: center;
    gap: 10px;
  }

  .hero-doc-btn {
    white-space: nowrap;
  }

  .hero-center-content {
    padding-left: 14px;
    padding-right: 14px;
  }
}


/* ----------------------------------------------------------------
   INPUTS — 60px высоковато; + font-size ≥ 16px предотвращает
   автозум на iOS при фокусе
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .search-input,
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  select {
    height: 50px;
    font-size: 16px;
  }

  .hero-search-input {
    font-size: 16px;
  }

  .search-btn-black {
    padding: 0 20px;
    font-size: 15px;
  }
}


/* ----------------------------------------------------------------
   КНОПКИ
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .btn {
    height: 44px;
    padding: 0 18px;
    font-size: 15px;
  }

  /* Banner buttons — стекируем вертикально */
  .banner-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .banner-btn {
    width: 100%;
    min-width: 0;
    height: 48px;
    font-size: 14px;
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .banner-btn,
  .cases-cta .btn-black {
    font-size: 18px;
    font-weight: 600;
  }

  .section-contacts .contact-item {
    font-size: 15px;
    font-weight: 600;
  }

  .section-contacts .address-link strong {
    font-size: 15px;
    font-weight: 600;
  }

  .section-contacts .address-link div span {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .banner-btn,
  .cases-cta .btn-black {
    height: 52px;
    font-size: 17px;
  }

  .section-contacts .contact-item {
    font-size: 15px;
  }
}


/* ----------------------------------------------------------------
   FAQ — крупный паддинг и шрифт уменьшаем
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .faq-list {
    gap: 8px;
  }

  .faq-item summary {
    padding: 16px 18px;
    font-size: 15px;
    gap: 10px;
  }

  .faq-item p {
    padding: 14px 18px 18px;
    font-size: 15px;
  }
}


/* ----------------------------------------------------------------
   BANNER — слишком большой вертикальный паддинг на мобилке
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .banner-fullwidth {
    min-height: 360px;
  }

  .banner-center-content {
    padding: 56px 20px;
  }
}

@media (max-width: 480px) {
  .banner-center-content {
    padding: 44px 16px;
  }

  .banner-small-text {
    font-size: 14px;
    margin-top: 12px;
  }
}


/* ----------------------------------------------------------------
   PAGE HEAD TOP — grid 1fr auto 1fr сложно на малом экране
   ---------------------------------------------------------------- */
@media (max-width: 560px) {
  .page-head-top {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left right"
      "center center";
    row-gap: 8px;
  }

  .page-head-left  { grid-area: left; }
  .page-head-center { grid-area: center; justify-self: start; }
  .page-head-right { grid-area: right; }

  .page-head-center .page-title {
    text-align: left;
    white-space: normal;
  }
}


/* ----------------------------------------------------------------
   SERVICE DETAIL — кнопки на всю ширину на мобилке
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .service-detail-actions {
    flex-direction: column;
  }

  .service-detail-actions .btn {
    min-width: 0;
    width: 100%;
  }

  .service-detail-name {
    font-size: 20px;
  }
}


/* ----------------------------------------------------------------
   KP ITEM + HOME CTA — лишний паддинг убираем
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .kp-item {
    padding: 18px 16px;
  }

  .home-cta {
    padding: 32px 16px;
  }

  .kp-example-card {
    padding: 16px;
  }

  .kp-example-title {
    font-size: 16px;
  }
}


/* ----------------------------------------------------------------
   PORTFOLIO TABS — горизонтальный скролл на мобилке
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .pf-tabs-wrap {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: var(--space-lg);
  }

  .pf-tabs-wrap::-webkit-scrollbar {
    display: none;
  }

  .pf-tabs {
    flex-wrap: nowrap;
    border-radius: var(--radius-lg);
    width: auto;
  }

  .pf-tab {
    padding: 8px 14px;
    font-size: 15px;
  }
}


/* ----------------------------------------------------------------
   PORTFOLIO DETAIL — выравнивание и шрифты
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .pf-detail-head {
    padding: var(--space-lg) 0 var(--space-md);
    text-align: left;
  }

  .pf-detail-desc {
    font-size: 14px;
    line-height: 1.6;
  }
}


/* ----------------------------------------------------------------
   CATEGORY SIDEBAR — компактные айтемы
   ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .category-sidebar .category-list {
    overflow-x: auto;
  }

  .category-sidebar {
    height: auto;
    padding: 10px;
  }

  .category-sidebar .category-name {
    font-size: 14px;
  }

  .category-sidebar .category-item {
    padding: 10px 12px;
    min-width: 140px;
  }

  .category-sidebar .category-count {
    font-size: 12px;
    padding: 3px 8px;
  }
}


/* ----------------------------------------------------------------
   MODAL — bottom sheet на маленьких экранах
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .modal-backdrop:not(.modal-backdrop--full) {
    align-items: center;
    padding: 0;
  }

  .modal-backdrop:not(.modal-backdrop--full) .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-lg) var(--space-md)
      calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  }
}


/* ----------------------------------------------------------------
   CONTACTS
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .address-link {
    padding: 12px 16px;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .address-link div {
    text-align: center;
  }
}


/* ----------------------------------------------------------------
   GRID — чуть меньше gap на малом экране
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .grid {
    gap: 16px;
  }

  .pf-grid {
    gap: 12px;
  }

  .categories-grid {
    gap: 12px;
  }
}


/* ----------------------------------------------------------------
   CRM ACTIONS
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .crm-actions {
    gap: 6px;
  }
}


/* ----------------------------------------------------------------
   TOUCH TARGETS — минимум 44×44px для всех кликабельных элементов
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .contact-item {
    min-height: 44px;
  }

  .pf-lightbox-close,
  .pf-lightbox-arrow {
    width: 48px;
    height: 48px;
  }

  .pf-lightbox-prev { left: 12px; }
  .pf-lightbox-next { right: 12px; }
}


/* ================================================================
   HAMBURGER MENU — мобильная навигация
   ================================================================ */

/* ---- Кнопка бургера ---- */
.nav-burger {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.nav-burger:hover {
  background: var(--hover);
  border-color: var(--color-accent);
}

/* Три полоски */
.burger-bar {
  position: absolute;
  left: 9px;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.18s ease, top 0.22s ease;
  transform-origin: center;
}

.burger-bar:nth-child(1) { top: 13px; }
.burger-bar:nth-child(2) { top: 19px; }
.burger-bar:nth-child(3) { top: 25px; }

/* Анимация → крестик */
.nav-burger.is-open .burger-bar:nth-child(1) {
  top: 19px;
  transform: rotate(45deg);
}
.nav-burger.is-open .burger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-burger.is-open .burger-bar:nth-child(3) {
  top: 19px;
  transform: rotate(-45deg);
}

/* ---- Выпадающее меню ---- */
.mobile-menu {
  display: none; /* полностью скрыто на десктопе */
}

.mobile-menu-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 52px;
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast), transform var(--transition-fast);
}

/* Стрелка-индикатор справа */
.mobile-menu-link::after {
  content: '›';
  margin-left: auto;
  font-size: 22px;
  font-weight: 300;
  color: var(--muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.mobile-menu-link:hover {
  background: var(--hover);
  border-color: var(--border);
}

.mobile-menu-link:hover::after {
  color: var(--color-accent);
  transform: translateX(3px);
}

.mobile-menu-link:active {
  background: var(--tile-hover);
  color: var(--color-accent);
  transform: scale(0.99);
}

/* ---- Включаем на мобилке ---- */
@media (max-width: 768px) {
  /* Показываем бургер */
  .nav-burger {
    display: flex;
  }

  /* Прячем все nav-ссылки кроме первой (Главная = логотип) */
  .nav-left .brand ~ .brand {
    display: none;
  }

  /* Делаем первую ссылку чуть крупнее — она теперь логотип */
  .nav-left .brand:first-child {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.02em;
  }

  .nav-left .brand:first-child .brand-logo-wrap {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }

  /* Мобильное меню — dropdown под навбаром */
  .mobile-menu {
    display: block;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 99998;
    background: var(--navbar-bg, var(--bg));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 12px 16px 20px;

    /* Скрытое состояние */
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }

  .mobile-menu.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
  }
}

@media (max-width: 380px) {
  .nav-left .brand:first-child {
    font-size: 16px;
  }

  .nav-left .brand:first-child .brand-logo-wrap {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }
}


/* ================================================================
   BANNER BUTTONS — чёткое разделение primary / secondary на мобилке
   ================================================================ */
@media (max-width: 768px) {
  /* Первая кнопка в баннере — яркий purple-CTA */
  .banner-buttons .banner-btn:first-child {
    background: linear-gradient(180deg, var(--purple-2), var(--purple));
    border-color: var(--purple-border);
    box-shadow: 0 8px 24px var(--purple-glow);
    color: #fff;
  }

  .banner-buttons .banner-btn:first-child:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
  }

  /* Вторая кнопка — outline */
  .banner-buttons .banner-btn:not(:first-child) {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px);
    color: #fff;
  }
}

/* Тап-фидбек для всех кнопок */
@media (hover: none) {
  .btn:active,
  .banner-btn:active,
  .hero-doc-btn:active {
    transform: scale(0.97);
    filter: brightness(0.95);
  }
}


/* ================================================================
   GLOBAL UI FLOOR (loaded last):
   - font-size not below 15px
   - compact controls get safer padding
   - prevent text overflow in tight containers
   ================================================================ */
:root {
  --ui-min-font: 20px;
  --ui-min-pad: 15px;
  --ui-min-line: 1.45;
}

body,
input,
select,
textarea,
button {
  font-size: var(--ui-min-font);
}

p,
small,
label,
li,
a,
button,
input,
select,
textarea,
.muted,
.section-subtitle,
.category-tile-info p,
.address-link strong,
.address-link div span {
  font-size: var(--ui-min-font) !important;
  line-height: var(--ui-min-line);
}

/* Исключения: кнопки с кастомным font-size */
.hero-doc-btn {
  font-size: 30px !important;
  line-height: 1.1 !important;
}

/* Inline styles like style="font-size: 15px" */
[style*="font-size: 15px"],
[style*="font-size: 15px"],
[style*="font-size:14px"],
[style*="font-size: 14px"],
[style*="font-size:12px"],
[style*="font-size: 12px"] {
  font-size: var(--ui-min-font) !important;
}

.btn,
.btn-compact,
.banner-btn,
.lang-mobile-toggle,
.lang-mobile-option,
.mobile-menu-link {
  min-height: 44px;
  padding-left: var(--ui-min-pad);
  padding-right: var(--ui-min-pad);
}

/* Small buttons floor: make text readable */
.btn,
.btn-compact,
a.btn,
input[type="submit"],
input[type="button"],
.banner-btn,
.banner-btn-white,
.banner-btn-outline,
.search-btn-black,
.search-reset,
.category-search-reset,
.lang-switch,
.lang-mobile-toggle,
.lang-mobile-option,
.mobile-menu-link {
  font-size: 18px !important;
  line-height: 1.2;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
  min-height: 44px;
  padding-left: var(--ui-min-pad);
  padding-right: var(--ui-min-pad);
}

.container,
.card,
.tile,
.modal,
.faq-item,
.contact-item,
.category-tile-info {
  overflow-wrap: anywhere;
}
