/* ==========================================================
   三千寒的工作室 —— 站点样式
   配色: 深蓝灰 + 琥珀金, 浅色/深色双主题
   ========================================================== */

:root {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --bg-soft: #f0f2f6;
  --text: #1c2333;
  --text-2: #4a5568;
  --text-3: #7b879c;
  --border: #e3e7ee;
  --border-2: #d3d9e4;
  --accent: #2f6fd0;
  --accent-soft: #e8f0fd;
  --gold: #c8862a;
  --gold-soft: #fdf3e2;
  --code-bg: #f4f6f9;
  --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 8px 24px rgba(20, 30, 50, .05);
  --shadow-lg: 0 4px 12px rgba(20, 30, 50, .08), 0 20px 48px rgba(20, 30, 50, .09);
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", "Courier New", monospace;
}

[data-theme='dark'] {
  --bg: #0d1117;
  --bg-elev: #151b24;
  --bg-soft: #1c2430;
  --text: #e6edf5;
  --text-2: #b3bfce;
  --text-3: #7d8899;
  --border: #232c39;
  --border-2: #2f3a4a;
  --accent: #6ea8ff;
  --accent-soft: #16243a;
  --gold: #e0a94f;
  --gold-soft: #2a2113;
  --code-bg: #11161e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .4), 0 20px 48px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, #000 30%, transparent 75%);
  opacity: .5;
}
[data-theme='dark'] .bg-grid { opacity: .25; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- 头部 ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; font-weight: 600; }
.brand-text em { font-style: normal; font-size: 11px; color: var(--text-3); letter-spacing: 1.2px; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 7px 14px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; transition: all .18s;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 500; }

.theme-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text-2); cursor: pointer;
  transition: all .18s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(12deg); }
.theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun { display: none; }
[data-theme='dark'] .theme-toggle .icon-moon { display: block; }

/* ---------- 布局 ---------- */
.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 32px;
  padding-top: 32px;
  padding-bottom: 64px;
  align-items: start;
}
.content-col { min-width: 0; }
.sidebar { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Hero ---------- */
.hero {
  grid-column: 1 / -1;
  padding: 52px 40px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; right: -60px; top: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-block; margin-bottom: 16px; padding: 5px 13px;
  border: 1px solid var(--border-2); border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2);
  font-size: 12px; letter-spacing: .3px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700; letter-spacing: - .5px;
}
.hero-desc { margin: 0 0 24px; max-width: 640px; color: var(--text-2); font-size: 15.5px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; border: 1px solid transparent;
  transition: all .18s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); box-shadow: 0 6px 18px var(--accent-soft); }
.btn-ghost { border-color: var(--border-2); color: var(--text-2); background: var(--bg-elev); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 区块标题 ---------- */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 600;
}
.section-title span::before {
  content: ''; display: inline-block; width: 3px; height: 15px;
  margin-right: 9px; border-radius: 2px;
  background: var(--accent); vertical-align: -2px;
}
.section-title a { font-size: 13px; font-weight: 400; color: var(--text-3); }
.section-title a:hover { color: var(--accent); text-decoration: none; }

/* ---------- 文章卡片 ---------- */
.post-card {
  padding: 22px 24px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: all .2s;
}
.post-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.post-card.featured {
  border-color: color-mix(in srgb, var(--gold) 45%, var(--border));
  background: linear-gradient(180deg, var(--gold-soft), var(--bg-elev) 60%);
}
.post-card.featured .post-title a { color: var(--gold); }
.post-title { margin: 0 0 8px; font-size: 19px; font-weight: 600; line-height: 1.45; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); }
.post-meta .dot { opacity: .5; }
.post-excerpt { margin: 10px 0 0; color: var(--text-2); font-size: 14.5px; }
.post-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.post-tags a {
  padding: 2px 9px; border-radius: 6px;
  background: var(--bg-soft); color: var(--text-3);
  font-size: 12px; transition: all .16s;
}
.post-tags a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

.empty { padding: 48px; text-align: center; color: var(--text-3); border: 1px dashed var(--border-2); border-radius: var(--radius); }

/* ---------- 侧栏 ---------- */
.widget {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.widget-title {
  margin-bottom: 13px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: .3px;
}
.profile-widget { text-align: center; }
.avatar {
  width: 74px; height: 74px; border-radius: 50%;
  border: 2px solid var(--border-2);
  background: var(--bg-soft);
  object-fit: cover;
}
.profile-name { margin-top: 11px; font-size: 16px; font-weight: 600; }
.profile-sub { font-size: 11px; color: var(--gold); letter-spacing: 1.4px; }
.profile-desc { margin: 11px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.65; text-align: left; }
.social-row { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.social-icon {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-3); transition: all .18s;
}
.social-icon:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

.stats { display: flex; gap: 10px; }
.stat {
  flex: 1; padding: 12px 8px; text-align: center;
  border-radius: var(--radius-sm); background: var(--bg-soft);
}
.stat b { display: block; font-size: 20px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat span { font-size: 12px; color: var(--text-3); }

.recent-list, .cat-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.recent-list li:last-child { border-bottom: 0; }
.recent-list a { color: var(--text); display: block; }
.recent-list a:hover { color: var(--accent); text-decoration: none; }
.recent-list time { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }

.cat-list li { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.cat-list a { color: var(--text-2); }
.cat-list a:hover { color: var(--accent); text-decoration: none; }
.cat-list span { color: var(--text-3); font-size: 12px; font-family: var(--mono); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-soft); color: var(--text-2); font-size: 12px; transition: all .16s;
}
.tag-cloud a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.tag-cloud i { font-style: normal; font-size: 10.5px; color: var(--text-3); }

/* ---------- 文章详情 ---------- */
.post-full {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.post-full-head { padding: 30px 34px 20px; border-bottom: 1px solid var(--border); }
.post-full-head h1 { margin: 0 0 12px; font-size: clamp(24px, 3.6vw, 32px); font-weight: 700; line-height: 1.35; }
.post-content { padding: 30px 34px 36px; font-size: 15.5px; }
.post-content > :first-child { margin-top: 0; }
.post-content h2 { margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 21px; font-weight: 600; }
.post-content h3 { margin: 26px 0 11px; font-size: 17.5px; font-weight: 600; }
.post-content h4 { margin: 20px 0 9px; font-size: 15.5px; font-weight: 600; color: var(--text-2); }
.post-content p { margin: 0 0 16px; }
.post-content ul, .post-content ol { margin: 0 0 16px; padding-left: 24px; }
.post-content li { margin-bottom: 6px; }
.post-content li.task { list-style: none; margin-left: -20px; }
.post-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); display: block; margin: 18px 0; border: 1px solid var(--border); }
.post-content blockquote {
  margin: 18px 0; padding: 12px 18px;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--gold-soft); color: var(--text-2);
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content code {
  padding: 2px 6px; border-radius: 5px;
  background: var(--code-bg); border: 1px solid var(--border);
  font-family: var(--mono); font-size: .875em; color: var(--gold);
}
.post-content pre {
  margin: 18px 0; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--code-bg); overflow-x: auto;
}
.post-content pre code { padding: 0; border: 0; background: none; color: var(--text); font-size: 13px; line-height: 1.7; }
.post-content hr { margin: 30px 0; border: 0; border-top: 1px solid var(--border); }
.post-content table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
.table-wrap { overflow-x: auto; }
.post-content th, .post-content td { padding: 9px 13px; border: 1px solid var(--border); text-align: left; }
.post-content th { background: var(--bg-soft); font-weight: 600; }
.post-content a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.post-content a:hover { text-decoration: none; border-bottom-color: var(--accent); }
.anchor {
  float: left; margin-left: -20px; padding-right: 6px;
  color: var(--text-3); opacity: 0; font-weight: 400; transition: opacity .16s;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }

.post-full-foot { padding: 20px 34px 26px; border-top: 1px solid var(--border); }
.nav-post { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.nav-post a { display: flex; flex-direction: column; gap: 3px; max-width: 46%; color: var(--text); }
.nav-post a:hover { text-decoration: none; }
.nav-post a:hover b { color: var(--accent); }
.nav-post span { font-size: 12px; color: var(--text-3); }
.nav-post b { font-size: 14px; font-weight: 500; }
.nav-next { text-align: right; }

/* ---------- 目录 ---------- */
.toc-widget { max-height: calc(100vh - 120px); overflow-y: auto; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { padding: 3px 0; font-size: 13px; line-height: 1.55; }
.toc-list a { color: var(--text-2); display: block; }
.toc-list a:hover { color: var(--accent); text-decoration: none; }
.toc-l2 { padding-left: 12px !important; }
.toc-l3 { padding-left: 24px !important; font-size: 12.5px; color: var(--text-3); }
.toc-l4 { padding-left: 36px !important; font-size: 12px; color: var(--text-3); }

/* ---------- 归档 / 列表页 ---------- */
.page-title { margin: 0 0 8px; font-size: 28px; font-weight: 700; }
.page-desc { margin: 0 0 24px; color: var(--text-3); font-size: 14px; }
.archive-year { margin-bottom: 28px; }
.year-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 600;
}
.year-title i { font-style: normal; font-size: 12px; color: var(--text-3); font-weight: 400; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; margin-bottom: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  transition: all .16s;
}
.archive-list li:hover { background: var(--bg-elev); border-color: var(--border); }
.archive-list time { flex-shrink: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }
.archive-list a { color: var(--text); font-size: 14.5px; }
.archive-list a:hover { color: var(--accent); text-decoration: none; }
.archive-cat { margin-left: auto; flex-shrink: 0; font-size: 12px; color: var(--text-3); padding: 1px 8px; border-radius: 5px; background: var(--bg-soft); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-elev); padding: 26px 0; }
.footer p { margin: 0 0 6px; text-align: center; font-size: 13px; color: var(--text-3); }
.footer-meta { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px !important; }
.footer-meta a { color: var(--text-3); }
.footer-meta a:hover { color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 940px) {
  .main { grid-template-columns: 1fr; gap: 24px; }
  .sidebar { position: static; }
  .hero { padding: 36px 26px; }
  .post-full-head, .post-content, .post-full-foot { padding-left: 22px; padding-right: 22px; }
  .anchor { display: none; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .header-inner { height: 58px; gap: 8px; }
  .brand { flex-shrink: 0; }
  .brand-mark { width: 34px; height: 34px; font-size: 12px; }
  .brand-text em { display: none; }
  .brand-text strong { font-size: 14px; white-space: nowrap; }
  .nav { gap: 0; flex-shrink: 0; }
  .nav a { padding: 6px 9px; font-size: 13px; white-space: nowrap; }
  .theme-toggle { flex-shrink: 0; width: 34px; height: 34px; }
  .hero { padding: 28px 20px; border-radius: 16px; }
  .post-card { padding: 18px; }
  .post-title { font-size: 17px; }
  .archive-list li { flex-wrap: wrap; gap: 8px; }
  .archive-cat { margin-left: 0; }
  .nav-post a { max-width: 100%; }
  .nav-next { text-align: left; }
}

@media (max-width: 400px) {
  .brand-text { display: none; }
  .nav a { padding: 6px 8px; font-size: 12.5px; }
}
