<script setup>
import { advantages as defaultAdvantages } from "~/data/advantages";

defineProps({
  advantages: {
    type: Array,
    default: () => defaultAdvantages,
  },
  title: {
    type: String,
    default: "四大核心优势",
  },
  description: {
    type: String,
    default: "从真人内容生产、媒体矩阵到增长闭环与行业定制能力，帮助用户快速理解大马棒的差异化竞争力。",
  },
  routes: {
    type: Array,
    default: () => [],
  },
  preview: {
    type: Boolean,
    default: false,
  },
  sectionId: {
    type: String,
    default: "advantages",
  },
});
</script>

<template>
  <section :id="sectionId" class="bg-white py-16 md:py-20">
    <div class="container-gm">
      <div class="flex flex-col gap-5 md:flex-row md:items-end md:justify-between" data-reveal>
        <div class="max-w-3xl">
          <p class="text-sm uppercase tracking-[0.3em] text-[#999]">Advantages</p>
          <h2 class="section-title mt-4">{{ title }}</h2>
          <p class="mt-4 text-base leading-8 text-[#666]">{{ description }}</p>
        </div>
        <div class="flex flex-col items-start gap-3 md:items-end">
          <SectionRouteLinks :routes="routes" />
          <NuxtLink v-if="preview" to="/advantages" class="text-sm font-medium text-gm-green">
            查看核心优势 →
          </NuxtLink>
        </div>
      </div>

      <div class="mt-10 grid gap-5 md:grid-cols-2 xl:grid-cols-4" data-stagger>
        <article
          v-for="item in advantages"
          :key="item.slug"
          class="rounded-lg border border-gm-border bg-white p-6 shadow-sm"
          data-stagger-item
          data-hover-card
        >
          <p class="text-[28px] font-semibold leading-none text-gm-green">{{ item.metric }}</p>
          <h3 class="mt-5 text-[20px] font-semibold text-[#262626]">{{ item.title }}</h3>
          <p class="mt-3 text-sm font-medium leading-7 text-[#333]">{{ item.point }}</p>
          <p class="mt-3 text-sm leading-7 text-[#666]">{{ item.value }}</p>
        </article>
      </div>
    </div>
  </section>
</template>
