/* Оформление магазина МИХАС.
 *
 * Фон белый почти везде — так просил заказчик и так правильнее для
 * магазина: товар снят на белом, и любая цветная подложка спорит
 * с фотографией. Цвет берём из логотипа и тратим только на действия.
 */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --red:        #b9121a;
  --red-dark:   #910d14;
  --red-pale:   #fdf2f2;
  --ink:        #16181d;
  --text:       #3f4550;
  --muted:      #7c8595;
  --line:       #e8ebf0;
  --line-soft:  #f2f4f7;
  --bg:         #ffffff;
  --bg-soft:    #f7f8fa;
  --green:      #12855a;
  --wrap:       1280px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--red); }
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; left: -9999px; }

/* ── кнопки ───────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}

.btn-main { background: var(--red); color: #fff; }
.btn-main:hover { background: var(--red-dark); color: #fff; }

.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); }

.btn-sm { height: 38px; padding: 0 16px; font-size: 15px; }
.btn-wide { width: 100%; }

/* ── шапка ────────────────────────────────────────────── */

.top { background: #fff; border-bottom: 1px solid var(--line-soft); }

.top-bar { background: var(--bg-soft); border-bottom: 1px solid var(--line-soft); }

.top-line {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 9px 20px;
  font-size: 14px;
  color: var(--muted);
}
.top-line > span { display: inline-flex; align-items: center; gap: 7px; }
.top-line svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--red); }
.top-line a { color: var(--muted); }
.top-line a:hover { color: var(--red); }
.top-line-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }

/* Кнопка, которая выглядит ссылкой: выход из кабинета обязан быть
   формой, иначе по нему выйдет любая ссылка, открытая роботом. */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.link-btn:hover { color: var(--red); }

.head {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 16px 20px;
}

.logo { flex: 0 0 auto; }
.logo img { width: 210px; }

.head-search { flex: 1 1 auto; max-width: 560px; position: relative; }
.head-search input {
  width: 100%;
  height: 46px;
  padding: 0 46px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
.head-search input:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
.head-search button {
  position: absolute;
  right: 4px; top: 4px;
  width: 38px; height: 38px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.head-search button:hover { color: var(--red); }

/* ── подсказки поиска ─────────────────────────────────── */

.suggest {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(22, 24, 29, .12);
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
}
.suggest-item:hover, .suggest-item.on { background: var(--bg-soft); color: var(--ink); }

.suggest-pic {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}
.suggest-pic img { width: 100%; height: 100%; object-fit: contain; }

.suggest-txt { flex: 1 1 auto; min-width: 0; }
.suggest-name { display: block; font-size: 15px; line-height: 1.3; }
.suggest-stock { font-size: 12px; color: var(--muted); }
.suggest-stock.in { color: var(--green); }
.suggest-price { flex: 0 0 auto; font-weight: 700; white-space: nowrap; }

.suggest-more {
  display: block;
  padding: 10px;
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
  color: var(--red);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.suggest-empty { padding: 14px 10px; color: var(--muted); font-size: 15px; text-align: center; }

.head-phone { text-align: right; }
.head-phone a { display: block; font-size: 18px; font-weight: 700; color: var(--ink); }
.head-phone a:hover { color: var(--red); }
.head-phone span { display: block; font-size: 13px; color: var(--muted); }

.head-icons { display: flex; gap: 6px; }

.icon-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 62px;
  padding: 6px 4px;
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--red); }
.icon-btn svg { width: 24px; height: 24px; }

.icon-count {
  position: absolute;
  top: 2px; right: 8px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ── меню разделов ────────────────────────────────────── */

/* Меню приклеивается к верху: в каталоге на двести пятьдесят товаров
   переход в другой раздел иначе стоит прокрутки страницы наверх. */
/* Полоса красная — единственное крупное цветное пятно на странице.
   Весь остальной фон остаётся белым, и товар на белом с ним не спорит. */
.nav {
  position: sticky;
  top: 0;
  z-index: 55;
  background: var(--red);
  color: #fff;
  transition: box-shadow .2s;
}
.nav.stuck { box-shadow: 0 6px 20px rgba(22, 24, 29, .2); }

.nav-in { display: flex; align-items: center; gap: 2px; padding: 0 20px; }

.nav-menu { display: flex; align-items: center; gap: 2px; }

.nav a {
  display: block;
  padding: 14px 14px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

/* Приклеенная полоса низкая: она отъедает место у списка товаров,
   а нужны в ней только значки кабинета, избранного и корзины. */
.nav.stuck a { padding-top: 11px; padding-bottom: 11px; }
/* Первый пункт выравниваем по краю содержимого страницы, иначе меню
   выглядит сдвинутым относительно всего остального. */
.nav-menu > a:first-child { padding-left: 0; }

/* На цветном фоне подсветку даёт не цвет текста — он и так белый, —
   а подчёркивание. Подложка при наведении выглядела заплаткой, тем
   более что у первого пункта её быть не может: он прижат к краю. */
.nav a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, .65); }
.nav a.here { color: #fff; border-bottom-color: #fff; }

.nav-rest { display: flex; gap: 2px; }
.nav-rest a { font-weight: 500; color: rgba(255, 255, 255, .8); }
.nav-rest a:hover { color: #fff; }

/* ── что появляется в приклеенном меню ────────────────── */

.nav-extra {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding-left: 22px;
}
.nav.stuck .nav-extra { display: flex; }

/* Только значки, без подписей: рядом стоит меню из шести разделов,
   и с подписями полоса переносится на вторую строку. Что означает
   значок, подсказывает всплывающая подсказка. */
.icon-only {
  min-width: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}
.nav-extra .icon-btn { color: #fff; }
.nav-extra .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.nav-extra .icon-btn svg { width: 22px; height: 22px; }

/* Счётчик на красном фоне выворачиваем: красным по красному его не видно. */
.nav-extra .icon-btn .icon-count {
  top: -2px;
  right: -2px;
  background: #fff;
  color: var(--red);
}

.nav-toggle {
  display: none;
  width: 100%;
  padding: 12px 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

/* ── хлебные крошки ───────────────────────────────────── */

.crumbs { padding: 14px 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--red); }
.crumbs span { margin: 0 7px; opacity: .5; }

/* ── общие блоки страницы ─────────────────────────────── */

section { padding: 34px 0; }

.page-h {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  margin-bottom: 6px;
}
.page-sub { margin: 0 0 22px; color: var(--muted); }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.sec-head h2 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; }
.sec-head a { color: var(--red); font-weight: 600; font-size: 15px; }

/* ── плитка товаров ───────────────────────────────────── */

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: #d9dee6; box-shadow: 0 6px 22px rgba(22, 24, 29, .07); }

.card-pic {
  display: block;
  aspect-ratio: 1;
  margin-bottom: 12px;
}
.card-pic img { width: 100%; height: 100%; object-fit: contain; }

.card-name {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  min-height: 3em;
}
.card-name:hover { color: var(--red); }

.card-attrs { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.card-bottom { margin-top: auto; padding-top: 12px; }

.price { display: flex; align-items: baseline; gap: 9px; }
.price-now { font-size: 20px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.price-old { font-size: 14px; color: var(--muted); text-decoration: line-through; }

.badge {
  position: absolute;
  top: 12px; left: 12px;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.stock { margin: 6px 0 10px; font-size: 13px; }
.stock-in { color: var(--green); }
.stock-low { color: #b8730a; }
.stock-out { color: var(--muted); }

/* Кнопка в плитке: подпись «Сообщить о поступлении» в узкую клетку
   одной строкой не помещается, поэтому здесь разрешаем перенос —
   высоту клетки это не ломает, соседние в ряду тянутся следом. */
.card .btn {
  margin-top: 8px;
  height: auto;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}

.fav {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.fav:hover, .fav.on { color: var(--red); }
.fav svg { width: 20px; height: 20px; }

/* ── плитки разделов и брендов ────────────────────────── */

/* Лёгкая заливка вместо белого: разделы должны отличаться от карточек
   товара, иначе главная выглядит как одна длинная сетка. */
.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 96px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(160deg, #f7f9fc 0%, #eef1f6 100%);
  text-align: center;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cat-card:hover {
  border-color: #d5dbe4;
  box-shadow: 0 6px 20px rgba(22, 24, 29, .07);
  transform: translateY(-2px);
}

.cat-name { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.cat-count { font-size: 14px; color: var(--muted); }

/* Оттенки повторяют обложки статей: у каждого раздела свой цвет. */
.cat-konditsionery { background: linear-gradient(160deg, #f2f7fd 0%, #dfeaf7 100%); }
.cat-vodonagrevateli { background: linear-gradient(160deg, #fdf4f4 0%, #f8e2e2 100%); }
.cat-gazovye-kolonki { background: linear-gradient(160deg, #fdf7ef 0%, #f8e8d3 100%); }
.cat-aksessuary { background: linear-gradient(160deg, #f5f8f5 0%, #e5ede6 100%); }

/* ── каталог с фильтрами ──────────────────────────────── */

.catalog { display: grid; gap: 26px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .catalog { grid-template-columns: 260px 1fr; gap: 32px; } }

/* Фильтр едет вместе со страницей: список товаров длинный, а менять
   условия отбора приходится, дойдя до его середины.
   Верхний отступ — под приклеенное меню, иначе фильтр уезжает под него. */
.filters {
  position: sticky;
  top: 86px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 18px 18px;
}
.filter { border-bottom: 1px solid var(--line-soft); padding: 14px 0; }
.filter:last-child { border-bottom: 0; }

.filter-h {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

/* Свёрнутые группы: стрелка вместо стандартного треугольника,
   чтобы список выглядел как часть оформления, а не как отладка. */
summary.filter-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
summary.filter-h::-webkit-details-marker { display: none; }

summary.filter-h::after {
  content: '';
  width: 8px; height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s;
}
details[open] > summary.filter-h::after { transform: rotate(-135deg) translate(-3px, -3px); }
summary.filter-h:hover { color: var(--red); }
summary.filter-h:hover::after { border-color: var(--red); }

.filter-mark {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.filter-body { padding-top: 8px; }

.check { display: flex; align-items: center; gap: 9px; margin: 7px 0; cursor: pointer; font-size: 15px; }
.check input { width: 17px; height: 17px; accent-color: var(--red); }
.check-count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* ── ползунок цены ────────────────────────────────────── */

/* Две дорожки лежат друг на друге: браузер не умеет диапазон из двух
   значений, поэтому берём два обычных ползунка и гасим фон у обоих. */
.slider { position: relative; height: 32px; margin-top: 14px; }

.slider-track {
  position: absolute;
  top: 14px; left: 0; right: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.slider-fill { position: absolute; top: 0; height: 4px; border-radius: 2px; background: var(--red); }

.slider input[type="range"] {
  position: absolute;
  top: 7px; left: 0;
  width: 100%;
  height: 18px;
  margin: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
}

.slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--red);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(22, 24, 29, .2);
}

.slider input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border: 2px solid var(--red);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  pointer-events: auto;
}
.slider input[type="range"]::-moz-range-track { background: none; }

.range { display: flex; gap: 8px; }
.range input {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.tools-count { color: var(--muted); font-size: 15px; }
.tools-sort { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.tools-sort select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  background: #fff;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  display: inline-block;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
}
.chip:hover { border-color: var(--red); color: var(--red); }
.chip.here { background: var(--red); border-color: var(--red); color: #fff; }

.empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* ── карточка товара ──────────────────────────────────── */

.product { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .product { grid-template-columns: 1.1fr 1fr; gap: 40px; } }

.gallery-main {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  aspect-ratio: 1;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }

.gallery-strip { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; }
.gallery-strip button {
  flex: 0 0 74px;
  height: 74px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.gallery-strip button.on { border-color: var(--red); }
.gallery-strip img { width: 100%; height: 100%; object-fit: contain; }

.p-brand { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.p-brand a { color: var(--red); font-weight: 600; }
.p-h { font-size: clamp(21px, 2.6vw, 28px); font-weight: 800; margin-bottom: 10px; }
.p-sku { font-size: 13px; color: var(--muted); margin-bottom: 18px; }

.p-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 18px;
}
.p-price .price-now { font-size: 30px; }
.p-buy .btn { flex: 1 1 190px; }

/* Условия покупки: список с разделителями внутри одной рамки, чтобы
   три пункта читались как один блок, а не как три случайные строки. */
.p-notes {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.p-notes li {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.p-notes li:last-child { border-bottom: 0; }

.p-note-ico {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--red-pale);
  color: var(--red);
}
.p-note-ico svg { width: 20px; height: 20px; }

.p-note-txt { font-size: 14px; line-height: 1.45; color: var(--muted); }
.p-note-txt b { display: block; margin-bottom: 2px; font-size: 15px; color: var(--ink); }

.specs { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.specs td { padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; vertical-align: top; }
.specs td:first-child { color: var(--muted); width: 52%; }
.specs td:last-child { color: var(--ink); font-weight: 500; }

.tabs { display: flex; gap: 22px; margin: 34px 0 18px; border-bottom: 1px solid var(--line); }
.tabs button {
  padding: 0 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--red); }

.text-block { max-width: 80ch; }
.text-block p { margin: 0 0 14px; }
.text-block h2, .text-block h3 { margin: 24px 0 10px; font-size: 19px; }
.text-block ul { margin: 0 0 14px; padding-left: 20px; }

/* ── страницы каталога ────────────────────────────────── */

.pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
}

.page-btn, .page-num, .page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.page-btn:hover, .page-num:hover { border-color: var(--red); color: var(--red); }

.page-nums { display: flex; flex-wrap: wrap; gap: 8px; }
.page-num.is-here { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.page-gap { border-color: transparent; color: var(--muted); }

.page-btn.is-off { color: var(--muted); border-color: var(--line-soft); }
.page-btn.is-off:hover { border-color: var(--line-soft); color: var(--muted); }

.pages-note { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

@media (max-width: 560px) {
  .page-nums { display: none; }
  .pages { justify-content: space-between; }
}

/* ── корзина ──────────────────────────────────────────── */

.cart-list { border-top: 1px solid var(--line-soft); }

.cart-row {
  display: grid;
  gap: 14px 16px;
  grid-template-columns: 78px 1fr auto;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
@media (min-width: 760px) {
  .cart-row { grid-template-columns: 78px 1fr 128px 130px 40px; }
}

.cart-pic {
  width: 78px; height: 78px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cart-pic img { width: 100%; height: 100%; object-fit: contain; }

.cart-name a { display: block; color: var(--ink); font-size: 15px; line-height: 1.35; }
.cart-name a:hover { color: var(--red); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
.qty button {
  width: 38px; height: 40px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.qty button:hover { color: var(--red); }
.qty input {
  width: 46px;
  height: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
}
.qty input:focus { outline: 2px solid var(--red); outline-offset: -2px; }

.cart-sum { font-size: 17px; font-weight: 700; color: var(--ink); white-space: nowrap; }

.cart-del {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.cart-del:hover { background: var(--red-pale); color: var(--red); }

/* ── формы ────────────────────────────────────────────── */

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 500; color: var(--ink); }
.field label b { color: var(--red); font-weight: 500; }

.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--red);
  outline-offset: -1px;
  border-color: transparent;
}
.field .check { margin: 8px 0; }
.field .check input { width: 18px; min-height: 0; }

.field-note { display: block; margin-top: 5px; font-size: 13px; color: var(--muted); }
.field-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }

.block-h { font-size: 18px; font-weight: 700; margin: 26px 0 14px; }
.block-h:first-child { margin-top: 0; }

.form-error {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--red-pale);
  color: var(--red-dark);
}

.hp { position: absolute; left: -9999px; }

/* ── оформление заказа ────────────────────────────────── */

.checkout { display: grid; gap: 28px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .checkout { grid-template-columns: 1fr 340px; gap: 40px; } }

.checkout-side {
  position: sticky;
  top: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.checkout-item { padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.checkout-item:last-of-type { border-bottom: 0; }

.checkout-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 16px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

/* ── кабинет ──────────────────────────────────────────── */

.account { display: grid; gap: 26px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .account { grid-template-columns: 230px 1fr; gap: 36px; } }

.account-menu { list-style: none; margin: 0; padding: 0; }
.account-menu li { margin-bottom: 4px; }
.account-menu a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
}
.account-menu a:hover { background: var(--bg-soft); }
.account-menu a.here { background: var(--red-pale); color: var(--red); font-weight: 600; }

.order {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}
.order-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 12px;
}
.order-num { font-weight: 700; color: var(--ink); }
.order-date { color: var(--muted); font-size: 14px; }
.order-sum { margin-left: auto; font-weight: 700; }

.status {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text);
}
.status-new { background: #fff4e5; color: #a35a00; }
.status-confirmed { background: #e8f1ff; color: #14509b; }
.status-delivering { background: #eaf3ff; color: #14509b; }
.status-done { background: #e7f6ee; color: var(--green); }
.status-canceled { background: var(--bg-soft); color: var(--muted); }

.auth-box { max-width: 420px; margin: 0 auto; }

/* ── блог ─────────────────────────────────────────────── */

.posts { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .posts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .posts { grid-template-columns: repeat(3, 1fr); } }

.post-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.post-card:hover { border-color: #d9dee6; box-shadow: 0 6px 22px rgba(22, 24, 29, .07); }

.post-card-pic { position: relative; display: block; background: var(--bg-soft); }
.post-card-pic img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.post-card-tag {
  position: absolute;
  left: 12px; bottom: 12px;
  padding: 4px 11px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.post-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1 1 auto; }
.post-card-body h2, .post-card-body h3 { font-size: 18px; line-height: 1.3; }
.post-card-body h2 a, .post-card-body h3 a { color: var(--ink); }
.post-card-body h2 a:hover, .post-card-body h3 a:hover { color: var(--red); }

.post-card-lead {
  margin: 9px 0 0;
  font-size: 15px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta { margin-top: auto; padding-top: 12px; font-size: 13px; color: var(--muted); }

/* ── страница статьи ──────────────────────────────────── */

/* Заголовок статьи стоит по левому краю, как и её текст. Ограничение
   ширины вешаем на строки, а не на контейнер: контейнер с максимальной
   шириной центрируется и уводит заголовок к середине экрана. */
.post-head { padding-top: 10px; }
.post-head > * { max-width: 820px; }

.post-tag {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--red-pale);
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
}

.post-h { font-size: clamp(26px, 3.6vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.post-lead { margin: 16px 0 0; font-size: 19px; line-height: 1.5; color: var(--text); }
.post-meta { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

/* Статья и боковая колонка. Колонка начинается на одной высоте
   с заголовком, а на узком экране просто уходит под статью. */
.post-layout { display: grid; gap: 34px 40px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .post-layout { grid-template-columns: minmax(0, 1fr) 300px; } }

.post-main { min-width: 0; }

.side-box {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
}
.side-box-h { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

.side-links { list-style: none; margin: 0 0 14px; padding: 0; font-size: 15px; }
.side-links li { border-bottom: 1px solid var(--line-soft); }
.side-links li:last-child { border-bottom: 0; }

.side-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  color: var(--text);
}
.side-links a:hover { color: var(--red); }
.side-links a.on { color: var(--red); font-weight: 600; }
.side-links a span { margin-left: auto; color: var(--muted); font-size: 13px; }

.side-help { background: var(--bg-soft); border-color: transparent; }
.side-help p { margin: 0 0 12px; font-size: 15px; color: var(--muted); }
.side-phone { display: block; font-size: 20px; font-weight: 700; color: var(--ink); }
.side-phone:hover { color: var(--red); }

.post-body { max-width: 780px; padding-top: 8px; padding-bottom: 20px; font-size: 17px; line-height: 1.65; }
.post-body h2 { margin: 36px 0 14px; font-size: clamp(21px, 2.6vw, 27px); font-weight: 800; }
.post-body h3 { margin: 28px 0 10px; font-size: 19px; font-weight: 700; }
.post-body p { margin: 0 0 16px; }
.post-body ul, .post-body ol { margin: 0 0 18px; padding-left: 22px; }
.post-body li { margin: 7px 0; }
.post-body a { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover { text-decoration: none; }

/* Кнопки и карточки товаров внутри статьи под это правило попадать
   не должны: красный текст на красной кнопке не виден вовсе. */
.post-body .btn-main { color: #fff; text-decoration: none; }
.post-body .btn-ghost { color: var(--ink); text-decoration: none; }
.post-body .post-product a { text-decoration: none; }
.post-body .post-product-name { color: var(--ink); }
.post-body .post-product-name:hover { color: var(--red); }

/* Отступы, которые нужны картинке в тексте, вылезают из карточки
   товара: там снимок вписан в квадрат по размеру. */
.post-body .post-product img { margin: 0; border-radius: 6px; }
.post-body img { border-radius: 12px; margin: 22px 0; }

/* Вывод, ради которого статья написана: он должен читаться отдельно
   от текста, даже если человек пролистал середину. */
.post-note {
  margin: 24px 0;
  padding: 18px 22px;
  border-left: 3px solid var(--red);
  border-radius: 0 10px 10px 0;
  background: var(--red-pale);
  font-size: 16px;
}
.post-note p:last-child { margin-bottom: 0; }

.post-table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 16px; }
.post-table th, .post-table td { padding: 11px 14px; border: 1px solid var(--line); text-align: left; }
.post-table th { background: var(--bg-soft); font-weight: 700; color: var(--ink); }
.post-table tr:nth-child(even) td { background: #fcfcfd; }

.post-link { margin: 18px 0; }
.post-link a { font-weight: 600; }

/* Карточка товара внутри текста статьи. */
.post-product {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.post-product-pic { flex: 0 0 86px; width: 86px; height: 86px; }
.post-product-pic img { width: 100%; height: 100%; object-fit: contain; }
.post-product-txt { flex: 1 1 200px; min-width: 0; }
.post-product-name { display: block; font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.post-product-name:hover { color: var(--red); }
.post-product-txt .stock { display: block; margin: 5px 0 0; font-size: 13px; }
.post-product-buy { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.post-product-buy .price-now { font-size: 19px; }

.posts-more { background: var(--bg-soft); }

/* ── подвал ───────────────────────────────────────────── */

.foot { border-top: 1px solid var(--line); background: #fff; padding: 40px 0 24px; }
.foot-in { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .foot-in { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .foot-in { grid-template-columns: 1.4fr repeat(3, 1fr); } }

.foot h3 { font-size: 15px; margin-bottom: 12px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 7px 0; font-size: 15px; }
.foot li a { color: var(--text); }
.foot li a:hover { color: var(--red); }
.foot-logo img { width: 190px; margin-bottom: 14px; }
.foot-desc { font-size: 15px; color: var(--muted); max-width: 34ch; }
.foot-phone { display: block; font-size: 19px; font-weight: 700; color: var(--ink); margin-top: 12px; }

.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
}

/* Значки в одну строку у правого края: «Импульс», за ним «Дассет».
   Каждый из них рисует внутри себя блок во всю ширину, поэтому ширину
   задаём по содержимому здесь. */
.foot-marks { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.foot-marks > span { flex: 0 0 auto; }

/* ── телефон ──────────────────────────────────────────── */

/* Кнопка меню: три полоски, складывающиеся в крестик. */
.burger {
  display: none;
  place-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  margin-left: -8px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
.burger span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .2s, opacity .15s;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.menu-extra { display: none; }

/*
 * Шапка на телефоне собрана заново. Правило простое: в одну строку —
 * кнопка меню, логотип и два значка, под ними поиск. Телефон, служебные
 * ссылки и вход переезжают в меню: иначе шапка занимает треть экрана
 * и товар начинается за сгибом.
 */
@media (max-width: 900px) {
  .top-bar { display: none; }

  .top {
    position: sticky;
    top: 0;
    z-index: 60;
    box-shadow: 0 2px 10px rgba(22, 24, 29, .07);
  }

  /* Шапка ровно в одну строку: логотип, три значка и кнопка меню.
     Она видна на каждом экране, поэтому каждый лишний ряд — это минус
     ряд товаров. */
  .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
  }

  .burger { display: grid; order: 3; margin-left: 0; }
  .logo { order: 1; }
  .logo img { width: 132px; }
  .head-icons { order: 2; gap: 2px; }

  /* Поиск переезжает в выпадающее меню — его переносит скрипт. */
  .head-search { display: none; }
  .nav.open .head-search {
    display: block;
    order: -1;
    max-width: none;
    margin-bottom: 10px;
  }
  .head-search input { height: 44px; font-size: 16px; }

  .head-phone { display: none; }

  .icon-btn { min-width: 40px; padding: 5px; }
  .icon-btn svg { width: 23px; height: 23px; }
  .icon-txt { display: none; }
  .icon-count { top: -2px; right: -2px; }

  /* Меню разворачивается под шапкой на всю ширину. */
  .nav {
    position: static;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }
  .nav:not(.open) { display: none; }

  .nav-in { display: flex; flex-direction: column; padding: 10px 16px 14px; }
  .nav-menu { display: block; }

  .nav a {
    display: block;
    padding: 13px 0;
    color: var(--ink);
    font-size: 17px;
    border-bottom: 1px solid var(--line-soft);
  }
  .nav a:hover, .nav a.here { border-bottom-color: var(--line-soft); }
  .nav a.here { color: var(--red); }

  .nav-rest { display: block; }
  .nav-rest a { color: var(--ink); font-weight: 600; }
  .nav-extra { display: none !important; }

  .menu-extra { display: block; padding-top: 6px; }
  .menu-extra a { font-size: 16px; font-weight: 400; color: var(--text); }

  .menu-phone {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--ink) !important;
    line-height: 1.2;
  }
  .menu-phone span {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
  }

  /* Значки в подвале: друг под другом и по левому краю. Рядом они
     не помещаются и вылезают за край экрана.
     Выравнивание задано скриптом значка прямо в разметке, поэтому здесь
     без «!important» не обойтись — иначе правило не сработает. */
  .foot-marks { flex-direction: column; align-items: flex-start; gap: 12px; margin-left: 0; }
  .foot-marks > span { width: 100%; }
  .foot-marks > span > div { justify-content: flex-start !important; }
  .foot-bottom { flex-direction: column; align-items: flex-start; }

  section { padding: 24px 0; }
  .facts-in { grid-template-columns: 1fr; gap: 18px; }
  .contact-k { flex: 1 1 100%; }

  /* Липкий фильтр на телефоне не нужен: он и так стоит над списком. */
  .filters { position: static; }
}

@media (max-width: 560px) {
  .head { padding: 9px 14px; }
  .logo img { width: 132px; }
  .grid { gap: 12px; }
  .card { padding: 11px; }
  .page-h { font-size: 24px; }
}
