<script setup>
import { solutions as defaultSolutions } from "~/data/solutions";

defineProps({
  solutions: {
    type: Array,
    default: () => defaultSolutions,
  },
  title: {
    type: String,
    default: "深耕 12+ 行业，定制专属 GEO 增长方案",
  },
  description: {
    type: String,
    default: "让不同行业客户快速找到与自身相关的增长方案，提升业务匹配度感知。",
  },
  routes: {
    type: Array,
    default: () => [],
  },
  preview: {
    type: Boolean,
    default: false,
  },
  sectionId: {
    type: String,
    default: "solutions",
  },
});
</script>

<template>
  <section :id="sectionId" class="bg-[#f4f4f4] 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]">Solutions</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="/solutions" 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-3" data-stagger>
        <NuxtLink
          v-for="item in solutions"
          :key="item.slug"
          :to="item.href"
          class="group overflow-hidden rounded-lg border border-gm-border bg-white shadow-sm"
          data-stagger-item
          data-hover-card
        >
          <div class="h-44 overflow-hidden bg-gm-light">
            <img :src="item.image" :alt="item.title" class="h-full w-full object-cover transition duration-500 group-hover:scale-105" loading="lazy" />
          </div>
          <div class="p-6">
            <h3 class="text-[20px] font-semibold text-[#262626]">{{ item.title }}</h3>
            <p class="mt-3 text-sm leading-7 text-[#666]">{{ item.summary }}</p>
            <div class="mt-5 flex flex-wrap gap-2">
              <span v-for="tag in item.tags" :key="tag" class="rounded bg-gm-light px-3 py-1 text-xs text-[#666]">
                {{ tag }}
              </span>
            </div>
            <p class="mt-5 font-mono text-[11px] text-[#999]">
              方案路径 {{ item.path || item.href }}
            </p>
          </div>
        </NuxtLink>
      </div>
    </div>
  </section>
</template>
