/* ==========================================================================
   Тема led-elektro.ru (new-theme)
   Общие стили, перенесённые из макетов new-theme/*.dc.html.
   Инлайн-стили остаются в самих шаблонах; здесь только то, что повторяется
   и не может быть инлайном (базовые правила, @media, hover/focus).
   ========================================================================== */

/* --- Базовые (из блока <style> каждого макета) --- */
body {
  margin: 0;
  background: #F5F3EE;
  color: #1E1F22;
  font-family: 'Manrope', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: oklch(0.52 0.19 258); }
/* В подвале синий фон — ссылки подсвечиваем тёплым жёлтым (amber) */
footer a:hover { color: oklch(0.85 0.18 90); transition: color .15s; }
input::placeholder {
  font-family: 'Manrope', sans-serif;
  font-weight: 500;
  color: #8E8A82;
  opacity: 1;
}
* { box-sizing: border-box; }

/* --- Адаптивные правила по data-r (дословно из макетов) --- */
details[data-r=burger] summary::-webkit-details-marker { display: none; }

@media (max-width:1024px) {
  [data-r=g4] { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
}
@media (max-width:1100px) {
  [data-r=hdr] { grid-template-columns: minmax(0,1fr) auto auto !important; gap: 12px !important; }
  [data-r=hdr] > :nth-child(2) { grid-column: 1/-1; order: 5; }
  [data-r=dnav], [data-r=hide-m] { display: none !important; }
  [data-r=burger] { display: block !important; }
  [data-r=stackl] { grid-template-columns: minmax(0,1fr) !important; grid-template-rows: auto !important; }
}
@media (max-width:900px) {
  [data-r=g4], [data-r=g3], [data-r=foot] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  [data-r=stack] { grid-template-columns: minmax(0,1fr) !important; grid-template-rows: auto !important; }
  [data-r=sticky] { position: static !important; }
  /* Популярные категории: даём карточкам расти под длинные названия */
  .cat-grid { grid-auto-rows: minmax(150px, auto) !important; }
  /* Заголовок категории (H1) — меньше, когда карточки идут в 2 колонки */
  .cat-title { font-size: 24px !important; }
  /* Заголовки подкатегорий — меньше, чтобы меньше переносов */
  .subcat-title { font-size: 12px !important; }
  /* Названия товаров — меньше */
  .prod-title { font-size: 12px !important; min-height: 48px !important; }
}
/* Популярные категории: перенос длинных слов, чтобы карточка не вылезала за край */
.cat-grid > a { min-width: 0; }
.cat-grid span { overflow-wrap: anywhere; word-break: break-word; }

/* Кнопка «наверх» — скрыта до прокрутки, плавно появляется */
#to-top { opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .25s, visibility .25s, transform .25s; }
#to-top.show { opacity: 1; visibility: visible; transform: none; }
@media (max-width:600px) {
  [data-r=g3], [data-r=foot], [data-r=hcard] { grid-template-columns: minmax(0,1fr) !important; }
  /* Популярные категории: на узких экранах — по одной карточке в ряд */
  .cat-grid { grid-template-columns: minmax(0,1fr) !important; }
  .cat-grid > a:first-child { grid-row: auto !important; }
  /* Блок преимуществ (Доставка/Опт/…) — по одной карточке в ряд */
  .feat-grid { grid-template-columns: minmax(0,1fr) !important; }
  [data-r=hide-s] { display: none !important; }
  [data-r=cartrow] { grid-template-columns: 72px minmax(0,1fr) auto !important; gap: 12px 16px !important; }
  [data-r=cartrow] > :nth-child(1) { grid-area: 1/1/3/2; width: 72px !important; height: 72px !important; }
  [data-r=cartrow] > :nth-child(2) { grid-area: 1/2/2/3; }
  [data-r=cartrow] > :nth-child(5) { grid-area: 1/3/2/4; }
  [data-r=cartrow] > :nth-child(3) { grid-area: 2/2/3/3; justify-self: start; }
  [data-r=cartrow] > :nth-child(4) { grid-area: 2/3/3/4; min-width: 0 !important; }
}

/* --- Утилиты hover/focus (замена DC-атрибутов style-hover / style-focus) --- */
/* Затемнение кнопок при наведении */
.th-dim:hover { filter: brightness(0.92); }
/* Обводка карточки при наведении */
.th-ring:hover { box-shadow: 0 0 0 2px oklch(0.52 0.19 258); }
/* Поле ввода в фокусе */
.th-input:focus { border-color: oklch(0.52 0.19 258) !important; background: #fff !important; }
/* Стрелки карусели «Популярные товары» */
.pop-arrow:hover { background: oklch(0.62 0.21 28) !important; color: #fff !important; }

/* --- Типографика HTML-контента из CKEditor (страницы, новости, описание товара) --- */
.article-body { font-size: 16px; line-height: 1.65; color: #2C2D30; }
.article-body > :first-child { margin-top: 0; }
.article-body > :last-child { margin-bottom: 0; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: #1E1F22;
  margin: 1.6em 0 0.6em; text-wrap: balance;
}
.article-body h1 { font-size: clamp(26px, 3.0vw, 38px); }
.article-body h2 { font-size: clamp(22px, 2.5vw, 30px); }
.article-body h3 { font-size: clamp(19px, 2.0vw, 24px); }
.article-body p { margin: 0 0 1em; }
.article-body a { color: oklch(0.52 0.19 258); text-decoration: underline; text-underline-offset: 3px; }
.article-body ul, .article-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.article-body li { margin: 0.35em 0; }
.article-body img { max-width: 100%; height: auto; border-radius: 16px; margin: 0.5em 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 15px; }
.article-body th, .article-body td { border: 1px solid #E4E0D7; padding: 10px 14px; text-align: left; }
.article-body th { background: #F5F3EE; font-weight: 700; }
.article-body blockquote {
  margin: 1em 0; padding: 12px 20px; border-left: 4px solid oklch(0.52 0.19 258);
  background: #F5F3EE; border-radius: 0 12px 12px 0; color: #4A4945;
}
.article-body iframe { max-width: 100%; border-radius: 16px; }
