<template>
  <div class="welcome-page">
    <!-- 顶部导航栏 -->
    <header class="nav">
      <div class="nav-inner">
        <div class="nav-brand">
          <img src="/images/backgrounds/logo.svg?v=2" alt="Logo" class="nav-logo" />
        </div>

        <nav class="nav-links">
          <a href="#" class="nav-link" @click.prevent="goToTextToVideo">{{ $t('welcome.textToVideo') }}</a>
          <a href="#" class="nav-link" @click.prevent="goToImageToVideo">{{ $t('welcome.imageToVideo') }}</a>
          <a href="#" class="nav-link" @click.prevent="goToStoryboardVideo">{{ $t('welcome.storyboardVideo') }}</a>
        </nav>

        <div class="nav-actions">
          <LanguageSwitcher />
          <button class="nav-cta" @click="goToLogin">{{ $t('welcome.startExperience') }}</button>
        </div>
      </div>
    </header>

    <!-- 英雄区域 -->
    <section class="hero">
      <!-- 装饰元素 -->
      <div class="hero-decor">
        <div class="orb orb--1"></div>
        <div class="orb orb--2"></div>
        <div class="orb orb--3"></div>
        <div class="hero-grid-lines"></div>
      </div>

      <div class="hero-content">
        <h1 class="hero-title">
          <span class="hero-title-line">
            <span class="text-bright">智创</span><span class="text-fade">无限,</span>
          </span>
          <span class="hero-title-line">
            <span class="text-bright">灵感</span><span class="text-fade">变现。</span>
          </span>
        </h1>

        <p class="hero-subtitle">
          AI 驱动的视频创作平台，将你的想象力化为影像
        </p>

        <div class="hero-actions">
          <button class="btn-hero" @click="goToLogin">
            <span>立即体验</span>
            <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M5 12h14M12 5l7 7-7 7"/>
            </svg>
          </button>
        </div>

        <!-- 功能标签 -->
        <div class="hero-features">
          <div class="feature-chip" @click="goToTextToVideo">
            <span class="chip-dot chip-dot--blue"></span>
            {{ $t('welcome.textToVideo') }}
          </div>
          <div class="feature-chip" @click="goToImageToVideo">
            <span class="chip-dot chip-dot--purple"></span>
            {{ $t('welcome.imageToVideo') }}
          </div>
          <div class="feature-chip" @click="goToStoryboardVideo">
            <span class="chip-dot chip-dot--green"></span>
            {{ $t('welcome.storyboardVideo') }}
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import LanguageSwitcher from '@/components/LanguageSwitcher.vue'

const router = useRouter()

const goToLogin = () => router.push('/login')
const goToTextToVideo = () => router.push('/text-to-video/create')
const goToImageToVideo = () => router.push('/image-to-video/create')
const goToStoryboardVideo = () => router.push('/storyboard-video/create')
</script>

<style scoped>
/* 自定义字体 */
@font-face {
  font-family: 'Taipei Sans TC';
  src: url('/fonts/TaipeiSansTC.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.welcome-page {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-display);
  background: url('/images/backgrounds/welcome-bg.svg') center center / cover no-repeat;
  background-color: var(--bg-root);
}

/* ==================== Navigation ==================== */

.nav {
  position: fixed;
  top: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-10));
  max-width: 1200px;
  z-index: var(--z-sticky);
  background: rgba(11, 13, 20, 0.6);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  height: var(--navbar-height);
}

.nav-inner {
  width: 100%;
  height: 100%;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
}

.nav-logo {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: var(--space-8);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: var(--transition-colors);
  letter-spacing: var(--tracking-wide);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-cta {
  background: var(--primary-500);
  color: var(--text-inverse);
  border: none;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: var(--transition-all);
  letter-spacing: var(--tracking-wide);
}

.nav-cta:hover {
  background: var(--primary-400);
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

/* ==================== Hero Section ==================== */

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
}

/* Hero 装饰 */
.hero-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
}

.orb--1 {
  width: 700px;
  height: 500px;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0, 212, 255, 0.10) 0%, transparent 70%);
  animation: breathe 8s ease-in-out infinite;
}

.orb--2 {
  width: 400px;
  height: 400px;
  bottom: 10%;
  left: 10%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  animation: breathe 10s ease-in-out infinite;
  animation-delay: -3s;
}

.orb--3 {
  width: 350px;
  height: 300px;
  top: 20%;
  right: 5%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  animation: breathe 12s ease-in-out infinite;
  animation-delay: -6s;
}

.hero-grid-lines {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  transform: perspective(500px) rotateX(55deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 100%);
}

/* Hero 内容 */
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--space-6);
  animation: fade-in 1s var(--ease-out) both;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-6);
  letter-spacing: var(--tracking-tight);
}

.hero-title-line {
  display: block;
}

.text-bright {
  color: #ffffff;
}

.text-fade {
  color: rgba(255, 255, 255, 0.55);
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-weight: var(--font-normal);
  margin-bottom: var(--space-10);
  letter-spacing: var(--tracking-wide);
  animation: fade-in 1s var(--ease-out) 0.2s both;
}

/* Hero CTA */
.hero-actions {
  margin-bottom: var(--space-12);
  animation: fade-in 1s var(--ease-out) 0.4s both;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--primary-500);
  color: var(--text-inverse);
  border: none;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: var(--transition-all);
  letter-spacing: var(--tracking-wide);
  position: relative;
  overflow: hidden;
}

.btn-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-default);
}

.btn-hero:hover {
  background: var(--primary-400);
  box-shadow: var(--glow-primary-lg);
  transform: translateY(-2px);
}

.btn-hero:hover::before {
  transform: translateX(100%);
}

.btn-hero:active {
  transform: translateY(0);
}

.btn-hero svg {
  transition: transform var(--duration-normal) var(--ease-default);
}

.btn-hero:hover svg {
  transform: translateX(4px);
}

/* Feature Chips */
.hero-features {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  animation: fade-in 1s var(--ease-out) 0.6s both;
}

.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-all);
}

.feature-chip:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-dot--blue {
  background: var(--primary-500);
  box-shadow: 0 0 8px var(--primary-glow-medium);
}

.chip-dot--purple {
  background: var(--secondary-500);
  box-shadow: 0 0 8px var(--secondary-glow);
}

.chip-dot--green {
  background: var(--accent-500);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ==================== Responsive ==================== */

@media (max-width: 1024px) {
  .hero-title {
    font-size: clamp(2.5rem, 5vw, 5rem);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .hero-title {
    font-size: clamp(2rem, 8vw, 3.5rem);
  }

  .hero-subtitle {
    font-size: var(--text-base);
    padding: 0 var(--space-4);
  }

  .hero-features {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .btn-hero {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }
}
</style>

<style>
/* 全局样式 - 欢迎页滚动控制 */
html:has(.welcome-page),
body:has(.welcome-page) {
  overflow: hidden !important;
}
</style>
