/*
Theme Name: 明月未来
Theme URI: https://read.imoons.cn
Description: 科技感十足的暗黑渐变博客主题
Version: 1.0.0
Author: 鹏飞
*/

:root {
  --bg: #030712;
  --surface: #0f172a;
  --surface2: #1e293b;
  --border: rgba(0,245,255,0.12);
  --primary: #00f5ff;
  --primary-dim: rgba(0,245,255,0.15);
  --secondary: #a855f7;
  --accent: #f472b6;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --glow: 0 0 24px rgba(0,245,255,0.25);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── 背景动画 ── */
.bg-anim {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,245,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 20s ease-in-out infinite;
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,245,255,0.18) 0%, transparent 70%);
  top: -200px; left: -100px;
  animation-duration: 25s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,0.18) 0%, transparent 70%);
  top: 40%; right: -150px;
  animation-duration: 20s;
  animation-delay: -7s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(244,114,182,0.14) 0%, transparent 70%);
  bottom: -100px; left: 30%;
  animation-duration: 28s;
  animation-delay: -14s;
}
@keyframes float {
  0%,100% { transform: translateY(0) scale(1); }
  33% { transform: translateY(-40px) scale(1.05); }
  66% { transform: translateY(20px) scale(0.95); }
}

/* ── 头部 ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(3,7,18,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-logo a {
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--primary);
  background: var(--primary-dim);
}
.theme-btn, .menu-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-left: auto;
}
.theme-btn:hover, .menu-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── 移动端导航 ── */
.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
}
.mobile-nav.open { display: flex; }
.mobile-nav .nav-link { padding: 10px 12px; }

/* ── 主容器 ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Hero ── */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 120px 24px 100px;
}
.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--primary);
  background: var(--primary-dim);
  border: 1px solid rgba(0,245,255,0.2);
  border-radius: 100px;
  padding: 4px 16px;
  margin-bottom: 28px;
  letter-spacing: 0.05em;
}
.hero-title {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}
.gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 40px;
}
.hero-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #030712;
  box-shadow: 0 4px 20px rgba(0,245,255,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,245,255,0.4);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

/* ── 内容区 ── */
.content {
  position: relative;
  z-index: 1;
  padding-bottom: 100px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  border-radius: 2px;
  margin-right: 10px;
  vertical-align: middle;
}

/* ── 文章网格 ── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.post-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.post-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent 30%, var(--primary) 50%, var(--secondary) 70%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
}
.post-card:hover::before { opacity: 1; }
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--glow), var(--shadow);
  border-color: rgba(0,245,255,0.2);
}
.post-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.post-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.post-card:hover .post-thumb { transform: scale(1.06); }
.post-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface2), var(--surface));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--border);
}
.post-cat {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #030712;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
}
.post-body { padding: 20px 22px 22px; }
.post-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-excerpt {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}
.post-meta {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── 单文章页 ── */
.single-post {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 100px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 32px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--primary); }
.post-header { margin-bottom: 32px; }
.post-header-cat {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #030712;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.post-header-title {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.post-header-meta {
  display: flex;
  gap: 18px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.post-cover {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 36px;
}
.article-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
}
.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2em 0 0.8em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}
.article-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.6em 0 0.6em;
}
.article-content p { margin-bottom: 1.2em; }
.article-content a { color: var(--primary); text-decoration: none; }
.article-content a:hover { text-decoration: underline; }
.article-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 1.5em 0;
}
.article-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.88rem;
}
.article-content code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.88em;
}
.article-content pre code {
  background: none;
  border: none;
  padding: 0;
}
.article-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 20px;
  margin: 1.5em 0;
  background: var(--primary-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-content ul, .article-content ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}
.article-content li { margin-bottom: 0.4em; }

/* ── 分页 ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 60px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}
.pagination .current {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #030712;
  border-color: transparent;
  font-weight: 700;
}

/* ── 页脚 ── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.footer-brand-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.footer-wechat {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.footer-col-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom a { color: var(--text-muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--primary); }

/* ── 响应式 ── */
@media (max-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .main-nav .nav-link:not(:first-child) { display: none; }
  .menu-btn { display: flex !important; }
  .hero { padding: 80px 16px 60px; }
  .hero-title { font-size: 2.2rem; }
  .posts-grid { grid-template-columns: 1fr; gap: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .single-post { padding: 32px 16px 60px; }
  .post-header-title { font-size: 1.6rem; }
  .article-content { font-size: 1rem; }
  .article-content h2 { font-size: 1.3rem; }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 16px; gap: 12px; }
  .site-logo a { font-size: 1.1rem; }
  .btn { padding: 10px 20px; font-size: 0.9rem; }
  .pagination a, .pagination span { min-width: 36px; height: 36px; font-size: 0.85rem; }
}

/* ── 浅色模式覆盖 ── */
[data-theme="light"] {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #e8eef4;
  --border: rgba(0,0,0,0.1);
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #0891b2;
  --primary-dim: rgba(8,145,178,0.1);
  --secondary: #7c3aed;
  --accent: #db2777;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --glow: 0 4px 16px rgba(8,145,178,0.2);
}
[data-theme="light"] .bg-anim { opacity: 0.6; }
[data-theme="light"] .site-header {
  background: rgba(255,255,255,0.85);
  border-bottom-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .nav-link { color: #64748b; }
[data-theme="light"] .nav-link:hover { color: var(--primary); background: var(--primary-dim); }
[data-theme="light"] .hero-badge {
  color: var(--primary);
  background: var(--primary-dim);
  border-color: rgba(8,145,178,0.2);
}

/* ── 置顶标签 ── */
[data-theme] .post-cat:only-child { display: none; }

/* ── 置顶标签 ── */
.post-sticky {
  position: absolute !important;
  top: 12px !important;
  left: auto !important;
  right: 12px !important;
  bottom: auto !important;
  background: linear-gradient(135deg, #f472b6, #a855f7) !important;
  color: #fff !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 3px 10px !important;
  border-radius: 100px !important;
  z-index: 2;
}
