/* ═══════════════════════════════════════════════════════════════
   КАЛЬКУЛЯТОР СТОИМОСТИ ДОМА — модальное окно
   Все стили и переменные заскоплены в .calc-overlay,
   чтобы не пересекаться с глобальными :root / .btn сайта.
   ═══════════════════════════════════════════════════════════════ */

.calc-overlay {
  /* Локальные токены калькулятора (не выходят за пределы окна) */
  --bg: oklch(97.5% 0.008 75);
  --text: oklch(16% 0.012 55);
  --text-muted: oklch(48% 0.010 55);
  --accent: oklch(60% 0.115 52);
  --accent-hover: oklch(54% 0.115 52);
  --accent-soft: oklch(60% 0.115 52 / 0.08);
  --border: oklch(88% 0.010 70);
  --white: oklch(99% 0.004 75);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --r: 2px;

  position: fixed; inset: 0; z-index: 1000;
  background: oklch(14% 0.010 60 / 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 4vh, 40px) clamp(12px, 4vw, 40px);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  font-family: var(--font-body); color: var(--text);
}
.calc-overlay.is-open { opacity: 1; pointer-events: auto; visibility: visible; }

/* Контейнерный сброс — только внутри окна */
.calc-overlay, .calc-overlay *, .calc-overlay *::before, .calc-overlay *::after { box-sizing: border-box; }
.calc-overlay :where(h2, h3, p, ul, li) { margin: 0; }
.calc-overlay :where(ul) { list-style: none; padding: 0; }
.calc-overlay button { cursor: pointer; font-family: var(--font-body); border: none; background: none; color: inherit; }
.calc-overlay a { color: inherit; text-decoration: none; }

.calc {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 100%;
  background: var(--white);
  border-radius: var(--r);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px oklch(14% 0.010 60 / 0.30);
  transform: translateY(16px) scale(0.985);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.calc-overlay.is-open .calc { transform: none; }

/* ── Кнопки калькулятора (.calc-btn — не конфликтуют с .btn сайта) ── */
.calc-overlay .calc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: var(--r); transition: background 0.2s, transform 0.15s, color 0.2s, border-color 0.2s;
}
.calc-overlay .calc-btn--primary { padding: 0.85rem 1.8rem; background: var(--text); color: var(--white); }
.calc-overlay .calc-btn--primary:hover { background: var(--accent); transform: translateY(-1px); }
.calc-overlay .calc-btn--outline { padding: 0.85rem 1.8rem; border: 1.5px solid var(--text); color: var(--text); }
.calc-overlay .calc-btn--outline:hover { background: var(--text); color: var(--white); }
.calc-overlay .calc-btn--accent { padding: 1rem 1.8rem; background: var(--accent); color: var(--white); }
.calc-overlay .calc-btn--accent:hover { background: var(--accent-hover); transform: translateY(-1px); }
.calc-overlay .calc-btn--ghost { padding: 1rem 1.8rem; border: 1.5px solid var(--border); color: var(--text); }
.calc-overlay .calc-btn--ghost:hover { border-color: var(--text); }
.calc-overlay .calc-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ── HEADER ── */
.calc__head { padding: 1.5rem 1.6rem 1.2rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.calc__head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.calc__kicker {
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.5rem;
}
.calc__title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 500; line-height: 1.05; }
.calc__close {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); color: var(--text-muted);
  transition: all 0.2s; margin: -4px -4px 0 0;
}
.calc__close:hover { background: var(--text); color: var(--white); border-color: var(--text); }

.calc__progress { margin-top: 1.2rem; }
.calc__progress-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.calc__step-label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted); }
.calc__step-name { font-size: 0.74rem; font-weight: 600; color: var(--text); }
.calc__bar { height: 3px; background: var(--border); border-radius: 100px; overflow: hidden; }
.calc__bar-fill { height: 100%; background: var(--accent); border-radius: 100px; width: 25%; transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1); }

/* ── BODY ── */
.calc__body { padding: 1.6rem; overflow-y: auto; flex: 1; }
.calc__step { display: none; animation: calcStepIn 0.32s ease; }
.calc__step.is-active { display: block; }
@keyframes calcStepIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.step__q { font-family: var(--font-display); font-size: 1.32rem; font-weight: 500; line-height: 1.15; margin-bottom: 0.35rem; }
.step__hint { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 1.3rem; }

/* Площадь */
.area-value { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 1rem; }
.area-input {
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 500; line-height: 1;
  width: 4.5ch; background: transparent; border: none; outline: none; color: var(--text);
  border-bottom: 1.5px solid var(--border); text-align: left; padding-bottom: 2px;
  transition: border-color 0.2s;
}
.area-input:focus { border-color: var(--accent); }
.area-unit { font-family: var(--font-display); font-size: 1.6rem; color: var(--text-muted); }
.area-slider { width: 100%; margin: 0.4rem 0 0.4rem; }
.calc-overlay input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px;
  background: var(--border); border-radius: 100px; outline: none;
}
.calc-overlay input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 3px solid var(--white);
  box-shadow: 0 1px 6px oklch(14% 0.010 60 / 0.25); transition: transform 0.12s;
}
.calc-overlay input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.12); }
.calc-overlay input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  cursor: pointer; border: 3px solid var(--white); box-shadow: 0 1px 6px oklch(14% 0.010 60 / 0.25);
}
.area-scale { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.5rem 0.95rem; border: 1px solid var(--border); border-radius: 100px;
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted); transition: all 0.18s;
}
.chip:hover { border-color: var(--text); color: var(--text); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* Карточки выбора */
.opts { display: flex; flex-direction: column; gap: 0.6rem; }
.opt {
  display: flex; align-items: center; gap: 1rem; text-align: left; width: 100%;
  padding: 1rem 1.1rem; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--white); transition: all 0.18s;
}
.opt:hover { border-color: var(--text-muted); }
.opt.is-active { border-color: var(--accent); background: var(--accent-soft); }
.opt__mark {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.opt.is-active .opt__mark { border-color: var(--accent); }
.opt.is-active .opt__mark::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.opt__body { flex: 1; }
.opt__name { display: block; font-size: 0.95rem; font-weight: 600; line-height: 1.2; }
.opt__desc { display: block; font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; margin-top: 0.25rem; }
.opt__price { flex-shrink: 0; font-size: 0.78rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.opt__badge { flex-shrink: 0; font-size: 0.7rem; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ── FOOTER степпера ── */
.calc__foot {
  flex-shrink: 0; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1.6rem;
  background: var(--bg);
}
.calc__estimate { flex: 1; min-width: 0; }
.calc__estimate-label { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.calc__estimate-val { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.05; white-space: nowrap; }
.calc__estimate-val .upd { transition: opacity 0.15s; }
.calc__foot-btns { display: flex; gap: 0.6rem; flex-shrink: 0; }
.calc__foot .calc-btn { font-size: 0.72rem; }
.calc__foot .calc-btn--outline, .calc__foot .calc-btn--primary, .calc__foot .calc-btn--accent { padding: 0.8rem 1.4rem; }

/* ── ЭКРАН РЕЗУЛЬТАТА ── */
.result { display: none; }
.result.is-active { display: block; animation: calcStepIn 0.32s ease; }
.result__hero { text-align: center; padding: 0.4rem 0 1.4rem; border-bottom: 1px solid var(--border); margin-bottom: 1.4rem; }
.result__label { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 0.6rem; }
.result__big { font-family: var(--font-display); font-size: clamp(2.6rem, 9vw, 3.4rem); font-weight: 500; line-height: 0.98; }
.result__range { font-size: 0.92rem; color: var(--text-muted); margin-top: 0.5rem; }
.result__range b { color: var(--text); font-weight: 600; }
.result__meta {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.9rem;
  font-size: 0.74rem; color: var(--text-muted);
}
.result__meta span { display: inline-flex; align-items: center; gap: 0.5rem; }
.result__meta span:not(:first-child)::before { content: '·'; color: var(--border); margin-right: 0.5rem; }

.result__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 1.4rem; }
.result__col { background: var(--white); padding: 1rem 1.1rem; }
.result__col-label { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.35rem; }
.result__col-val { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.result__col-val small { font-size: 0.9rem; color: var(--text-muted); }

.result__includes { margin-bottom: 1.3rem; }
.result__includes-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.7rem; }
.result__includes ul { display: flex; flex-direction: column; gap: 0.5rem; }
.result__includes li { font-size: 0.88rem; line-height: 1.45; display: flex; gap: 0.6rem; }
.result__includes li::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 0.5rem; }

.result__region { margin-bottom: 1.3rem; }
.result__region-label { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.55rem; }
.seg { display: flex; gap: 0.5rem; }
.seg button {
  flex: 1; padding: 0.7rem; border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); transition: all 0.18s;
}
.seg button.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

.disclaimer {
  font-size: 0.74rem; color: var(--text-muted); line-height: 1.55;
  background: var(--bg); border-left: 2px solid var(--accent); padding: 0.8rem 1rem;
  border-radius: 0 var(--r) var(--r) 0; margin-bottom: 1.4rem;
}

/* ── ЛИД-ФОРМА ── */
.lead { border-top: 1px solid var(--border); padding-top: 1.4rem; }
.lead__title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; margin-bottom: 0.3rem; }
.lead__sub { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; }
.lead__fields { display: flex; flex-direction: column; gap: 0.6rem; }
.field label { display: block; font-size: 0.72rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.35rem; }
.field input[type="text"], .field input[type="tel"] {
  width: 100%; font-family: var(--font-body); font-size: 0.95rem;
  padding: 0.85rem 1rem; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--white); color: var(--text); outline: none; transition: border-color 0.18s;
}
.field input:focus { border-color: var(--accent); }
.field input.is-error { border-color: oklch(55% 0.17 25); }
.field__err { font-size: 0.72rem; color: oklch(52% 0.17 25); margin-top: 0.3rem; display: none; }
.field.has-error .field__err { display: block; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.76rem; color: var(--text-muted); line-height: 1.5; margin-top: 0.3rem; }
.consent input { margin-top: 0.15rem; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.consent a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.calc-overlay .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lead__actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.1rem; }
.lead__actions .calc-btn { width: 100%; }
.lead__status { font-size: 0.84rem; line-height: 1.5; margin-top: 0.8rem; text-align: center; min-height: 1.2em; }
.lead__status.ok { color: oklch(52% 0.12 150); font-weight: 600; }
.lead__status.err { color: oklch(52% 0.17 25); font-weight: 600; }
.calc-overlay .calc-spinner { width: 14px; height: 14px; border: 2px solid oklch(99% 0.004 75 / 0.4); border-top-color: var(--white); border-radius: 50%; animation: calcSpin 0.7s linear infinite; }
@keyframes calcSpin { to { transform: rotate(360deg); } }

/* ── УСПЕХ ── */
.success { display: none; text-align: center; padding: 2rem 1rem; }
.success.is-active { display: block; animation: calcStepIn 0.32s ease; }
.success__icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.2rem; }
.success__title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 500; margin-bottom: 0.6rem; }
.success__text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; max-width: 360px; margin: 0 auto 1.5rem; }

@media (max-width: 560px) {
  .calc-overlay { padding: 0; align-items: stretch; }
  .calc { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .calc__title { font-size: 1.45rem; }
  .calc__foot { flex-wrap: wrap; }
  .calc__estimate { flex-basis: 100%; }
  .calc__foot-btns { width: 100%; }
  .calc__foot-btns .calc-btn { flex: 1; }
  .result__cols { grid-template-columns: 1fr; }
}
