/* Home redesign — «Фактуры»
   Figma: 360 / 768 / 1024 — cards; 1280 / 1440 / 1920 — list + hover
*/

.bz-textures {
  background-color: var(--bz-bg-prim, #f7f6f1);
  /* Figma 360: кнопки ECO/PRO → title = 120; карточки → тёмная секция = 120 */
  padding: 120px 0 120px;
  margin: 0;
  box-sizing: border-box;
  /* карточки: не даём ленте раздувать страницу; с 1280 — visible для hover-превью */
  overflow-x: hidden; /* Safari < 16: нет clip */
  overflow-x: clip;
}

.bz-textures__label {
  display: none;
  margin: 0;
  color: #7e7d7b;
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.bz-textures__main {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.bz-textures__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 0 20px;
  /* Figma 360: title 196×79 (3 строки) → cards; 2621−2534−79 ≈ 8 */
  margin-bottom: 8px;
  box-sizing: border-box;
}

.bz-textures__title {
  margin: 0;
  flex: 0 0 auto;
  max-width: 196px;
  color: var(--bz-b-100, #2d2c2c);
  font-family: Inter, sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

/* 360/базовый макет: только «Самые популярные фактуры».
   «Коллекции плёнок» — итерация 768–1024 (см. media). */
.bz-textures__title-td {
  display: none;
}

.bz-textures__catalog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  /* Figma: вровень с первой строкой заголовка */
  margin-top: 0;
  color: var(--bz-prim, #f27e00);
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.bz-textures__catalog:hover,
.bz-textures__catalog:focus {
  color: var(--bz-prim-hov, #ff9521);
  text-decoration: none;
}

.bz-textures__icon {
  display: block;
  flex-shrink: 0;
}

/* ——— Cards (mobile / tablet) ——— */
.bz-textures__cards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 15px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0 20px;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bz-textures__cards::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.bz-textures__card {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 0 0 236px;
  width: 236px;
  color: var(--bz-b-100, #2d2c2c);
  text-decoration: none;
}

.bz-textures__card:hover,
.bz-textures__card:focus {
  color: var(--bz-b-100, #2d2c2c);
  text-decoration: none;
}

.bz-textures__card-img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.bz-textures__card-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding-right: 20px;
}

.bz-textures__card-name {
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-decoration-skip-ink: none;
  text-underline-offset: from-font;
}

.bz-textures__card .bz-textures__icon {
  color: var(--bz-b-100, #2d2c2c);
}

.bz-textures__list {
  display: none;
}

/* ——— 768 ——— */
@media (min-width: 768px) {
  .bz-textures {
    /* Figma 768: от кнопок ECO/PRO до заголовка 101, от подписей карточек до тёмной секции 147 */
    padding: 101px 0 147px;
  }

  .bz-textures__head {
    padding: 0 30px;
    /* Figma 768: заголовок → карточки = 44 */
    margin-bottom: 44px;
  }

  .bz-textures__title {
    max-width: 400px;
    font-size: 32px;
    line-height: 1.3;
    letter-spacing: -0.04em;
  }

  /* Переключение заголовка по итерациям макета: 768–1023 = «Коллекции плёнок» */
  .bz-textures__title-def {
    display: none;
  }

  .bz-textures__title-td {
    display: inline;
  }

  .bz-textures__catalog {
    /* Figma 768: стрелка до ~758 (правое поле 10) */
    margin-right: 20px;
  }

  .bz-textures__cards {
    padding: 0 30px;
    gap: 15px;
  }

  .bz-textures__card {
    flex-basis: 230px;
    width: 230px;
  }
}

/* ——— 1024 ——— */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .bz-textures {
    padding: 101px 0 147px;
  }

  .bz-textures__head {
    padding: 0 30px;
  }

  .bz-textures__title {
    max-width: 500px;
  }

  .bz-textures__cards {
    padding: 0 30px;
  }

  .bz-textures__card {
    flex-basis: 226px;
    width: 226px;
  }
}

/* ——— 1280+: list ——— */
@media (min-width: 1280px) {
  .bz-textures {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(0, 601px);
    column-gap: 40px;
    align-items: start;
    padding: 160px 30px 90px;
    overflow-x: visible;
  }

  /* Возврат к итерации 1280+ (старый макет): заголовок «Самые популярные фактуры» */
  .bz-textures__title-def {
    display: inline;
  }

  .bz-textures__title-td {
    display: none;
  }

  .bz-textures__label {
    display: block;
    padding-top: 0;
  }

  .bz-textures__main {
    grid-column: 2;
  }

  .bz-textures__head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 16px;
    padding: 0;
    /* Figma: title → list = 40px */
    margin-bottom: 40px;
  }

  .bz-textures__title {
    /* Figma 1280: 397×~84, 2 строки */
    max-width: 397px;
    font-size: 32px;
    line-height: 1.3;
    letter-spacing: -0.04em;
  }

  .bz-textures__catalog {
    margin-top: 0;
  }

  .bz-textures__cards {
    display: none;
  }

  .bz-textures__list {
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .bz-textures__row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    margin-top: -1px;
    padding-right: 20px;
    border-top: 1px solid var(--bz-divider, #cecece);
    border-bottom: 1px solid var(--bz-divider, #cecece);
    box-sizing: border-box;
    color: var(--bz-b-100, #2d2c2c);
    font-family: Inter, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.02em;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
  }

  .bz-textures__row:hover,
  .bz-textures__row:focus {
    color: var(--bz-prim, #f27e00);
    background-color: rgba(45, 44, 44, 0.03);
    text-decoration: none;
  }

  .bz-textures__row-name {
    position: relative;
    z-index: 1;
  }

  .bz-textures__row .bz-textures__icon {
    position: relative;
    z-index: 1;
    color: inherit;
  }

  .bz-textures__preview {
    position: absolute;
    right: calc(100% + 80px);
    top: 50%;
    width: 200px;
    height: 240px;
    margin-top: -120px;
    opacity: 0;
    pointer-events: none;
    transform: rotate(19deg);
    transform-origin: center;
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0, 0, 0, 1);
    z-index: 2;
  }

  .bz-textures__preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .bz-textures__row:hover .bz-textures__preview {
    opacity: 1;
    transform: rotate(0deg);
  }

  /* отдельно: Safari < 15.4 выбросил бы правило с :hover целиком */
  .bz-textures__row:focus-visible .bz-textures__preview {
    opacity: 1;
    transform: rotate(0deg);
  }
}

/* ——— 1440 ——— */
@media (min-width: 1440px) {
  .bz-textures {
    /* Figma: label | main 681 (title 451 + catalog, list 681).
       Ограничение контейнера 1440 + центрирование: на окнах 1441–1919
       (MacBook 14/16) left-колонка 1fr раньше поглощала всю ширину окна
       и отталкивала блок от центра (BUG-003, задача 6324.82). */
    grid-template-columns: minmax(200px, 1fr) minmax(0, 681px);
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    padding: 180px 30px 100px;
    column-gap: 40px;
  }

  .bz-textures__title {
    /* Figma 1440: 451×84, 2 строки, lh 42 */
    max-width: 451px;
    font-size: 42px;
    line-height: 1;
    letter-spacing: -0.04em;
  }

  .bz-textures__catalog {
    margin-top: 0;
  }

  .bz-textures__preview {
    right: calc(100% + 100px);
  }
}

/* ——— 1920 ——— */
@media (min-width: 1920px) {
  .bz-textures {
    grid-template-columns: 1fr minmax(0, 1fr) auto;
    max-width: 1920px;
    margin: 0 auto;
    padding: 180px 30px 100px;
    column-gap: 40px;
  }

  .bz-textures__title {
    max-width: none;
    font-size: 42px;
    line-height: 1;
  }

  .bz-textures__catalog {
    margin-top: 11px;
  }

  .bz-textures__preview {
    right: calc(100% + 120px);
  }
}
