/* ==========================================================================
   SanDez Control — pages.css
   Специфика отдельных блоков: калькулятор, «Почему не помогают», CTA-секция.
   ========================================================================== */

/* ---------- Калькулятор --------------------------------------------------- */

.calc {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: clamp(24px, 4vw, 48px);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.calc::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 60%;
  aspect-ratio: 1;
  background: radial-gradient(circle, var(--accent-soft), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.calc__inner { position: relative; z-index: 1; }

.calc__progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 32px;
}

.calc__progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.calc__progress-bar.is-active { background: var(--accent); }
/* done-сегмент — бирюзовый (была мятная --trust, выпадал из палитры). */
.calc__progress-bar.is-done { background: var(--cta-teal); }

.calc__step {
  display: none;
}
.calc__step.is-active {
  display: block;
  animation: calc-in var(--dur-base) var(--ease) both;
}

@keyframes calc-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.calc__step-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.calc__q {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 24px;
  text-wrap: balance;
}

.calc__options {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
/* КРИТИЧНО: без этого правила HTML-атрибут [hidden] перебивается
   `display: grid` выше, и второй (скрытый) контейнер вариантов остаётся
   кликабельным — пользователь, выбрав «частный дом», может попасть в
   апартментный «3-комнатная», state корраптится (roomType='house' +
   roomSize='3') и getPrice не находит цену. Эта строка возвращает hidden
   свою силу. */
.calc__options[hidden] { display: none; }
@media (min-width: 640px) {
  .calc__options { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (min-width: 1024px) {
  .calc__options--3 { grid-template-columns: repeat(3, 1fr); }
}

.calc__actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.calc__actions .btn { flex: 1 1 auto; min-width: 120px; }

.calc__phone-field { max-width: 480px; }

/* Результат */
.calc-result {
  display: none;
  background: var(--bg);
  border-radius: var(--r-xl);
  padding: clamp(24px, 4vw, 48px);
  border: 1.5px solid var(--accent);
  position: relative;
  overflow: hidden;
}
.calc-result.is-active {
  display: block;
  animation: calc-in var(--dur-slow) var(--ease-spring) both;
}

.calc-result__grid {
  display: grid;
  /* На мобилке gap = тот же отступ что cta margin-top — баночка
     визуально по центру между списком параметров и кнопками. */
  gap: 24px;
  align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .calc-result__grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

/* Подсветка-карточка вокруг лейбла + цены: визуально это самый важный
   элемент результата, ему нужен «вес» — мягкий accent-soft фон с
   нормальным паддингом, отдельная карточка внутри карточки. */
.calc-result__price-card {
  background: var(--accent-soft);
  border-radius: var(--r-lg);
  padding: clamp(20px, 4vw, 28px) clamp(20px, 4vw, 28px);
  text-align: center;
  margin-bottom: 4px;
}
@media (min-width: 768px) {
  .calc-result__price-card { text-align: left; }
}

.calc-result__label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.calc-result__price {
  /* flex + baseline — «от», число и «₸» сидят на одной базовой линии,
     даже при разных размерах шрифта. */
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.15em;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Само число — полный размер, наследует от родителя */
.calc-result__price [data-result-price] {
  font-size: inherit;
  color: inherit;
}

/* «от» и «₸» — приглушённые и заметно меньше числа */
.calc-result__price-from,
.calc-result__price > span:last-child {
  font-size: 0.42em;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0;
}

.calc-result__list {
  display: flex;
  flex-direction: column;
  margin-top: 24px;
  font-size: 0.9375rem;
}

/* Каждая строка с тонким разделителем сверху — карточка читается как
   аккуратная таблица параметров, а не «слепленный» абзац. */
.calc-result__row {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
}
.calc-result__row:last-child {
  border-bottom: 1px solid var(--border);
}

.calc-result__list dt {
  flex-shrink: 0;
  min-width: 130px;
  color: var(--ink-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.calc-result__list dd {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  margin-left: auto;
}

@media (min-width: 640px) {
  .calc-result__list dd {
    text-align: left;
    margin-left: 0;
  }
}

.calc-result__media {
  aspect-ratio: 1;
  max-width: 320px;
  margin-inline: auto;
}
@media (max-width: 767px) {
  /* Баночка крупнее (260px вместо 220), без своих margin — отступы
     сверху и снизу контролируются ОДНИМ значением (24px = grid-gap +
     cta margin-top). Это даёт визуальную центровку: воздух от списка
     параметров до банки = воздух от банки до кнопки. */
  .calc-result__media {
    max-width: 260px;
    margin-top: 0;
    margin-bottom: 0;
  }
}

.calc-result__cta {
  /* Синхронизировано с .calc-result__grid gap — баночка центрирована
     между списком параметров и кнопками. */
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
@media (min-width: 768px) {
  .calc-result__cta { margin-top: 16px; }
}

/* Mobile: обе кнопки во всю ширину столбиком, заявка-WhatsApp в одну строку.
   Уменьшаем padding и шрифт у .btn--lg, чтобы «Отправить заявку в WhatsApp»
   помещалось без переноса даже на 360-градусных экранах. */
@media (max-width: 639px) {
  .calc-result__cta {
    flex-direction: column;
    align-items: stretch;
  }
  .calc-result__cta .btn { width: 100%; }
  .calc-result__cta .btn--lg {
    padding: 14px 16px;
    min-height: 56px;
    font-size: 0.9375rem;
    white-space: nowrap;
    gap: 8px;
  }
}

.calc-result__hint {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.55;
}

/* Trust-список после калькулятора.
   3 пункта — помещаются в одну строку на планшете/десктопе без переносов
   (раньше было 4 пункта и они ломались на две строки неравномерно). */
.calc-trust {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 24px;
  padding: 20px 24px;
  /* Мягкий бирюзовый фон + бирюзовый текст — той же палитры, что live-плашка
     наверху и WhatsApp-кнопки. Раньше был мятный «гарантия»-зелёный
     (var(--trust-soft)/var(--trust)), он бил по глазам кислотностью на
     лендинге, где доминирует тёплый оранжевый акцент. */
  background: var(--cta-teal-soft);
  border-radius: var(--r-lg);
}
@media (min-width: 640px) { .calc-trust { grid-template-columns: repeat(3, 1fr); } }

.calc-trust li {
  display: flex;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--cta-teal);
  font-weight: 500;
  line-height: 1.4;
  align-items: center;
}
.calc-trust .icon { flex-shrink: 0; width: 18px; height: 18px; }

/* ---------- «Почему не помогают» ----------------------------------------- */

.diy {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .diy { grid-template-columns: repeat(3, 1fr); gap: 28px; } }

.diy__item {
  position: relative;
  padding: 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diy__num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.diy__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.diy__text {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.diy__text strong {
  color: var(--ink);
  font-weight: 600;
}

.diy-dontlist {
  margin-top: 32px;
  padding: 24px 28px;
  background: var(--accent-soft);
  border-radius: var(--r-lg);
  border-left: 4px solid var(--accent);
}
.diy-dontlist h3 {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  margin-bottom: 12px;
}
.diy-dontlist ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.diy-dontlist li {
  position: relative;
  padding-left: 28px;
  font-size: 0.9375rem;
  color: var(--ink);
  line-height: 1.5;
}
.diy-dontlist li::before {
  content: '×';
  position: absolute;
  left: 0; top: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--error);
  color: #FFF;
  font-weight: 700;
  font-size: 0.875rem;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ---------- Guarantee section -------------------------------------------- */

.guarantee {
  display: grid;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .guarantee { grid-template-columns: 1fr 1fr; } }

.guarantee__visual {
  aspect-ratio: 3 / 4;
  max-width: 520px;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--r-lg);
}

.guarantee__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.guarantee__list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
}

.guarantee__list .icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  padding: 4px;
  border-radius: 50%;
  background: var(--trust);
  color: #FFF;
}

.guarantee__zero {
  margin-top: 24px;
  padding: 24px;
  background: var(--bg-soft);
  border-radius: var(--r-lg);
}

.guarantee__zero h4 {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  margin-bottom: 12px;
}

.guarantee__zero-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
  font-size: 0.9375rem;
}

.guarantee__zero-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--r-md);
  color: var(--ink-soft);
}
.guarantee__zero-list li span { color: var(--ink); font-weight: 600; }

/* ---------- Final CTA (dark) --------------------------------------------- */

.final-cta {
  position: relative;
  background: var(--bg-dark);
  color: var(--bg);
  padding-block: clamp(56px, 8vw, 112px);
  overflow: hidden;
}

.final-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(238, 92, 52, 0.22), transparent 60%);
  pointer-events: none;
}

.final-cta__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--bg);
  max-width: 20ch;
  margin-bottom: 20px;
}

.final-cta__sub {
  font-size: clamp(1rem, 1.3vw, 1.1875rem);
  color: var(--ink-muted);
  max-width: 60ch;
  line-height: 1.55;
  margin-bottom: 40px;
}

.final-cta__buttons {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  /* max-width 1080 — обеспечивает, что в каждой колонке хватает места
     на «Написать в WhatsApp» и «Позвонить сейчас» без переноса в 2 строки.
     Раньше было 880px, и заголовок WhatsApp-кнопки ломался. */
  max-width: 1080px;
}
@media (min-width: 640px) { .final-cta__buttons { grid-template-columns: repeat(3, 1fr); gap: 16px; } }

.final-cta__btn {
  padding: 24px 28px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--bg);
  transition: all var(--dur-fast) var(--ease);
  min-height: 80px;
  font-weight: 600;
  font-size: 1.0625rem;
}
@media (hover: hover) {
  .final-cta__btn:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
  }
}

.final-cta__btn-icon {
  width: 48px; aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.final-cta__btn--call .final-cta__btn-icon { background: var(--accent); color: #FFF; }
.final-cta__btn--wa .final-cta__btn-icon   { background: var(--wa-brand); color: #FFF; }
.final-cta__btn--tg .final-cta__btn-icon   { background: #0088CC; color: #FFF; }

.final-cta__btn-text {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  min-width: 0;
}
/* Заголовок кнопки в одну строку: «Написать в WhatsApp» / «Позвонить сейчас»
   могли переноситься на узких десктопах. nowrap гарантирует одну строку,
   а max-width buttons выше даёт нужный запас по ширине. */
.final-cta__btn-text span:first-child { white-space: nowrap; }
.final-cta__btn-text span:last-child {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.final-cta__note {
  margin-top: 40px;
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.55;
  max-width: 60ch;
}

/* ---------- Overlay (WhatsApp открыт) ------------------------------------ */

/* Принудительное центрирование по обеим осям: position: fixed + inset: 0 +
   margin: auto. Не полагаемся на UA-defaults для <dialog>:modal, потому что
   в некоторых движках они конфликтуют с author-стилями (max-width/padding) и
   диалог уезжает в верхний-левый угол. Фиксим explicitly. */
.overlay {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 0;
  max-width: 460px;
  width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  /* Компактные симметричные отступы — карточка не «дышит» лишним
     воздухом по краям. */
  padding: 24px clamp(24px, 5vw, 36px);
  background: var(--bg);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  text-align: center;
  overflow-y: auto;
}
.overlay::backdrop { background: rgba(26, 24, 21, 0.6); backdrop-filter: blur(6px); }

.overlay__media {
  /* Картинка крупнее — насекомое читается. */
  width: clamp(180px, 42vw, 240px);
  aspect-ratio: 1;
  /* margin-bottom РАВЕН padding-top карточки (24px) — расстояние от
     верха карточки до головы насекомого = расстояние от его ног до
     заголовка «WhatsApp открыт». Идеальная центровка по вертикали. */
  margin: 0 auto 24px;
}

.overlay__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.2;
}

.overlay__text {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

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

/* ---------- Section: How we work (с фото этапов) ------------------------- */

.process__intro {
  font-size: 1.0625rem;
  color: var(--ink-soft);
  max-width: 60ch;
  line-height: 1.55;
  margin-bottom: 32px;
}

/* ---------- After (финальная секция таймлайна) --------------------------- */

.after-visual {
  margin-top: 48px;
  border-radius: var(--r-xl);
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  /* Mobile: aspect 4/3 — картинка выше, не вытянутая ленточкой. */
  aspect-ratio: 4 / 3;
}
@media (min-width: 768px) {
  .after-visual {
    /* Desktop/tablet: компактнее ширины и не уходит на всю секцию.
       max-width центрирует визуал в контейнере, max-height ограничивает
       растяжение по высоте. */
    aspect-ratio: 16 / 9;
    max-width: 720px;
    max-height: 360px;
    margin-inline: auto;
  }
}

/* ---------- 404 ---------------------------------------------------------- */

.page-404 {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  text-align: center;
}

.page-404 h1 {
  font-size: clamp(5rem, 18vw, 12rem);
  color: var(--accent);
  line-height: 1;
  margin-bottom: 16px;
}

.page-404 p {
  font-size: 1.125rem;
  color: var(--ink-soft);
  margin-bottom: 32px;
  max-width: 40ch;
}
