/**
 * style.css - Green 主题样式
 * 绿色毛玻璃风格，轻量级纯 CSS
 */

/* ============================
   CSS 变量
   ============================ */
:root {
  --green-primary: #4aac7e;
  --green-light: #6abf96;
  --green-dim: #a8d5bc;
  --green-pale: #e0f2ea;
  --green-text: #2d7a57;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-card-inner: rgba(255, 255, 255, 0.85);
  --text-main: #2c3e35;
  --text-meta: #7aab90;
  --text-muted: #99b8a8;
  --border: rgba(160, 210, 185, 0.35);
  --shadow: 0 8px 32px rgba(60, 140, 100, 0.10);
}

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

body {
  font-family: 'Noto Sans SC', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 16px;
  background: radial-gradient(
    ellipse at 20% 30%,
    #c8ecd8 0%, #d6f0e4 30%, #e8f5ee 60%, #c5e8d8 100%
  );
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
}

/* 轻微噪点纹理叠加 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

a {
  color: var(--green-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--green-text);
}

.page-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================
   导航栏
   ============================ */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 28px 8px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav-logo:hover {
  color: var(--text-main);
}

.nav-logo .leaf {
  font-size: 20px;
}

.nav-logo .sparkle {
  color: var(--green-primary);
  font-size: 14px;
  margin-left: 2px;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  font-size: 13.5px;
  color: var(--text-muted);
  transition: color 0.2s;
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  color: var(--green-text);
}

.nav-links li.active a {
  color: var(--green-text);
  font-weight: 600;
  position: relative;
}

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

/* 移动端菜单开关 */
.nav-toggle-input {
  display: none;
}

.nav-toggle-label {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* ============================
   主卡片
   ============================ */
.main-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  padding: 28px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
}

/* 文章页/归档页：单栏布局 */
.main-card.post-layout,
.main-card.archive-layout {
  display: block;
}

/* ============================
   侧边栏
   ============================ */
.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.avatar-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a8d8bc 0%, #7cc4a0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(76, 172, 126, 0.25);
  border: 3px solid rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.sidebar-bio {
  font-size: 11.5px;
  color: var(--green-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.sidebar-bio .diamond {
  font-size: 10px;
}

.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.stat-item {
  text-align: center;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  display: block;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.tags-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}

.tag {
  padding: 4px 12px;
  background: var(--green-pale);
  border: 1px solid rgba(74, 172, 126, 0.2);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--green-text);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.tag:hover {
  background: rgba(74, 172, 126, 0.15);
  border-color: var(--green-primary);
  color: var(--green-text);
}

/* ============================
   文章卡片列表
   ============================ */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.article-card {
  background: var(--bg-card-inner);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 20px 22px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  border-left: 3.5px solid var(--green-dim);
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(60, 140, 100, 0.12);
  border-color: var(--green-primary);
}

.article-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.article-meta {
  font-size: 11.5px;
  color: var(--text-meta);
  margin-bottom: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.article-meta .dot {
  opacity: 0.5;
}

.article-excerpt {
  font-size: 13px;
  color: #5a7a6a;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-tip {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

/* ============================
   文章详情页
   ============================ */
.post-content-wrap {
  max-width: 900px;
  margin: 0 auto;
}

.post-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 12px;
}

.post-meta {
  font-size: 13px;
  color: var(--text-meta);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.post-meta a {
  color: var(--text-meta);
}

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

.post-meta .dot {
  opacity: 0.5;
}

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

/* ============================
   文章正文 (Markdown 渲染)
   ============================ */
.post-body {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-main);
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  color: var(--text-main);
  font-weight: 700;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  line-height: 1.35;
}

.post-body h1 { font-size: 1.6em; }
.post-body h2 { font-size: 1.35em; }
.post-body h3 { font-size: 1.15em; }
.post-body h4 { font-size: 1.05em; }

.post-body h2 {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--green-pale);
}

.post-body p {
  margin-bottom: 1em;
}

.post-body a {
  color: var(--green-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body a:hover {
  color: var(--green-text);
}

/* 列表 */
.post-body ul,
.post-body ol {
  padding-left: 1.8em;
  margin-bottom: 1em;
}

.post-body li {
  margin-bottom: 0.3em;
}

.post-body li > ul,
.post-body li > ol {
  margin-bottom: 0;
}

/* 行内代码 */
.post-body code {
  background: var(--green-pale);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--green-text);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* 代码块 - Hexo highlight.js 输出 */
.post-body figure.highlight,
.post-body pre {
  background: #f5faf7;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1.2em;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}

.post-body figure.highlight {
  padding: 0;
}

.post-body figure.highlight pre {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  background: transparent;
}

.post-body pre {
  padding: 16px 20px;
}

.post-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

/* Hexo highlight 表格结构 */
.post-body figure.highlight table {
  width: 100%;
  border: none;
}

.post-body figure.highlight td {
  border: none;
  padding: 0;
}

.post-body figure.highlight .gutter {
  width: 40px;
  padding: 12px 8px 12px 16px;
  text-align: right;
  color: var(--text-muted);
  background: rgba(74, 172, 126, 0.04);
  border-right: 1px solid var(--border);
  user-select: none;
}

.post-body figure.highlight .code {
  padding: 12px 16px;
}

.post-body figure.highlight .gutter pre,
.post-body figure.highlight .code pre {
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
}

/* 引用块 */
.post-body blockquote {
  border-left: 4px solid var(--green-dim);
  padding: 12px 20px;
  margin: 0 0 1.2em 0;
  background: rgba(224, 242, 234, 0.5);
  border-radius: 0 8px 8px 0;
  color: #4a6b5a;
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

/* 图片 */
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 8px 0;
  box-shadow: 0 4px 16px rgba(60, 140, 100, 0.08);
}

/* 表格 */
.post-body > table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.2em;
  font-size: 14px;
}

.post-body > table th,
.post-body > table td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}

.post-body > table th {
  background: var(--green-pale);
  font-weight: 600;
  color: var(--green-text);
}

.post-body > table tr:nth-child(even) td {
  background: rgba(224, 242, 234, 0.3);
}

/* 水平线 */
.post-body hr {
  border: none;
  height: 2px;
  background: var(--green-pale);
  margin: 2em 0;
  border-radius: 2px;
}

/* ============================
   文章导航（上一篇 / 下一篇）
   ============================ */
.post-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  max-width: 48%;
  transition: transform 0.18s, box-shadow 0.18s;
}

.post-nav-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(60, 140, 100, 0.1);
}

.post-nav-item.next {
  margin-left: auto;
  text-align: right;
}

.post-nav-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.post-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--green-text);
  line-height: 1.4;
}

/* ============================
   归档页
   ============================ */
.archive-wrap {
  max-width: 800px;
  margin: 0 auto;
}

.archive-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
}

.archive-year {
  font-size: 18px;
  font-weight: 700;
  color: var(--green-primary);
  margin: 24px 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green-pale);
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.18s;
}

.archive-item:hover {
  background: rgba(74, 172, 126, 0.08);
}

.archive-date {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  width: 48px;
}

.archive-item-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-main);
}

.archive-item:hover .archive-item-title {
  color: var(--green-text);
}

/* ============================
   分页
   ============================ */
.pagination {
  margin-top: 24px;
  text-align: center;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 6px 14px;
  margin: 0 3px;
  font-size: 13px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
}

.pagination a {
  color: var(--green-text);
  background: var(--green-pale);
  border: 1px solid rgba(74, 172, 126, 0.15);
}

.pagination a:hover {
  background: var(--green-primary);
  color: #fff;
}

.pagination span.current {
  background: var(--green-primary);
  color: #fff;
  font-weight: 600;
}

.pagination span.space {
  border: none;
  background: none;
}

/* ============================
   页脚
   ============================ */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

.site-footer a {
  color: var(--green-primary);
}

/* ============================
   返回顶部
   ============================ */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-primary);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 99;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#back-to-top:hover {
  background: var(--green-primary);
  color: #fff;
}

/* ============================
   响应式
   ============================ */
@media (max-width: 768px) {
  body {
    padding: 16px 10px;
  }

  nav {
    padding: 0 4px 20px 4px;
    flex-wrap: wrap;
  }

  .nav-logo {
    font-size: 16px;
  }

  /* 移动端菜单 */
  .nav-toggle-label {
    display: flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    margin-top: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }

  .nav-toggle-input:checked ~ .nav-links {
    display: flex;
  }

  .nav-toggle-input:checked ~ .nav-toggle-label span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle-input:checked ~ .nav-toggle-label span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle-input:checked ~ .nav-toggle-label span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-links li {
    padding: 6px 0;
  }

  .nav-links li.active a::after {
    display: none;
  }

  /* 主卡片堆叠 */
  .main-card {
    grid-template-columns: 1fr;
    padding: 20px 16px;
    border-radius: 18px;
  }

  .sidebar {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }

  .avatar-wrap {
    width: 68px;
    height: 68px;
    font-size: 26px;
  }

  .article-card {
    padding: 16px 18px;
  }

  .post-title {
    font-size: 20px;
  }

  .post-body {
    font-size: 14.5px;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav-item {
    max-width: 100%;
  }

  .post-nav-item.next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .stats-row {
    gap: 16px;
  }

  .article-title {
    font-size: 14.5px;
  }

  .article-excerpt {
    font-size: 12.5px;
    -webkit-line-clamp: 2;
  }
}
