<template>
  <div id="News">
    <!-- Banner -->
    <div class="banner-wrapper">
      <div class="banner-bg"></div>
      <div class="banner-content">
        <div class="section-tag">
          <span class="tag-dot"></span>
          <span>NEWS & EVENTS</span>
        </div>
        <h1 class="banner-title">公司动态</h1>
        <p class="banner-subtitle">Latest News & Updates</p>
      </div>
    </div>

    <!-- 新闻列表 - 时间轴形式 -->
    <div class="l-container">
      <div class="news-section">
        <div class="timeline">
          <div class="timeline-line"></div>
          <div
            v-for="(item, index) in newsList"
            :key="index"
            class="timeline-item wow fadeInUp"
            :class="index % 2 === 0 ? 'left' : 'right'"
            :style="{ animationDelay: index * 0.15 + 's' }"
          >
            <div class="timeline-dot">
              <span class="dot-pulse"></span>
            </div>
            <div class="timeline-card">
              <div class="news-date">
                <span class="date-day">{{ item.date }}</span>
                <span class="date-year">{{ item.year }}</span>
              </div>
              <div class="news-content">
                <h3 class="news-title">{{ item.title || '新闻动态' }}</h3>
                <p class="news-desc">{{ item.introduce }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {WOW} from 'wowjs';

export default {
  name: 'News',
  data() {
    return {
      newsList: [
        {
          id: '001',
          title: 'AI应用定制化业务',
          introduce: '成功入围多家企业的AI系统供应线，为多家大型企业定制化开发人工智能应用平台',
          date: '3月',
          year: '2025 年'
        }, {
          id: '002',
          title: '轨道交通行业服务',
          introduce: '服务于上海轨道交通建设业务的无人机自动化巡检，为客户安装配置多台大疆机场2，成功实现了地铁轨道交通的无人机常态化巡检',
          date: '2月',
          year: '2024 年'
        }, {
          id: '003',
          title: '数字化转型合作',
          introduce: '配合和参与上海测绘院及上海建科集团数字化转型发展，推荐大疆产品在测绘及工程建设城市运维领域的应用',
          date: '07-18',
          year: '2023 年'
        }, {
          id: '004',
          title: '智能无人系统应用',
          introduce: '完成上海化工区智能无人系统应用监管研究课题，帮助园区管委会和相关企业规范开展无人系统应用服务业务',
          date: '09-27',
          year: '2022 年'
        }, {
          id: '005',
          title: '工业园区无人机应用',
          introduce: '参与上海宝武吴淞园、上海化工区等大型工业园区无人机应用项目的实验和监管论证，推广大疆行业应用产品和服务',
          date: '03-16',
          year: '2020 年'
        }, {
          id: '006',
          title: '创客空间示范项目建设',
          introduce: '完成对口支援日喀则和果乐地区创客空间示范项目建设，设立创客师资上海培训基地，推广 3D 打印和无人机课程',
          date: '06-08',
          year: '2018 年'
        }, {
          id: '007',
          title: '公司成立',
          introduce: '公司由北航和复旦校友发起创立，推出飞天网创客空间，成为上海众创空间联盟首批会员单位，服务航空科技爱好者',
          date: '05-24',
          year: '2014 年'
        }
      ]
    }
  },
  mounted() {
    var wow = new WOW();
    wow.init();
  },
}
</script>

<style scoped>
/* ===== CSS 变量 ===== */
#News {
  --primary-color: #1e73be;
  --primary-gradient: linear-gradient(135deg, #1e73be 0%, #3b82f6 100%);
  --tech-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #999;
  --bg-light: #f8f9fa;
  --card-bg: #ffffff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition-base: all 0.3s ease;
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#News {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-light);
}

/* ===== Banner 区域 ===== */
.banner-wrapper {
  position: relative;
  height: 350px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("~@/assets/img/dji.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.banner-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.8) 0%,
    rgba(30, 58, 95, 0.6) 100%
  );
}

.banner-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 40px;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
}

.tag-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.section-tag span {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 2px;
}

.banner-title {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 16px;
  letter-spacing: 4px;
}

.banner-subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  letter-spacing: 2px;
}

/* ===== 时间轴区域 ===== */
.l-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 80px 20px;
}

.news-section {
  width: 100%;
}

.timeline {
  position: relative;
  padding: 40px 0;
}

/* 中间时间轴线 */
.timeline-line {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg,
    var(--primary-color) 0%,
    rgba(30, 115, 190, 0.5) 50%,
    transparent 100%
  );
  border-radius: 2px;
}

/* 时间轴项目 */
.timeline-item {
  position: relative;
  width: 50%;
  padding: 0 40px;
  margin-bottom: 50px;
  box-sizing: border-box;
}

.timeline-item.left {
  left: 0;
  text-align: right;
}

.timeline-item.right {
  left: 50%;
  text-align: left;
}

/* 时间轴圆点 */
.timeline-dot {
  position: absolute;
  top: 24px;
  width: 16px;
  height: 16px;
  background: var(--primary-gradient);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.2);
  z-index: 10;
  transition: var(--transition-base);
}

.timeline-item.left .timeline-dot {
  right: -8px;
}

.timeline-item.right .timeline-dot {
  left: -8px;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.3);
  box-shadow: 0 0 0 6px rgba(30, 115, 190, 0.3);
}

.dot-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.5); }
}

/* 时间轴卡片 */
.timeline-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-bounce);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.timeline-card::before {
  content: '';
  position: absolute;
  top: 20px;
  width: 12px;
  height: 12px;
  background: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transform: rotate(45deg);
}

.timeline-item.left .timeline-card::before {
  right: -6px;
  border-right: none;
  border-bottom: none;
}

.timeline-item.right .timeline-card::before {
  left: -6px;
  border-left: none;
  border-top: none;
}

.timeline-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* 日期样式 */
.news-date {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.timeline-item.left .news-date {
  flex-direction: row-reverse;
}

.date-day {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

.date-year {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 新闻内容 */
.news-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
}

.news-desc {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 响应式设计 ===== */
@media screen and (max-width: 996px) {
  .banner-wrapper {
    height: 280px;
  }

  .banner-title {
    font-size: 36px;
  }

  .banner-subtitle {
    font-size: 16px;
  }

  .l-container {
    padding: 60px 20px;
  }

  .timeline-item {
    padding: 0 30px;
  }
}

@media screen and (max-width: 768px) {
  .banner-wrapper {
    height: 240px;
  }

  .banner-title {
    font-size: 28px;
  }

  .banner-subtitle {
    font-size: 14px;
  }

  .l-container {
    padding: 40px 16px;
  }

  /* 手机端改为单侧时间轴 */
  .timeline-line {
    left: 20px;
  }

  .timeline-item {
    width: 100%;
    left: 0 !important;
    padding-left: 50px;
    padding-right: 0;
    text-align: left !important;
  }

  .timeline-item.left .timeline-dot,
  .timeline-item.right .timeline-dot {
    left: 12px !important;
    right: auto;
  }

  .timeline-item.left .timeline-card::before,
  .timeline-item.right .timeline-card::before {
    left: -6px !important;
    right: auto;
    border-left: none;
    border-top: none;
  }

  .timeline-item.left .news-date {
    flex-direction: row;
  }

  .news-desc {
    -webkit-line-clamp: 2;
  }
}
</style>
