/* === Reset / 盒模型基线 === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; border: none; outline: none; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }

/* === 排版基线 === */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* === 语义变量 :root === */
:root {
  --canvas: #f0efec;
  --surface: rgba(255,255,255,0.72);
  --surface-elevated: #ffffff;
  --surface-hover: rgba(107,124,138,0.08);
  --brand: #6b7c8a;
  --brand-soft: rgba(107,124,138,0.12);
  --accent: #6b7c8a;
  --text-primary: #26252a;
  --text-secondary: #78787d;
  --text-tertiary: #a5a5aa;
  --border: rgba(0,0,0,0.04);
  --max: 1120px;
  --gutter: 24px;
  --nav-height: 58px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --transition: 240ms cubic-bezier(0.33, 1, 0.68, 1);
}

/* === 自定义滚动条 === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.14); }
* { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.08) transparent; }

/* === 导航 === */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  display: flex; align-items: center;
  padding: 0 var(--gutter);
  background: rgba(240,239,236,0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-inner {
  display: flex; align-items: center;
  width: 100%; max-width: var(--max); margin: 0 auto;
  gap: 32px;
}
.nav-logo {
  font-size: 16px; font-weight: 600;
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text-primary);
}
.nav-logo-icon {
  width: 26px; height: 26px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff;
}
.nav-links {
  display: flex; gap: 24px;
}
.nav-link {
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
}
.nav-link.active { color: var(--text-primary); }
.nav-link.active::after {
  content: ''; position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 2px; background: var(--brand); border-radius: 1px;
}
.nav-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.nav-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-icon-btn svg { width: 20px; height: 20px; }

@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { color: var(--text-primary); }
  .nav-icon-btn:hover { color: var(--text-primary); background: rgba(0,0,0,0.04); }
}

/* === 主体布局 === */
.main {
  padding-top: var(--nav-height);
  min-height: 100vh;
}
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 64px;
}

/* === 首页双栏 === */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  padding-top: 36px;
  align-items: start;
}
.blog-main { min-width: 0; }

/* === 精选文章 (Hero 替代) === */
.featured-post {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 40px;
  background: var(--surface);
  transition: all var(--transition);
  cursor: pointer;
}
.featured-post:hover { box-shadow: var(--shadow-md); }
.featured-post-img {
  width: 100%; aspect-ratio: 2.2 / 1;
  object-fit: cover;
  background: var(--surface);
  transition: transform var(--transition);
}
.featured-post:hover .featured-post-img { transform: scale(1.02); }
.featured-post-body {
  padding: 24px;
}
.featured-post-tag {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  color: var(--brand);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.featured-post-title {
  font-size: 20px; font-weight: 700;
  line-height: 1.3; margin-bottom: 8px;
  color: var(--text-primary);
}
.featured-post-excerpt {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}
.featured-post-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--text-tertiary);
}

@media (hover: hover) and (pointer: fine) {
  .featured-post:hover { box-shadow: var(--shadow-md); }
  .featured-post:hover .featured-post-img { transform: scale(1.02); }
}

/* === 文章流 === */
.post-stream-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
  letter-spacing: 0.3px;
}
.post-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  padding: 20px 0;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
}
.post-item:hover {
  background: var(--surface-hover);
  padding-left: 12px;
  padding-right: 12px;
  margin-left: -12px;
  margin-right: -12px;
}
.post-item-img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.post-item-img {
  width: 100%; aspect-ratio: 1.5 / 1;
  object-fit: cover;
  transition: transform var(--transition);
}
.post-item:hover .post-item-img { transform: scale(1.04); }
.post-item-info { min-width: 0; padding-top: 2px; }
.post-item-tag {
  font-size: 10px; font-weight: 600;
  color: var(--brand);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 6px;
}
.post-item-title {
  font-size: 16px; font-weight: 600;
  line-height: 1.35; margin-bottom: 6px;
  color: var(--text-primary);
}
.post-item-excerpt {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-item-meta {
  display: flex; align-items: center; gap: 14px;
  font-size: 11px; color: var(--text-tertiary);
}

@media (hover: hover) and (pointer: fine) {
  .post-item:hover { background: var(--surface-hover); }
  .post-item:hover .post-item-img { transform: scale(1.04); }
}

/* === 侧栏 === */
.sidebar {
  position: sticky; top: calc(var(--nav-height) + 24px);
  display: flex; flex-direction: column; gap: 24px;
}
.sidebar-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 20px;
}
.sidebar-card-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

/* 作者卡片 */
.author-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  background: var(--surface);
}
.author-name {
  font-size: 15px; font-weight: 600;
  margin-bottom: 4px;
}
.author-desc {
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}
.author-social {
  display: flex; gap: 10px;
}
.author-social a {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--transition);
}
.author-social a:hover { color: var(--brand); background: var(--brand-soft); }
.author-social svg { width: 16px; height: 16px; }

/* 分类列表 */
.category-list { display: flex; flex-direction: column; gap: 2px; }
.category-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--transition);
  cursor: pointer;
}
.category-item:hover { color: var(--text-primary); }
.category-count {
  font-size: 11px; color: var(--text-tertiary);
  background: rgba(0,0,0,0.04);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

@media (hover: hover) and (pointer: fine) {
  .category-item:hover { color: var(--text-primary); }
}

/* 标签云 */
.tag-cloud {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  background: rgba(0,0,0,0.04);
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}
.tag:hover { background: var(--brand-soft); color: var(--brand); }

@media (hover: hover) and (pointer: fine) {
  .tag:hover { background: var(--brand-soft); color: var(--brand); }
}

/* 归档链接 */
.archive-link {
  display: block;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.archive-link:hover { color: var(--text-primary); }

@media (hover: hover) and (pointer: fine) {
  .archive-link:hover { color: var(--text-primary); }
}

/* === 文章详情页 === */
.post-detail {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 0;
}
.post-detail-header {
  margin-bottom: 32px;
}
.post-detail-tag {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  color: var(--brand);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 10px;
}
.post-detail-title {
  font-size: 20px; font-weight: 700;
  line-height: 1.3; margin-bottom: 12px;
}
.post-detail-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--text-tertiary);
  margin-bottom: 24px;
}
.post-detail-cover {
  width: 100%; aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 32px;
  background: var(--surface);
}
.post-detail-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
}
.post-detail-content p {
  margin-bottom: 20px;
}
.post-detail-content h2 {
  font-size: 18px; font-weight: 700;
  margin-top: 36px; margin-bottom: 12px;
}
.post-detail-content h3 {
  font-size: 16px; font-weight: 600;
  margin-top: 28px; margin-bottom: 10px;
}
.post-detail-content blockquote {
  border-left: none;
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-style: italic;
  color: var(--text-secondary);
}
.post-detail-content blockquote p { margin-bottom: 0; }
.post-detail-content ul, .post-detail-content ol {
  margin-bottom: 20px;
  padding-left: 20px;
}
.post-detail-content li {
  margin-bottom: 8px;
}
.post-detail-content img {
  width: 100%;
  border-radius: var(--radius-sm);
  margin: 24px 0;
  background: var(--surface);
}
.post-detail-content a {
  color: var(--brand);
  box-shadow: inset 0 -1px 0 var(--brand-soft);
  transition: box-shadow var(--transition);
}
.post-detail-content a:hover { box-shadow: inset 0 -2px 0 var(--brand); }

@media (hover: hover) and (pointer: fine) {
  .post-detail-content a:hover { box-shadow: inset 0 -2px 0 var(--brand); }
}

/* 文章底部 */
.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.post-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.post-tags .tag { font-size: 11px; }
.post-share {
  display: flex; gap: 8px;
}
.post-share-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--transition);
}
.post-share-btn:hover { color: var(--brand); background: var(--brand-soft); }
.post-share-btn svg { width: 16px; height: 16px; }

@media (hover: hover) and (pointer: fine) {
  .post-share-btn:hover { color: var(--brand); background: var(--brand-soft); }
}

/* 上一篇/下一篇 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
  padding-top: 24px;
}
.post-nav-link {
  padding: 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
}
.post-nav-link:hover { background: var(--surface-hover); }
.post-nav-link.next { text-align: right; }
.post-nav-label {
  font-size: 11px; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 4px;
}
.post-nav-title {
  font-size: 14px; font-weight: 500;
  color: var(--text-primary);
}

@media (hover: hover) and (pointer: fine) {
  .post-nav-link:hover { background: var(--surface-hover); }
}

/* === 归档页 === */
.archive-page {
  padding-top: 36px;
}
.archive-header {
  margin-bottom: 36px;
}
.archive-header h1 {
  font-size: 20px; font-weight: 700;
  margin-bottom: 6px;
}
.archive-header p {
  font-size: 14px; color: var(--text-secondary);
}
.archive-filters {
  display: flex; gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 18px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500;
  background: rgba(0,0,0,0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { background: var(--brand-soft); color: var(--brand); }
.filter-btn.active { background: var(--brand); color: #fff; }

@media (hover: hover) and (pointer: fine) {
  .filter-btn:hover { background: var(--brand-soft); color: var(--brand); }
  .filter-btn.active:hover { background: #5a6b79; }
}

.archive-year {
  margin-bottom: 32px;
}
.archive-year-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}
.archive-list {
  display: flex; flex-direction: column; gap: 2px;
}
.archive-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 16px;
  padding: 12px 0;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
}
.archive-item:hover {
  background: var(--surface-hover);
  padding-left: 12px;
  padding-right: 12px;
  margin-left: -12px;
  margin-right: -12px;
}
.archive-item-date {
  font-size: 13px; color: var(--text-tertiary);
  padding-top: 1px;
}
.archive-item-title {
  font-size: 14px; font-weight: 500;
  color: var(--text-primary);
  transition: color var(--transition);
}
.archive-item:hover .archive-item-title { color: var(--brand); }
.archive-item-cat {
  font-size: 11px; color: var(--text-tertiary);
  margin-top: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .archive-item:hover { background: var(--surface-hover); }
  .archive-item:hover .archive-item-title { color: var(--brand); }
}

/* === 关于页 === */
.about-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 0;
}
.about-header {
  text-align: center;
  margin-bottom: 40px;
}
.about-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  background: var(--surface);
}
.about-header h1 {
  font-size: 20px; font-weight: 700;
  margin-bottom: 6px;
}
.about-header p {
  font-size: 14px; color: var(--text-secondary);
}
.about-body {
  font-size: 15px;
  line-height: 1.8;
}
.about-body p {
  margin-bottom: 20px;
  color: var(--text-secondary);
}
.about-section {
  margin-top: 40px;
}
.about-section h2 {
  font-size: 17px; font-weight: 600;
  margin-bottom: 14px;
}
.about-timeline {
  display: flex; flex-direction: column; gap: 20px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
}
.timeline-year {
  font-size: 13px; font-weight: 600;
  color: var(--brand);
}
.timeline-content h3 {
  font-size: 14px; font-weight: 600;
  margin-bottom: 4px;
}
.timeline-content p {
  font-size: 13px; color: var(--text-secondary);
}

/* === 按钮 === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 24px;
  border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand); color: #fff;
}
.btn-primary:hover {
  background: #5a6b79;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(107,124,138,0.25);
}
.btn-secondary {
  background: rgba(0,0,0,0.04); color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: #5a6b79; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(107,124,138,0.25); }
  .btn-secondary:hover { background: rgba(0,0,0,0.08); transform: translateY(-1px); }
}

/* === 页脚 === */
.footer {
  padding: 40px var(--gutter) 28px;
  margin-top: 24px;
  background: var(--surface);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-brand {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
}
.footer-links {
  display: flex; gap: 20px;
}
.footer-link {
  font-size: 12px; color: var(--text-tertiary);
  transition: color var(--transition);
}
.footer-link:hover { color: var(--text-primary); }
.footer-copy {
  font-size: 11px; color: var(--text-tertiary);
}

@media (hover: hover) and (pointer: fine) {
  .footer-link:hover { color: var(--text-primary); }
}

/* === Toast === */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-elevated);
  backdrop-filter: blur(16px);
  padding: 10px 22px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  opacity: 0; transform: translateX(-50%) translateY(12px);
  pointer-events: none;
  transition: all var(--transition);
  white-space: nowrap;
  z-index: 300;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* === 骨架屏 === */
.skeleton {
  background: rgba(0,0,0,0.04);
  border-radius: var(--radius-sm);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* === 响应式 === */
@media (max-width: 1024px) {
  .blog-layout { grid-template-columns: 1fr; gap: 36px; }
  .sidebar { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .sidebar-card { break-inside: avoid; }
  .post-item { grid-template-columns: 160px 1fr; }
}

@media (max-width: 768px) {
  :root { --gutter: 16px; }

  .nav-links { display: none; }

  .blog-layout { padding-top: 24px; }
  .sidebar { grid-template-columns: 1fr; }

  .featured-post-img { aspect-ratio: 1.6 / 1; }
  .featured-post-body { padding: 18px; }
  .featured-post-title { font-size: 18px; }

  .post-item { grid-template-columns: 120px 1fr; gap: 14px; padding: 16px 0; }

  .post-detail { padding: 24px 0; }
  .post-detail-title { font-size: 18px; }
  .post-detail-content { font-size: 14px; }

  .post-nav { grid-template-columns: 1fr; gap: 8px; }

  .archive-item { grid-template-columns: 1fr; gap: 4px; padding: 10px 0; }
  .archive-item-date { font-size: 11px; }

  .about-page { padding: 32px 0; }
  .timeline-item { grid-template-columns: 1fr; gap: 4px; }

  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
}

@media (max-width: 480px) {
  .post-item { grid-template-columns: 1fr; gap: 10px; }
  .post-item-img-wrap { max-width: 100%; }
  .post-item-img { aspect-ratio: 2 / 1; }
  .post-footer { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* === 动效降级 === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
