.faq {
  background: var(--color-white);
  border-radius: 2rem;
}

.faq .faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem;
  cursor: pointer;
  transition: padding-bottom 0.3s ease;
}

.faq .faq__question svg {
  height: 1.5rem;
  width: 1.5rem;
  min-height: 1.5rem;
  min-width: 1.5rem;
  transition: transform 0.3s ease;
}

/* grid-template-rows: 0fr → 1fr animates the row size without forcing layout
   per-frame the way height in pixels does. Crucially, iOS Safari handles fr
   interpolation far better than `height` transitions and we no longer need to
   measure scrollHeight in JS. */
.faq .faq__answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
  opacity: 0;
}

.faq .faq__answer > * {
  min-height: 0;
}

.faq__answer-inner {
  overflow: hidden;
  padding: 0 2rem;
}

.faq[data-active] {
  padding-bottom: 2rem;
}

.faq[data-active] .faq__question {
  padding-bottom: 1rem;
}

.faq[data-active] .faq__answer {
  grid-template-rows: 1fr;
  opacity: 1;
}

.faq[data-active] .faq__question svg {
  transform: rotate(45deg);
}

@media (max-width: 64.9375rem) {
  .faq {
    border-radius: 1rem;
  }

  .faq .faq__question {
    padding: 1.5rem 1rem;
  }

  .faq__answer-inner {
    padding: 0 1rem;
  }
}
