/* ------------------------------------------------------------------
   Секция 07 «Выгода» — «Зачем платить больше и подстраиваться…»
   Десктоп 121:19523, планшет 175:16936, телефон 175:16999.
   Десктоп — сцена 1600 px, масштабируется через --s (script.js).
   Карточки повёрнуты вокруг левого верхнего угла, как в Figma
   (угол — в --r, свойство rotate, чтобы анимация не трогала поворот).
   Анимация (script.js, .is-anim): заголовок проявляется, карточки
   «прилипают» с покачиванием. Без JS и при reduced motion сразу
   видно финальное состояние.
   ------------------------------------------------------------------ */

.bnf {
  margin-top: calc(120px * var(--s, 1));
  background: var(--c-bg);
}

.bnf__stage {
  position: relative;
  width: 1600px;
  height: 1149px;
  margin: 0 auto;
  zoom: var(--s, 1);
}

/* ---------- Фоновое свечение ---------- */

.bnf__glow {
  position: absolute;
  pointer-events: none;
  filter: blur(110px);
}
.bnf__glow--violet {
  left: 448px;
  top: 291px;
  width: 704px;
  height: 478px;
  border-radius: 239px;
  background: rgba(117, 32, 252, 0.42);
}
.bnf__glow--lime {
  left: 704px;
  top: 416px;
  width: 288px;
  height: 229px;
  border-radius: 114px;
  background: rgba(229, 249, 116, 0.12);
}

/* ---------- Заголовок ---------- */

.bnf__head {
  position: absolute;
  top: 479.4px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.bnf__head h2 {
  max-width: 1390px;
  margin: 0;
  font: 400 52px/61.6px var(--font-display);
  color: #fff;
}

.bnf__head p {
  margin: 16.6px 0 0;
  font: 400 22px/32px var(--font-text);
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Карточки ---------- */

.bnf__cards {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.bnf-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 40px 32px 0;
  border-radius: 30px;
  pointer-events: auto;
  transform-origin: 0 0;
  rotate: var(--r, 0deg);
}

.bnf-card h3 {
  margin: 0;
  font: 400 30px/36px var(--font-display);
}

.bnf-card p {
  margin: 20px 0 0;
  font: 400 18px/28px var(--font-text);
}

/* плашка-выделение в заголовке: высотой со строку */
.bnf-card mark {
  display: inline-block;
  vertical-align: top;
  height: 36px;
  border-radius: 8px;
  color: var(--c-ink);
  text-align: center;
}
.bnf-nw { white-space: nowrap; }

/* ярлык над карточкой */
.bnf-card__tag {
  position: absolute;
  left: 29px;
  top: -26px;
  height: 38px;
  border-radius: 19px;
  font: 600 16px/38px var(--font-text);
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  background: #7a4be0;
}

/* «хвостики» облачков — только на десктопе */
.bnf-card--tutor::after,
.bnf-card--lexa::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% + 42px);
}

/* 1 — репетитор */
.bnf-card--tutor {
  --r: -6deg;
  left: 119px;
  top: 119px;
  width: 461px;
  height: 265px;
  background: #f4f2f8;
}
.bnf-card--tutor::after {
  background: #f4f2f8;
  clip-path: polygon(346px 263px, 417px 263px, 412.7px 305px);
}
.bnf-card--tutor h3 { color: var(--c-ink); }
.bnf-card--tutor mark { width: 191px; margin-left: 0.8px; background: #d4baff; }
.bnf-card--tutor p { color: #6b6578; }
.bnf-card--tutor .bnf-card__tag { width: 121px; background: #2a2633; }

/* 2 — Лекса */
.bnf-card--lexa {
  --r: 6deg;
  left: 1062px;
  top: 167px;
  width: 423px;
  height: 193px;
  padding-top: 39.5px;
  background: linear-gradient(131deg, #7a4be0 0%, #a774ff 96%);
  box-shadow: 0 30px 80px rgba(117, 32, 252, 0.35);
}
.bnf-card--lexa::after {
  background: #9060ef;
  clip-path: polygon(103px 191px, 140px 191px, 105.2px 233px);
}
.bnf-card--lexa h3 { color: #fff; white-space: nowrap; }
.bnf-card--lexa mark { width: 196px; background: var(--c-lime); }
.bnf-card--lexa p { color: rgba(255, 255, 255, 0.72); }
.bnf-card--lexa .bnf-card__tag {
  top: -25px;
  width: 84px;
  background: var(--c-lime);
  color: var(--c-ink);
}

/* 3 — бесплатно */
.bnf-card--free {
  --r: -4deg;
  left: 100px;
  top: 820px;
  width: 485px;
  height: 268px;
  padding-top: 77.6px;
  background: #1c1a24;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.bnf-card--free h3 { color: #fff; }
.bnf-card--free mark {
  width: 75px;
  padding-left: 8px;
  background: var(--c-lime);
  text-align: left;
}
.bnf-card--free p { color: rgba(255, 255, 255, 0.72); }
.bnf-card--free .bnf-card__tag { width: 122px; }

/* 4 — результат */
.bnf-card--result {
  left: 1000px;
  top: 786px;
  width: 560px;
  height: 323px;
  background: var(--c-lime);
}
.bnf-card--result h3 { font-size: 35px; line-height: 44px; color: var(--c-ink); }
.bnf-card--result p { max-width: 420px; margin-top: 16px; color: rgba(20, 17, 28, 0.7); }
.bnf-card--result .bnf-card__tag { width: 117px; }
.bnf-num { display: inline-block; min-width: 3.8ch; text-align: right; font-variant-numeric: tabular-nums; }

.bnf-card__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  height: 62px;
  margin-top: 21px;
  border-radius: 999px;
  background: #141418;
  color: #fff;
  font: 400 17px/20px var(--font-display);
  white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s;
}
.bnf-card__btn:hover { background: #2a2433; }
.bnf-card__btn:active { transform: scale(0.97); }

/* ---------- Анимации (включает script.js, класс .is-anim) ---------- */

.bnf.is-anim .bnf__head > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s, transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.bnf.is-anim .bnf__head > p { transition-delay: 0.12s; }
.bnf.is-anim .bnf__head.is-go > * { opacity: 1; transform: none; }

/* карточка «прилипает»: доворачивается до своего угла с перелётом */
.bnf.is-anim .bnf-card {
  opacity: 0;
  translate: 0 48px;
  rotate: calc(var(--r, 0deg) + var(--sw));
  transition:
    opacity 0.5s var(--d, 0s),
    translate 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.15) var(--d, 0s),
    rotate 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) var(--d, 0s);
}
.bnf.is-anim .bnf-card--tutor { --sw: -8deg; }
.bnf.is-anim .bnf-card--lexa { --sw: 8deg; --d: 0.12s; }
.bnf.is-anim .bnf-card--free { --sw: -7deg; }
.bnf.is-anim .bnf-card--result { --sw: 5deg; --d: 0.12s; }
.bnf.is-anim .bnf-card.is-go { opacity: 1; translate: none; rotate: var(--r, 0deg); }
.bnf.is-anim .bnf-card.is-go:hover {
  translate: 0 -6px;
  transition: translate 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

/* ------------------------------------------------------------------
   Планшет 768–1023: та же композиция в кадре 768 px
   ------------------------------------------------------------------ */

@media (max-width: 1023px) {
  .bnf { margin-top: 96px; }

  .bnf__stage { width: 768px; height: 893px; zoom: 1; }

  .bnf__glow { filter: blur(77px); }
  .bnf__glow--violet { left: 138px; top: 220px; width: 493px; height: 335px; border-radius: 167px; }
  .bnf__glow--lime { left: 283px; top: 220px; width: 202px; height: 160px; border-radius: 80px; }

  .bnf__head { top: 38.5px; }
  .bnf__head h2 { max-width: 704px; font-size: 34px; line-height: 44.5px; }
  .bnf__head p { margin-top: 39.8px; font-size: 18px; line-height: 22px; }

  .bnf-card h3 { font-size: 24px; line-height: 28px; }
  .bnf-card p { font-size: 17px; line-height: 20px; }
  .bnf-card mark { height: 28px; border-radius: 6px; }

  .bnf-card--tutor::after,
  .bnf-card--lexa::after { content: none; }

  .bnf-card--tutor {
    --r: -2.1deg;
    left: 35.79px;
    top: 281.18px;
    width: 330px;
    height: 272px;
    padding-top: 40.3px;
  }
  .bnf-card--tutor mark { width: 154px; margin-left: 2.4px; }

  .bnf-card--lexa {
    --r: 2.1deg;
    left: 402.43px;
    top: 353.03px;
    width: 330px;
    height: 188px;
    padding-top: 40px;
    background: linear-gradient(128.6deg, #7a4be0 0%, #a774ff 100%);
  }
  .bnf-card--lexa mark { width: 159px; }
  .bnf-card--lexa p { max-width: 240px; }

  .bnf-card--free {
    --r: 0deg;
    left: 33.5px;
    top: 672px;
    width: 330px;
    height: 169px;
    padding: 32.3px 26px 0;
    border-radius: 24px;
  }
  /* плашка выше строки, но строку не раздвигает */
  .bnf-card--free mark { width: 61px; height: 29px; margin-bottom: -1px; padding-left: 6px; }
  .bnf-card--free p { margin-top: 16.9px; }
  .bnf-card--free .bnf-card__tag {
    left: 23px;
    top: -21px;
    width: 115px;
    height: 34px;
    border-radius: 17px;
    line-height: 34px;
  }

  .bnf-card--result {
    left: 383.5px;
    top: 593px;
    width: 351px;
    height: 248px;
    padding: 24.3px 19px 0;
    border-radius: 18px;
  }
  .bnf-card--result h3 { font-size: 20px; line-height: 24px; }
  .bnf-card--result p { max-width: 230px; margin-top: 10px; font-size: 17px; line-height: 20px; }
  .bnf-card--result .bnf-card__tag {
    left: 17px;
    top: -16px;
    width: 103px;
    height: 30px;
    border-radius: 15px;
    line-height: 30px;
  }
  .bnf-card__btn { margin-top: 19.5px; }
}

/* ------------------------------------------------------------------
   Телефон < 768: карточки друг под другом
   ------------------------------------------------------------------ */

@media (max-width: 767px) {
  .bnf { margin-top: 72px; }

  .bnf__stage {
    width: auto;
    height: auto;
    padding: 22.6px 16px 25px;
  }

  .bnf__glow { filter: blur(55px); }
  .bnf__glow--violet { left: calc(50% - 176px); top: 160px; width: 352px; height: 239px; border-radius: 119.5px; }
  .bnf__glow--lime { left: calc(50% - 72px); top: 160px; width: 144px; height: 114px; border-radius: 57px; }

  .bnf__head { position: relative; top: auto; }
  .bnf__head h2 { max-width: none; font-size: 24px; line-height: 28.6px; }
  .bnf__head p { margin-top: 27.4px; font-size: 16px; line-height: 20px; }

  .bnf__cards {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 48.2px;
  }

  .bnf-card {
    position: relative;
    left: auto;
    top: auto;
    width: calc(100% - 12px);
    padding: 24px 24px 20px;
  }
  .bnf-card h3 { font-size: 20px; line-height: 24px; }
  .bnf-card p { font-size: 16px; line-height: 18px; }
  .bnf-card mark { height: 24px; }

  .bnf-card--tutor { --r: -2deg; left: auto; top: auto; width: calc(100% - 12px); height: auto; min-height: 190px; padding-top: 24px; }
  .bnf-card--tutor mark { width: 130px; }

  .bnf-card--lexa {
    --r: 2deg;
    left: auto;
    top: auto;
    width: calc(100% - 12px);
    height: auto;
    min-height: 124px;
    margin: 63.88px 0 0 4.33px;
    padding-top: 24px;
    background: linear-gradient(141.8deg, #7a4be0 0%, #a774ff 100%);
  }
  .bnf-card--lexa mark { width: 134px; }
  .bnf-card--lexa p { max-width: none; }

  .bnf-card--free {
    --r: -2deg;
    left: auto;
    top: auto;
    width: calc(100% - 12px);
    height: auto;
    min-height: 143px;
    margin-top: 88.08px;
    padding: 24px 24px 20px;
  }
  .bnf-card--free mark { margin-bottom: -5px; }
  .bnf-card--free p { margin-top: 20px; }

  .bnf-card--result {
    left: auto;
    top: auto;
    width: calc(100% - 12px);
    height: auto;
    min-height: 238px;
    margin-top: 63.91px;
    padding: 24px;
    padding-bottom: 20px;
  }
  /* в макете первая строка «Экономишь от 8 000 ₽» заходит в правый отступ */
  .bnf-card--result h3 { margin-right: -16px; font-size: 22px; line-height: 26px; }
  .bnf-card--result p { max-width: 215px; font-size: 16px; line-height: 18px; }
  .bnf-card__btn { height: 58px; margin-top: 20px; font-size: 16px; }

  /* на телефоне каждая карточка появляется сама, без задержки */
  .bnf.is-anim .bnf-card { --d: 0s; }
}
