/* ===== 暗黑风 Gitea 主页样式 ===== */

/* 基础重置和变量 */
:root {
  /* 主色调 */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  
  /* 文字颜色 */
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #666666;
  
  /* 高亮色调 */
  --accent-blue: #00d4ff;
  --accent-purple: #8b5cf6;
  --accent-red: #ff4757;
  --accent-gold: #feca57;
  
  /* 渐变色 */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(45deg, #00d4ff, #8b5cf6);
  --gradient-glow: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.3), transparent);
  
  /* 阴影 */
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-strong: 0 16px 64px rgba(0, 0, 0, 0.6);
  --glow-blue: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-purple: 0 0 30px rgba(139, 92, 246, 0.4);
  
  /* 间距 */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;
  --spacing-xl: 4rem;
  
  /* 动画 */
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.3s ease;
  --transition-slow: 0.6s ease;
}

/* 隐藏滚动条 */
html, body {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

html::-webkit-scrollbar, 
body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* 全局样式 */
* {
  box-sizing: border-box;
}

.dark-home-container {
  position: relative;
  min-height: 100vh;
  background: var(--bg-primary);
  overflow-x: hidden;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
}

/* 背景效果 */
.particle-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.gradient-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 2;
}

/* Hero Section */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  z-index: 10;
}

.hero-content {
  text-align: center;
  max-width: 800px;
  width: 100%;
}

.logo-container {
  margin-bottom: var(--spacing-lg);
  position: relative;
}

.logo-glow {
  position: relative;
  display: inline-block;
  padding: var(--spacing-md);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.1), transparent);
  animation: logoFloat 6s ease-in-out infinite;
}

.logo-glow::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: var(--gradient-accent);
  z-index: -1;
  opacity: 0.3;
  filter: blur(10px);
  animation: logoGlow 3s ease-in-out infinite alternate;
}

.logo-main {
  width: 180px;
  height: 180px;
  filter: drop-shadow(var(--glow-blue));
  transition: var(--transition-smooth);
}

.logo-main:hover {
  transform: scale(1.05);
  filter: drop-shadow(var(--glow-purple));
}

.hero-text {
  margin-top: var(--spacing-lg);
}

.hero-title {
  font-size: 4rem;
  font-weight: 800;
  margin: 0 0 var(--spacing-md) 0;
  letter-spacing: -0.02em;
}

.dark-home-container .title-gradient {
  background: var(--gradient-accent);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  position: relative;
}

.dark-home-container .title-gradient::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  background: var(--gradient-accent);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: blur(20px);
  opacity: 0.5;
  z-index: -1;
}

/* 打字机光标样式 - 仿真文本编辑器光标 */
.dark-home-container .typewriter-cursor {
  display: inline-block;
  width: 10px; /* 更宽的光标，类似真实文本编辑器 */
  height: 1.3em;
  background: linear-gradient(to right,
    rgba(0, 212, 255, 0.9) 0%,
    rgba(0, 212, 255, 1) 20%,
    rgba(0, 212, 255, 1) 80%,
    rgba(0, 212, 255, 0.9) 100%
  );
  margin-left: 2px; /* 减少间距使其更贴近文字 */
  animation: cursorBlink 1.2s infinite ease-in-out;
  -webkit-animation: cursorBlink 1.2s infinite ease-in-out; /* Safari/Chrome */
  -moz-animation: cursorBlink 1.2s infinite ease-in-out; /* Firefox */
  position: relative;
  vertical-align: middle;
  border-radius: 1px;
  /* 更自然的发光效果 */
  box-shadow:
    0 0 6px rgba(0, 212, 255, 0.8),
    0 0 12px rgba(0, 212, 255, 0.5),
    0 0 18px rgba(0, 212, 255, 0.3),
    inset 0 0 2px rgba(255, 255, 255, 0.4);
  /* 添加轻微的透明度变化 */
  opacity: 0.95;
  /* 性能优化 */
  will-change: opacity, transform, box-shadow;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.dark-home-container .typewriter-cursor::after {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(to right,
    rgba(0, 212, 255, 0.6) 0%,
    rgba(0, 212, 255, 0.8) 50%,
    rgba(0, 212, 255, 0.6) 100%
  );
  filter: blur(4px);
  opacity: 0.6;
  z-index: -1;
  border-radius: 2px;
  /* 柔和的外层发光 */
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

/* 打字机效果容器 - 添加隔离以防止与Gitea样式冲突 */
.dark-home-container .hero-title {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  /* 确保样式只应用于主页 */
  isolation: isolate;
}

/* 打字机状态 - 更安全的样式，避免与Gitea冲突 */
.dark-home-container .title-gradient.typing {
  /* 移除可能导致布局问题的overflow和white-space */
  /* overflow: hidden; */
  /* white-space: nowrap; */
  border-right: none;
  transition: all 0.3s ease;
  /* 确保文本渲染正常 */
  word-break: normal;
  overflow-wrap: normal;
}

/* 打字时隐藏背景模糊效果，避免显示完整文本造成视觉冲突 */
.dark-home-container .title-gradient.typing::after {
  opacity: 0 !important;
  transition: opacity 0.3s ease;
}

.dark-home-container .title-gradient.typing .typewriter-cursor {
  animation: cursorBlink 0.6s infinite ease-in-out; /* 打字时更快的闪烁，平滑过渡 */
}

/* 打字机完成状态 */
.dark-home-container .title-gradient.completed {
  transition: transform 0.3s ease;
}

/* 打字完成后恢复背景模糊效果 */
.dark-home-container .title-gradient.completed::after {
  opacity: 0.5 !important;
  transition: opacity 0.5s ease 0.3s; /* 延迟恢复，确保打字完成 */
}

/* 光标闪烁动画 - 增强的平滑过渡效果 */
@-webkit-keyframes cursorBlink {
  /* 完全可见状态 - 开始 */
  0% {
    opacity: 0.95;
    -webkit-transform: scaleY(1) scaleX(1);
    transform: scaleY(1) scaleX(1);
    -webkit-box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }
  40% {
    opacity: 0.95;
    -webkit-transform: scaleY(1) scaleX(1);
    transform: scaleY(1) scaleX(1);
    -webkit-box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }
  45% {
    opacity: 0.7;
    -webkit-transform: scaleY(1) scaleX(0.95);
    transform: scaleY(1) scaleX(0.95);
    -webkit-box-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 8px rgba(0, 212, 255, 0.3),
      0 0 12px rgba(0, 212, 255, 0.2),
      inset 0 0 1px rgba(255, 255, 255, 0.2);
    box-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 8px rgba(0, 212, 255, 0.3),
      0 0 12px rgba(0, 212, 255, 0.2),
      inset 0 0 1px rgba(255, 255, 255, 0.2);
  }
  50% {
    opacity: 0;
    -webkit-transform: scaleY(1) scaleX(0.8);
    transform: scaleY(1) scaleX(0.8);
    -webkit-box-shadow: none;
    box-shadow: none;
  }
  55% {
    opacity: 0.7;
    -webkit-transform: scaleY(1) scaleX(0.95);
    transform: scaleY(1) scaleX(0.95);
    -webkit-box-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 8px rgba(0, 212, 255, 0.3),
      0 0 12px rgba(0, 212, 255, 0.2),
      inset 0 0 1px rgba(255, 255, 255, 0.2);
    box-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 8px rgba(0, 212, 255, 0.3),
      0 0 12px rgba(0, 212, 255, 0.2),
      inset 0 0 1px rgba(255, 255, 255, 0.2);
  }
  60%, 100% {
    opacity: 0.95;
    -webkit-transform: scaleY(1) scaleX(1);
    transform: scaleY(1) scaleX(1);
    -webkit-box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }
}

@keyframes cursorBlink {
  /* 完全可见状态 - 开始 */
  0% {
    opacity: 0.95;
    transform: scaleY(1) scaleX(1);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }

  /* 保持可见状态 */
  40% {
    opacity: 0.95;
    transform: scaleY(1) scaleX(1);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }

  /* 开始淡出 - 平滑过渡 */
  45% {
    opacity: 0.7;
    transform: scaleY(1) scaleX(0.95);
    box-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 8px rgba(0, 212, 255, 0.3),
      0 0 12px rgba(0, 212, 255, 0.2),
      inset 0 0 1px rgba(255, 255, 255, 0.2);
  }

  /* 几乎不可见 */
  48% {
    opacity: 0.1;
    transform: scaleY(1) scaleX(0.85);
    box-shadow:
      0 0 2px rgba(0, 212, 255, 0.2),
      0 0 4px rgba(0, 212, 255, 0.1),
      0 0 6px rgba(0, 212, 255, 0.05);
  }

  /* 完全不可见状态 */
  50% {
    opacity: 0;
    transform: scaleY(1) scaleX(0.8);
    box-shadow: none;
  }

  /* 开始淡入 - 平滑过渡 */
  52% {
    opacity: 0.1;
    transform: scaleY(1) scaleX(0.85);
    box-shadow:
      0 0 2px rgba(0, 212, 255, 0.2),
      0 0 4px rgba(0, 212, 255, 0.1),
      0 0 6px rgba(0, 212, 255, 0.05);
  }

  /* 逐渐可见 */
  55% {
    opacity: 0.7;
    transform: scaleY(1) scaleX(0.95);
    box-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 8px rgba(0, 212, 255, 0.3),
      0 0 12px rgba(0, 212, 255, 0.2),
      inset 0 0 1px rgba(255, 255, 255, 0.2);
  }

  /* 恢复完全可见 */
  60% {
    opacity: 0.95;
    transform: scaleY(1) scaleX(1);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }

  /* 保持可见状态直到结束 */
  100% {
    opacity: 0.95;
    transform: scaleY(1) scaleX(1);
    box-shadow:
      0 0 6px rgba(0, 212, 255, 0.8),
      0 0 12px rgba(0, 212, 255, 0.5),
      0 0 18px rgba(0, 212, 255, 0.3),
      inset 0 0 2px rgba(255, 255, 255, 0.4);
  }
}

/* 简化版光标动画 - 旧浏览器兼容性 */
@keyframes cursorBlinkSimple {
  0%, 50% { opacity: 0.95; }
  51%, 100% { opacity: 0; }
}

/* 浏览器兼容性支持 */
@supports not (transform: scaleX(1)) {
  .dark-home-container .typewriter-cursor {
    animation: cursorBlinkSimple 1.2s infinite ease-in-out;
  }

  .dark-home-container .title-gradient.typing .typewriter-cursor {
    animation: cursorBlinkSimple 0.6s infinite ease-in-out;
  }
}



/* 副标题样式 - 添加淡入动画支持 */
.dark-home-container .hero-subtitle {
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 1.4;
  /* 初始状态：不可见 */
  opacity: 0;
  transform: translateY(10px); /* 轻微向上移动效果 */
  transition: opacity 1.5s ease-out, transform 1.5s ease-out;
}

/* 副标题淡入动画状态 */
.dark-home-container .hero-subtitle.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* 滚动指示器 */
.scroll-indicator {
  position: absolute;
  bottom: calc(var(--spacing-lg) + var(--spacing-md));
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
  z-index: 20;
}

.scroll-arrow {
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent-blue);
  border-left: none;
  border-top: none;
  transform: rotate(45deg);
}

/* Features Section */
.features-section {
  position: relative;
  padding: var(--spacing-xl) var(--spacing-lg);
  z-index: 10;
  background: linear-gradient(180deg, transparent 0%, var(--bg-secondary) 50%);
  overflow: hidden;
}

.features-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
  overflow: hidden;
  padding: 0 var(--spacing-sm);
}

.feature-card {
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: var(--spacing-lg);
  transition: var(--transition-smooth);
  cursor: pointer;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-glow);
  transition: var(--transition-slow);
  z-index: 1;
}

.feature-card:hover::before {
  left: 100%;
}

.feature-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 212, 255, 0.3);
  box-shadow: var(--shadow-medium), var(--glow-blue);
}

.feature-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
  opacity: 0;
  transition: var(--transition-smooth);
  z-index: 1;
  pointer-events: none;
}

.feature-card:hover .feature-glow {
  opacity: 0.1;
}

.feature-icon {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: var(--spacing-md);
  z-index: 2;
}

.feature-icon svg {
  width: 100%;
  height: 100%;
  fill: var(--accent-blue);
  filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
  transition: var(--transition-smooth);
}

.feature-card:hover .feature-icon svg {
  fill: var(--accent-purple);
  filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.7));
  transform: scale(1.1);
}

.feature-content {
  position: relative;
  z-index: 2;
}

.feature-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.feature-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.feature-description a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition-fast);
}

.feature-description a:hover {
  color: var(--accent-purple);
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

/* 特定功能卡片的个性化颜色 */
.feature-card[data-feature="install"]:hover .feature-icon svg {
  fill: var(--accent-red);
  filter: drop-shadow(0 0 15px rgba(255, 71, 87, 0.7));
}

.feature-card[data-feature="platform"]:hover .feature-icon svg {
  fill: var(--accent-blue);
  filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.7));
}

.feature-card[data-feature="lightweight"]:hover .feature-icon svg {
  fill: var(--accent-purple);
  filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.7));
}

.feature-card[data-feature="license"]:hover .feature-icon svg {
  fill: var(--accent-gold);
  filter: drop-shadow(0 0 15px rgba(254, 202, 87, 0.7));
}

/* 动画关键帧 */
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes logoGlow {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}



/* 响应式设计 */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .dark-home-container .typewriter-cursor {
    height: 1.2em;
    width: 8px; /* 在平板上稍微缩小但保持文本编辑器外观 */
  }
  
  .dark-home-container .hero-subtitle {
    font-size: 1.2rem;
    /* 在平板上稍微减少移动距离 */
    transform: translateY(8px);
  }

  .dark-home-container .hero-subtitle.fade-in {
    transform: translateY(0);
  }
  
  .logo-main {
    width: 120px;
    height: 120px;
  }
  
  .features-container {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }
  
  .hero-section {
    padding: var(--spacing-md);
  }
  
  .features-section {
    padding: var(--spacing-lg) var(--spacing-md);
  }
  
  .scroll-indicator {
    bottom: calc(var(--spacing-md) + var(--spacing-sm));
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .dark-home-container .typewriter-cursor {
    height: 1.2em;
    width: 6px; /* 在手机上保持合理的文本编辑器外观 */
  }
  
  .dark-home-container .hero-subtitle {
    font-size: 1rem;
    /* 在手机上进一步减少移动距离 */
    transform: translateY(6px);
  }

  .dark-home-container .hero-subtitle.fade-in {
    transform: translateY(0);
  }
  
  .logo-main {
    width: 100px;
    height: 100px;
  }
  
  .feature-card {
    padding: var(--spacing-md);
  }
  
  .features-container {
    grid-template-columns: 1fr;
    overflow: hidden;
  }
  
  .scroll-indicator {
    bottom: var(--spacing-md);
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-tertiary: #1a1a1a;
  }
  
  .feature-card {
    border-color: rgba(255, 255, 255, 0.3);
  }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-indicator {
    animation: none;
  }
  
  .logo-glow::before {
    animation: none;
    opacity: 0.3;
  }
  
  .dark-home-container .typewriter-cursor {
    animation: none !important;
    opacity: 1;
  }
  
  .dark-home-container .title-gradient.typing {
    animation: none !important;
  }

  /* 减少动画偏好时，副标题立即显示 */
  .dark-home-container .hero-subtitle {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: none !important;
  }
}

/* 暗色主题偏好支持 */
@media (prefers-color-scheme: dark) {
  .dark-home-container {
    background: var(--bg-primary);
  }
}

/* 打印样式 */
@media print {
  .particle-bg,
  .gradient-overlay,
  .scroll-indicator {
    display: none;
  }
  
  .dark-home-container {
    background: white;
    color: black;
  }
  
  .feature-card {
    break-inside: avoid;
    border: 1px solid #ccc;
  }
}