/* Блоки главной под баннерами: плашки разделов, преимущества, вкладки с товарами,
   новости, четыре баннера, описание сайта. Общий ритм: 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;
  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);
  transition: background-color var(--dur) var(--ease);
}
.cat-tile:hover { background: var(--surface-2); }
.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;
  transition: transform 500ms var(--ease);
  transform-origin: 70% 90%;
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cat-tile:hover .cat-tile__img { transform: scale(1.06); }
}

/* ---------- Вкладки: Новинки / Хиты продаж / Комплекты ---------- */
.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 .article-image-frame { width: 100%; height: 100%; }
.ncard__photo img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; 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 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-16); }
.bbn { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-tile); background: var(--surface-1); }
.bbn__img { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease); }
.bbn__title {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-32) var(--space-16) var(--space-12);
  background: linear-gradient(to top, rgba(24, 16, 8, 0.72), rgba(24, 16, 8, 0));
  color: var(--inverse-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}
.bbn:focus-visible { box-shadow: var(--shadow-focus); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .bbn:hover .bbn__img { transform: scale(1.04); }
}

/* ---------- Описание сайта ---------- */
/* Текст описания — на всю ширину блока */
.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-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 { gap: var(--space-12); }
  .bbn__title { padding: var(--space-24) var(--space-8) var(--space-8); font-size: 12px; }
}
