/* ------------------------------------------------------------------
   Секция 09 «FAQ» — «Отвечаю заранее»
   Десктоп 121:20289, планшет 175:17118, телефон 175:17390.
   Десктоп — сцена 1600 px, масштабируется через --s (script.js).
   Аккордеон (script.js): открыт один вопрос, высота ответа плавно
   раскрывается через grid-template-rows. Анимация появления
   (.is-anim): заголовок проявляется, вопросы выезжают по очереди.
   ------------------------------------------------------------------ */

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

.faq__stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: 1600px;
  margin: 0 auto;
  padding: 40px 100px;
  zoom: var(--s, 1);
}

/* фиолетовое свечение слева внизу */
.faq__glow {
  position: absolute;
  left: -160px;
  top: 44px;
  width: 800px;
  height: 991px;
  border-radius: 400px;
  background: rgba(117, 32, 252, 0.2);
  filter: blur(120px);
  pointer-events: none;
}

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

.faq__head {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-start;
  width: 500px;
}

.faq__head h2 {
  margin: 0;
  font: 400 60px/67px var(--font-display);
  letter-spacing: -0.01em;
  color: #fff;
}

.faq__head p {
  margin: 20.4px 0 0;
  font: 400 20px/30px var(--font-text);
  color: rgba(255, 255, 255, 0.72);
}

.faq__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 62px;
  margin-top: 19px;
  padding: 0 32px;
  border-radius: 999px;
  background: var(--c-lime);
  color: var(--c-ink);
  font: 400 17px/20px var(--font-display);
  white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s;
}
.faq__btn:hover { background: #d6eb5c; }
.faq__btn:active { transform: scale(0.97); }

/* ---------- Аккордеон ---------- */

.faq__list {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-item {
  border-radius: 28px;
  background: #18171f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  transition: background-color 0.35s, box-shadow 0.35s;
}
.faq-item:not(.is-open):hover { background: #1d1c25; }
.faq-item.is-open {
  background: #211a38;
  box-shadow: inset 0 0 0 1px rgba(229, 249, 116, 0.28);
}

.faq-item h3 { margin: 0; }

.faq-item__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-height: 44px;
  padding: 32px 32px 33px;
  border: 0;
  border-radius: 28px;
  background: none;
  color: #fff;
  font: 400 24px/30px var(--font-display);
  text-align: left;
  cursor: pointer;
  transition: padding 0.45s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.faq-item.is-open .faq-item__q { padding-top: 24px; padding-bottom: 0; }

/* + / −: вертикальная черта прячется поворотом */
.faq-item__ico {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  transition: background-color 0.35s, transform 0.45s cubic-bezier(0.3, 0.8, 0.3, 1.2);
}
.faq-item__ico::before,
.faq-item__ico::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 21px;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: #fff;
  transition: background-color 0.35s, transform 0.45s cubic-bezier(0.3, 0.8, 0.3, 1.2);
}
.faq-item__ico::after { transform: rotate(90deg); }
.faq-item__q:hover .faq-item__ico { background: rgba(255, 255, 255, 0.12); }

.faq-item.is-open .faq-item__ico { background: var(--c-lime); transform: rotate(180deg); }
.faq-item.is-open .faq-item__ico::before,
.faq-item.is-open .faq-item__ico::after { background: var(--c-ink); }
.faq-item.is-open .faq-item__ico::after { transform: rotate(0deg); }

.faq-item__a {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.45s cubic-bezier(0.3, 0.8, 0.3, 1), visibility 0s 0.45s;
}
.faq-item.is-open .faq-item__a {
  grid-template-rows: 1fr;
  visibility: visible;
  transition-delay: 0s;
}
.faq-item__a > div { min-height: 0; overflow: hidden; }

.faq-item__a p {
  margin: 0;
  padding: 25px 32px 33px;
  font: 400 18px/26px var(--font-text);
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.45s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.faq-item.is-open .faq-item__a p {
  opacity: 1;
  transform: none;
  transition-delay: 0.1s;
}

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

.faq.is-anim .faq__head > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s, transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.1),
    background-color 0.2s;
}
.faq.is-anim .faq__head > p { transition-delay: 0.12s; }
.faq.is-anim .faq__head > .faq__btn { transition-delay: 0.24s, 0.24s, 0s; }
.faq.is-anim .faq__head.is-go > * { opacity: 1; transform: none; }
.faq.is-anim .faq__head.is-go > .faq__btn:active { transform: scale(0.97); transition-delay: 0s; }

/* вопросы выезжают снизу один за другим */
.faq.is-anim .faq-item {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.5s, transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.1),
    background-color 0.35s, box-shadow 0.35s;
  transition-delay: calc(var(--i) * 0.07s), calc(var(--i) * 0.07s), 0s, 0s;
}
.faq.is-anim .faq__list.is-go .faq-item { opacity: 1; transform: none; }

/* ------------------------------------------------------------------
   Планшет 768–1023: заголовок над списком
   ------------------------------------------------------------------ */

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

  .faq__stage {
    display: block;
    width: auto;
    padding: 33px 32px 36px;
    zoom: 1;
  }

  .faq__glow {
    left: -120px;
    top: 140px;
    width: 480px;
    height: 595px;
    border-radius: 240px;
    filter: blur(72px);
  }

  .faq__head { width: auto; }
  .faq__head br { display: none; }
  .faq__head h2 { font-size: 40px; line-height: 46px; }
  .faq__head p { margin-top: 21px; font-size: 18px; line-height: 26px; }
  .faq__btn { margin-top: 34px; }

  .faq__list { gap: 10px; margin-top: 36px; }

  .faq-item__q { font-size: 20px; line-height: 26px; }
  .faq-item__a p { padding: 23.5px 32px 30.5px; font-size: 17px; line-height: 22px; }
}

/* ------------------------------------------------------------------
   Телефон < 768
   ------------------------------------------------------------------ */

@media (max-width: 767px) {
  /* на узких экранах свечение шире экрана — режем только по горизонтали */
  .faq { margin-top: 72px; overflow-x: clip; }

  .faq__stage { padding: 27.5px 16px 16px; }

  .faq__glow { top: 32px; }

  .faq__head { align-items: center; text-align: center; }
  .faq__head h2 { font-size: 28px; line-height: 34px; }
  .faq__head p { margin-top: 21.3px; font-size: 16px; line-height: 20px; }
  .faq__btn { height: 58px; margin-top: 15.2px; padding: 0 32px; font-size: 16px; }

  .faq__list { gap: 8px; margin-top: 28px; }

  .faq-item__q {
    gap: 16px;
    padding: 24px 16px 25px;
    font-size: 18px;
    line-height: 22px;
  }
  .faq-item.is-open .faq-item__q { padding-top: 16px; }
  .faq-item__a p { padding: 15.8px 16px 16.2px; font-size: 16px; line-height: 18px; }
}
