/* Figma 1870-16075: блок «Почему инженеры выбирают Euler» */
.home-features {
  background-color: #ffffff;
  padding: 130px var(--container-padding) 120px;
}

.home-features__inner {
  width: 100%;
  max-width: calc(var(--container-width) - var(--container-padding) * 2);
  margin-inline: auto;
}

.home-features__head {
  display: flex;
  align-items: flex-start;
  gap: 123px;
  margin-bottom: 60px;
}

.home-features__microheading {
  flex: none;
  align-items: center;
  width: fit-content;
  max-width: 266px;
  padding: 0;
}

.home-features__microheading.microheading--two-lines {
  align-items: flex-start;
  gap: 10px;
}

.home-features__microheading.microheading--two-lines .microheading__icon {
  margin-top: 7px;
}

.home-features__microheading.microheading--two-lines .microheading__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.home-features__microheading .microheading__line {
  display: block;
}

.home-features__microheading .microheading__text {
  font-family: "Roboto Flex", var(--font-body);
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: 0;
  color: #8a8e92;
}

.home-features__title {
  flex: 1;
  max-width: 1023px;
  margin: 0;
  font-family: "Roboto Condensed", var(--font-heading), sans-serif;
  font-size: 50px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

.home-features__grid {
  display: grid;
  grid-template-columns: repeat(4, 325px);
  justify-content: space-between;
  gap: 23px;
  width: 100%;
}

.home-feature-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 325px;
  height: 400px;
  padding: 37px 30px 30px;
  background-color: #f4f6f9;
}

.home-feature-card__icon {
  display: block;
  flex: none;
  width: 133px;
  height: 133px;
}

.home-feature-card__icon--wide {
  width: auto;
  height: 133px;
  max-width: 100%;
  object-fit: contain;
}

.home-feature-card__content {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  width: 274px;
  margin-top: auto;
}

.home-feature-card__title {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 274px;
  min-height: 58px;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text-primary);
}

.home-feature-card__desc {
  width: 274px;
  margin: 15px 0 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text-secondary);
}

.home-features__title-lines--1440,
.home-features__title-lines--mobile,
.home-feature-card__lines--1440,
.home-feature-card__lines--mobile {
  display: none;
}

/* 1201+: ряд карточек 4×325 — фиксированные переносы, заголовок по ширине сетки */
@media (min-width: 1201px) {
  .home-features__head {
    display: grid;
    grid-template-columns: 266px minmax(0, 1fr);
    align-items: flex-start;
    gap: 88px;
    width: 100%;
  }

  .home-features__microheading {
    grid-column: 1;
  }

  .home-features__title {
    grid-column: 2;
    box-sizing: border-box;
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    line-height: 1.1;
  }

  .home-feature-card__fallback {
    display: none;
  }

  .home-feature-card__lines--1440 {
    display: block;
  }

  .home-feature-card__line {
    display: block;
    white-space: nowrap;
  }

  .home-feature-card__title {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 58px;
    margin: 0;
  }

  .home-feature-card__desc {
    box-sizing: border-box;
    min-height: 77px;
    margin-top: 15px;
  }
}

@media (min-width: 1201px) and (max-width: 1439px) {
  .home-features__head {
    gap: clamp(48px, calc(48px + (88 - 48) * (100vw - 1200px) / 240), 88px);
    grid-template-columns: minmax(200px, 266px) minmax(0, 1fr);
  }

  /* Как на 1440: две фиксированные строки, шрифт плавно 30→50px */
  .home-features__title {
    max-width: none;
    font-size: clamp(30px, calc(30px + (50 - 30) * (100vw - 1200px) / 240), 50px);
  }

  .home-features__title-lines--default {
    display: none !important;
  }

  .home-features__title-lines--1440 {
    display: block !important;
  }

  .home-features__title-line {
    display: block;
    white-space: nowrap;
  }
}

@media (min-width: 1440px) {
  .home-features__head {
    gap: 80px;
  }

  .home-features__title {
    font-size: 50px;
  }

  .home-features__title-lines--default {
    display: none;
  }

  .home-features__title-lines--1440 {
    display: block;
  }

  .home-features__title-line {
    display: block;
    white-space: nowrap;
  }
}

/* Figma «Карточки 1200»: шапка + сетка 2×2, карточка 550×350 (только ≥1024) */
@media (min-width: 1024px) and (max-width: 1200px) {
  .home-features {
    padding-top: 100px;
  }

  .home-features__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 48px;
  }

  .home-features__microheading {
    width: fit-content;
    max-width: 266px;
    min-height: 19px;
  }

  .home-features__microheading .microheading__text {
    font-size: 16px;
    line-height: 1.2;
    color: #8a8e92;
  }

  .home-features__title {
    flex: none;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    font-size: clamp(26px, calc(26px + (40 - 26) * (100vw - 1024px) / 176), 40px);
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .home-features__title-lines--default {
    display: none;
  }

  .home-features__title-lines--1440 {
    display: block;
  }

  .home-features__title-line {
    display: block;
    white-space: nowrap;
  }

  .home-features__grid {
    grid-template-columns: repeat(2, 550px);
    justify-content: space-between;
    gap: 28px;
  }

  .home-feature-card {
    position: relative;
    display: block;
    width: 550px;
    height: 350px;
    padding: 0;
  }

  .home-feature-card__icon {
    position: absolute;
    top: 52px;
    left: 50%;
    width: 152px;
    height: 152px;
    object-fit: contain;
    transform: translateX(-50%);
  }

  .home-feature-card__icon--wide {
    width: auto;
    height: 152px;
    transform: translateX(-50%);
  }

  .home-feature-card__content {
    position: absolute;
    top: 238px;
    left: 30px;
    right: 30px;
    display: block;
    width: auto;
    margin: 0;
  }

  .home-feature-card__title {
    display: block;
    width: 100%;
    min-height: 29px;
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
  }

  .home-feature-card__desc {
    width: 100%;
    margin: 15px 0 0;
    font-size: 16px;
    line-height: 1.2;
  }
}

/* 1024–1199: Figma 1024 — карточки 462×350, плавно к 1200 */
@media (min-width: 1024px) and (max-width: 1199px) {
  .home-features__inner {
    width: var(--layout-inner-width, 944px);
    max-width: 100%;
  }

  .home-features__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(20px, calc(20px + (28 - 20) * (100vw - 1024px) / 176), 28px);
    width: 100%;
    max-width: var(--layout-inner-width, 944px);
    justify-content: space-between;
  }

  .home-feature-card {
    width: 100%;
    max-width: clamp(462px, calc(462px + (550 - 462) * (100vw - 1024px) / 176), 550px);
    height: 350px;
  }

  .home-feature-card__icon {
    top: 52px;
    left: 50%;
    width: 152px;
    height: 152px;
    object-fit: contain;
    transform: translateX(-50%);
  }

  .home-feature-card__icon--wide {
    width: auto;
    height: 152px;
    transform: translateX(-50%);
  }
}

/* 688–943: макет 768 — сетка на всю ширину контента (не 688px и не 1024) */
@media (min-width: 688px) and (max-width: 943px) {
  .home-features {
    box-sizing: border-box;
    overflow-x: clip;
    padding: clamp(64px, 10vw, 75px) var(--container-padding, 40px) clamp(64px, 11vw, 90px);
  }

  .home-features__inner {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0;
  }

  .home-features__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 36px;
    min-width: 0;
  }

  .home-features__microheading {
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    padding: 0;
  }

  .home-features__microheading .microheading__text {
    font-size: 12px;
    line-height: 1.2;
    color: #8a8e92;
  }

  .home-features__title {
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    font-size: clamp(28px, 3.75vw, 30px);
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .home-features__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 1.9vw, 15px);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0;
    justify-content: stretch;
  }

  .home-feature-card {
    position: relative;
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: clamp(240px, 34vw, 263px);
    min-height: clamp(240px, 34vw, 263px);
    max-height: clamp(240px, 34vw, 263px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f4f6f9;
  }

  .home-feature-card__icon {
    position: absolute;
    top: 44px;
    left: 50%;
    width: clamp(108px, 16vw, 128px);
    height: clamp(108px, 16vw, 128px);
    object-fit: contain;
    transform: translateX(-50%);
  }

  .home-feature-card__icon--wide {
    width: auto;
    height: clamp(108px, 16vw, 128px);
    transform: translateX(-50%);
  }

  .home-feature-card__content {
    position: absolute;
    top: clamp(172px, 25vw, 186px);
    right: clamp(16px, 2.8vw, 22px);
    left: clamp(16px, 2.8vw, 22px);
    display: block;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    min-width: 0;
    margin: 0;
  }

  .home-feature-card__title {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    font-size: clamp(16px, 2.25vw, 18px);
    line-height: 1.2;
    overflow-wrap: break-word;
  }

  .home-feature-card__desc {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 11px 0 0;
    font-size: clamp(11px, 1.5vw, 12px);
    line-height: 1.2;
    overflow-wrap: break-word;
  }

  .home-feature-card__lines--1440 {
    display: none;
  }

  .home-feature-card__fallback {
    display: inline;
  }
}

/* 944–1023: шапка как на 768; карточки 462×2 — в home-between-768-1024.css */
@media (min-width: 944px) and (max-width: 1023px) {
  .home-features {
    box-sizing: border-box;
    overflow-x: clip;
    padding: 75px var(--container-padding, 40px) 90px;
  }

  .home-features__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 36px;
  }

  .home-features__microheading .microheading__text {
    font-size: 12px;
    line-height: 1.2;
    color: #8a8e92;
  }

  .home-features__title {
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
}

/* ≤687 — мобильная колонка: карточки по центру, текст внутри на всю ширину (слева) */
@media (max-width: 687px) {
  .home-features {
    box-sizing: border-box;
    overflow-x: clip;
    padding: 40px var(--container-padding, 15px) 80px;
  }

  .home-features__inner {
    box-sizing: border-box;
    width: 100%;
    max-width: min(540px, 100%);
    margin-inline: auto;
  }

  .home-features__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 32px;
  }

  .home-features__microheading {
    width: auto;
    max-width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
  }

  .home-features__microheading.microheading--two-lines {
    align-items: flex-start;
    gap: 10px;
    height: auto;
  }

  .home-features__microheading.microheading--two-lines .microheading__icon {
    margin-top: 0;
  }

  .home-features__microheading.microheading--two-lines .microheading__text {
    display: block;
    max-width: 250px;
    font-family: "Roboto Flex", var(--font-body), sans-serif;
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0;
    color: #8a8e92;
  }

  .home-features__microheading .microheading__line {
    display: inline;
  }

  .home-features__title {
    width: 100%;
    max-width: min(345px, 100%);
    min-height: 0;
    margin: 0;
    padding: 0;
    font-family: "Roboto Condensed", var(--font-heading), sans-serif;
    font-size: clamp(24px, calc(24px + (28 - 24) * (100vw - 375px) / 312), 28px);
    font-weight: 400;
    font-style: normal;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
  }

  .home-features__title-lines--default {
    display: none !important;
  }

  .home-features__title-lines--mobile {
    display: block;
  }

  .home-features__title-lines--mobile .home-features__title-line {
    display: block;
    font-family: "Roboto Condensed", var(--font-heading), sans-serif;
    font-size: inherit;
    font-weight: 400;
    font-style: normal;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .home-features__grid {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    justify-content: stretch;
  }

  .home-feature-card {
    position: relative;
    box-sizing: border-box;
    display: block;
    width: 100%;
    max-width: 100%;
    height: clamp(300px, calc(100vw - var(--container-padding) * 2), 420px);
    min-height: clamp(300px, calc(100vw - var(--container-padding) * 2), 420px);
    max-height: clamp(300px, calc(100vw - var(--container-padding) * 2), 420px);
    margin-inline: auto;
    padding: 0;
    overflow: hidden;
    background-color: #f4f6f9;
  }

  .home-feature-card__icon {
    position: absolute;
    top: calc(18 / 345 * 100%);
    left: 50%;
    width: calc(163 / 345 * 100%);
    height: calc(164 / 345 * 100%);
    max-width: 163px;
    max-height: 164px;
    margin: 0;
    object-fit: contain;
    transform: translateX(-50%);
  }

  .home-feature-card__icon--wide {
    width: auto;
    height: calc(164 / 345 * 100%);
    max-height: 164px;
  }

  .home-feature-card__content {
    position: absolute;
    top: calc(197 / 345 * 100%);
    right: 30px;
    bottom: 30px;
    left: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    box-sizing: border-box;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
  }

  .home-feature-card__title {
    position: static;
    display: block;
    width: 100%;
    max-width: 260px;
    min-height: 0;
    margin: 0;
    font-family: "Roboto Condensed", var(--font-heading), sans-serif;
    font-size: 24px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.1;
    letter-spacing: 0;
    color: var(--color-text-primary);
  }

  .home-feature-card__desc {
    position: static;
    width: 100%;
    max-width: 292px;
    margin: 0;
    font-family: "Roboto Flex", var(--font-body), sans-serif;
    font-size: 14px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.2;
    letter-spacing: 0;
    color: var(--color-text-secondary);
  }

  .home-feature-card__lines--1440 {
    display: none;
  }

  .home-feature-card__lines--mobile {
    display: block;
  }

  .home-feature-card__lines--mobile .home-feature-card__line {
    display: block;
    white-space: nowrap;
  }

  .home-feature-card__lines--mobile ~ .home-feature-card__fallback {
    display: none;
  }

  .home-feature-card__fallback {
    display: inline;
  }
}

/* 376–687: между 375 и 768 — плавное масштабирование карточек */
@media (min-width: 376px) and (max-width: 687px) {
  .home-features {
    padding-top: 40px;
    padding-bottom: 80px;
  }

  .home-features__grid {
    gap: clamp(10px, 2vw, 16px);
  }

  .home-feature-card {
    width: 100%;
    max-width: 100%;
  }

  .home-feature-card__title {
    font-size: clamp(20px, 4vw, 24px);
  }

  .home-feature-card__desc {
    font-size: clamp(13px, 2.8vw, 14px);
  }
}

/* ≤375: Figma 375 — карточка 345×345, точные отступы */
@media (max-width: 375px) {
  .home-features {
    padding-top: 40px;
    padding-bottom: 80px;
    padding-inline: max(12px, var(--container-padding, 15px));
  }

  .home-features__inner {
    max-width: 100%;
  }

  .home-features__head {
    gap: 16px;
    margin-bottom: 32px;
  }

  .home-features__microheading.microheading--two-lines .microheading__text {
    max-width: 250px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .home-features__title {
    box-sizing: border-box;
    width: 345px;
    max-width: 100%;
    min-height: 104px;
    font-family: "Roboto Condensed", var(--font-heading), sans-serif;
    font-size: 24px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .home-features__title-lines--mobile .home-features__title-line {
    max-width: 345px;
  }

  .home-features__grid {
    gap: 10px;
  }

  .home-feature-card {
    width: 100%;
    max-width: 345px;
    height: 345px;
    min-height: 345px;
    max-height: 345px;
  }

  .home-feature-card__icon {
    top: 18px;
    width: 163px;
    height: 164px;
    max-width: 163px;
    max-height: 164px;
  }

  .home-feature-card__icon--wide {
    height: 164px;
    max-height: 164px;
  }

  .home-feature-card__content {
    top: 197px;
    right: 30px;
    bottom: 30px;
    left: 30px;
    gap: 15px;
  }

  .home-feature-card__title {
    max-width: 260px;
    font-size: 24px;
    line-height: 1.1;
  }

  .home-feature-card__desc {
    max-width: 292px;
    font-size: 14px;
    line-height: 1.2;
  }

  .home-features__grid > .home-feature-card:last-child .home-feature-card__content {
    top: 197px;
  }

  .home-features__grid > .home-feature-card:last-child .home-feature-card__desc .home-feature-card__lines--mobile {
    width: 292px;
    max-width: 100%;
  }

  .home-features__grid > .home-feature-card:last-child .home-feature-card__title .home-feature-card__lines--mobile .home-feature-card__line {
    white-space: normal;
  }
}
