<template>
  <div class="page-autumn">
    <LayoutPageHero
      :title="seo.h1"
      :subtitle="autumnData?.style"
      :breadcrumbs="[{ text: '产品线', to: '/products' }, { text: '游牧的森林' }]"
    />

    <!-- TL;DR -->
    <section class="page-tldr" aria-label="产品页摘要">
      <div class="container">
        <div class="page-tldr-inner">
          <p>游牧的森林V3系列提供4-7天6个版本的呼伦贝尔秋季定制游，涵盖南线（呼伦贝尔+阿尔山）和北线（呼伦贝尔+大兴安岭）两条主线。所有版本均为独立成团、私家专车，不与陌生人同行。不确定选哪条线，可<NuxtLink to="/contact">联系定制师</NuxtLink>获取推荐。</p>
        </div>
      </div>
    </section>

    <!-- 风景大图 -->
    <div class="scenic-banner">
      <img :src="'/images/seasons/autumn-hero.jpg'" alt="秋季大兴安岭金色白桦林" loading="eager" />
    </div>

    <!-- 产品设计理念 -->
    <ProductsProductOverview v-if="autumnData" :narrative="autumnData.narrative" class="reveal" />

    <!-- 秋季亮点 -->
    <section v-if="autumnData" class="section reveal">
      <div class="container">
        <CommonSectionTitle :title="st('productsAutumn.highlights', '秋季呼伦贝尔 · 不可错过的风景')" :subtitle="st('productsAutumn.highlights', '每年9月中旬-10月中旬', 'subtitle')" />
        <div class="highlights-grid">
          <div v-for="h in autumnData.highlights" :key="h.title" class="highlight-card">
            <h3 class="highlight-title">{{ h.title }}</h3>
            <p class="highlight-desc">{{ h.description }}</p>
          </div>
        </div>
      </div>
    </section>

    <!-- 南线产品卡片 -->
    <section class="section reveal">
      <div class="container">
        <CommonSectionTitle :title="st('productsAutumn.southLine', '南线 · 呼伦贝尔+阿尔山')" :subtitle="st('productsAutumn.southLine', '草原秋色与火山天池', 'subtitle')" />
        <div class="products-grid">
          <AutumnProductCard v-for="p in southVersions" :key="p.id" :product="p" />
        </div>
      </div>
    </section>

    <!-- 南线特色体验 -->
    <section v-if="autumnData" class="section section--warm reveal">
      <div class="container">
        <CommonSectionTitle :title="st('productsAutumn.southHighlights', '南线独有体验')" :subtitle="st('productsAutumn.southHighlights', '阿尔山专属', 'subtitle')" />
        <div class="highlights-grid highlights-grid--small">
          <div v-for="h in autumnData.southHighlights" :key="h.title" class="highlight-card">
            <h3 class="highlight-title">{{ h.title }}</h3>
            <p class="highlight-desc">{{ h.description }}</p>
          </div>
        </div>
      </div>
    </section>

    <!-- 中间转化入口 -->
    <CommonSectionCTA
      title="不确定选南线还是北线？"
      description="联系定制师，根据您的假期和偏好推荐合适的行程"
      :links="[{ to: '/contact', text: '联系定制师' }]"
    />

    <!-- 北线产品卡片 -->
    <section class="section reveal">
      <div class="container">
        <CommonSectionTitle :title="st('productsAutumn.northLine', '北线 · 呼伦贝尔+大兴安岭')" :subtitle="st('productsAutumn.northLine', '深入大兴安岭腹地赏秋', 'subtitle')" />
        <div class="products-grid">
          <AutumnProductCard v-for="p in northVersions" :key="p.id" :product="p" />
        </div>
      </div>
    </section>

    <!-- 北线特色体验 -->
    <section v-if="autumnData" class="section section--warm reveal">
      <div class="container">
        <CommonSectionTitle :title="st('productsAutumn.northHighlights', '北线独有体验')" :subtitle="st('productsAutumn.northHighlights', '大兴安岭专属', 'subtitle')" />
        <div class="highlights-grid highlights-grid--small">
          <div v-for="h in autumnData.northHighlights" :key="h.title" class="highlight-card">
            <h3 class="highlight-title">{{ h.title }}</h3>
            <p class="highlight-desc">{{ h.description }}</p>
          </div>
        </div>
      </div>
    </section>

    <!-- 选择指南 -->
    <section v-if="autumnData?.selectionGuide" id="guide" class="section section--gray reveal">
      <div class="container">
        <CommonSectionTitle :title="st('productsAutumn.selection', '不知道选哪个？')" :subtitle="st('productsAutumn.selection', '按假期长度推荐', 'subtitle')" />
        <div class="guide-items">
          <div v-for="item in autumnData.selectionGuide.byVacationLength" :key="item.condition" class="guide-item">
            <div class="guide-item-top">
              <span class="guide-condition">{{ item.condition }}</span>
              <span class="guide-arrow">→</span>
              <span class="guide-rec">{{ getProductName(item.recommendation) }}</span>
            </div>
            <p class="guide-reason">{{ item.reason }}</p>
          </div>
        </div>
      </div>
    </section>

    <!-- 版本迭代时间线 -->
    <ProductsVersionTimeline
      v-if="autumnData"
      :timeline="autumnData.timeline"
      title="游牧的森林 · 版本迭代"
      subtitle="V1到V3的完整迭代记录"
    />

    <!-- 底部 CTA -->
    <CommonSectionCTA
      title="听听其他家庭怎么说"
      description="看看真实客户的旅行评价"
      :links="[{ to: '/reviews', text: '查看10000+家庭的真实评价' }]"
    />
  </div>
</template>

<script setup>
import { useBreadcrumbSchema } from '~/composables/useJsonLd'

const { data: autumnData } = await usePublicApi('autumn-products')
const st = await useSectionTitles()

const seo = useSEO('products-autumn', {
  title: '游牧的森林V3 - 呼伦贝尔秋季定制游·4-8天7版本可选 - 呼籁旅行',
  description: '呼籁旅行呼伦贝尔秋季定制游产品「游牧的森林」V3系列，南线呼伦贝尔+阿尔山、北线呼伦贝尔+大兴安岭、南北8天7晚全景版，4-8天共7个版本可选。独立成团不拼团，一家一单一车。',
  h1: '游牧的森林 · 呼伦贝尔秋季定制游',
})

useScrollReveal()
useBreadcrumbSchema([
  { text: '首页', to: '/' },
  { text: '产品线', to: '/products' },
  { text: '游牧的森林' },
])

const southVersions = computed(() =>
  autumnData.value?.versions?.filter(v => v.line !== '北线') || []
)

const northVersions = computed(() =>
  autumnData.value?.versions?.filter(v => v.line === '北线') || []
)

function getProductName(id) {
  const v = autumnData.value?.versions?.find(v => v.id === id)
  return v ? v.name : id
}
</script>

<style lang="less" scoped>
.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: @space-xl;

  .respond-md({
    grid-template-columns: repeat(2, 1fr);
  });

  .respond-lg({
    grid-template-columns: repeat(3, 1fr);
  });

  > * {
    display: flex;
  }
}

.scenic-banner {
  width: 100%;
  overflow: hidden;
  max-height: 480px;

  img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    object-position: center 70%;
    display: block;
  }
}

// 秋季亮点卡片
.highlights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: @space-lg;

  .respond-md({
    grid-template-columns: repeat(2, 1fr);
  });

  .respond-lg({
    grid-template-columns: repeat(3, 1fr);
  });

  &--small {
    max-width: 900px;
    margin: 0 auto;

    .respond-lg({
      grid-template-columns: repeat(3, 1fr);
    });
  }
}

.highlight-card {
  padding: @space-lg;
  background: @color-bg-white;
  border: 1px solid @color-border;
  border-radius: @border-radius-md;
  transition: box-shadow @transition-fast, transform @transition-fast;

  &:hover {
    box-shadow: @shadow-sm;
    transform: translateY(-2px);
  }
}

.highlight-title {
  font-size: @font-size-base;
  font-weight: @font-weight-bold;
  color: @color-text-primary;
  margin-bottom: @space-sm;
  padding-left: @space-sm;
  border-left: 3px solid #D97706;
}

.highlight-desc {
  font-size: @font-size-sm;
  color: @color-text-secondary;
  line-height: @line-height-relaxed;
  margin: 0;
}

// 选择指南
.guide-items {
  display: flex;
  flex-direction: column;
  gap: @space-md;
  max-width: 800px;
  margin: 0 auto;
}

.guide-item {
  padding: @space-lg;
  background: @color-bg-white;
  border-radius: @border-radius-md;
  border: 1px solid @color-border;
  transition: border-color @transition-fast, box-shadow @transition-fast;

  &:hover {
    border-color: #D97706;
    box-shadow: @shadow-sm;
  }
}

.guide-item-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: @space-sm;
  margin-bottom: @space-xs;
}

.guide-condition {
  font-weight: @font-weight-medium;
  color: @color-text-primary;
  background: @color-bg-gray;
  padding: @space-xs @space-sm;
  border-radius: @border-radius-sm;
  font-size: @font-size-sm;
}

.guide-arrow {
  color: #D97706;
  font-weight: @font-weight-bold;
}

.guide-rec {
  color: #D97706;
  font-weight: @font-weight-bold;
  font-size: @font-size-base;
}

.guide-reason {
  font-size: @font-size-sm;
  color: @color-text-muted;
  margin: 0;
  line-height: @line-height-base;
}
</style>
