/* =============================================================
   backwash.css — статья «Сколько воды уходит на промывку»
   ============================================================= */

body { background: #1e3c72; }
.bw-main { background: #F4F1EA; padding-top: 40px; padding-bottom: 48px; }

/* ── Хиро ───────────────────────────────────────────────────── */
.bw-hero {
  background: var(--dark);
  color: #fff;
  padding: 24px 0 48px;
}
.bw-hero__title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 16px;
}
.bw-hero__sub {
  font-size: var(--fs-lg);
  color: rgba(255,255,255,.7);
  margin: 0;
}

/* ── Текст ───────────────────────────────────────────────────── */
.bw-text {
  font-size: var(--fs-base);
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
}
.bw-text:last-child { margin-bottom: 0; }
.bw-text a, .bw-list a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* ── Секции ──────────────────────────────────────────────────── */
.bw-section { margin-bottom: 48px; }
.bw-section__title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--dark);
}
.bw-section__subtitle {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--dark);
  margin: 24px 0 12px;
}

/* ── Список ──────────────────────────────────────────────────── */
.bw-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bw-list li {
  font-size: var(--fs-base);
  color: var(--muted);
  line-height: 1.6;
  padding-left: 20px;
  position: relative;
}
.bw-list li::before { content: '—'; position: absolute; left: 0; color: var(--muted); }
.bw-list li strong { color: var(--dark); }

/* ── Врезка / выноска ────────────────────────────────────────── */
.bw-note {
  background: #fff3cd;
  border-left: 3px solid #e6a817;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 12px 16px;
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 20px;
}
.bw-callout {
  background: rgba(0,102,204,.08);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 14px 20px;
  font-size: var(--fs-base);
  color: var(--dark);
  line-height: 1.6;
  margin-bottom: 20px;
}
.bw-callout strong { color: var(--dark); }

/* ── Формула ──────────────────────────────────────────────────── */
.bw-formula {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin: 0 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.bw-formula__eq {
  font-family: 'Courier New', monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
  /* раньше тут был nowrap — длинная формула уезжала за край на телефоне.
     Теперь строка переносится, но только по «+»: сами произведения
     обёрнуты в .bw-nw и внутри не рвутся */
  white-space: normal;
  line-height: 1.6;
  margin-bottom: 10px;
}
.bw-nw { white-space: nowrap; }
.bw-formula__vars {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bw-formula__vars li { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.bw-formula__vars strong { color: var(--dark); }

/* ── Таблицы ─────────────────────────────────────────────────── */
.bw-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
  /* Тени у краёв показывают, что таблица прокручивается вбок, и гаснут,
     когда доскроллил до конца. Два первых слоя — белые «заслонки»
     на local, две радиальные тени — на scroll */
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left,  #fff 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(30,60,114,.16), rgba(30,60,114,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(30,60,114,.16), rgba(30,60,114,0)) right center;
  background-color: #fff;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.bw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  /* без min-width: таблица вписывается в экран телефона и переносит слова.
     Жёсткий минимум уводил её за край, а шапка с nowrap не давала сжаться */
  min-width: 0;
}
.bw-table thead th {
  padding: 10px 14px;
  background: #F0EDE7;
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dark);
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  white-space: normal;
}
.bw-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #edeae4;
  color: var(--dark);
  vertical-align: middle;
}
.bw-table tbody tr:last-child td { border-bottom: none; }
.bw-table tbody tr:nth-child(even) td { background: #faf9f6; }
.bw-table td.bw-table__num { text-align: right; font-weight: 600; }
/* Тем же классом помечается заголовок числовой колонки — иначе шапка
   стоит слева, а числа под ней справа */
.bw-table thead th.bw-table__num { text-align: right; }
/* Выравнивание вправо без жирности — для «Время»: в одном ряду с литрами,
   но «10 мин» остаётся обычным весом */
.bw-table th.bw-table__right,
.bw-table td.bw-table__right { text-align: right; }
.bw-table td.bw-table__total { font-weight: 700; color: var(--dark); }
.bw-table tr.bw-table__total-row td { background: #f0ede7; font-weight: 700; }

/* ── Калькуляторы ────────────────────────────────────────────── */
.bw-calc {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 32px;
}
.bw-calc__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 20px;
}
.bw-calc__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.bw-calc__field label {
  display: block;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 4px;
}
.bw-calc__hint {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 2px 0 6px;
  line-height: 1.4;
}
.bw-calc__field select,
.bw-calc__field input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--dark);
  background: #fff;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.bw-calc__field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.bw-calc__field select:focus,
.bw-calc__field input:focus { border-color: var(--blue); }

/* Предупреждение P>6 (над результатом) */
.bw-calc__warn-high {
  display: none;
  background: #fde8eb;
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #e85668;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Блок результата */
.bw-calc__result {
  background: var(--dark);
  border-radius: var(--r-md);
  padding: 20px;
  color: #fff;
}
.bw-calc__result-total-label {
  font-size: var(--fs-base);
  font-weight: 600;
  color: rgba(255,255,255,.65);
  margin: 0 0 4px;
}
.bw-calc__result-total {
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: #fff;
  margin: 0 0 16px;
  line-height: 1.1;
}
.bw-calc__breakdown { display: none; }
.bw-calc__breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-size: var(--fs-sm);
}
.bw-calc__breakdown-row:last-child { border-bottom: none; }
.bw-calc__breakdown-label { color: rgba(255,255,255,.6); }
.bw-calc__breakdown-val { font-weight: 600; color: #fff; }

/* Замечание P<1.5 / P<2.5 (под результатом) */
.bw-calc__note-low {
  display: none;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}
.bw-calc__footnote {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* ── FAQ аккордеон ───────────────────────────────────────────── */
.bw-faq { display: flex; flex-direction: column; }
.bw-faq__item { border-bottom: 1px solid var(--border); }
.bw-faq__item:first-child { border-top: 1px solid var(--border); }
.bw-faq__q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 16px 0;
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  text-align: left;
  gap: 16px;
}
.bw-faq__q:hover { color: var(--blue); }
.bw-faq__chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform .2s;
}
.bw-faq__item.is-open .bw-faq__chevron { transform: rotate(-135deg) translateY(-3px); }
.bw-faq__a { display: none; padding-bottom: 16px; }
.bw-faq__item.is-open .bw-faq__a { display: block; }
.bw-faq__a p {
  font-size: var(--fs-base);
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 8px;
}
.bw-faq__a p:last-child { margin-bottom: 0; }
.bw-faq__a a { color: var(--blue); text-decoration: underline; }

/* ── Источники: карточки паспортов ───────────────────────────── */
/* тот же приём, что в каталоге (.soft-docs), но с третьей строкой —
   в ней сказано, что именно взято из документа */
.bw-docs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 20px;
}
.bw-docs__card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  text-decoration: none;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color .15s;
}
.bw-docs__card:hover { border-color: var(--blue); }
.bw-docs__preview {
  width: 64px;
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
  display: block;
  border-right: 1.5px solid var(--border);
  background: #fff;
}
.bw-docs__info { padding: 10px 12px 10px 0; }
.bw-docs__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--dark);
  line-height: 1.3;
}
.bw-docs__desc {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.45;
  margin-top: 3px;
}
.bw-docs__meta { font-size: var(--fs-xs); color: var(--blue); margin-top: 5px; }

/* На десктопе карточки в два ряда — как .soft-docs в каталоге.
   min-height держит одну высоту, когда описания разной длины */
@media (min-width: 640px) {
  .bw-docs { flex-direction: row; flex-wrap: wrap; }
  .bw-docs__card { width: calc(50% - 5px); min-height: 104px; }
}

/* ── Переключатель клапана ───────────────────────────────────── */
.bw-calc__valve-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.bw-calc__valve-label {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
}
.bw-calc__valve {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.bw-calc__valve-opt {
  cursor: pointer;
  line-height: 1;
}
.bw-calc__valve-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.bw-calc__valve-opt span {
  display: block;
  padding: 10px 20px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--muted);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.bw-calc__valve-opt input[type="radio"]:checked + span {
  background: var(--dark);
  color: #fff;
}

/* ── Таблица фаз (3 колонки, первая широкая) ────────────────── */
.bw-table--phases th:first-child,
.bw-table--phases td:first-child { width: 50%; white-space: normal; }

/* У обезжелезивателя колонок всего две. Растягиваем первую до 75%,
   чтобы «Время» встало на ту же вертикаль, что в таблице умягчителя */
.bw-table--phases2 th:first-child,
.bw-table--phases2 td:first-child { width: 75%; }

/* ── Сводная таблица (4 колонки) ─────────────────────────────── */
.bw-table--combined thead th,
.bw-table--combined tbody td { padding: 8px 10px; }
.bw-table--combined td.bw-table__num { white-space: nowrap; }
/* Все заголовки числовых колонок вправо, включая групповой «Умягчитель» */
.bw-table--combined thead tr:first-child th:not(:first-child),
.bw-table--combined thead tr:last-child th { text-align: right; }

/* Ширины фиксированы всегда, иначе авто-раскладка отдаёт первой колонке
   весь излишек. На телефоне числовым нужно по 24% — в 17% не влезал
   заголовок «Фильтрация, л» и обрезался */
.bw-table--combined { table-layout: fixed; }
.bw-table--combined col + col { width: 24%; }
@media (min-width: 640px) {
  .bw-table--combined col + col { width: 17%; }
}

/* На телефоне ужимаем padding — четыре колонки иначе не вписываются */
@media (max-width: 639px) {
  .bw-table thead th,
  .bw-table tbody td { padding: 8px 8px; }
  .bw-table--combined thead th,
  .bw-table--combined tbody td { padding: 8px 6px; }
}

@media (min-width: 640px) {
  /* на широком экране шапка в одну строку выглядит аккуратнее */
  .bw-table thead th { white-space: nowrap; }
  .bw-table--combined thead th { white-space: normal; }
}

/* ── Адаптив ─────────────────────────────────────────────────── */
/* Строки внутри калькулятора */
.bw-calc__row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Английский подзаголовок в метке */
.bw-label-en {
  display: block;
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

@media (min-width: 640px) {
  .bw-hero { padding: 64px 0 56px; }

  .bw-calc__row {
    flex-direction: row;
    align-items: stretch;
  }
  .bw-calc__row .bw-calc__field {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .bw-calc__row .bw-calc__field select,
  .bw-calc__row .bw-calc__field input { margin-top: auto; }
  /* Баллон шире давления */
  .bw-calc__row--top .bw-calc__field:first-child { flex: 2; }
  /* Выравниваем «Заводские» по одной линии */
  .bw-calc__row:not(.bw-calc__row--top) .bw-calc__field label {
    min-height: 4em;
  }
}

@media (min-width: 1024px) {
  .bw-calc { scroll-margin-top: calc(var(--header-h) + 16px); }
}

/* Телефон: сводная таблица с colgroup не влезала на ~30px. */
@media (max-width: 639px) {
  /* table-layout: fixed не расширяет колонку под контент — длинное слово
     («Фильтрация,») вылезало за таблицу. Разрешаем перенос внутри слова. */
  .bw-table--combined thead th,
  .bw-table--combined tbody td {
    padding-left: 4px; padding-right: 4px;
    font-size: var(--fs-xs);
    overflow-wrap: anywhere;
  }
}

/* Перенос внутри слова нужен на всех ширинах: при table-layout: fixed
   колонка не растягивается под контент, и длинное слово вылезает
   за таблицу (на 640–700 давало перебор в несколько пикселей). */
.bw-table--combined thead th,
.bw-table--combined tbody td { overflow-wrap: anywhere; }
