/*
Theme Name: 清墨卷现代主题
Theme URI: https://qingmojuan.com
Author: 清墨卷
Description: 一个受 Notion 启发的现代化 WordPress 主题，包含流畅的动画和精美的设计
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: qingmojuan-modern
*/

/* ==================== 全局样式 ==================== */
:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --text-color: #1e293b;
  --text-light: #64748b;
  --bg-color: #ffffff;
  --bg-secondary: #f8fafc;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max-width: 1200px;
  --content-width: 780px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    'Microsoft YaHei', sans-serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* 移除 WordPress 管理工具栏的边距 */
body.admin-bar {
  margin-top: 0 !important;
}

html {
  margin-top: 0 !important;
}

/* ==================== 顶部导航栏 ==================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.site-logo:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

.site-logo::before {
  content: '📚';
  font-size: 1.8rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.main-navigation {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
}

.nav-menu a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 0;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

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

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

.search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-light);
  transition: all 0.3s ease;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.search-toggle:hover {
  color: var(--primary-color);
  background: var(--bg-secondary);
}

/* ==================== 主要内容区域 ==================== */
.site-content {
  margin-top: 80px;
  min-height: calc(100vh - 140px);
  padding: 3rem 2rem;
}

.content-wrapper {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ==================== 文章列表 ==================== */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.post-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

.post-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
  border-color: var(--primary-color);
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.post-header {
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.post-meta-item::before {
  content: '•';
  margin-right: 0.5rem;
}

.post-meta-item:first-child::before {
  content: '';
  margin: 0;
}

.post-title {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.post-title a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-block;
}

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

.post-excerpt {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.1);
}

.read-more:hover {
  background: var(--primary-color);
  color: white;
  transform: translateX(4px);
}

.read-more::after {
  content: '→';
  transition: transform 0.3s ease;
}

.read-more:hover::after {
  transform: translateX(4px);
}

/* ==================== 单篇文章 ==================== */
.single-post {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-color);
}

.post-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--text-color);
  position: relative;
  padding-left: 1rem;
}

.post-content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 4px;
  background: linear-gradient(to bottom, var(--primary-color), #8b5cf6);
  border-radius: 2px;
}

.post-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text-color);
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
}

.post-content ul li::marker {
  color: var(--primary-color);
}

.post-content strong {
  color: var(--text-color);
  font-weight: 600;
}

.post-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.3);
  transition: all 0.3s ease;
}

.post-content a:hover {
  border-bottom-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
}

/* ==================== 页脚 ==================== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 2rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  list-style: none;
  margin-bottom: 1.5rem;
}

.footer-links a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

.footer-copyright {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ==================== 返回顶部按钮 ==================== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  background: #1d4ed8;
}

/* ==================== 加载动画 ==================== */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ==================== 搜索框 ==================== */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.search-modal.active {
  opacity: 1;
  visibility: visible;
}

.search-container {
  background: var(--bg-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.search-modal.active .search-container {
  transform: translateY(0);
}

.search-input {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.3s ease;
}

.search-input:focus {
  border-color: var(--primary-color);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .header-container {
    padding: 0 1rem;
  }
  
  .nav-menu {
    display: none;
  }
  
  .site-content {
    padding: 2rem 1rem;
  }
  
  .post-card {
    padding: 1.5rem;
  }
  
  .post-title {
    font-size: 1.5rem;
  }
  
  .post-content {
    font-size: 1rem;
  }
  
  .post-content h2 {
    font-size: 1.5rem;
  }
  
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

/* ==================== 暗色模式支持 ==================== */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #f1f5f9;
    --text-light: #94a3b8;
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --border-color: #334155;
  }
  
  .site-header {
    background: rgba(15, 23, 42, 0.95);
  }
  
  .post-card {
    background: var(--bg-secondary);
  }
}

/* ==================== 特殊效果 ==================== */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

