/* ============================================
   YouTuDown.com — Design System
   渐变紫主题 + 玻璃拟态 + 微动画
   ============================================ */

/* --- Google Font ---
   NOTE: Font loaded via <link> in index.html for non-blocking render.
   Do NOT re-add @import here — it causes render-blocking. */

/* ============================================
   1. CSS Variables (Design Tokens)
   ============================================ */
:root {
  /* Colors - Light */
  --bg-primary: #F0F2FF;
  --bg-secondary: #E8EAFF;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-solid: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #4A4A6A;
  --text-muted: #8888AA;
  --accent: #7C3AED;
  --accent-light: #A78BFA;
  --accent-dark: #5B21B6;
  --accent-gradient: linear-gradient(135deg, #7C3AED 0%, #6366F1 50%, #818CF8 100%);
  --accent-glow: rgba(124, 58, 237, 0.25);
  --border: rgba(124, 58, 237, 0.12);
  --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 8px 32px rgba(26, 26, 46, 0.08);
  --shadow-lg: 0 16px 48px rgba(26, 26, 46, 0.12);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.15);

  /* Spacing */
  --section-gap: 100px;
  --content-max: 1100px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.3s;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #0B0D1A;
  --bg-secondary: #111328;
  --bg-card: rgba(30, 35, 60, 0.6);
  --bg-card-solid: #1A1D35;
  --text-primary: #E8E8F0;
  --text-secondary: #A8A8C0;
  --text-muted: #6A6A8A;
  --accent: #A78BFA;
  --accent-light: #C4B5FD;
  --accent-dark: #7C3AED;
  --accent-glow: rgba(167, 139, 250, 0.2);
  --border: rgba(167, 139, 250, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 60px rgba(167, 139, 250, 0.12);
}

/* ============================================
   2. Reset & Base
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

a:hover {
  color: var(--accent-light);
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================
   3. Layout Utilities
   ============================================ */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: var(--section-gap) 0;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-tag {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.section-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   4. Header / Navigation
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: background var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.header.scrolled {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.logo span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease);
  position: relative;
}

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

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: width var(--duration) var(--ease);
}

.nav-link:hover::after {
  width: 100%;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-size: 1.2rem;
}

.theme-toggle:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: rotate(20deg);
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--duration) var(--ease);
}

/* ============================================
   5. Hero Section
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 24px 80px;
  overflow: hidden;
}

/* Animated Background */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.hero-bg .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.hero-bg .orb-1 {
  width: 500px;
  height: 500px;
  background: #7C3AED;
  top: -10%;
  left: -5%;
  animation-delay: 0s;
}

.hero-bg .orb-2 {
  width: 400px;
  height: 400px;
  background: #6366F1;
  bottom: -10%;
  right: -5%;
  animation-delay: -7s;
}

.hero-bg .orb-3 {
  width: 300px;
  height: 300px;
  background: #818CF8;
  top: 40%;
  left: 60%;
  animation-delay: -14s;
}

[data-theme="dark"] .hero-bg .orb {
  opacity: 0.2;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 40px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--border);
  margin-bottom: 28px;
  backdrop-filter: blur(10px);
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.hero-title {
  font-size: 3.8rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero-title .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 48px;
  line-height: 1.7;
}

/* ============================================
   6. Download Tool Section
   ============================================ */
.download-tool {
  position: relative;
  z-index: 1;
  width: 55vw;
  max-width: 1100px;
  min-width: 320px;
  margin: 0 auto;
}

.download-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transition: all var(--duration) var(--ease);
}

.download-card:hover {
  box-shadow: var(--shadow-lg), 0 0 60px rgba(124, 58, 237, 0.2);
}

.widget-container {
  width: 100%;
  min-height: 260px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
}

.widget-container iframe {
  width: 100%;
  min-height: 260px;
  border: none;
  display: block;
}

.download-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.download-notice .notice-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ============================================
   7. Supported Platforms
   ============================================ */
.platforms {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 36px;
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

.platform-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--duration) var(--ease);
}

.platform-item:hover {
  color: var(--accent);
}

.platform-item .platform-icon {
  font-size: 1.5rem;
}

/* ============================================
   8. Features Section
   ============================================ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(124, 58, 237, 0.25);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   9. How It Works Section
   ============================================ */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  position: relative;
}

/* Connecting line */
.steps-grid::before {
  content: '';
  position: absolute;
  top: 42px;
  left: calc(16.666% + 16px);
  right: calc(16.666% + 16px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step-card {
  text-align: center;
  position: relative;
  z-index: 1;
}

.step-number {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
  position: relative;
}

.step-number::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent-glow);
  animation: pulse-ring 3s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0; }
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   10. FAQ Section
   ============================================ */
.faq-list {
  max-width: 740px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--duration) var(--ease);
}

.faq-item:hover {
  border-color: rgba(124, 58, 237, 0.2);
}

.faq-item.active {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 20px var(--accent-glow);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  user-select: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: color var(--duration) var(--ease);
}

.faq-question:hover {
  color: var(--accent);
}

.faq-chevron {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.4s var(--ease), color var(--duration) var(--ease);
  flex-shrink: 0;
}

.faq-item.active .faq-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease), padding 0.4s var(--ease);
}

.faq-answer-inner {
  padding: 0 24px 20px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.faq-item.active .faq-answer {
  max-height: 300px;
}

/* ============================================
   11. Footer
   ============================================ */
.footer {
  padding: 60px 0 32px;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================
   12. Scroll Reveal Animations
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ============================================
   13. Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
  :root {
    --section-gap: 72px;
  }

  .nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .nav.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-card-solid);
    backdrop-filter: blur(20px);
    padding: 16px 24px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .hero {
    padding: 120px 24px 60px;
    min-height: auto;
  }

  .hero-title {
    font-size: 2.6rem;
  }

  .hero-subtitle {
    font-size: 1.05rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .steps-grid::before {
    display: none;
  }

  .download-tool {
    width: 100%;
  }

  .download-card {
    padding: 20px;
  }

  .platforms {
    gap: 20px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .section-title {
    font-size: 1.7rem;
  }

  .section-header {
    margin-bottom: 40px;
  }

  .feature-card {
    padding: 24px 20px;
  }

  .download-card {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .faq-question {
    padding: 16px 18px;
    font-size: 0.92rem;
  }

  .faq-answer-inner {
    padding: 0 18px 16px;
    font-size: 0.88rem;
  }
}

/* ============================================
   14. Loading State
   ============================================ */
.widget-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   15. Formats Grid (below download)
   ============================================ */
.formats-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.format-badge {
  padding: 6px 18px;
  border-radius: 40px;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.format-badge.highlight {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: rgba(124, 58, 237, 0.25);
}
