/* ==========================================================================
   СОДРУЖЕСТВО — адаптивность и mobile-first UI
   Подключается после style.css на всех страницах
   ========================================================================== */

/* --- База: app-shell, safe-area, без горизонтального скролла --- */
:root {
  --mobile-gutter: 16px;
  --mobile-gutter-sm: 12px;
  --touch-min: 44px;
  --app-radius: 14px;
  --dock-h: 0px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + var(--dock-h));
  -webkit-tap-highlight-color: transparent;
}

img,
video,
iframe,
svg {
  max-width: 100%;
  height: auto;
}

.container,
.container-fluid {
  padding-left: max(var(--mobile-gutter), env(safe-area-inset-left, 0));
  padding-right: max(var(--mobile-gutter), env(safe-area-inset-right, 0));
}

/* --- Типографика и переносы --- */
*, *::before, *::after {
  word-break: normal;
  overflow-wrap: break-word;
  -webkit-hyphens: none;
  hyphens: none;
}

body, p, h1, h2, h3, h4, h5, h6,
a, span, li, div, label, input, textarea, button {
  word-break: normal;
  overflow-wrap: break-word;
  -webkit-hyphens: none;
  hyphens: none;
}

h1, h2, h3, h4, h5, h6 {
  word-break: keep-all;
  overflow-wrap: anywhere;
  white-space: normal;
}

a[href^="mailto:"],
a[href^="tel:"] {
  overflow-wrap: anywhere;
}

/* --- Шапка --- */
@media (max-width: 991px) {
  .header-grid {
    grid-template-columns: 1fr auto !important;
    gap: 10px !important;
    padding: 10px 0 !important;
  }

  .header-logo .logo-img {
    height: 30px !important;
    width: auto;
  }

  .header-actions {
    gap: 8px !important;
  }

  .hdr.header-floating,
  .hdr.header-1 {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* --- Hero (главная) --- */
@media (max-width: 767px) {
  .hero-h1 {
    font-size: clamp(26px, 7.2vw, 36px) !important;
    line-height: 1.12 !important;
    margin-bottom: 16px !important;
  }

  .hero-desc,
  .hero-dirs {
    font-size: 13px !important;
    line-height: 1.65 !important;
    margin-bottom: 22px !important;
  }

  .hero .d-flex.flex-wrap.gap-3 {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100%;
  }

  .hero .btn-gold,
  .hero .btn-outline {
    justify-content: center;
    width: 100%;
    min-height: var(--touch-min);
    padding: 14px 20px;
  }

  .hero-logo-col {
    display: none !important;
  }
}

@media (max-width: 575px) {
  .hero {
    padding: 108px 0 52px !important;
  }
}

/* --- Внутренние hero --- */
@media (max-width: 767px) {
  .page-hero {
    padding: 112px 0 44px !important;
  }

  .page-hero-title {
    font-size: clamp(26px, 7vw, 38px) !important;
    line-height: 1.12 !important;
  }

  .page-hero-lead {
    font-size: 14.5px !important;
    line-height: 1.65 !important;
  }

  .page-hero-eyebrow {
    letter-spacing: 2.5px !important;
    font-size: 11px !important;
  }

  .breadcrumb-nav {
    font-size: 12px !important;
    margin-bottom: 14px !important;
  }
}

/* --- Секции и сетки Bootstrap --- */
@media (max-width: 991px) {
  .sec {
    padding: 64px 0 !important;
  }

  .sec-title {
    font-size: clamp(22px, 5.5vw, 28px) !important;
    margin-bottom: 32px !important;
  }

  .row.g-4,
  .row.g-5 {
    --bs-gutter-y: 1rem;
  }

  .col-lg-6.offset-lg-1 {
    margin-left: 0 !important;
  }
}

@media (max-width: 575px) {
  .sec {
    padding: 48px 0 !important;
  }

  .sec-title {
    margin-bottom: 28px !important;
  }
}

/* --- Карточки практик, направлений, доверия --- */
@media (max-width: 767px) {
  .prac-card,
  .about-exp-card,
  .case-card,
  .post-card {
    border-radius: var(--app-radius);
  }

  .trust-item {
    padding: 8px 4px;
  }

  .trust-ico-wrap {
    width: 58px !important;
    height: 58px !important;
  }

  .trust-txt {
    font-size: 12.5px !important;
  }

  .dirs-grid {
    border-radius: var(--app-radius) !important;
  }

  .dir-item {
    padding: 20px 10px 18px !important;
  }

  .dir-txt {
    font-size: 11.5px !important;
  }
}

/* --- Статистика --- */
@media (max-width: 767px) {
  .stats-card,
  .stats-card--3 {
    grid-template-columns: 1fr 1fr !important;
    border-radius: var(--app-radius) !important;
  }

  .stat-item {
    padding: 22px 16px !important;
  }

  .stat-num {
    font-size: clamp(22px, 6vw, 30px) !important;
  }
}

@media (max-width: 399px) {
  .stats-card,
  .stats-card--3 {
    grid-template-columns: 1fr !important;
  }

  .stat-item {
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .stat-item:last-child {
    border-bottom: none !important;
  }
}

/* --- О компании --- */
@media (max-width: 991px) {
  .about-intro-card {
    margin-top: 8px;
    padding: 28px 22px !important;
  }

  .about-mini-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .about-mini-stat:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 575px) {
  .about-mini-stats {
    grid-template-columns: 1fr !important;
  }

  .principle-pyramid {
    gap: 12px !important;
  }

  .principle-item {
    padding: 18px 16px !important;
    gap: 14px !important;
  }

  .principle-num {
    font-size: 22px !important;
    min-width: 36px !important;
  }

  .principle-txt {
    font-size: 13.5px !important;
  }

  .about-quote-text {
    font-size: clamp(18px, 4.8vw, 24px) !important;
  }

  .svc-principle-text {
    font-size: clamp(18px, 4.8vw, 24px) !important;
  }
}

/* --- Услуги --- */
@media (max-width: 991px) {
  .svc-block-head {
    flex-direction: column;
    gap: 12px !important;
  }

  .svc-block + .svc-block {
    margin-top: 36px !important;
    padding-top: 36px !important;
  }

  .svc-list {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

/* --- Практика / кейсы --- */
@media (max-width: 639px) {
  .case-filters {
    justify-content: flex-start !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 6px;
    margin-bottom: 28px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .case-filters::-webkit-scrollbar {
    display: none;
  }

  .case-chip {
    flex-shrink: 0;
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
  }

  .cases-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 575px) {
  .case-modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100dvh;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 72px 18px 28px !important;
  }
}

/* --- Блог --- */
@media (max-width: 767px) {
  .blog-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .blog-search {
    max-width: none !important;
    flex: 1 1 auto !important;
  }

  .blog-chips {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .blog-chips::-webkit-scrollbar {
    display: none;
  }

  .blog-chip {
    flex-shrink: 0;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .blog-featured__body {
    padding: 24px 18px !important;
  }

  .blog-featured__title {
    font-size: clamp(20px, 5.5vw, 26px) !important;
  }

  .post-card__title {
    font-size: 16px !important;
  }
}

/* --- Статья --- */
@media (max-width: 767px) {
  .article-cover {
    margin-top: -12px !important;
    padding: 0 12px !important;
  }

  .article-wrap {
    padding: 0 14px 24px !important;
  }

  .article-body {
    padding-top: 32px !important;
    font-size: 15.5px !important;
    line-height: 1.75 !important;
  }

  .article-body .article-lead {
    font-size: 17px !important;
  }

  .article-body blockquote {
    padding: 18px 16px !important;
    font-size: 16px !important;
  }

  .article-nav {
    grid-template-columns: 1fr !important;
  }

  .article-author {
    flex-direction: column;
    align-items: flex-start !important;
    text-align: left;
  }

  .related__grid,
  .related .blog-grid {
    grid-template-columns: 1fr !important;
  }
}

/* --- Контакты --- */
@media (max-width: 767px) {
  .contact-method {
    padding: 18px 16px !important;
  }

  .contact-method-value {
    font-size: 15px !important;
  }

  .contact-map {
    height: 280px !important;
    border-radius: var(--app-radius) !important;
    overflow: hidden;
  }

  .contact-quick {
    border-radius: var(--app-radius) !important;
  }

  .contact-quick-item {
    padding: 20px 18px !important;
  }
}

/* --- Формы --- */
@media (max-width: 575px) {
  .consult-title {
    font-size: clamp(22px, 5.8vw, 28px) !important;
  }

  .consult-form-card {
    padding: 22px 16px !important;
    border-radius: var(--app-radius) !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
  }

  .form-field input,
  .form-field textarea {
    font-size: 16px !important; /* предотвращает zoom на iOS */
    min-height: var(--touch-min);
  }

  .btn-gold-full {
    min-height: 48px;
    font-size: 15px !important;
  }

  .form-consent {
    font-size: 12px !important;
  }
}

/* --- Кнопки: touch-friendly --- */
@media (max-width: 991px) {
  .btn-gold,
  .btn-outline,
  .btn-outline-lg,
  .btn-more,
  .btn-hdr,
  .consent-banner__btn {
    min-height: var(--touch-min);
  }

  .scroll-to-top {
    width: 46px !important;
    height: 46px !important;
    right: max(16px, env(safe-area-inset-right, 0)) !important;
    bottom: calc(20px + var(--dock-h) + env(safe-area-inset-bottom, 0)) !important;
  }
}

/* --- Футер: реквизиты без стиля ссылок --- */
.footer-requisites-row .footer-requisites-label {
  display: inline-block;
  min-width: 42px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.34);
}

.footer-requisites-row .footer-requisites-value {
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.55;
  text-decoration: none;
  cursor: default;
  pointer-events: none;
  user-select: text;
}

.footer-requisites-row a.footer-requisites-value {
  pointer-events: none;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 991px) {
  .footer-top {
    padding: 44px 0 32px !important;
  }

  .footer-top .row > [class*="col-"] {
    margin-bottom: 8px;
  }

  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  .footer-policy-links {
    flex-direction: column;
    gap: 10px !important;
  }

  .footer-requisites {
    margin-top: 12px;
  }
}

/* --- Юридические страницы --- */
@media (max-width: 767px) {
  .legal {
    padding: 0 2px !important;
  }

  .legal-card {
    padding: 18px 16px !important;
    border-radius: var(--app-radius) !important;
  }

  .legal h2 {
    font-size: 16px !important;
    gap: 12px !important;
    flex-wrap: wrap;
  }

  .legal p,
  .legal li {
    font-size: 14px !important;
    line-height: 1.7 !important;
  }

  .legal-meta {
    font-size: 12.5px !important;
  }
}

/* --- Cookie / PD баннеры --- */
@media (max-width: 767px) {
  .consent-banner {
    left: 0 !important;
    right: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 18px 16px calc(14px + env(safe-area-inset-bottom, 0)) !important;
    max-width: none !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12) !important;
  }

  #banner-cookies {
    bottom: 0 !important;
    z-index: 10001;
  }

  #banner-pd {
    bottom: 0 !important;
    z-index: 10000;
  }

  body.consent-double #banner-cookies {
    bottom: 0 !important;
  }

  body.consent-double #banner-pd {
    bottom: calc(var(--cookie-banner-h, 118px) + env(safe-area-inset-bottom, 0)) !important;
  }
}

/* --- Мобильная нижняя панель (app-like) --- */
.mobile-dock {
  display: none;
}

@media (max-width: 767px) {
  :root {
    --dock-h: 62px;
  }

  .mobile-dock {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    padding: 8px max(12px, env(safe-area-inset-left, 0)) calc(8px + env(safe-area-inset-bottom, 0)) max(12px, env(safe-area-inset-right, 0));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(28, 37, 57, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    gap: 8px;
    box-shadow: 0 -4px 24px rgba(28, 37, 57, 0.08);
  }

  .mobile-dock__btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border-radius: 12px;
    font-family: var(--font, "Montserrat", sans-serif);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-dock__btn:active {
    transform: scale(0.98);
  }

  .mobile-dock__btn--call {
    background: #f5f5f5;
    color: #1c2539;
    border: 1px solid #e5e5e5;
  }

  .mobile-dock__btn--cta {
    background: #c4933f;
    color: #fff;
    box-shadow: 0 4px 14px rgba(196, 147, 63, 0.35);
  }

  .mobile-dock__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  body.nav-locked .mobile-dock {
    opacity: 0;
    pointer-events: none;
  }

  body.consent-visible .mobile-dock {
    display: none;
  }
}

/* --- Отключение hover-эффектов на touch --- */
@media (hover: none) and (pointer: coarse) {
  .prac-card:hover,
  .about-exp-card:hover,
  .case-card:hover,
  .post-card:hover,
  .principle-item:hover,
  .contact-method:hover,
  .dir-item:hover {
    transform: none !important;
  }
}

/* --- Очень маленькие экраны --- */
@media (max-width: 360px) {
  :root {
    --mobile-gutter: 12px;
  }

  .hero-feats {
    grid-template-columns: 1fr !important;
  }

  .hero-feat {
    border-right: none !important;
    border-bottom: 1px solid rgba(196, 147, 63, 0.2) !important;
  }

  .hero-feat:last-child {
    border-bottom: none !important;
  }

  .mobile-dock__btn {
    font-size: 12px;
    gap: 6px;
  }
}

/* --- Планшеты landscape --- */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 92%;
  }

  .hero-h1 {
    font-size: clamp(30px, 4vw, 40px) !important;
  }
}
