<template>
  <section>
    <section class="hero-section">
      <video ref="videoRef" class="hero-video-bg" preload="auto" :src="homeVideo" autoplay loop muted playsinline
        @loadedmetadata="onVideoLoaded"></video>
      <ParticlesCanvas class="canvas-overlay" />
      <div class="hero-content">
        <h2 class="hero-title">您专注业务，我们守护安全&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;再强的攻击,也有攻不破的防线
        </h2>
        <div class="hero-subtitle">
          <p>高防服务器&nbsp;|&nbsp;高防DNS&nbsp;|&nbsp;游戏盾SDK&nbsp;|&nbsp;高防CDN&nbsp;全方位守护您的业务</p>
        </div>
      </div>
    </section>

    <ProductTabs />

    <!-- 安全运营与方案模块 -->
    <PlansSection />

    <!-- 安全漏洞 / 全景技术架构上方模块 -->
    <section class="security-arch-section">
      <!-- <NuxtImg alt="安全架构" src="/images/home/home-bg2.png" class="security-arch-img" />
      <div class="security-arch-animate">
        <SecurityParticles />
      </div> -->
      <div class="security-arch-desc">
        <h3 class="security-arch-title">
          全景技术架构，让技术成为增长引擎
        </h3>
        <div class="security-arch-subtitle">
          <p>
            从基础设施、数据引擎、服务中台到业务应用，层层协同，将算力、数据与能力统一管理，
          </p>
          <p>
            保证系统在高并发、高复杂度场景下依然稳定运行。
          </p>
        </div>
      </div>
    </section>
    <section class="security-flowchart">
      <Flowchart />
    </section>

    <section class="insight-header">
      <h2 class="insight-title">安全洞见&nbsp;&nbsp;&nbsp;全网感知</h2>
      <p class="insight-subtitle">实时攻防态势数据</p>
    </section>

    <StatsSection />

    <!-- 助力各行业客户成功 -->
    <section class="cain-section">
      <h3 class="cain-section-title">
        助力各行业客户成功
      </h3>
    </section>
    <section class="industry">
      <div class="industry-content">
        <div class="industry-item">
          <img src="~/assets/svg/home/icon1.svg" alt="icon">
          <div class="industry-text">金融</div>
        </div>
        <div class="industry-item">
          <img src="~/assets/svg/home/icon2.svg" alt="icon">
          <div class="industry-text">互联网</div>
        </div>
        <div class="industry-item">
          <img src="~/assets/svg/home/icon3.svg" alt="icon">
          <div class="industry-text">医疗健康</div>
        </div>
        <div class="industry-item">
          <img src="~/assets/svg/home/icon4.svg" alt="icon">
          <div class="industry-text">制造</div>
        </div>
        <div class="industry-item">
          <img src="~/assets/svg/home/icon5.svg" alt="icon">
          <div class="industry-text">教育</div>
        </div>
      </div>
      <div class="industry-other">
        <div class="other-item">
          <NuxtImg width="172" src="/images/home/icon6.png" alt="卓越教育" />
        </div>
        <div class="other-item">
          <NuxtImg width="178" src="/images/home/icon7.png" alt="华福证券" />
        </div>
        <div class="other-item">
          <NuxtImg width="178" src="/images/home/icon8.png" alt="汉王" />
        </div>
        <div class="other-item">
          <NuxtImg width="178" src="/images/home/icon9.png" alt="隧道股份" />
        </div>
        <div class="other-item">
          <NuxtImg width="102" src="/images/home/icon10.png" alt="岳阳医院" />
        </div>
        <div class="other-item">
          <NuxtImg width="120" src="/images/home/icon11.png" alt="杉德" />
        </div>
        <div class="other-item">
          <NuxtImg width="154" src="/images/home/icon12.png" alt="易班" />
        </div>
        <div class="other-item">
          <NuxtImg width="164" src="/images/home/icon13.png" alt="银联商务" />
        </div>
        <div class="other-item">
          <NuxtImg width="164" src="/images/home/icon14.png" alt="长海医院" />
        </div>
        <div class="other-item">
          <NuxtImg width="102" src="/images/home/icon15.png" alt="斗象科技" />
        </div>
        <div class="other-item">
          <NuxtImg width="72" src="/images/home/icon16.png" alt="瑞金" />
        </div>
        <div class="other-item">
          <NuxtImg width="84" src="/images/home/icon17.png" alt="3L" />
        </div>
        <div class="other-item">
          <NuxtImg width="138" src="/images/home/icon18.png" alt="宝付" />
        </div>
        <div class="other-item">
          <NuxtImg width="66" src="/images/home/icon19.png" alt="新华医院" />
        </div>
        <div class="other-item">
          <NuxtImg width="180" src="/images/home/icon20.png" alt="中船重工物贸集团" />
        </div>
      </div>
      <div class="join-container">
        <div class="join-left">
          <h3>立即加入 &nbsp;安全之旅</h3>
          <div class="join-subtitle">完成注册，即可免费体验 DDoS防护、CC防护、DNS解析等多款安全产品</div>
          <div class="join-btn">
            <span>去完成注册</span>
            <Icon name="material-symbols:arrow-forward-rounded" />
          </div>
        </div>
        <img width="492" src="~/assets/svg/home/aq.svg" alt="安全之旅" />
      </div>
    </section>
  </section>
</template>

<script setup>
definePageMeta({
  layout: 'web'
})

import { ref } from 'vue'
import StatsSection from '~/components/home/StatsSection.vue'
import ProductTabs from '~/components/home/ProductTabs.vue'
import PlansSection from '~/components/PlansSection.vue'
import ParticlesCanvas from '~/components/ParticlesCanvas.vue'
// import SecurityParticles from '~/components/SecurityParticles.vue'
import homeVideo from '~/assets/video/home.webm'
import Flowchart from '~/components/home/Flowchart.vue'



const videoRef = ref(null)
const onVideoLoaded = () => {
  if (videoRef.value) {
    videoRef.value.play().catch(() => {
    })
  }
}

useHead(() => ({
  title: 'DDAC',
  meta: [
    { name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
    { name: 'description', content: 'DDAC - 游戏盾防御' },
    { name: 'keywords', content: '高防服务器 | 高防DNS | 游戏盾SDK | 高防CDN' }
  ],
  link: [
    { rel: 'icon', href: '/favicon.ico' },
    // { rel: 'preload', as: 'video', href: homeVideo }
  ],
}))
</script>

<style scoped lang="scss">
.main-content {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0;
}

.hero-section {
  width: 100%;
  height: 497px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;

  .hero-video-bg {
    position: absolute;
    top: 20%;
    left: 50%;
    width: 1600px;
    transform: translate(-50%);
    object-fit: cover;
    clip-path: inset(0 0 0% 0);
    z-index: 0;
  }

  .canvas-overlay {
    position: absolute;
    top: 370px;
    left: 0;
    width: 100%;
    height: 50%; // 只显示上半部分
    pointer-events: none;
    z-index: 1; // 层级不要太高
  }

  .hero-content {
    width: 100%;
    max-width: 1568px;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2; // 内容在视频和canvas之上
    margin: 0 auto;

    .hero-title {

      font-size: 30px;
      font-weight: 400;
      line-height: 30px;
      // color: #7c4dff;
      margin: 0;
      white-space: normal;
      text-align: center;
      word-break: break-word;
      max-width: 100%;
      background: linear-gradient(90deg, #7C4DFF 0.24%, #DEB9FF 45.03%, #617FFF 132.52%);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .hero-subtitle {
      margin-top: 28px;
      width: 100%;
      max-width: 918.27px;
      // min-height: 341.49px;
      position: relative;
      display: flex;
      justify-content: center;
      align-items: flex-start;

      p {
        font-size: 20px;
        font-weight: 400;
        line-height: normal;
        color: #ffffff;
        margin: 0;
        text-align: center;
        white-space: normal;
        word-break: break-word;
        max-width: 100%;
      }
    }
  }
}

// 安全洞见标题
.insight-header {
  width: 313px;
  margin: 100px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;

  .insight-title {

    font-size: 36px;
    font-weight: 400;
    line-height: 36px;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
  }

  .insight-subtitle {

    font-size: 24px;
    font-weight: 400;
    line-height: 24px;
    color: #a39dff;
    margin: 24px 0 0 0;
    text-align: center;
  }
}


// 安全架构展示（到全景技术架构上方）
.security-arch-section {
  position: relative;
  padding-top: 120px;
  padding-bottom: 60px;
  box-sizing: border-box;

  .security-arch-desc {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    gap: 30px;

    .security-arch-title {
      font-size: 45px;
      font-style: normal;
      font-weight: 400;
      line-height: 36px;
    }

    .security-arch-subtitle {
      color: #A39DFF;
      text-align: center;
      font-size: 20px;
      font-weight: 400;
      line-height: 30px;
    }
  }
}

.security-flowchart {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.cain-section {
  width: 100%;
  text-align: center;
  padding-top: 120px;
  padding-bottom: 60px;
  box-sizing: border-box;

  .cain-section-title {
    color: #FFF;
    font-size: 45px;
    font-weight: 400;
    line-height: 36px;
  }

}

$Diameter :890px;

.industry {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 2;

  .industry-content {
    display: flex;
    gap: 16px;
  }

  .industry-item {
    display: flex;
    width: 220px;
    height: 100px;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    border: 1px solid #C6BAFF;
    background: linear-gradient(169deg, rgba(101, 70, 255, 0.60) -37.16%, rgba(101, 70, 255, 0.10) 193.82%);
    backdrop-filter: blur(1px);
    gap: 20px;
  }


  .industry-text {
    color: #FFF;
    font-size: 30px;
    font-weight: 400;
    line-height: 30px;
  }

  .industry-other {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, auto);
  }

  .other-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 220px;
    height: 100px;
    border-radius: 10px;
    border: 1px solid #B2A1FF;
    background: #1C192B;
  }

  .join-container {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px; // 与上面的 grid 宽度对齐
    margin-top: 100px;
    margin-bottom: 60px;
    gap: 160px;

    .join-left {
      text-align: left;

      h3 {
        color: #FFF;
        font-size: 45px;
        font-weight: 400;
        line-height: 45px;
      }

      .join-subtitle {
        margin-top: 45px;
        margin-bottom: 36px;
        color: #A39DFF;
        font-size: 26px;
        font-weight: 400;
        line-height: 45px;
      }

      .join-btn {
        display: flex;
        width: 330px;
        height: 66px;
        justify-content: center;
        align-items: center;
        gap: 10px;
        border-radius: 50px;
        background: linear-gradient(91deg, #A39DFF 1.24%, #7D46FF 122.93%);
        cursor: pointer;

        span {
          color: #FFF;
          font-size: 24px;
          font-weight: 500;
        }

      }
    }
  }

}
</style>
