/* ============================================================
   CATALOG PAGE — отдельная страница со всеми проектами
   ============================================================ */

.catalog-page-body {
  background: #fafaf8;
  color: #0a0a0a;
  font-family: 'Inter', -apple-system, sans-serif;
}

.catalog-page {
  padding: clamp(100px, 14vh, 140px) 0 80px;
}

.catalog-page__container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

/* ─── Заголовок ─── */
.catalog-page__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  margin-bottom: clamp(32px, 5vh, 56px);
}

.catalog-page__back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  padding: 12px 22px;
  border: 1px solid rgba(10,10,10,0.12);
  border-radius: 999px;
  background: #fff;
  color: #0a0a0a;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .25s ease;
}
.catalog-page__back svg { width: 18px; height: 18px; transition: transform .25s ease; }
.catalog-page__back:hover { border-color: #0a0a0a; transform: translateX(-2px); }
.catalog-page__back:hover svg { transform: translateX(-3px); }

.catalog-page__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: center;
  margin: 0;
}

.catalog-page__counter {
  justify-self: end;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 22px;
  background: #fff;
  border: 1px solid rgba(10,10,10,0.08);
  border-radius: 999px;
  font-family: 'Unbounded', sans-serif;
  font-size: 0.9rem;
}
.catalog-page__counter #cpCount {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0a0a0a;
  background: #C5F056;
  padding: 2px 10px;
  border-radius: 999px;
}
.catalog-page__counter-label {
  color: #666;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

/* ─── Фильтры ─── */
.cp-filters {
  display: grid;
  grid-template-columns: auto auto auto minmax(200px, 1.2fr) minmax(200px, 1.2fr) auto;
  align-items: end;
  gap: 14px clamp(20px, 2vw, 28px);
  padding: clamp(18px, 2.6vw, 26px) clamp(18px, 2.6vw, 28px);
  background: #fff;
  border: 1px solid rgba(10,10,10,0.06);
  border-radius: 24px;
  box-shadow: 0 4px 30px rgba(10,10,10,0.04);
  margin-bottom: 24px;
}

.cp-filter { display: flex; flex-direction: column; gap: 10px; }
.cp-filter__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.cp-filter__label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
}
.cp-filter__values {
  font-family: 'Unbounded', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: #0a0a0a;
  white-space: nowrap;
}

/* ─── Чипы ─── */
.cp-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-chip {
  appearance: none;
  border: 1px solid rgba(10,10,10,0.14);
  background: #fff;
  color: #0a0a0a;
  padding: 9px 14px;
  border-radius: 999px;
  font: 500 0.82rem 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
}
.cp-chip:hover { border-color: #0a0a0a; }
.cp-chip.is-active {
  background: #0a0a0a;
  border-color: #0a0a0a;
  color: #fff;
}

/* ─── Range slider ─── */
.cp-filter--range { min-width: 0; }

.cp-range {
  position: relative;
  height: 36px;
  padding: 0 12px;
}
.cp-range__track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(10,10,10,0.08);
  border-radius: 2px;
  transform: translateY(-50%);
}
.cp-range__fill {
  position: absolute;
  top: 50%;
  height: 4px;
  background: #C5F056;
  border-radius: 2px;
  transform: translateY(-50%);
}
/*cp-range__thumb {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #C5F056;
  box-shadow: 0 2px 8px rgba(197,240,86,0.5);
  cursor: grab;
  transform: translate(-50%, -50%);
  transition: transform .15s ease, box-shadow .15s ease;
  padding: 0;
  z-index: 2;
}
.cp-range__thumb:hover { transform: translate(-50%, -50%) scale(1.1); }
.cp-range__thumb:active,
.cp-range__thumb.is-dragging {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 4px 14px rgba(197,240,86,0.7);
}
.cp-range__thumb:focus-visible {
  outline: 3px solid rgba(197,240,86,0.6);
  outline-offset: 2px;
}
*/

.cp-range__thumb {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #C5F056;
  border: 3px solid #0a0a0a;
  box-shadow: 0 2px 8px rgba(10,10,10,0.15);
  cursor: grab;
  transform: translate(-50%, -50%);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  padding: 0;
  z-index: 2;
}
.cp-range__thumb:hover {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 4px 14px rgba(10,10,10,0.25);
}
.cp-range__thumb:active,
.cp-range__thumb.is-dragging {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 6px 20px rgba(197,240,86,0.6), 0 0 0 6px rgba(197,240,86,0.2);
}
.cp-range__thumb:focus-visible {
  outline: 3px solid rgba(10,10,10,0.4);
  outline-offset: 2px;
}
/* ─── Сброс ─── */
.cp-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid rgba(10,10,10,0.14);
  border-radius: 999px;
  background: #fff;
  color: #0a0a0a;
  font: 500 0.88rem 'Inter', sans-serif;
  cursor: pointer;
  transition: all .25s ease;
  height: fit-content;
}
.cp-reset svg { width: 16px; height: 16px; }
.cp-reset:hover { border-color: #0a0a0a; background: #0a0a0a; color: #fff; }

/* ─── Тулбар сортировки ─── */
.cp-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}
.cp-sort { position: relative; }
.cp-sort__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1px solid rgba(10,10,10,0.12);
  border-radius: 999px;
  background: #fff;
  color: #0a0a0a;
  font: 500 0.88rem 'Inter', sans-serif;
  cursor: pointer;
  transition: all .25s ease;
}
.cp-sort__btn svg { width: 16px; height: 16px; transition: transform .25s ease; }
.cp-sort__btn:hover { border-color: #0a0a0a; }
.cp-sort.is-open .cp-sort__btn svg { transform: rotate(180deg); }

.cp-sort__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  list-style: none;
  margin: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(10,10,10,0.08);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(10,10,10,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 50;
}
.cp-sort.is-open .cp-sort__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.cp-sort__option {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background .15s ease;
}
.cp-sort__option:hover { background: rgba(197,240,86,0.25); }
.cp-sort__option.is-active { background: #C5F056; color: #0a0a0a; font-weight: 600; }

/* ─── Сетка карточек ─── */
.cp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 2.5vw, 32px);
}

/* ─── Пустой результат ─── */
.cp-empty {
  text-align: center;
  padding: 80px 20px;
  color: #666;
}
.cp-empty p {
  font-size: 1.1rem;
  margin: 0 0 20px;
}
.cp-empty__btn {
  padding: 12px 28px;
  border: 1px solid #0a0a0a;
  border-radius: 999px;
  background: #0a0a0a;
  color: #fff;
  font: 500 0.9rem 'Inter', sans-serif;
  cursor: pointer;
  transition: all .25s ease;
}
.cp-empty__btn:hover { background: transparent; color: #0a0a0a; }

/* ─── Адаптив ─── */
@media (max-width: 1200px) {
  .cp-filters { grid-template-columns: repeat(3, 1fr); }
  .cp-reset { grid-column: 1 / -1; justify-self: end; }
  .cp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .catalog-page { padding: 90px 0 60px; }

  .catalog-page__header {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 16px;
  }
  .catalog-page__back,
  .catalog-page__counter { justify-self: center; }

  /* Фильтры: 2 колонки */
  .cp-filters {
    grid-template-columns: 1fr 1fr;
    padding: 20px;
    border-radius: 18px;
    gap: 18px 14px;
  }

  /* Порядок: Этажность (1) и Спальни (2) - первая строка
     дальше Терраса, Площадь, Цена, Сброс - на всю ширину */
  .cp-filters > .cp-filter:nth-child(1) { order: 1; grid-column: span 1; } /* Этажность */
  .cp-filters > .cp-filter:nth-child(3) { order: 2; grid-column: span 1; } /* Спальни */
  .cp-filters > .cp-filter:nth-child(2) { order: 3; grid-column: 1 / -1; } /* Терраса */
  .cp-filters > .cp-filter:nth-child(4) { order: 4; grid-column: 1 / -1; } /* Площадь */
  .cp-filters > .cp-filter:nth-child(5) { order: 5; grid-column: 1 / -1; } /* Цена */
  .cp-filters > .cp-reset               { order: 6; grid-column: 1 / -1; justify-self: stretch; justify-content: center; }

  .cp-grid { grid-template-columns: 1fr; }
  .cp-toolbar { justify-content: stretch; }
  .cp-sort, .cp-sort__btn { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
