<template>
  <section :id="category.id" class="faq-category">
    <h2 class="faq-category-title">{{ category.name }}</h2>
    <div class="faq-category-list">
      <FaqItem
        v-for="q in category.questions"
        :key="q.id"
        :question="q.question"
        :answer="q.answer"
        :related-links="q.relatedLinks"
        :initial-open="initialOpen"
      />
    </div>
  </section>
</template>

<script setup>
defineProps({
  category: { type: Object, required: true },
  initialOpen: { type: Boolean, default: false },
})
</script>

<style lang="less" scoped>
.faq-category {
  margin-bottom: @space-2xl;
  scroll-margin-top: 80px;
}

.faq-category-title {
  font-size: @font-size-xl;
  color: @color-primary;
  margin-bottom: @space-lg;
  padding-bottom: @space-sm;
  border-bottom: 2px solid @color-primary-lighter;
}

.faq-category-list {
  display: flex;
  flex-direction: column;
  gap: @space-md;
}
</style>
