/* ================================================================
   НеустойкА.pro — раздел «Площадь»
   Общие стили. Подключать один раз на страницах /ploshchad/*
   ================================================================ */

:root {
  --ink: #101418;
  --ink-soft: #3d4650;
  --muted: #6b7683;
  --line: #e4e8ee;
  --line-strong: #cfd6df;
  --bg: #ffffff;
  --bg-soft: #f7f9fb;
  --bg-tint: #f1f5fa;

  --accent: #c8322b;
  --accent-hover: #a82822;
  --accent-soft: #fdf4f3;

  --good: #0a7a4a;
  --good-bg: #eaf7f0;
  --good-line: #b7dfc8;

  --warn: #8a5a00;
  --warn-bg: #fdf5e6;
  --warn-line: #e8d5a8;

  --bad: #a3251e;
  --bad-bg: #fdedec;
  --bad-line: #f0cfcc;

  --blue: #2f6fd0;
  --blue-bg: #eef4fd;
  --blue-line: #c4d8f5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 20, 24, .04), 0 8px 24px -12px rgba(16, 20, 24, .12);
  --maxw: 780px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- сетка ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; overflow-x: clip; }
.wrap--wide { max-width: 980px; }
main { padding: 8px 0 80px; }

/* ---------- крошки ---------- */
.crumbs { padding: 14px 20px 0; max-width: var(--maxw); margin: 0 auto; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---------- типографика ---------- */
h1 {
  font-size: clamp(27px, 4.2vw, 40px);
  line-height: 1.14;
  letter-spacing: -.022em;
  font-weight: 750;
  margin: 18px 0 16px;
  text-wrap: balance;
}
h2 {
  font-size: clamp(21px, 2.8vw, 28px);
  line-height: 1.22;
  letter-spacing: -.015em;
  font-weight: 700;
  margin: 48px 0 14px;
  text-wrap: balance;
}
h3 { font-size: 19px; line-height: 1.3; font-weight: 680; margin: 30px 0 10px; }
p { margin: 0 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
strong, b { font-weight: 650; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* формула-блок: переносится по строкам, а не вылезает за экран */
blockquote code {
  display: inline-block;
  padding: 8px 12px;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}
blockquote {
  margin: 22px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--line-strong);
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-size: .97em;
}
blockquote p:last-child { margin-bottom: 0; }

/* ---------- лид-ответ (для ИИ и для человека) ---------- */
.answer {
  background: var(--blue-bg);
  border: 1px solid var(--blue-line);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px;
  margin: 26px 0 34px;
}
.answer p { margin: 0; font-size: 16.5px; color: #1b2b3d; }
.answer strong { color: #0d1b2a; }

/* ---------- таблицы ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 22px 0; }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
/* на узких экранах таблица скроллится внутри себя, страница — нет */
@media (max-width: 620px) {
  table { min-width: 0; font-size: 14.5px; }
  th, td { padding: 9px 8px; }
  th { font-size: 11.5px; }
  .table-scroll { margin-left: 0; margin-right: 0; overflow-x: auto; }
}
caption { caption-side: bottom; text-align: left; padding-top: 10px; font-size: 13.5px; color: var(--muted); }
th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--line-strong);
  vertical-align: bottom;
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfdfe; }
.table--key td:first-child { font-weight: 560; width: 38%; }
.num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* маркеры в таблицах */
.tag { display: inline-block; font-size: 13px; font-weight: 650; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.tag--yes { background: var(--good-bg); color: var(--good); border: 1px solid var(--good-line); }
.tag--no { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }
.tag--may { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.tag--flat { background: var(--bg-tint); color: var(--muted); border: 1px solid var(--line); }

/* ---------- врезки ---------- */
.callout {
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 26px 0;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.callout p:last-child { margin-bottom: 0; }
.callout__title { font-weight: 680; margin: 0 0 8px; font-size: 16px; }
.callout--warn { background: var(--warn-bg); border-color: var(--warn-line); }
.callout--warn .callout__title { color: var(--warn); }
.callout--good { background: var(--good-bg); border-color: var(--good-line); }
.callout--good .callout__title { color: var(--good); }
.callout--bad { background: var(--bad-bg); border-color: var(--bad-line); }
.callout--bad .callout__title { color: var(--bad); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s, transform .1s, box-shadow .15s;
  cursor: pointer;
}
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(200, 50, 43, .22); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:active { transform: translateY(1px); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--muted); }
.btn--block { display: flex; width: 100%; }

/* ---------- CTA-блок ---------- */
.cta-box {
  background: linear-gradient(180deg, #fffaf9 0%, var(--accent-soft) 100%);
  border: 1px solid #f3d9d6;
  border-radius: 16px;
  padding: 28px;
  margin: 44px 0;
  box-shadow: var(--shadow);
}
.cta-box h2 { margin: 0 0 10px; font-size: 22px; }
.cta-box p { color: var(--ink-soft); font-size: 15.5px; }
.cta-box .btn { margin-top: 6px; }
.cta-box__meta { font-size: 13.5px; color: var(--muted); margin-top: 12px; }

/* ---------- шаги ---------- */
.steps { display: grid; gap: 16px; margin: 26px 0; }
@media (min-width: 700px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; background: var(--bg-soft); }
.step__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700; margin-bottom: 12px;
}
.step h3 { margin: 0 0 8px; font-size: 16.5px; }
.step p { font-size: 14.5px; color: var(--muted); margin: 0 0 12px; }
.step a { font-size: 14.5px; font-weight: 620; text-decoration: none; }
.step a:hover { text-decoration: underline; }

/* ---------- карточки-ссылки ---------- */
.cards { display: grid; gap: 14px; margin: 24px 0; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card__title { font-weight: 650; font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.card__desc { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- списки ---------- */
ul, ol { padding-left: 22px; }
li { margin-bottom: 8px; }
.checklist { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding-left: 30px; margin-bottom: 10px; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--line-strong); background: #fff;
}

/* ---------- FAQ ---------- */
.faq { margin: 24px 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 16px 34px 16px 0; font-weight: 620; font-size: 16px;
  list-style: none; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 8px; top: 24px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); top: 26px; }
.faq details > *:not(summary) { font-size: 15.5px; color: var(--ink-soft); }
.faq details p { margin: 0 0 16px; }

/* ---------- мета-строка ---------- */
.meta { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; }
.meta__dot { color: var(--line-strong); }

/* ---------- источники ---------- */
.sources {
  margin-top: 40px; padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--muted); line-height: 1.7;
}
.sources__title { font-weight: 650; color: var(--ink-soft); margin-bottom: 6px; }
.sources ol { padding-left: 20px; margin: 0; }
.sources li { margin-bottom: 5px; }

/* ---------- вывод ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- инлайн-блок приёмки ---------- */
.install-check {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  margin: 36px 0;
  background: #fff;
  box-shadow: var(--shadow);
}
.install-check h3 { margin-top: 0; }
.install-check__list { list-style: none; padding: 0; margin: 18px 0; }
.install-check__list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px dashed var(--line);
  font-size: 15.5px;
}
.install-check__list li:last-child { border-bottom: none; }
.install-check__list .mark {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg-tint); border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted);
  margin-top: 2px;
}
.install-check__note {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm); padding: 14px 18px; font-size: 14.5px; color: #5f4300;
  margin: 18px 0;
}

/* ---------- печать ---------- */
@media print {
  .btn, .cta-box, nav { display: none; }
  body { font-size: 12pt; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
}

/* ================================================================
   Калькулятор площади — форма и карточка результата
   ================================================================ */
.calc-form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 0 0 18px;
  background: var(--bg-soft);
}
.calc-form legend {
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 0 8px;
}
.calc-form label {
  display: block;
  font-size: 14px;
  font-weight: 560;
  color: var(--ink-soft);
  margin: 16px 0 6px;
}
.calc-form label:first-of-type { margin-top: 6px; }
.calc-form .opt { font-weight: 400; color: var(--muted); font-size: 13px; }
.calc-form input[type="text"],
.calc-form select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.calc-form input[type="text"]:focus,
.calc-form select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 208, .12);
}
.calc-form small { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.calc-form details { margin: 18px 0; }
.calc-form summary {
  cursor: pointer; font-weight: 600; font-size: 15px;
  padding: 12px 0; list-style: none;
}
.calc-form summary::-webkit-details-marker { display: none; }
.calc-form summary::before { content: "▸ "; color: var(--muted); }
.calc-form details[open] summary::before { content: "▾ "; }
.calc-form button[type="submit"] {
  width: 100%; padding: 15px 24px; font-size: 16px; font-weight: 650;
  color: #fff; background: var(--accent); border: none; border-radius: 10px;
  cursor: pointer; transition: background .15s;
}
.calc-form button[type="submit"]:hover { background: var(--accent-hover); }
.calc-form .privacy { font-size: 13px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.calc-form .area-error {
  color: var(--bad); background: var(--bad-bg); border: 1px solid var(--bad-line);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; margin: 0 0 16px;
}

/* карточка результата */
.area-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  margin-top: 26px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: area-in .22s ease-out;
}
@keyframes area-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.area-card header p { margin: 0; font-size: 15px; color: var(--muted); }
.area-card header .big {
  font-size: 40px; font-weight: 750; color: var(--ink);
  letter-spacing: -.02em; line-height: 1.1; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.area-card header .big .pct {
  font-size: 18px; font-weight: 500; color: var(--muted);
  letter-spacing: 0;
}
.area-card .compare {
  display: grid; gap: 0; margin: 22px 0;
  border-top: 1px solid var(--line);
}
.area-card .compare > div {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.area-card .compare dt { color: var(--muted); }
.area-card .compare dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.area-card .verdict {
  border-radius: var(--radius); padding: 18px 20px; margin: 18px 0;
  background: var(--bg-tint); border: 1px solid var(--line);
}
.area-card .verdict .amount {
  font-size: 30px; font-weight: 750; margin: 0 0 8px;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.area-card .verdict p:last-child { margin: 0; font-size: 15px; color: var(--ink-soft); }
.area-card .verdict [data-tone="good"] { color: var(--good); }
.area-card .verdict:has([data-tone="good"]) { background: var(--good-bg); border-color: var(--good-line); }
.area-card .verdict:has([data-tone="good"]) .amount { color: var(--good); }
.area-card .verdict:has([data-tone="warn"]) { background: var(--warn-bg); border-color: var(--warn-line); }
.area-card .verdict:has([data-tone="warn"]) .amount { color: var(--warn); }
.area-card .verdict:has([data-tone="flat"]) .amount { color: var(--muted); }

.area-card .coef {
  background: var(--blue-bg); border: 1px solid var(--blue-line);
  border-radius: var(--radius-sm); padding: 14px 18px; font-size: 14.5px;
  color: #1b2b3d; margin: 16px 0;
}
.area-card .thresholds { font-size: 14.5px; color: var(--muted); margin: 16px 0; }
.area-card .thresholds strong { color: var(--ink); }
.area-card .warnings { background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 16px 0; }
.area-card .warnings ul { margin: 0; padding-left: 18px; font-size: 14.5px; color: #5f4300; }
.area-card .notes { margin: 16px 0; }
.area-card .notes ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.area-card .cta {
  display: block; text-align: center; margin-top: 22px; padding: 15px 24px;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 10px; font-weight: 650; font-size: 16px;
  transition: background .15s;
}
.area-card .cta:hover { background: var(--accent-hover); }
.area-card .disclaimer {
  font-size: 12.5px; color: var(--muted); margin: 14px 0 0; line-height: 1.6;
}
