/* 08 «Часті питання» — Figma node 48:520 (1800 × 1092).
   Interaction follows the notes «07–08 — інтерактив для верстки». */

.faq {
  display: grid;
  grid-template-columns: calc(520 * var(--ui)) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 0 calc(120 * var(--u));
  padding: calc(120 * var(--ui)) calc(64 * var(--u));
}
.faq :focus-visible { outline: 2px solid var(--color-bg-strong); outline-offset: 3px; }

/* ───────────── Left column: head and the card that stays while the questions scroll ───────────── */
.faq__head { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: flex-start; }
.faq__head .section-title { margin: calc(13 * var(--ui)) 0 0 calc(-4 * var(--ui)); }
.faq__lead { width: calc(440 * var(--ui)); margin-top: calc(20 * var(--ui)); font-size: calc(18 * var(--ui)); line-height: calc(24 * var(--ui)); color: var(--color-text-secondary); }

.faq__help {
  grid-area: 2 / 1;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: calc(16 * var(--ui));
  margin-top: calc(48 * var(--ui));
  padding: calc(32 * var(--ui));
  border-radius: calc(28 * var(--ui));
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
}
.faq__help-title { font-family: var(--font-display); font-weight: 500; font-size: calc(30 * var(--ui)); line-height: calc(32 * var(--ui)); letter-spacing: -.02em; }
.faq__help-text { font-size: calc(15 * var(--ui)); line-height: calc(23 * var(--ui)); color: var(--color-text-inverse-muted); }
.faq__phone { display: flex; flex-direction: column; align-items: flex-start; gap: calc(4 * var(--ui)); padding-top: calc(8 * var(--ui)); }
.faq__phone a { position: relative; top: calc(1 * var(--ui)); font-family: var(--font-display); font-weight: 500; font-size: calc(44 * var(--ui)); line-height: calc(46 * var(--ui)); letter-spacing: -.025em; color: var(--color-bg-accent); white-space: nowrap; }
.faq__phone span { font-size: calc(12 * var(--ui)); line-height: calc(15 * var(--ui)); color: var(--color-text-inverse-subtle); }
.faq__help :focus-visible { outline-color: var(--color-bg-accent); }
.faq__call { width: 100%; }

/* ───────────── Accordion ───────────── */
.faq__list { grid-area: 1 / 2 / 3 / 3; min-width: 0; }
.faq__item { padding-bottom: calc(28 * var(--ui)); border-top: 1px solid rgb(28 27 25 / .12); scroll-margin: 24px; }
.faq__item:last-child { border-bottom: 1px solid rgb(28 27 25 / .12); }
.faq__row { position: relative; display: flex; align-items: center; min-height: calc(52 * var(--ui)); margin-top: calc(28 * var(--ui)); }
.faq__q { min-width: 0; padding-right: calc(24 * var(--ui)); font-family: var(--font-display); font-weight: 500; font-size: calc(30 * var(--ui)); line-height: calc(32.4 * var(--ui)); letter-spacing: -.02em; }
.faq__btn { padding: 0; border: 0; background: none; color: var(--color-text-primary); font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
/* the whole row, padding included, opens the answer; once open, the area stops short of the answer text */
.faq__btn::after { content: ""; position: absolute; inset: calc(-28 * var(--ui)) 0; }
.faq__item.is-open .faq__btn::after { bottom: calc(-12 * var(--ui)); }
/* keyboard focus: a ring with room around the question, clear of the text and of the answer below */
.faq__btn::before { content: ""; position: absolute; inset: calc(-12 * var(--ui)) calc(-16 * var(--ui)); border-radius: calc(20 * var(--ui)); pointer-events: none; }
.faq .faq__btn:focus-visible { outline: 0; }
.faq .faq__btn:focus-visible::before { outline: 2px solid var(--color-bg-strong); outline-offset: 0; }

.faq__toggle {
  position: relative;
  flex: none;
  width: calc(52 * var(--ui));
  height: calc(52 * var(--ui));
  margin-left: auto;
  border-radius: var(--radius-full);
  background: rgb(28 27 25 / .06);
  pointer-events: none;
  transition: background-color .3s ease;
}
.faq__row:hover .faq__toggle { background: rgb(28 27 25 / .12); }
.faq__item.is-open .faq__toggle { background: var(--color-bg-accent); }
/* «+» is the design's «−» twice: both turn, and they end up on one line */
.faq__toggle i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(12.8 * var(--ui));
  height: calc(1.8 * var(--ui));
  margin: calc(-.9 * var(--ui)) 0 0 calc(-6.4 * var(--ui));
  background: url("../assets/faq/minus.svg") center / 100% 100% no-repeat;
  transition: rotate .45s cubic-bezier(.32, .72, 0, 1);
}
.faq__toggle i + i { rotate: 90deg; }
.faq__item.is-open .faq__toggle i { rotate: 180deg; }

.faq__panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .45s cubic-bezier(.32, .72, 0, 1), visibility .45s; }
.faq__clip { min-height: 0; overflow: hidden; }
.faq__a {
  max-width: calc(820 * var(--ui));
  padding-top: calc(16 * var(--ui));
  font-size: calc(18 * var(--ui));
  line-height: calc(24 * var(--ui));
  color: var(--color-text-secondary);
  opacity: 0;
  translate: 0 -6px;
  transition: opacity .25s ease, translate .45s cubic-bezier(.32, .72, 0, 1);
}
.faq__item.is-open .faq__panel { grid-template-rows: 1fr; visibility: visible; }
.faq__item.is-open .faq__a { opacity: 1; translate: none; transition: opacity .35s ease .08s, translate .45s cubic-bezier(.32, .72, 0, 1); }
.faq--instant * { transition: none !important; }

/* ───────────── Narrower windows (Figma has only the 1800 frame) ───────────── */
@media (max-width: 1099px) {
  .faq { display: flex; flex-direction: column; align-items: stretch; gap: 32px; padding: 72px 20px; }
  .faq__head .section-title { margin: 13px 0 0; }
  .faq__lead { width: auto; max-width: 440px; margin-top: 16px; font-size: 16px; line-height: 1.45; }
  .faq__help { position: static; width: 100%; max-width: 520px; margin: 0; padding: 28px 24px; }
  .faq__phone a { font-size: clamp(30px, 10cqw, 44px); }
  .faq__q { font-size: clamp(19px, 5.4cqw, 30px); line-height: 1.15; }
  .faq__row { margin-top: 20px; min-height: 44px; }
  .faq__item { padding-bottom: 20px; }
  .faq__q { padding-right: 12px; }
  .faq__btn::after { inset: -20px 0; }
  .faq__item.is-open .faq__btn::after { bottom: -8px; }
  .faq__btn::before { inset: -8px -10px; border-radius: 14px; }
  .faq__toggle { width: 44px; height: 44px; }
  .faq__a { padding-top: 12px; font-size: 16px; line-height: 1.5; }
}
@media (min-width: 600px) and (max-width: 1099px) {
  .faq { padding-inline: 40px; }
}
