:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-muted: #eef1f7;
  --text: #232531;
  --muted: #64697a;
  --brand: #dc2f2f;
  --brand-dark: #bf2121;
  --line: #e5e8f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.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;
}

.container {
  width: min(1200px, 92vw);
  margin-inline: auto;
}

.section {
  padding: 24px 0;
}

.section--tight {
  padding-top: 6px;
}

.topbar {
  background: #f2f4f8;
  color: #5f6576;
  font-size: 13px;
  border-bottom: 1px solid #dde2ee;
}

.topbar__inner,
.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__inner {
  justify-content: space-between;
  padding: 10px 0;
}

.topbar__left a:hover,
.topbar__right a:hover {
  color: #1f2433;
}

.header-main {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-main__inner {
  display: grid;
  grid-template-columns: 260px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
}

.logo {
  display: block;
}

.logo img {
  display: block;
  width: 240px;
  max-width: 100%;
  border-radius: 6px;
}

.search-field input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfcff;
  padding: 0 13px;
}

.user-nav {
  display: flex;
  gap: 14px;
  font-size: 14px;
}

.user-nav a {
  padding: 8px 10px;
  border-radius: 8px;
}

.user-nav a:hover {
  background: #f3f5fb;
}

.catalog-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.catalog-nav__inner {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 9px 0;
}

.catalog-nav__inner a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafbfe;
  font-size: 14px;
}

.catalog-nav__inner a:hover {
  border-color: #c8cddd;
  background: #f2f5fd;
}

.hero__grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.hero__banner,
.hero__benefits {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}

.hero__banner {
  background: linear-gradient(130deg, #fff 0%, #ffe9e9 100%);
  border-color: #ffd7d7;
}

.hero__kicker {
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 8px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero__banner p {
  color: var(--muted);
  max-width: 700px;
}

.hero__actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 600;
}

.btn:hover {
  background: var(--brand-dark);
}

.btn--light {
  background: #fff;
  color: var(--text);
  border: 1px solid #d4d9e8;
}

.hero__benefits h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.hero__benefits ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

h2 {
  margin-bottom: 16px;
  font-size: 28px;
  line-height: 1.15;
}

.categories-grid,
.product-grid,
.features-grid,
.articles-grid,
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.categories-grid article,
.product-card,
.seo-block,
.brands,
.feature-card,
.article-card,
.review-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.categories-grid article img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-bottom: 12px;
  display: block;
}

.categories-grid p,
.product-card p,
.seo-block p,
.feature-card p,
.review-card p {
  color: var(--muted);
}

.section--muted {
  background: var(--surface-muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title-row a,
.seo-block__link {
  color: var(--brand);
  font-weight: 600;
}

.badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #8f0f0f;
  background: #ffe6e6;
}

.product-card {
  display: grid;
  gap: 8px;
}

.product-card__bottom {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-card__bottom a {
  color: var(--brand);
  font-weight: 600;
}

.feature-card h3,
.article-card h3 {
  margin-bottom: 8px;
}

.article-card {
  min-height: 130px;
  background: linear-gradient(160deg, #f9fbff 0%, #eef4ff 100%);
}

.article-card__tag {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #5f6d91;
  text-transform: uppercase;
}

.review-card {
  display: grid;
  gap: 10px;
}

.review-card__meta {
  color: #5b6175;
  font-size: 14px;
  font-weight: 600;
}

.brands__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.brands__list span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fafbfe;
}

.seo-block {
  display: grid;
  gap: 12px;
}

.footer {
  margin-top: 20px;
  background: #1a2030;
  color: #bec6db;
}

.footer__inner {
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.footer__links {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.footer__links a {
  color: #fff;
}

@media (max-width: 960px) {
  .header-main__inner,
  .hero__grid {
    grid-template-columns: 1fr;
  }

  .footer__links {
    justify-items: start;
  }
}

@media (max-width: 700px) {
  h2 {
    font-size: 24px;
  }

  .topbar__inner,
  .topbar__left,
  .topbar__right,
  .footer__inner,
  .section-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-nav {
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

/* ---- Кнопка «Заказать звонок» в шапке ---- */
.user-nav__cta {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}
.user-nav__cta:hover { background: rgba(0,0,0,0.04); }

/* ---- Модалка ---- */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal__panel {
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: min(92vw, 480px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  max-height: 90vh; overflow: auto;
}
.modal__close {
  position: absolute; top: 12px; right: 12px;
  background: transparent; border: 0; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--muted, #888); padding: 4px 8px;
}
.modal__close:hover { color: #000; }

/* ---- Подписка на наличие на карточке ---- */
.stock-subscription {
  background: #f6f8fa;
  border: 1px solid var(--line, #e5e7eb);
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
}
.stock-subscription h3 { margin: 0 0 8px; font-size: 16px; }
.stock-subscription input {
  width: 100%; padding: 8px; box-sizing: border-box;
  margin-top: 4px;
}
.stock-subscription label {
  display: block; margin-top: 8px;
  font-size: 14px; color: var(--muted, #555);
}

/* ---- 4 квадрата категорий-промо на главной (Фаза 7) ---- */
.category-promos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.category-promo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: border-color .12s, box-shadow .12s;
}
.category-promo:hover {
  border-color: #c8cddd;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.category-promo__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafbfe;
  border-radius: 10px;
  overflow: hidden;
}
.category-promo__image img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}
.category-promo h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}
@media (max-width: 960px) {
  .category-promos { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .category-promos { grid-template-columns: 1fr; }
}

/* ---- Плашка «Доставка по Москве на следующий рабочий день» ---- */
.delivery-banner {
  margin-top: 16px;
  padding: 14px 16px;
  background: #f6faf6;
  border: 1px solid #d8e8d8;
  border-radius: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.delivery-banner__icon {
  font-size: 28px;
  line-height: 1;
}
.delivery-banner strong {
  display: block;
  margin-bottom: 4px;
}
.delivery-banner p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}
.delivery-banner a {
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
}
.delivery-banner a:hover {
  text-decoration: underline;
}

/* Honeypot — поле / контейнер, скрытый offscreen для защиты от ботов
   (см. ADR 0001 §5). Использует left:-9999px вместо display:none, чтобы
   автозаполнение и боты видели поле и заполнили его. */
.honeypot-field,
.honeypot-wrap {
  position: absolute;
  left: -9999px;
}
.honeypot-wrap {
  top: -10000px;
}

/* Список flash-сообщений Django (templates/base.html). Сбрасываем
   маркеры/паддинги, чтобы карточки .messages li сами рулили layout. */
.messages-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* CMS-блог: разделитель «вернуться» под телом статьи. */
.blog-back {
  margin-top: 24px;
}

/* Callback-модалка: пояснение под заголовком. */
.callback-modal__hint {
  margin-top: 0;
  color: var(--legacy-muted);
  font-size: 14px;
}
