/* =====================================================================
   AURUM ESTATE — SHARED UX LAYER
   Подключается последним на всех страницах.
   1) Планшетная шапка и меню (769–1200 px)
   2) Мобильный каталог: крупные карточки и понятные фильтры
   3) Мобильная типографика и проектные блоки
   4) Cookie, формы, сравнение, страница умного подбора
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Планшет / небольшой ноутбук: шапка как на главной
   --------------------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 1200px) {
  html,
  body {
    overflow-x: clip;
  }

  #mainHeader,
  header:not(.pk-sitehead) {
    padding: 12px clamp(18px, 4vw, 44px);
    gap: 12px;
  }

  .logo-link {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 220px);
  }

  .logo-img {
    width: auto;
    max-width: 100%;
    max-height: 38px;
    object-fit: contain;
  }

  .nav-wrapper {
    margin-left: auto;
    gap: 10px;
  }

  #mainHeader nav:not(.m-nav),
  header:not(.pk-sitehead) nav:not(.m-nav) {
    display: none;
  }

  .burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .14);
  }

  .burger i {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform .3s ease, opacity .2s ease;
  }

  header.menu-open {
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
  }

  header.menu-open .burger i:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  header.menu-open .burger i:nth-child(2) {
    opacity: 0;
  }

  header.menu-open .burger i:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  html.menu-lock {
    overflow: hidden;
  }

  html.menu-lock .cookie-banner {
    visibility: hidden;
  }

  .m-menu {
    position: fixed;
    inset: 0;
    z-index: 998;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: 96px 7% max(28px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg-dark);
  }

  .m-menu.open {
    display: flex;
    animation: cmpIn .25s ease both;
  }

  .m-nav {
    display: flex;
    flex-direction: column;
  }

  .m-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    font: 500 1.35rem 'Montserrat', sans-serif;
    color: #fff;
  }

  .m-link::after {
    content: "";
    width: 9px;
    height: 9px;
    border-top: 2px solid var(--gold);
    border-right: 2px solid var(--gold);
    transform: rotate(45deg);
    margin-right: 4px;
  }

  .m-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .m-cta {
    justify-content: center;
    min-height: 52px;
    font-size: .95rem;
    border-radius: 12px;
  }

  .m-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .m-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    font: 600 .9rem 'Montserrat', sans-serif;
  }

  .m-hours {
    margin-top: 4px;
    text-align: center;
    font-size: .78rem;
    color: var(--text-muted);
  }

  .header-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
  }
}

/* Плоские ссылки не должны выглядеть как раскрывающиеся пункты */
@media (max-width: 1200px) {
  .m-nav > a.m-link::after {
    display: none;
  }

  .m-group > button.m-link::after {
    display: block;
  }
}

/* ---------------------------------------------------------------------
   2. Каталог на телефоне: одна колонка, крупная карточка
   --------------------------------------------------------------------- */
html.menu-lock #cmpTray {
  display: none !important;
}

@media (max-width: 768px) {
  .cat-view {
    display: none !important;
  }

  .cat-chips {
    flex-wrap: wrap !important;
    overflow: visible !important;
    padding-bottom: 2px;
    scroll-snap-type: none;
  }

  .cat-chips button {
    flex: 0 0 auto;
  }

  .cat-meta {
    gap: 10px;
  }

  .cat-meta .cat-sort,
  .cat-meta #catSort {
    flex: 1 1 100%;
    max-width: none;
  }

  .cat-seg button {
    padding: 9px 5px;
  }

  .cat-seg b {
    flex-direction: column;
    gap: 2px;
    font-size: .7rem;
    letter-spacing: .01em;
    white-space: nowrap;
  }

  .cat-seg b i {
    font-size: .68rem;
  }

  .cat-grid:not(.list) .cat-body h3,
  .cat-grid:not(.list) .cat-body .cat-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
  }

  .cat-empty .cat-fbtn {
    margin-top: 18px;
  }

  .cat-smart {
    display: flex;
    width: 100%;
    justify-content: center;
    margin: 12px 0 2px;
    padding: 11px 12px;
    text-align: center;
  }

  .cat-smart span {
    display: inline;
  }

  /* Сравнение: явно говорим, что таблица прокручивается */
  .cmp-mobile-hint {
    display: block !important;
  }

}

/* CTA «Умный подбор» в каталоге */
.cat-smart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 10px 15px;
  border: 1px solid rgba(212, 175, 55, .38);
  border-radius: 999px;
  background: rgba(212, 175, 55, .07);
  color: rgba(255, 255, 255, .76);
  font: 500 .82rem/1.3 'Montserrat', sans-serif;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease;
}

.cat-smart span {
  color: var(--gold);
  font-weight: 700;
}

.cat-smart:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, .14);
}

.bh-quiz {
  margin-top: 16px;
}

.hero-quiz {
  margin-top: 18px;
}

/* ---------------------------------------------------------------------
   3. Мобильная типографика и проектные страницы
   --------------------------------------------------------------------- */
@media (max-width: 480px) {
  .owners-title {
    font-size: clamp(1.95rem, 9.2vw, 2.45rem) !important;
    letter-spacing: -.045em !important;
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  /* На страницах проектов статистика больше не прижата к краю */
  .mz-stats {
    padding-left: 5% !important;
    padding-right: 5% !important;
  }

  .mz-stat {
    padding: 18px 12px !important;
  }

  .mz-stat:nth-child(odd) {
    padding-left: 0 !important;
  }

  .mz-stat:nth-child(even) {
    padding-right: 0 !important;
  }

  /* Закрываемые подсказки/кнопки в лайтбоксе */
  .mz-lb .x,
  .mz-lb .p,
  .mz-lb .n {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ---------------------------------------------------------------------
   4. Cookie, формы, сравнение
   --------------------------------------------------------------------- */

/* Визуально скрытый, но доступный скринридерам текст */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Контраст нумерации 01–06 на страницах проектов */
.mz-n {
  color: #8a8a93 !important;
}

/* Точки видео-карусели: визуально те же, но область нажатия ≥24px */
.vc-dot {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 24px !important;
  height: 24px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
}

.vc-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3a3a40;
  transition: all .3s ease;
}

.vc-dot:hover::before {
  background: #5a5a64;
}

.vc-dot.active::before {
  width: 24px;
  border-radius: 6px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}
.cookie-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.cookie-btn.cookie-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
}

.cookie-btn.cookie-btn-secondary:hover {
  background: rgba(255, 255, 255, .08);
}

@media (max-width: 768px) {
  .cookie-banner {
    flex-wrap: wrap;
  }

  .cookie-actions {
    width: 100%;
    justify-content: stretch;
  }

  .cookie-actions .cookie-btn {
    flex: 1 1 0;
    width: auto;
  }
}

/* Инлайн-ошибки форм */
.ux-field-error {
  margin: 6px 0 0;
  color: #ff8a8a;
  font: 500 .78rem/1.35 'Montserrat', sans-serif;
}

.ux-invalid,
[aria-invalid="true"] {
  border-color: rgba(255, 90, 90, .72) !important;
  box-shadow: 0 0 0 1px rgba(255, 90, 90, .24) !important;
}

.ux-invalid:focus,
[aria-invalid="true"]:focus {
  outline-color: #ff8a8a !important;
}

/* Подсказка в мобильном сравнении */
.cmp-mobile-hint {
  display: none;
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid rgba(212, 175, 55, .3);
  border-radius: 10px;
  background: rgba(212, 175, 55, .08);
  color: var(--gold);
  font: 600 .74rem/1.4 'Montserrat', sans-serif;
  letter-spacing: .02em;
}

/* ---------------------------------------------------------------------
   5. Страница умного подбора: минимальная шапка и выход на сайт
   --------------------------------------------------------------------- */
.pk-sitehead {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 10px clamp(16px, 5vw, 64px);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  background: rgba(10, 10, 12, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pk-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: #fff;
  font: 700 1.05rem/1 'Montserrat', sans-serif;
  letter-spacing: .14em;
  text-decoration: none;
}

.pk-brand b {
  color: var(--gold, #d4af37);
  font-weight: 700;
}

.pk-sitehead-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pk-sitehead-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  color: #d8d8dc;
  font: 600 .8rem 'Montserrat', sans-serif;
  text-decoration: none;
}

.pk-sitehead-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}

.pk-sitehead-nav .pk-sitehead-back {
  border: 1px solid rgba(212, 175, 55, .45);
  color: var(--gold, #d4af37);
}

.pk-sitehead-nav .pk-sitehead-back:hover {
  background: rgba(212, 175, 55, .12);
}

@media (max-width: 600px) {
  .pk-sitehead {
    min-height: 56px;
    padding: 8px 16px;
  }

  .pk-brand {
    font-size: .9rem;
  }

  .pk-sitehead-nav a:not(.pk-sitehead-back) {
    display: none;
  }

  .pk-sitehead-nav .pk-sitehead-back {
    min-height: 38px;
    padding: 0 11px;
    font-size: .72rem;
  }
}
