/**
 * 博客现代化主题样式
 * 青色现代主题 + 深色模式 + 丰富动画
 */

/* ==================== 1. CSS 变量定义 ==================== */
:root {
  /* 青色现代主题配色 */
  --color-primary-50: #ecfeff;
  --color-primary-100: #cffafe;
  --color-primary-200: #a5f3fc;
  --color-primary-300: #67e8f9;
  --color-primary-400: #22d3ee;
  --color-primary-500: #06b6d4;
  --color-primary-600: #0891b2;
  --color-primary-700: #0e7490;
  --color-primary-800: #155e75;
  --color-primary-900: #164e63;

  /* 辅助色 */
  --color-accent: #f59e0b;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-purple: #8b5cf6;

  /* 中性色 */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  /* 背景色 */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;

  /* 文字色 */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;

  /* 边框色 */
  --border-color: #e5e7eb;
  --border-hover: rgba(6, 182, 212, 0.3);

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 20px 25px -5px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
                  0 20px 25px -5px rgba(0, 0, 0, 0.08),
                  0 0 0 1px rgba(6, 182, 212, 0.1);

  /* 渐变 */
  --gradient-primary: linear-gradient(135deg, #06b6d4 0%, #0891b2 50%, #0e7490 100%);
  --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  --gradient-hero: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);

  /* 动画时长 */
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 500ms;

  /* 缓动函数 */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ==================== 2. 深色模式 ==================== */
[data-theme="dark"] {
  /* 背景色 */
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;

  /* 文字色 */
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;

  /* 边框色 */
  --border-color: #374151;
  --border-hover: rgba(6, 182, 212, 0.4);

  /* 阴影（深色模式下更柔和） */
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 10px 15px -3px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.3),
                  0 20px 25px -5px rgba(0, 0, 0, 0.25),
                  0 0 0 1px rgba(6, 182, 212, 0.3);
}

/* ==================== 3. 平滑过渡 ==================== */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: var(--duration-base);
  transition-timing-function: var(--ease-out);
}

/* 深色模式切换时的平滑过渡 */
html {
  transition: background-color var(--duration-base) var(--ease-out);
}

body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* ==================== 4. 卡片优化 ==================== */
.blog-card-modern {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: var(--shadow-base);
  transition: all var(--duration-base) var(--ease-out);
  overflow: hidden;
}

.blog-card-modern:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
}

/* ==================== 5. 按钮优化 ==================== */
.btn-primary-modern {
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--ease-out);
  border: none;
  cursor: pointer;
}

.btn-primary-modern:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

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

/* ==================== 6. 动画定义 ==================== */

/* 淡入动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 从下滑入 */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 从左滑入 */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 从右滑入 */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 缩放进入 */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 脉冲动画 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* 渐变流动 */
@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ==================== 7. 应用动画类 ==================== */
.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out);
}

.animate-slide-up {
  animation: slideUp var(--duration-slow) var(--ease-out);
}

.animate-slide-in-left {
  animation: slideInLeft var(--duration-slow) var(--ease-out);
}

.animate-slide-in-right {
  animation: slideInRight var(--duration-slow) var(--ease-out);
}

.animate-scale-in {
  animation: scaleIn var(--duration-base) var(--ease-bounce);
}

/* 延迟动画（用于列表项） */
.animate-delay-1 { animation-delay: 100ms; }
.animate-delay-2 { animation-delay: 200ms; }
.animate-delay-3 { animation-delay: 300ms; }
.animate-delay-4 { animation-delay: 400ms; }
.animate-delay-5 { animation-delay: 500ms; }

/* ==================== 8. 滚动触发动画 ==================== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

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

/* ==================== 9. Hero 区域优化 ==================== */
.hero-gradient {
  position: relative;
  overflow: hidden;
}

.hero-gradient::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 20s ease-in-out infinite;
}

.hero-gradient::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(50px, 50px) scale(1.1);
  }
}

/* ==================== 10. 图片悬停效果 ==================== */
.image-hover-zoom {
  overflow: hidden;
}

.image-hover-zoom img {
  transition: transform var(--duration-slow) var(--ease-out);
}

.image-hover-zoom:hover img {
  transform: scale(1.05);
}

/* ==================== 11. 渐变文字 ==================== */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientFlow 3s ease infinite;
}

/* ==================== 12. 玻璃态效果 ==================== */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .glass-effect {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(55, 65, 81, 0.3);
}

/* ==================== 13. 深色模式切换按钮 ==================== */
.theme-toggle {
  position: relative;
  width: 60px;
  height: 30px;
  background: var(--color-gray-300);
  border-radius: 15px;
  cursor: pointer;
  transition: background-color var(--duration-base) var(--ease-out);
}

[data-theme="dark"] .theme-toggle {
  background: var(--color-primary-600);
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: transform var(--duration-base) var(--ease-bounce);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .theme-toggle::after {
  transform: translateX(30px);
}

/* ==================== 14. 侧边栏优化 ==================== */
.sidebar-sticky {
  position: sticky;
  top: 100px;
}

/* ==================== 15. 加载骨架屏 ==================== */
.skeleton {
  background: linear-gradient(90deg, var(--color-gray-200) 25%, var(--color-gray-100) 50%, var(--color-gray-200) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--color-gray-700) 25%, var(--color-gray-600) 50%, var(--color-gray-700) 75%);
  background-size: 200% 100%;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ==================== 16. 响应式优化 ==================== */
@media (max-width: 768px) {
  .blog-card-modern {
    border-radius: 0.75rem;
  }

  .hero-gradient::before,
  .hero-gradient::after {
    width: 400px;
    height: 400px;
  }
}

/* ==================== 17. 打印样式 ==================== */
@media print {
  .theme-toggle,
  .scroll-to-top,
  .floating-ad {
    display: none !important;
  }
}
