/* ==========================================================================
   祲川 · 极简主义设计系统 (Refined Minimalist Two-Column Layout)
   ========================================================================== */

:root {
  --bg: #fbfbfb;
  --bg-sidebar: #f7f7f8;
  --bg-card: #ffffff;
  --bg-subtle: #f0f1f3;
  --border: rgba(0, 0, 0, 0.07);
  --border-subtle: rgba(0, 0, 0, 0.035);
  --text: #111827;
  --text-muted: #4b5563;
  --text-dim: #9ca3af;
  --accent: #2563eb;
  --accent-light: rgba(37, 99, 235, 0.08);
  --accent-hover: #1d4ed8;
  --item-hover: rgba(0, 0, 0, 0.035);
  --code-bg: #f3f4f6;
  --code-text: #111827;
  --sidebar-width: 270px;
  --content-max-width: 820px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

html.dark {
  --bg: #121214;
  --bg-sidebar: #161619;
  --bg-card: #1a1a1e;
  --bg-subtle: #222227;
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent: #3b82f6;
  --accent-light: rgba(59, 130, 246, 0.12);
  --accent-hover: #60a5fa;
  --item-hover: rgba(255, 255, 255, 0.045);
  --code-bg: #1e1e24;
  --code-text: #f3f4f6;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
  background-color: var(--accent);
  color: #ffffff;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* ==========================================================================
   侧边栏导航 (Sidebar Navigation)
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 32px 24px 24px;
  flex-shrink: 0;
  z-index: 50;
  transition: transform 0.25s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  transition: transform 0.2s ease;
}

.sidebar-brand:hover .brand-avatar {
  transform: scale(1.05);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.brand-bio {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* 侧边栏导航链接 */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 12px 0 6px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.nav-item:hover {
  color: var(--text);
  background-color: var(--item-hover);
}

.nav-item.active {
  color: var(--accent);
  background-color: var(--accent-light);
  font-weight: 600;
}

.nav-item svg {
  opacity: 0.75;
  flex-shrink: 0;
}

.nav-item.active svg {
  opacity: 1;
}

/* 侧边栏底部操作 */
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.rss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.rss-btn:hover {
  color: var(--accent);
}

/* 移动端菜单开关 */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  width: 100%;
  height: 56px;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  backdrop-filter: blur(10px);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.mobile-brand img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.menu-toggle-btn {
  padding: 6px;
  color: var(--text);
}

/* ==========================================================================
   主内容区 (Main Content Area)
   ========================================================================== */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-content {
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 48px 36px 80px;
  flex: 1;
}

/* Hero 标题 */
.page-hero {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 8px;
}

.page-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 标签筛选 & 搜索栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
}

.tags-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-btn {
  padding: 5px 12px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  transition: all 0.15s ease;
}

.tag-btn:hover {
  color: var(--text);
  background-color: var(--item-hover);
}

.tag-btn.active {
  color: #ffffff;
  background-color: var(--text);
  font-weight: 500;
}

html.dark .tag-btn.active {
  color: #000000;
  background-color: var(--text);
}

.search-box {
  position: relative;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

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

/* ==========================================================================
   文章列表卡片 (Clean Minimalist Post Cards)
   ========================================================================== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  display: block;
  padding: 22px 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.post-tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: var(--accent-light);
  color: var(--accent);
}

.post-card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
  transition: color 0.15s ease;
}

.post-card:hover .post-card-title {
  color: var(--accent);
}

.post-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.post-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ==========================================================================
   文章详情页排版 (Article Typography)
   ========================================================================== */
.article-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.article-title {
  font-size: 30px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 14px;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.article-body {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  word-break: break-word;
}

.article-body p {
  margin-bottom: 22px;
}

.article-body h1, .article-body h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 44px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.article-body h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 30px 0 12px;
  color: var(--text);
}

.article-body ul, .article-body ol {
  margin: 0 0 22px 24px;
  color: var(--text-muted);
}

.article-body li {
  margin-bottom: 8px;
}

.article-body blockquote {
  margin: 26px 0;
  padding: 14px 18px;
  background-color: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

.article-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--code-bg);
  color: var(--accent);
  border: 1px solid var(--border-subtle);
}

.article-body pre {
  position: relative;
  background-color: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin: 26px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--code-text);
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 14px;
}

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

.article-body th {
  background: var(--bg-subtle);
  font-weight: 600;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 36px 0;
}

/* 阅读进度条 */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  background: var(--accent);
  width: 0%;
  z-index: 100;
  transition: width 0.1s ease;
}

/* 轻量 Toast */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 16px;
  background-color: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

.toast-notice.show {
  opacity: 1;
  transform: translateY(0);
}

/* 单壳单页动态视图插槽与平滑微动效 */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeInView 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 状态提示与空状态 */
.loading-state, .empty-box {
  padding: 60px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* 文章底部互动与分享 */
.article-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.article-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.action-btn.liked {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background-color: rgba(239, 68, 68, 0.06);
}

.view-count-btn {
  cursor: default;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

/* 时间线归档 */
.timeline-block {
  margin-top: 24px;
}

.timeline-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.timeline-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.timeline-row:hover {
  background-color: var(--item-hover);
}

.timeline-date {
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.timeline-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  transition: color 0.15s ease;
}

.timeline-row:hover .timeline-title {
  color: var(--accent);
}

/* 响应式适配 */
@media (max-width: 860px) {
  body {
    flex-direction: column;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-header {
    display: flex;
  }
  .main-content {
    padding: 24px 20px 60px;
  }
}
