/* ==========================================
   Butterfly 主题自定义样式 - 简约现代风格
   ========================================== */

:root {
  /* 浅色模式配色 */
  --primary-color: #2c3e50;
  --bg-color: #ffffff;
  --secondary-bg: #f8f9fa;
  --accent-color: #3498db;
  --border-color: #e1e4e8;
  --text-color: #2c3e50;
  --text-secondary: #6c757d;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --code-font: "JetBrains Mono", "Fira Code", Consolas, Monaco, monospace;

  /* 间距 */
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* 阴影 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* 过渡 */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-theme: 400ms ease;
}

/* 深色模式配色 */
[data-theme="dark"] {
  --primary-color: #e4e6eb;
  --bg-color: #1a1a1a;
  --secondary-bg: #242424;
  --accent-color: #5dade2;
  --border-color: #333333;
  --text-color: #e4e6eb;
  --text-secondary: #a8a8a8;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   全局样式优化
   ========================================== */

* {
  transition: background-color var(--transition-theme),
              color var(--transition-theme),
              border-color var(--transition-theme);
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.8;
  font-size: 16px;
}

/* 链接样式 */
a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-color);
}

/* 代码块样式 */
code, pre {
  font-family: var(--code-font);
}

/* ==========================================
   卡片和布局样式
   ========================================== */

/* 卡片样式 */
.card-widget {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal),
              box-shadow var(--transition-normal);
}

.card-widget:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* 文章卡片 */
#recent-posts > .recent-post-item {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: transform var(--transition-normal),
              box-shadow var(--transition-normal);
}

#recent-posts > .recent-post-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* 页面容器 */
#page {
  background: var(--bg-color);
}

#content-inner {
  background: var(--bg-color);
}

/* ==========================================
   动画效果
   ========================================== */

/* 页面加载淡入 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#page {
  animation: fadeIn var(--transition-slow) ease-out;
}

/* 卡片渐入效果 */
@keyframes staggerFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recent-post-item {
  animation: staggerFadeIn 0.6s ease-out backwards;
}

.recent-post-item:nth-child(1) { animation-delay: 0.1s; }
.recent-post-item:nth-child(2) { animation-delay: 0.2s; }
.recent-post-item:nth-child(3) { animation-delay: 0.3s; }
.recent-post-item:nth-child(4) { animation-delay: 0.4s; }
.recent-post-item:nth-child(5) { animation-delay: 0.5s; }

/* 按钮交互效果 */
button, .button, .btn {
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast);
}

button:active, .button:active, .btn:active {
  transform: scale(0.95);
}

/* 图片淡入效果 */
img {
  transition: opacity var(--transition-slow);
}

img[loading="lazy"] {
  opacity: 0;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ==========================================
   响应式优化
   ========================================== */

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .card-widget {
    border-radius: var(--radius-sm);
  }

  #recent-posts > .recent-post-item {
    border-radius: var(--radius-sm);
  }
}

/* 深色模式特定优化 */
[data-theme="dark"] img {
  opacity: 0.9;
}

[data-theme="dark"] .card-widget {
  background: var(--secondary-bg);
  border-color: var(--border-color);
}

/* ==========================================
   主题切换按钮
   ========================================== */

.theme-toggle-btn {
  position: fixed;
  right: 20px;
  bottom: 100px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  z-index: 100;
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

/* 阅读时间样式 */
.reading-time {
  margin-left: var(--spacing-md);
  color: var(--text-secondary);
}

.reading-time i {
  margin-right: var(--spacing-sm);
}
