<template>
  <!-- 为什么选择 Inkreach -->
  <view class="why-section">
    <text class="section-title">为什么选择Inkreach？</text>

    <view class="why-grid">
      <view class="why-card" v-for="(item, index) in reasons" :key="index">
        <view class="why-icon">
          <image class="icon-img" :src="getIcon(index)" mode="aspectFit"></image>
        </view>
        <text class="why-title">{{ item.title }}</text>
        <text class="why-desc">{{ item.desc }}</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'WhyChoose',
  props: {
    reasons: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    getIcon(index) {
      const icons = [
        '/static/icons/home/零库存图标.svg',
        '/static/icons/home/快速生产图标.svg',
        '/static/icons/home/优质产品图标.svg',
        '/static/icons/home/全球配送图标.svg'
      ]
      return icons[index] || ''
    }
  }
}
</script>

<style scoped>
.why-section {
  width: 100%;
  padding: 70rpx 0 0 0;
  background: #f8f8f8;
}

.section-title {
  display: block;
  padding: 0 32rpx;
  font-size: 38rpx;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 30rpx;
}

/* 2列网格 - 用 space-between 兼容小程序 */
.why-grid {
  padding: 0 32rpx;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.why-card {
  width: 330rpx;
  padding: 36rpx 28rpx;
  background: #ffffff;
  border-radius: 12rpx;
  margin-bottom: 20rpx;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.why-icon {
  width: 52rpx;
  height: 52rpx;
  margin-bottom: 20rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-img {
  width: 100%;
  height: 100%;
}
.why-title {
  font-size: 28rpx;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 8rpx;
}
.why-desc {
  font-size: 22rpx;
  color: #999999;
  line-height: 1.5;
}
</style>
