/* Блоки главной под баннерами: плашки разделов, преимущества, вкладки с товарами,
   новости, четыре баннера, описание сайта. Общий ритм: 48 px между блоками. */

.site-main > section,
.site-main > nav.cat-tiles { margin-top: var(--space-48); }
.site-main > .home-top + nav.cat-tiles { margin-top: var(--space-24); }

.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px var(--space-16); margin-bottom: var(--space-24); }
.section-head__title { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.2; }
/* Ссылка «Все …» — текстом рядом с заголовком секции, без стрелки */
.section-head__all { color: var(--primary-pressed); font-size: 14px; font-weight: 700; white-space: nowrap; }
.section-head__all:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Плашки разделов (маленькие, как на ВсеИнструменты) ---------- */
.cat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-16); }
.cat-tile {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 132px;
  overflow: hidden;
  padding: var(--space-16) var(--space-16) var(--space-16) var(--space-20, 20px);
  border-radius: var(--radius-tile);
  background: var(--surface-1);
}
/* Оранжевый круг растёт из правого нижнего угла за картинкой (как у плиток каталога на liderair.ru).
   Он занимает только правую часть плитки, где нет текста, поэтому подписи остаются тёмными. */
.cat-tile::before {
  content: "";
  position: absolute;
  z-index: 0;
  right: -4%;
  bottom: -28%;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--primary);
  transform: scale(0);
  transition: transform 350ms var(--ease);
  pointer-events: none;
}
.cat-tile__text { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; max-width: 58%; }
.cat-tile__name { font-size: 17px; font-weight: 700; line-height: 1.25; }
.cat-tile__count { color: var(--ink-subtle); font-size: 14px; line-height: 1.3; }
.cat-tile__img {
  position: absolute;
  right: 8px;
  bottom: 6px;
  width: 44%;
  height: 86%;
  object-fit: contain;
  object-position: right bottom;
  z-index: 1;
  transition: transform 500ms var(--ease);
  transform-origin: 70% 90%;
}
@media (hover: hover) and (pointer: fine) {
  .cat-tile:hover::before { transform: scale(1); }
}
.cat-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cat-tile:focus-visible::before { transform: scale(1); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cat-tile:hover .cat-tile__img { transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .cat-tile::before { transition: none; }
}

/* ---------- Вкладки: Новинки / Хиты продаж / Комплекты ---------- */
.showcase__tabs { display: flex; gap: var(--space-32); margin-bottom: var(--space-24); overflow-x: auto; scrollbar-width: none; }
.showcase__tabs::-webkit-scrollbar { display: none; }
.showcase__tab {
  position: relative;
  flex: none;
  padding: 0 0 var(--space-12);
  border: 0;
  background: none;
  color: var(--ink-subtle);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.showcase__tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px 2px 0 0; background: var(--primary); transform: scaleX(0); transition: transform var(--dur) var(--ease); }
.showcase__tab:hover { color: var(--ink); }
.showcase__tab[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.showcase__tab[aria-selected="true"]::after { transform: none; }
/* Плавное появление — только при переключении вкладки (класс ставит home.js); при загрузке страницы ничего не «всплывает» */
@media (prefers-reduced-motion: no-preference) { .showcase__panel.is-entering { animation: panel-in 260ms var(--ease) both; } }
.showcase__item { min-width: 0; display: flex; }
.showcase__item > .pcard { flex: 1; }
.showcase__item.is-revealed { animation: panel-in 320ms var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.showcase__more { display: flex; justify-content: center; margin-top: var(--space-24); }
.showcase__more-btn { min-width: 220px; gap: var(--space-8); transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
/* Наведение: контурная кнопка заливается цветом бренда, текст светлый (правило сайта) */
@media (hover: hover) {
  .showcase__more-btn:hover { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
}
.showcase__more-btn:active { background: var(--primary-pressed); border-color: var(--primary-pressed); color: var(--on-primary); }
.showcase__more-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--primary); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Новости ---------- */
.news__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-16); }
.ncard { position: relative; display: flex; flex-direction: column; min-width: 0; }
.ncard__photo { aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius-tile); background: var(--surface-1); }
.ncard__photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.ncard__meta { display: flex; align-items: center; gap: var(--space-12); margin: var(--space-12) 0 var(--space-4); color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.ncard__views { display: inline-flex; align-items: center; gap: 4px; }
.ncard__views .icon { width: 15px; height: 15px; }
/* Высота заголовка всегда под три строки, чтобы описания и карточки не «плясали» */
.ncard__title { display: -webkit-box; min-height: calc(1.3em * 3); margin: 0 0 var(--space-8); overflow: hidden; font-size: 16px; font-weight: 700; line-height: 1.3; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ncard__link { color: var(--primary-pressed); transition: color var(--dur-fast) var(--ease); }
.ncard__link::after { content: ""; position: absolute; inset: 0; }
.ncard__link:hover { color: var(--primary-deep); }
.ncard__text { display: -webkit-box; margin: 0; overflow: hidden; color: var(--ink-muted); -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .ncard:hover .ncard__photo img { transform: scale(1.04); }
}

/* ---------- Подбор техники по задаче на главной ---------- */
.bbanners { margin-top: var(--space-48); }
.bbanners__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-16); }
.bbn { position: relative; display: block; min-height: 230px; overflow: hidden; isolation: isolate; border-radius: var(--radius-tile); color: var(--inverse-ink); background: var(--surface-1); }
.bbn::before { content: none; }
.bbn::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(24, 16, 8, .88), rgba(24, 16, 8, .18) 54%, transparent 76%); pointer-events: none; }
.bbn__img { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease); }
.bbn__copy { position: absolute; z-index: 2; right: var(--space-16); bottom: var(--space-16); left: var(--space-16); display: grid; gap: 5px; }
.bbn__title { font-size: 16px; font-weight: 700; line-height: 1.22; }
.bbn__subtitle { color: rgba(255, 255, 255, .88); font-size: 13px; line-height: 1.35; }
.bbn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .bbn:hover .bbn__img { transform: scale(1.025); }
}

/* ---------- Описание сайта ---------- */
/* Текст описания — на всю ширину блока */
.seo-text { max-width: none; }
.seo-text__title { margin: 0 0 var(--space-16); font-size: 28px; font-weight: 500; line-height: 1.2; }
.seo-text__body { color: var(--ink-muted); font-size: 15px; line-height: 1.65; }
.seo-text__body h2, .seo-text__body h3 { margin: var(--space-24) 0 var(--space-8); color: var(--ink); font-size: 20px; line-height: 1.3; }
.seo-text__body p { margin: 0 0 var(--space-12); }
.seo-text__body ul, .seo-text__body ol { margin: 0 0 var(--space-12); padding-left: 1.3em; }
.seo-text__body a { color: var(--primary-pressed); text-decoration: underline; }

/* ---------- Планшет ---------- */
@media (max-width: 1279px) {
  .news__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .news__grid > :nth-child(5) { display: none; }
}
@media (max-width: 1023px) {
  .cat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .news__grid > :nth-child(4) { display: none; }
  .bbanners__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Телефон ---------- */
@media (max-width: 767px) {
  .site-main > section, .site-main > nav.cat-tiles { margin-top: var(--space-32); }
  .site-main > .home-top + nav.cat-tiles { margin-top: var(--space-16); }
  .section-head__title, .seo-text__title { font-size: 22px; }
  .section-head { margin-bottom: var(--space-16); }
  .cat-tiles { gap: var(--space-12); }
  .cat-tile { min-height: 116px; padding: var(--space-12) var(--space-8) var(--space-12) var(--space-12); }
  .cat-tile__name { font-size: 14px; }
  .cat-tile__text { max-width: 56%; }
  .cat-tile__img { width: 40%; }
  .showcase__tabs { gap: var(--space-24); }
  .showcase__tab { font-size: 18px; }
  .showcase__more-btn { width: 100%; }
  .news__grid { display: flex; gap: var(--space-12); margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .news__grid::-webkit-scrollbar { display: none; }
  .news__grid > .ncard { flex: 0 0 78%; scroll-snap-align: start; }
  .news__grid > :nth-child(4), .news__grid > :nth-child(5) { display: flex; }
  .bbanners__grid { gap: var(--space-12); }
  .bbn { min-height: 176px; }
  .bbn__copy { right: var(--space-12); bottom: var(--space-12); left: var(--space-12); gap: 3px; }
  .bbn__title { font-size: 13px; }
  .bbn__subtitle { font-size: 11px; }
}

/* Малый баннер, скрытый на телефоне */
@media (max-width: 767px) {
  .bbn--hide-mobile { display: none; }
}

/* Преимущества магазина под баннерами (выводятся, если включено на странице «Преимущества» в админке). Иконка своего размера (--adv-size), по умолчанию 32 px */
.advantages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-16); margin-top: var(--space-24); }
.adv-tile { display: flex; align-items: center; gap: var(--space-16); padding: var(--space-16); border-radius: var(--radius-tile); background: var(--surface-1); color: var(--ink); text-decoration: none; }
a.adv-tile { transition: background-color 160ms ease; }
a.adv-tile:hover { background: var(--surface-2); }
a.adv-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.adv-tile__icon { display: grid; place-items: center; flex: none; width: var(--adv-size, 32px); height: var(--adv-size, 32px); color: var(--primary-pressed); }
.adv-tile__icon .icon, .adv-tile__icon img { width: 100%; height: 100%; object-fit: contain; }
.adv-tile__body { display: grid; gap: 2px; min-width: 0; }
.adv-tile__title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.adv-tile__text { font-size: 14px; line-height: 1.4; color: var(--ink-muted); }
@media (max-width: 1023px) { .advantages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .advantages { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); } }
.site-main > .advantages + nav.cat-tiles { margin-top: var(--space-24); }


