/* Home redesign — «2 коллекции» Eco / Pro
   Figma: 360 / 768 / 1024 / 1280 / 1440 / 1920
*/

.bz-collections {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: var(--bz-bg-prim, #f7f6f1);
  padding: 120px 10px 0;
  margin: 0;
  box-sizing: border-box;
}

.bz-collections__title {
  order: 1;
  margin: 0 auto 33px;
  max-width: 320px;
  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-align: center;
  text-transform: uppercase;
}

/* Figma 360: абсолютные top строк + общий ритм gap 30.
   Subgrid держит label/ECO/PRO в одной дорожке — бейдж PRO
   не сдвигает колонку (раньше +13px на всех рядах). */
.bz-collections__compare {
  order: 2;
  display: grid;
  grid-template-columns: 81px minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto repeat(7, auto);
  column-gap: 12px;
  row-gap: 30px;
  align-items: start;
  width: 100%;
  max-width: 351px;
  margin: 0 auto;
  position: relative;
}

.bz-collections__textures {
  order: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 330px;
  margin: 30px auto 0;
}

.bz-collections__actions {
  order: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  margin: 40px auto 0;
}

.bz-collections__swatches {
  display: flex;
  align-items: center;
  align-self: stretch;
  width: 100%;
  height: 42px;
  isolation: isolate;
}

/* Figma 360: placeholder 72×42, полоса 330 → 6×72 − 5×20 = 332.
   Картинки шире слота equal-flex (55), стык за счёт нахлёста -20. */
.bz-collections__swatch {
  position: relative;
  display: block;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  height: 100%;
  margin-right: -20px;
  object-fit: cover;
  object-position: center;
}

.bz-collections__swatch:last-child {
  margin-right: 0;
}

.bz-collections__swatch:nth-child(1) { z-index: 6; }
.bz-collections__swatch:nth-child(2) { z-index: 5; }
.bz-collections__swatch:nth-child(3) { z-index: 4; }
.bz-collections__swatch:nth-child(4) { z-index: 3; }
.bz-collections__swatch:nth-child(5) { z-index: 2; }
.bz-collections__swatch:nth-child(6) { z-index: 1; }

.bz-collections__swatch:not(:first-child){
  margin-left: 10px;
}

.bz-collections__textures-note {
  margin: 0;
  color: var(--bz-bg-tert, #1b1b1b);
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.02em;
  text-align: center;
}

.bz-collections__labels {
  grid-column: 1;
  grid-row: 2 / 9;
  display: grid;
  grid-template-rows: subgrid;
  /* gap не задаём — subgrid берёт row-gap родителя (30px) */
  align-items: start;
  padding-top: 0;
}

.bz-collections__label {
  color: #7e7d7b;
  font-family: Inter, sans-serif;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.02em;
  text-align: right;
}

.bz-collections__card {
  display: grid;
  grid-template-rows: subgrid;
  min-width: 0;
}

.bz-collections__card--eco {
  position: relative;
  grid-column: 2;
  grid-row: 1 / 9;
}

.bz-collections__card--pro {
  grid-column: 3;
  grid-row: 1 / 9;
}

.bz-collections__card--eco::after {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  width: 1px;
  height: 100%;
  background-color: var(--bz-divider, #cecece);
  pointer-events: none;
}

.bz-collections__card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0;
}

.bz-collections__card-title {
  margin: 0;
  color: var(--bz-b-100, #2d2c2c);
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.bz-collections__card-badge {
  margin: 0;
  color: #7e7d7b;
  font-family: Inter, sans-serif;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.4;
}

.bz-collections__rows {
  display: contents;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bz-collections__row-label {
  display: none;
}

.bz-collections__row-value {
  display: block;
  color: var(--bz-b-100, #2d2c2c);
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.bz-collections__row--yes .bz-collections__row-value {
  color: #0a602d;
}

.bz-collections__row--no .bz-collections__row-value {
  color: #ce0000;
}

.bz-collections__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  padding: 10px 20px;
  border-radius: 40px;
  box-sizing: border-box;
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.bz-collections__btn--eco {
  background-color: var(--bz-b-100, #2d2c2c);
  border: 1px solid var(--bz-b-100, #2d2c2c);
  color: #ffffff;
}

.bz-collections__btn--eco:hover,
.bz-collections__btn--eco:focus {
  background-color: #1b1b1b;
  border-color: #1b1b1b;
  color: #ffffff;
  text-decoration: none;
}

.bz-collections__btn--pro {
  background-color: var(--bz-prim, #f27e00);
  border: 1px solid var(--bz-prim, #f27e00);
  color: #ffffff;
}

.bz-collections__btn--pro:hover,
.bz-collections__btn--pro:focus {
  background-color: var(--bz-prim-hov, #ff9521);
  border-color: var(--bz-prim-hov, #ff9521);
  color: #ffffff;
  text-decoration: none;
}

/* ——— 768 ——— */
@media (min-width: 768px) {
  .bz-collections__swatch:not(:first-child) {
    margin-left: -15px;
  }

  .bz-collections {
    padding: 120px 30px 0;
  }

  .bz-collections__title {
    max-width: 484px;
    margin-bottom: 55px;
    font-size: 32px;
    letter-spacing: 0;
  }

  .bz-collections__compare {
    grid-template-columns: minmax(0, 217px) minmax(0, 223px) minmax(0, 1fr);
    column-gap: 18px;
    max-width: 708px;
  }

  .bz-collections__label {
    font-size: 11px;
    white-space: nowrap;
  }

  .bz-collections__card-badge {
    font-size: 11px;
    font-weight: 400;
  }

  .bz-collections__row-value {
    font-size: 11px;
  }

  .bz-collections__card--eco::after {
    right: -9px;
  }

  .bz-collections__textures {
    max-width: 432px;
    margin-top: 50px;
  }

  /* Figma 768: свотчи 72×42 встык (без нахлёста, полоса 432px) */
  .bz-collections__swatch {
    margin-right: 0;
  }

  .bz-collections__actions {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    max-width: none;
    width: auto;
    margin-top: 39px;
  }

  .bz-collections__btn {
    width: auto;
    min-width: 211px;
    height: 68px;
    border: 0;
  }
}

/* ——— 1024 ———
   Figma: title 484×84 (2 строки) слева, свотчи 350×42 над PRO,
   колонки labels 217 / ECO 353 / PRO 353
*/
@media (min-width: 1024px) {
  .bz-collections__swatch:not(:first-child) {
    margin-left: -20px;
  }
  .bz-collections {
    display: grid;
    grid-template-columns: 217px 353px 353px;
    grid-template-areas:
      "title title textures"
      "labels card-eco card-pro"
      ". actions-eco actions-pro";
    column-gap: 13px;
    row-gap: 0;
    align-items: start;
    /* Figma 1024/1280: title left:30 — не прижимать сетку вправо */
    justify-content: end;
    padding: 90px 30px 0;
  }

  .bz-collections__title {
    grid-area: title;
    order: unset;
    max-width: 484px;
    width: 100%;
    margin: 0 0 30px;
    justify-self: start;
    align-self: start;
    align-items:flex-end;
    text-align: left;
    font-size: 32px;
    line-height: 1.3;
    letter-spacing: -0.04em;
  }

  .bz-collections__textures {
    grid-area: textures;
    grid-row: 1 / 4;
    order: unset;
    width: 350px;
    max-width: 350px;
    margin: 0 0 30px;
    justify-self: end;
    align-self: start;
    align-items: flex-start;
    gap: 8px;
    overflow: visible;
  }

  .bz-collections__swatches {
    height: 42px;
  }

  .bz-collections__swatch {
    flex: 0 0 75px;
    width: 75px;
    min-width: 75px;
    height: 42px;
    margin-right: -20px;
    object-fit: contain;
  }

  .bz-collections__textures-note {
    text-align: left;
  }

  .bz-collections__compare {
    display: contents;
  }

  .bz-collections__labels {
    display: flex;
    flex-direction: column;
    gap: 30px;
    grid-area: labels;
    grid-column: unset;
    grid-row: unset;
    /* опора первой подписи = padding карточки (16) + шапка (74, фикс.) + margin шапки (48):
       выравнивание с первой строкой значений независимо от браузера (BUG-002) */
    padding-top: 138px;
    justify-self: stretch;
    align-items:flex-end;
    width: 217px;
  }

  .bz-collections__label {
    font-size: 14px;
  }

  .bz-collections__card {
    display: flex;
    flex-direction: column;
    grid-column: unset;
    grid-row: unset;
    min-height: 489px;
    padding: 16px;
    box-sizing: border-box;
    background-color: #edeae7;
  }

  .bz-collections__card--eco {
    grid-area: card-eco;
    width: 353px;
  }

  .bz-collections__card--pro {
    grid-area: card-pro;
    width: 353px;
  }

  .bz-collections__rows {
    display: flex;
    flex-direction: column;
    gap: 30px;
  }

  .bz-collections__card--eco::after {
    display: none;
  }

  .bz-collections__card-head {
    /* высота шапки фикс.: строки сравнения начинаются на одной опоре
       во всех браузерах, независимо от метрик шрифта (BUG-002) */
    position: relative;
    height: 74px;
    margin-bottom: 48px;
    gap: 8px;
  }

  /* Figma: шаг строк 50px (lh≈20 + gap 30), абсолютные top —
     фиксируем высоту слота, чтобы перенос в PRO не сдвигал ряды */
  .bz-collections__rows {
    gap: 30px;
  }

  .bz-collections__row {
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    overflow: visible;
  }

  .bz-collections__label {
    height: 20px;
    line-height: 20px;
  }

  .bz-collections__card-title {
    font-size: 32px;
    letter-spacing: 0;
  }

  .bz-collections__card-badge {
    /* плашка вне потока (шапка фикс. высоты): её возможный перенос на 2 строки
       не сдвигает строки сравнения (BUG-002; BUG-004 — max-width: 100%) */
    display: inline-flex;
    position: absolute;
    top: 50px;
    left: 0;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    padding: 4px 10px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
  }

  .bz-collections__card--eco .bz-collections__card-badge {
    background-color: #1b1b1b;
  }

  .bz-collections__card--pro .bz-collections__card-badge {
    background-color: #0a602d;
  }

  .bz-collections__row-value {
    font-size: 14px;
    letter-spacing: 0;
  }

  .bz-collections__actions {
    display: contents;
  }

  .bz-collections__btn {
    height: 48px;
  }

  .bz-collections__btn--eco {
    grid-area: actions-eco;
    width: 353px;
    margin-top: 20px;
    background-color: var(--bz-prim, #f27e00);
    border-color: var(--bz-prim, #f27e00);
  }

  .bz-collections__btn--eco:hover,
  .bz-collections__btn--eco:focus {
    background-color: var(--bz-prim-hov, #ff9521);
    border-color: var(--bz-prim-hov, #ff9521);
  }

  .bz-collections__btn--pro {
    grid-area: actions-pro;
    width: 353px;
    margin-top: 20px;
  }
}

/* ——— 1280 ——— */
@media (min-width: 1280px) {
  
  .bz-collections {
    grid-template-columns: 217px 396px 397px;
    column-gap: 15px;
  }

  .bz-collections__card--eco,
  .bz-collections__btn--eco {
    width: 396px;
  }

  .bz-collections__card--pro,
  .bz-collections__btn--pro {
    width: 397px;
  }

  .bz-collections__card-badge {
    font-size: 12px;
  }
}

/* ——— 1440 ———
   Figma: title/swatches left:30; labels:479; ECO:728/333; PRO:1076/337;
   swatches 350×150 (6×flex); PRO badge — в макете width:305 с переносом,
   по комментарию заказчика — в одну строку (как на 1920).
*/
@media (min-width: 1440px) {
  .bz-collections__swatch:not(:first-child) {
      margin-left: 10px;
    }
  .bz-collections {
    grid-template-columns: minmax(0, 1fr) 217px 333px 337px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "title title card-eco card-pro"
      "textures labels card-eco card-pro"
      ". . actions-eco actions-pro";
    column-gap: 15px;
    padding: 180px 30px 0;
    align-items: start;
    justify-content: start;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
  }

  .bz-collections__title {
    grid-area: title;
    align-self: start;
    justify-self: start;
    max-width: 623px;
    margin: 0;
    font-size: 42px;
    line-height: 1;
  }

  .bz-collections__textures {
    grid-area: textures;
    align-self: end;
    grid-row: 2 / 4;
    /* Figma: бокс 350×150, left:30 — до лейблов (479) */
    width: 350px;
    max-width: 350px;
    margin: 0;
    justify-self: start;
    overflow: visible;
  }

  .bz-collections__swatches {
    width: 350px;
    height: 150px;
  }

  /* нахлёст −20 (отступ между полосками); 6×75−5×20 = 350 */
  .bz-collections__swatch {
    flex: 0 0 75px;
    width: 75px;
    min-width: 75px;
    height: 150px;
    margin-right: -20px;
    object-fit: contain;
  }

  .bz-collections__labels {
    /* опора первой подписи = padding карточки (16) + шапка (74, фикс.) + margin (55):
       выравнивание с первой строкой значений (BUG-002) */
    grid-area: labels;
    grid-row: 1 / 3;
    padding-top: 145px;
    width: 217px;
    align-self: start;
  }

  .bz-collections__card {
    height: 489px;
    padding: 16px;
    overflow: hidden;
  }

  .bz-collections__card--eco {
    grid-area: card-eco;
    grid-row: 1 / 3;
    width: 333px;
  }

  .bz-collections__card--pro {
    grid-area: card-pro;
    grid-row: 1 / 3;
    width: 337px;
  }

  .bz-collections__card-badge {
    font-size: 12px;
  }

  .bz-collections__card--pro .bz-collections__card-badge {
    /* заказчик: в одну строку, когда влезает; в Figma 1440 бокс 305px с переносом.
       Не убирать max-width: 100% и перенос: на Safari (шире метрики шрифта)
       без них плашка упирается в край карточки (BUG-004) */
    max-width: 100%;
    width: max-content;
    /* padding-left: 5px; */
    /* padding-right: 5px; */
    letter-spacing: -0.045em;
  }

  .bz-collections__card--eco .bz-collections__card-head,
  .bz-collections__card--pro .bz-collections__card-head {
    /* Figma: первая строка на top:145 от карточки (16+74+55) */
    margin-bottom: 55px;
  }

  .bz-collections__btn--eco,
  .bz-collections__btn--pro {
    /* Figma 1440: подпись в одну строку, ширина по контенту */
    width: max-content;
    min-width: 211px;
    height: 48px;
    margin-top: 20px;
    justify-self: start;
    white-space: nowrap;
  }
}

/* ——— 1920 ———
   Figma: labels:719; ECO:967/454; PRO:1436/454; swatches 6×120
*/
@media (min-width: 1920px) {
  .bz-collections__swatch:not(:first-child) {
      margin-left: -25px;
    }
  .bz-collections {
    grid-template-columns: minmax(0, 689px) 217px 454px 454px;
    max-width: 1920px;
    padding: 180px 30px 0;
    margin-left: auto;
    margin-right: auto;
    justify-content: start;
  }

  .bz-collections__title {
    max-width: 623px;
  }

  .bz-collections__textures {
    width: auto;
    max-width: none;
  }

  .bz-collections__swatches {
    width: auto;
    height: 150px;
  }

  .bz-collections__swatch {
    flex: 0 0 120px;
    width: 120px;
    min-width: 120px;
    height: 150px;
    margin-right: 0;
    object-fit: contain;
  }

  .bz-collections__card {
    padding: 24px;
    overflow: hidden;
  }

  .bz-collections__card--eco,
  .bz-collections__card--pro {
    width: 454px;
  }

  .bz-collections__card--pro {
    overflow: hidden;
  }

  .bz-collections__card--pro .bz-collections__card-badge {
    max-width: 100%;
    width: max-content;
  }
}

/* Safari < 16: нет subgrid. До 1024 раскладываем labels и строки карточек
   прямо в сетку .bz-collections__compare — выравнивание то же, что с subgrid. */
@supports not (grid-template-rows: subgrid) {
  @media (max-width: 1023.98px) {
    .bz-collections__labels,
    .bz-collections__card {
      display: contents;
    }

    .bz-collections__label { grid-column: 1; }
    .bz-collections__label:nth-child(1) { grid-row: 2; }
    .bz-collections__label:nth-child(2) { grid-row: 3; }
    .bz-collections__label:nth-child(3) { grid-row: 4; }
    .bz-collections__label:nth-child(4) { grid-row: 5; }
    .bz-collections__label:nth-child(5) { grid-row: 6; }
    .bz-collections__label:nth-child(6) { grid-row: 7; }
    .bz-collections__label:nth-child(7) { grid-row: 8; }

    .bz-collections__card--eco > *,
    .bz-collections__card--eco .bz-collections__row { grid-column: 2; }
    .bz-collections__card--pro > *,
    .bz-collections__card--pro .bz-collections__row { grid-column: 3; }

    .bz-collections__card-head { grid-row: 1; }
    .bz-collections__row:nth-child(1) { grid-row: 2; }
    .bz-collections__row:nth-child(2) { grid-row: 3; }
    .bz-collections__row:nth-child(3) { grid-row: 4; }
    .bz-collections__row:nth-child(4) { grid-row: 5; }
    .bz-collections__row:nth-child(5) { grid-row: 6; }
    .bz-collections__row:nth-child(6) { grid-row: 7; }
    .bz-collections__row:nth-child(7) { grid-row: 8; }

    /* разделитель: абсолютный grid-item, containing block — область колонки ECO */
    .bz-collections__card--eco::after {
      grid-column: 2;
      grid-row: 1 / 9;
    }
  }
}
