/* =========================================================
   home.css — главная страница
   ========================================================= */

.home-page {
  padding-bottom: var(--space-10);
}

/* ---------- 1. Hero-баннер ---------- */
.home-hero {
  margin-top: var(--space-4);
  margin-bottom: var(--space-5);
}

.home-hero__inner {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  height: 320px;
  display: flex;
  align-items: center;
  padding: var(--space-6) var(--space-8);
  background: #1A1E24;
}

.home-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 75% center;
  z-index: 1;
}

.home-hero__inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(26, 30, 36, 0.95) 0%, rgba(26, 30, 36, 0.7) 45%, rgba(26, 30, 36, 0) 100%);
  z-index: 2;
}

.home-hero__content {
  position: relative;
  z-index: 3;
  max-width: 520px;
  color: #ffffff;
}

.home-hero__title {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
  margin-bottom: var(--space-2);
  color: #ffffff;
}

.home-hero__desc {
  font-size: var(--fs-sm);
  margin-bottom: var(--space-5);
  color: rgba(255, 255, 255, 0.85);
}

.home-hero__actions {
  display: flex;
  gap: var(--space-3);
}

.home-hero__btn {
  font-size: var(--fs-sm);
  padding: var(--space-3) var(--space-5);
}

.home-hero__btn--ghost {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.home-hero__btn--ghost:hover {
  background: #ffffff;
  color: #1A1E24;
  border-color: #ffffff;
}

/* =========================================================
   2. ВЕРХНИЕ ПРЕИМУЩЕСТВА (ИКОНКИ)
   ========================================================= */
.home-top-features {
  margin-bottom: var(--space-8);
}

.home-top-features__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.home-top-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-5) var(--space-4);
  border-right: 1px solid var(--color-border);
}

.home-top-feature:last-child {
  border-right: none;
}

.home-top-feature__icon {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-3);
  object-fit: contain;
}

.home-top-feature__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  margin: 0 0 var(--space-1) 0;
}

.home-top-feature__desc {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}

/* ---------- Заголовки секций ---------- */
.home-section {
  margin-bottom: var(--space-8);
}

.home-section--last {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.section-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  margin: 0;
}

.link-all-products {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-accent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: opacity var(--transition);
}

.link-all-products:hover {
  opacity: 0.7;
}

/* =========================================================
   3. КАТЕГОРИИ ТОВАРОВ
   ========================================================= */
.home-categories {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  align-items: stretch;
}

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  background: #2a2a2a;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.category-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.category-card:hover .category-card__img {
  transform: scale(1.05);
}

.category-card__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #3a3a3a;
}

.category-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
  z-index: 1;
}

.category-card__content {
  position: relative;
  z-index: 2;
  padding: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.category-card__title {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-card__title-link {
  color: inherit;
  text-decoration: none;
}

.category-card__btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  color: #ffffff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s ease;
}

.category-card:hover .category-card__btn {
  background: var(--color-accent-hover);
}

/* --- Шапка подкатегорий --- */
.title-with-back {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.btn-back-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f0f0f0;
  color: var(--color-text);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-back-arrow:hover {
  background: var(--color-accent);
  color: #fff;
}

.subcategory-name {
  color: #888;
  font-weight: 400;
}

/* =========================================================
   4. СЛАЙДЕР ПОПУЛЯРНЫХ ТОВАРОВ
   ========================================================= */
.home-slider {
  position: relative;
  display: block !important;
  padding: 0 20px !important;
  overflow: visible !important;
  width: 100% !important;
}

.home-products-grid {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 20px !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 16px !important;
}

.home-products-grid::-webkit-scrollbar {
  display: none;
}

.home-products-grid__item {
  flex: 0 0 calc((100% - (16px * 4)) / 5) !important;
  max-width: calc((100% - (16px * 4)) / 5) !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.home-products-grid__item .product-card {
  border-radius: var(--radius-lg);
}

.home-products-grid__item .product-card__body {
  gap: 0 !important;
  padding: var(--space-3) !important;
  overflow: hidden !important;
}

.home-products-grid__item .product-card__brand {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 10px !important;
  color: #888;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.home-products-grid__item .product-card__title {
  font-size: 13px !important;
  line-height: 1.3 !important;
  margin-bottom: var(--space-2) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  word-break: break-word !important;
}

.home-products-grid__item .product-card__price {
  padding-top: 0 !important;
  font-size: var(--fs-base) !important;
  margin-top: auto !important;
  font-weight: var(--fw-bold) !important;
}

.home-products-grid__item .product-card__media {
  border-bottom: none !important;
}

.home-products-grid__item .product-card__media img {
  padding: var(--space-2) !important;
  mix-blend-mode: normal !important;
  transition: none !important;
}

.home-products-grid__item .product-card:hover .product-card__media img {
  transform: none !important;
}

.home-products-grid__item .product-card__like {
  width: 28px !important;
  height: 28px !important;
  top: 6px !important;
  right: 6px !important;
}

.home-products-grid__item .product-card__like svg {
  width: 14px !important;
  height: 14px !important;
}

.home-slider__btn {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 99 !important;
  width: 40px !important;
  height: 40px !important;
  background: #ffffff !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.3s ease !important;
}

.home-slider__btn:hover {
  color: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
}

.home-slider__btn--prev { left: 0 !important; }
.home-slider__btn--next { right: 0 !important; }

.home-slider__btn.is-disabled {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* =========================================================
   5. CTA Баннер (ИСПРАВЛЕННЫЙ ФОН)
   ========================================================= */
.home-cta {
  /* Градиент для читаемости текста + сама картинка */
  background-image:
    linear-gradient(90deg, #252D36 0%, rgba(37, 45, 54, 0.85) 40%, rgba(37, 45, 54, 0.1) 100%),
    url("/static/img/home/home_footer.a345c7707f4b.png");
  background-image:
    linear-gradient(90deg, #252D36 0%, rgba(37, 45, 54, 0.85) 40%, rgba(37, 45, 54, 0.1) 100%),
    image-set(
      url("/static/img/home/home_footer.3152617b1189.webp") type('image/webp'),
      url("/static/img/home/home_footer.a345c7707f4b.png") type('image/png')
    );
  background-size: cover;
  background-position: right center; /* Фокусируемся на правой части (машина) */
  background-repeat: no-repeat;
  background-color: #252D36; /* Запасной цвет */

  border-radius: var(--radius-xl);
  padding: var(--space-8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

.home-cta__content h2 {
  color: #fff;
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-2);
}

.home-cta__content p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.text-accent {
  color: var(--color-accent);
}



/* =========================================================
   МОБИЛЬНАЯ ВЕРСИЯ ELITAUTOCOLOR
   Десктопная версия не затрагивается
   ========================================================= */

@media (max-width: 767px) {

  .home-page {
    padding-bottom: 24px;
    overflow-x: clip;
  }

  /* 1. ГЛАВНЫЙ БАННЕР */

  .home-hero {
    margin-top: 12px;
    margin-bottom: 16px;
  }

  .home-hero__inner {
    height: 245px;
    min-height: 220px;
    padding: 18px 16px;
    align-items: flex-end;
    border-radius: 16px;
  }

  .home-hero__bg {
    object-position: 68% center;
  }

  .home-hero__inner::after {
    background: linear-gradient(
      90deg,
      rgba(26, 30, 36, 0.96) 0%,
      rgba(26, 30, 36, 0.78) 58%,
      rgba(26, 30, 36, 0.2) 100%
    );
  }

  .home-hero__content {
    width: 100%;
    max-width: 340px;
  }

  .home-hero__title {
    font-size: clamp(20px, 5.6vw, 24px);
    line-height: 1.12;
    margin-bottom: 8px;
  }

  .home-hero__desc {
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 12px;
  }

  .home-hero__btn {
    font-size: 12px;
    padding: 10px 15px;
  }


  /* 2. ПРЕИМУЩЕСТВА */

  .home-top-features {
    margin-bottom: 26px;
  }

  .home-top-features__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-radius: 14px;
    box-shadow: none;
  }

  .home-top-feature {
    min-width: 0;
    padding: 11px 4px;
    border-right: 1px solid var(--color-border) !important;
    border-bottom: none !important;
  }

  .home-top-feature:last-child {
    border-right: none !important;
  }

  .home-top-feature__icon {
    width: 25px;
    height: 25px;
    margin-bottom: 6px;
  }

  .home-top-feature__title {
    font-size: 10px;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
  }

  .home-top-feature__desc {
    display: none;
  }


  /* 3. ЗАГОЛОВКИ СЕКЦИЙ */

  .home-section {
    margin-bottom: 28px;
  }

  .home-section--last {
    margin-bottom: 0;
  }

  .section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
  }

  .section-title {
    min-width: 0;
    font-size: clamp(19px, 5.2vw, 23px);
    line-height: 1.15;
  }

  .link-all-products {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 12px;
    gap: 4px;
  }

  .link-all-products svg {
    width: 14px;
    height: 14px;
  }


  /* 4. КАТЕГОРИИ ТОВАРОВ */

  .home-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .category-card {
    height: auto;
    min-height: 140px;
    aspect-ratio: 1.08 / 1;
    border-radius: 14px;
  }

  .category-card__content {
    padding: 9px;
    gap: 6px;
  }

  .category-card__title {
    font-size: 12px;
    line-height: 1.2;
    -webkit-line-clamp: 2;
  }

  .category-card__btn {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .title-with-back {
    min-width: 0;
    gap: 8px;
  }

  .title-with-back .section-title {
    font-size: 19px;
  }


  /* 5. ПОПУЛЯРНЫЕ ТОВАРЫ */

  .home-slider {
    position: relative;
    width: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Стрелки на мобильном не нужны — используем свайп */

  .home-slider__btn {
    display: none !important;
  }

  .home-products-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;

    width: 100% !important;
    max-width: 100% !important;

    padding: 0 0 14px !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;

    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: none;
  }

  .home-products-grid::-webkit-scrollbar {
    display: none;
  }

  /* Показываем две карточки одновременно */

  .home-products-grid__item {
    flex: 0 0 calc((100% - 12px) / 2) !important;
    width: calc((100% - 12px) / 2) !important;
    max-width: calc((100% - 12px) / 2) !important;

    min-width: 0 !important;

    scroll-snap-align: start;

    display: flex !important;
    flex-direction: column !important;

    overflow: hidden !important;
  }

  .home-products-grid__item .product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    border-radius: 14px;
    overflow: hidden;
  }

  /* Изображение товара */

  .home-products-grid__item .product-card__media {
    height: 125px;
    min-height: 125px;
    flex: 0 0 125px;
    border-bottom: none !important;
  }

  .home-products-grid__item .product-card__media img {
    width: 100%;
    height: 100%;
    max-height: 125px;
    padding: 10px !important;
    object-fit: contain;
    mix-blend-mode: normal !important;
  }

  /* Информация о товаре */

  .home-products-grid__item .product-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;

    min-width: 0;

    gap: 3px !important;
    padding: 9px !important;

    overflow: hidden !important;
  }

  .home-products-grid__item .product-card__brand {
    font-size: 9px !important;
    line-height: 1.2;

    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .home-products-grid__item .product-card__title {
    display: -webkit-box !important;

    font-size: 11px !important;
    line-height: 1.25 !important;

    margin-bottom: 5px !important;

    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;

    overflow: hidden !important;
    overflow-wrap: anywhere !important;
  }

  .home-products-grid__item .product-card__price {
    margin-top: auto !important;
    padding-top: 3px !important;

    font-size: 14px !important;
    font-weight: var(--fw-bold) !important;
  }

  /* Избранное */

  .home-products-grid__item .product-card__like {
    width: 27px !important;
    height: 27px !important;
    top: 6px !important;
    right: 6px !important;
  }

  .home-products-grid__item .product-card__like svg {
    width: 14px !important;
    height: 14px !important;
  }


  /* 6. НИЖНИЙ БАННЕР */

  .home-cta {
    min-height: 180px;

    padding: 20px 16px;

    display: flex;
    flex-direction: column;

    align-items: flex-start;
    justify-content: center;

    gap: 14px;

    border-radius: 16px;

    background-image:
      linear-gradient(
        90deg,
        rgba(37, 45, 54, 0.96) 0%,
        rgba(37, 45, 54, 0.82) 100%
      ),
      url("/static/img/home/home_footer.a345c7707f4b.png");
    background-image:
      linear-gradient(
        90deg,
        rgba(37, 45, 54, 0.96) 0%,
        rgba(37, 45, 54, 0.82) 100%
      ),
      image-set(
        url("/static/img/home/home_footer.3152617b1189.webp") type('image/webp'),
        url("/static/img/home/home_footer.a345c7707f4b.png") type('image/png')
      );

    background-position: center, 65% center;
  }

  .home-cta__content h2 {
    font-size: 20px;
    line-height: 1.18;
    margin-bottom: 7px;
  }

  .home-cta__content p {
    font-size: 12px;
    line-height: 1.4;
  }

  .home-cta__btn {
    width: auto;
    min-height: 40px;

    margin-top: 2px;
    padding: 10px 16px;

    text-align: center;
    font-size: 12px;
  }

}


/* =========================================================
   ОЧЕНЬ УЗКИЕ ЭКРАНЫ: 320–359 PX
   ========================================================= */

@media (max-width: 359px) {

  .home-hero__inner {
    height: 220px;
    min-height: 210px;
    padding: 14px;
  }

  .home-hero__title {
    font-size: 19px;
  }

  .section-title {
    font-size: 18px;
  }

  .link-all-products {
    font-size: 11px;
  }

  .category-card {
    min-height: 125px;
  }

  .category-card__title {
    font-size: 11px;
  }

  .home-products-grid__item .product-card__media {
    height: 112px;
    min-height: 112px;
    flex-basis: 112px;
  }

  .home-products-grid__item .product-card__media img {
    max-height: 112px;
  }

  .home-products-grid__item .product-card__title {
    font-size: 10px !important;
  }

}
