/* ============================================
   主题变量层 — 三套可选主题
   切换方式：<html data-theme="minimal | tech | fresh">
   ============================================ */

/* ---------- 主题一：简约专业 ---------- */
:root,
[data-theme="minimal"] {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-elevated: #ffffff;
  --text: #1a1d21;
  --text-soft: #5a6169;
  --text-muted: #8b939c;
  --border: #e4e7eb;
  --border-soft: #eef1f4;
  --accent: #2f5fd0;
  --accent-soft: #eaf0fc;
  --accent-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);
  --radius: 10px;
  --radius-sm: 6px;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Songti SC", "SimSun", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --line-height: 1.75;
  --max-width: 760px;
  --hero-gradient: none;
}

/* ---------- 主题二：现代科技感 ---------- */
[data-theme="tech"] {
  --bg: #0d1117;
  --bg-soft: #131a23;
  --bg-elevated: #161d27;
  --text: #e8edf3;
  --text-soft: #a5b1c0;
  --text-muted: #6e7c8c;
  --border: #253040;
  --border-soft: #1c242f;
  --accent: #4d9fff;
  --accent-soft: rgba(77, 159, 255, 0.12);
  --accent-text: #0d1117;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, sans-serif;
  --font-serif: Georgia, "Songti SC", serif;
  --font-mono: "SFMono-Regular", Consolas, Menlo, monospace;
  --line-height: 1.8;
  --max-width: 760px;
  --hero-gradient: radial-gradient(
    ellipse 80% 60% at 50% -10%,
    rgba(77, 159, 255, 0.18),
    transparent 70%
  );
}

/* ---------- 主题三：清新自然 ---------- */
[data-theme="fresh"] {
  --bg: #fdfcf9;
  --bg-soft: #f4f1ea;
  --bg-elevated: #ffffff;
  --text: #2c3330;
  --text-soft: #5c6660;
  --text-muted: #8d968f;
  --border: #e2ded4;
  --border-soft: #ece8df;
  --accent: #4a7c59;
  --accent-soft: #e8f0ea;
  --accent-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(44, 51, 48, 0.05);
  --shadow-md: 0 4px 16px rgba(44, 51, 48, 0.08);
  --shadow-lg: 0 12px 34px rgba(44, 51, 48, 0.10);
  --radius: 14px;
  --radius-sm: 9px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, sans-serif;
  --font-serif: "Songti SC", Georgia, "SimSun", serif;
  --font-mono: "SFMono-Regular", Consolas, Menlo, monospace;
  --line-height: 1.9;
  --max-width: 720px;
  --hero-gradient: linear-gradient(180deg, #eef4ee 0%, transparent 100%);
}

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

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

a:hover {
  opacity: 0.78;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ============================================
   布局容器
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
   顶部导航
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  opacity: 1;
  color: var(--accent);
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.nav a {
  color: var(--text-soft);
  font-size: 14.5px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
  opacity: 1;
}

.nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 550;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
}

.theme-switch button {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 0.15s ease;
  outline: none;
}

.theme-switch button:hover {
  transform: scale(1.12);
}

.theme-switch button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent);
}

.theme-switch button[data-set-theme="minimal"] {
  background: linear-gradient(135deg, #ffffff 50%, #2f5fd0 50%);
}

.theme-switch button[data-set-theme="tech"] {
  background: linear-gradient(135deg, #0d1117 50%, #4d9fff 50%);
}

.theme-switch button[data-set-theme="fresh"] {
  background: linear-gradient(135deg, #fdfcf9 50%, #4a7c59 50%);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Hero 区
   ============================================ */
.hero {
  position: relative;
  padding: 84px 0 56px;
  background-image: var(--hero-gradient);
  overflow: hidden;
}

/* 顶部装饰光晕（仅科技主题可见） */
[data-theme="tech"] .hero::before {
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 360px;
  background: radial-gradient(
    ellipse at center,
    rgba(77, 159, 255, 0.16),
    transparent 68%
  );
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero .eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  color: var(--text-soft);
  font-size: 17px;
  max-width: 54ch;
  line-height: 1.7;
}

.hero .hero-stats {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.hero .hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero .hero-stat .num {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero .hero-stat .lbl {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ============================================
   区块标题
   ============================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section-head .count {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================
   文章列表
   ============================================ */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-item {
  position: relative;
  display: block;
  padding: 22px 24px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.18s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
  overflow: hidden;
}

/* 左侧强调条：hover 时从左侧划出 */
.post-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.22s ease;
}

.post-item:hover::before {
  transform: scaleY(1);
}

.post-item:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  opacity: 1;
}

.post-item h3 {
  margin: 0 0 9px;
  font-size: 18px;
  font-weight: 640;
  line-height: 1.45;
  color: var(--text);
  letter-spacing: -0.015em;
  transition: color 0.15s ease;
}

.post-item:hover h3 {
  color: var(--accent);
}

.post-item .excerpt {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.72;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.post-meta time {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.post-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
}

/* 阅读时长徽标 */
.read-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   标签
   ============================================ */
.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  line-height: 1.65;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tag-filter button {
  padding: 5px 13px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.tag-filter button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-filter button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 550;
}

/* ============================================
   文章详情
   ============================================ */
.article {
  padding: 52px 0 80px;
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border-soft);
}

.article-header h1 {
  margin: 0 0 16px;
  font-size: clamp(25px, 4vw, 34px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.article-header .post-meta {
  font-size: 13.5px;
}

.article-body {
  font-size: 16.5px;
  line-height: var(--line-height);
  color: var(--text);
}

.article-body h2 {
  margin: 2.1em 0 0.75em;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.015em;
  padding-left: 13px;
  border-left: 3px solid var(--accent);
  line-height: 1.45;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body h3 {
  margin: 1.7em 0 0.6em;
  font-size: 17.5px;
  font-weight: 640;
  letter-spacing: -0.01em;
  color: var(--text);
}

.article-body p {
  margin: 0 0 1.15em;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.3em;
  padding-left: 1.4em;
}

.article-body li {
  margin-bottom: 0.5em;
}

.article-body li::marker {
  color: var(--text-muted);
}

.article-body strong {
  font-weight: 650;
  color: var(--text);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  padding: 1.5px 6px;
  border-radius: 5px;
}

/* 正文图片 */
.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.7em auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.article-body img + em,
.article-body img + p em:only-child {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -1.1em;
  margin-bottom: 1.6em;
  font-style: normal;
}

.article-body blockquote {
  margin: 1.5em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--border);
  color: var(--text-soft);
}

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

.article-footer {
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.back-link {
  font-size: 14px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

/* 上下篇导航 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 40px;
}

.post-nav a {
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  display: block;
}

.post-nav a:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  opacity: 1;
}

.post-nav .label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.post-nav .title {
  font-size: 14.5px;
  font-weight: 580;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.post-nav .next {
  text-align: right;
}

.post-nav .placeholder {
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius);
  background: transparent;
  opacity: 0.45;
}

/* ============================================
   归档时间线
   ============================================ */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-group {
  margin-bottom: 34px;
}

.timeline-year {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 11px 0;
  align-items: baseline;
  border-bottom: 1px solid var(--border-soft);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 46px;
}

.timeline-item a {
  color: var(--text);
  font-size: 15.5px;
  font-weight: 520;
  line-height: 1.55;
}

.timeline-item a:hover {
  color: var(--accent);
  opacity: 1;
}

/* ============================================
   关于页
   ============================================ */
.about-section {
  padding: 52px 0 80px;
}

.about-section h1 {
  margin: 0 0 28px;
  font-size: clamp(25px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.about-body {
  font-size: 16.5px;
  line-height: var(--line-height);
}

.about-body h2 {
  margin: 2em 0 0.7em;
  font-size: 19px;
  font-weight: 650;
  padding-left: 13px;
  border-left: 3px solid var(--accent);
}

.about-body p {
  margin: 0 0 1.1em;
  color: var(--text-soft);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.info-card {
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.info-card .k {
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

.info-card .v {
  font-size: 15px;
  font-weight: 570;
  color: var(--text);
  line-height: 1.5;
}

/* ============================================
   空状态 / 404
   ============================================ */
.empty-state {
  text-align: center;
  padding: 90px 20px;
}

.empty-state .code {
  font-family: var(--font-mono);
  font-size: 60px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.28;
  line-height: 1;
  margin-bottom: 18px;
  letter-spacing: -0.04em;
}

.empty-state h1 {
  margin: 0 0 12px;
  font-size: 23px;
  font-weight: 650;
}

.empty-state p {
  margin: 0 auto 26px;
  color: var(--text-soft);
  max-width: 40ch;
  font-size: 15px;
}

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14.5px;
  font-weight: 560;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ============================================
   页脚
   ============================================ */
.site-footer {
  margin-top: 60px;
  padding: 30px 0 38px;
  border-top: 1px solid var(--border-soft);
  font-size: 13.5px;
  color: var(--text-muted);
}

.site-footer .inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-soft);
}

.site-footer .footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

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

.fade-up {
  animation: fadeUp 0.4s ease both;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 720px) {
  .container,
  .container-wide {
    padding: 0 18px;
  }

  .hero {
    padding: 48px 0 36px;
  }

  .nav {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 18px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 11px 12px;
  }

  .menu-toggle {
    display: flex;
  }

  .site-header .inner {
    position: relative;
  }

  .post-item {
    padding: 17px 18px;
  }

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

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

  .timeline-item {
    gap: 12px;
  }

  .article {
    padding: 36px 0 60px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印 */
@media print {
  .site-header,
  .site-footer,
  .theme-switch,
  .menu-toggle,
  .post-nav,
  .back-link {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
}
