/* ============================================
   米未熊个人博客 - 极简高级风格
   ============================================ */

/* CSS 变量 - 主题系统 */
:root {
  /* 浅色主题 */
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5f5f5;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --border-color: #e8e8e8;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1a1a1a;
  --text-primary: #ededed;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;
  --border-color: #2a2a2a;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59, 130, 246, 0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
}

/* ============================================
   基础重置
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

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

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

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
   导航栏
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all var(--transition);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary) !important;
  letter-spacing: -0.02em;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary) !important;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-color);
  border-radius: 1px;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-secondary);
  transition: transform var(--transition), color var(--transition);
  border-radius: var(--radius-sm);
}

.theme-toggle:hover {
  transform: rotate(15deg);
  color: var(--text-primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  flex-direction: column;
  gap: 16px;
  z-index: 999;
}

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

.mobile-menu a {
  color: var(--text-secondary);
  font-size: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.mobile-menu a:last-child {
  border-bottom: none;
}

/* ============================================
   Hero 区域
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.hero-content {
  max-width: 680px;
}

.hero-greeting {
  font-size: 17px;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.hero-name {
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-title {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 500;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-tertiary);
  line-height: 1.8;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary) !important;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--bg-primary) !important;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary) !important;
  border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-tertiary);
  color: var(--text-primary) !important;
}

/* ============================================
   通用 Section
   ============================================ */
.section {
  padding: 100px 0;
}

.section-title {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 750;
  letter-spacing: -0.025em;
  margin-bottom: 48px;
  text-align: center;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
}

.section-header .section-title {
  margin-bottom: 0;
}

.view-all {
  color: var(--accent-color);
  font-weight: 600;
  font-size: 15px;
}

.view-all:hover {
  color: var(--accent-hover);
}

/* ============================================
   关于我卡片
   ============================================ */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.about-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 36px 28px;
  transition: all var(--transition);
}

.about-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-color);
}

.about-icon {
  font-size: 40px;
  margin-bottom: 20px;
}

.about-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.about-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

/* ============================================
   文章卡片
   ============================================ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}

.post-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

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

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-tertiary);
}

.post-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.post-tag {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--accent-light);
  color: var(--accent-color);
  border-radius: 20px;
  font-weight: 600;
}

.post-card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  color: var(--text-primary) !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-excerpt {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-tertiary);
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.post-card-read-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-color) !important;
}

.post-card-read-more:hover {
  color: var(--accent-hover) !important;
}

.no-posts {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  font-size: 18px;
}

/* ============================================
   联系方式
   ============================================ */
.contact {
  background: var(--bg-tertiary);
}

.contact-desc {
  text-align: center;
  color: var(--text-secondary);
  font-size: 17px;
  margin-top: -32px;
  margin-bottom: 48px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 700px;
  margin: 0 auto;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  color: var(--text-primary) !important;
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-color);
}

.contact-icon {
  font-size: 36px;
}

.contact-card span {
  font-weight: 600;
  font-size: 16px;
}

.contact-card small {
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ============================================
   文章详情页
   ============================================ */
.page-header {
  padding-top: 120px;
  padding-bottom: 60px;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.page-header h1 {
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.page-header p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

.post-article {
  padding: 60px 0 100px;
  min-height: calc(100vh - 64px);
}

.post-container {
  max-width: 740px;
}

.post-detail-header {
  margin-bottom: 48px;
}

.post-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-color);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 28px;
  padding: 8px 0;
}

.post-detail-back:hover {
  color: var(--accent-hover);
}

.post-detail-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
}

.post-detail-meta {
  display: flex;
  gap: 20px;
  color: var(--text-tertiary);
  font-size: 14px;
  flex-wrap: wrap;
}

.post-detail-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.post-detail-content {
  font-size: 16px;
  line-height: 1.9;
  color: var(--text-primary);
}

.post-detail-content h2 {
  font-size: 26px;
  font-weight: 750;
  margin: 40px 0 20px;
  letter-spacing: -0.02em;
}

.post-detail-content h3 {
  font-size: 21px;
  font-weight: 700;
  margin: 32px 0 16px;
}

.post-detail-content p {
  margin-bottom: 18px;
}

.post-detail-content img {
  border-radius: var(--radius-md);
  margin: 28px 0;
  box-shadow: var(--shadow-md);
}

.post-detail-content blockquote {
  border-left: 3px solid var(--accent-color);
  padding: 16px 24px;
  margin: 24px 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-detail-content ul,
.post-detail-content ol {
  padding-left: 24px;
  margin-bottom: 18px;
}

.post-detail-content li {
  margin-bottom: 8px;
}

.post-detail-content code {
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.post-detail-content pre {
  background: var(--bg-tertiary);
  padding: 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border-color);
}

.post-detail-content pre code {
  background: none;
  padding: 0;
}

.post-detail-content hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 36px 0;
}

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

.post-detail-content a {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================
   页脚
   ============================================ */
.footer {
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  text-align: center;
}

.footer p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 6px;
}

.footer-sub {
  color: var(--text-tertiary) !important;
  font-size: 13px;
}

/* ============================================
   动画
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

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

  .hero {
    min-height: auto;
    padding: 120px 0 80px;
  }

  .section {
    padding: 70px 0;
  }

  .section-title {
    font-size: 26px;
    margin-bottom: 36px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

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

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

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

  .hero-actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
    width: 100%;
  }

  .page-header {
    padding-top: 100px;
    padding-bottom: 40px;
  }

  .post-article {
    padding: 40px 0 70px;
  }

  .post-detail-content {
    font-size: 15px;
  }

  .post-detail-content h2 {
    font-size: 22px;
  }

  .hide-mobile {
    display: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero-name {
    font-size: 36px;
  }

  .hero-greeting {
    font-size: 15px;
  }

  .hero-title {
    font-size: 17px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .about-card {
    padding: 28px 22px;
  }

  .post-card-body {
    padding: 20px;
  }
}

/* ============================================
   滚动条美化（暗色模式优化）
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}
