/* memory-hub 公开博客 — 排版语言参考 Fuwari（MIT）：近扁平圆角卡片 / 灰阶文字层级 / 虚线链接，浅/深色自适应，零外部依赖 */
:root {
  --bg: #f6f6f8;
  --bg-soft: #eeeef1;
  --card: #ffffff;
  --ink: #212227;
  --muted: rgba(38, 38, 48, 0.58);
  --faint: rgba(38, 38, 48, 0.38);
  --line: rgba(38, 38, 48, 0.09);
  --line-strong: rgba(38, 38, 48, 0.16);
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, #0f766e 10%, transparent);
  --accent-line: color-mix(in srgb, #0f766e 35%, transparent);
  --cat-dev: #3b82f6;
  --cat-ai: #8b5cf6;
  --cat-life: #f97316;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 25, 0.02), 0 4px 16px rgba(20, 18, 25, 0.04);
  --shadow-lift: 0 2px 6px rgba(20, 18, 25, 0.05), 0 14px 36px rgba(20, 18, 25, 0.11);
  --serif: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014;
    --bg-soft: #191a20;
    --card: #1b1c23;
    --ink: #eceaf0;
    --muted: rgba(236, 234, 240, 0.56);
    --faint: rgba(236, 234, 240, 0.36);
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #2fbfae;
    --accent-ink: #08211e;
    --accent-soft: color-mix(in srgb, #2fbfae 14%, transparent);
    --accent-line: color-mix(in srgb, #2fbfae 40%, transparent);
    --cat-dev: #6ea8ff;
    --cat-ai: #b795ff;
    --cat-life: #ffa06a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.22);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.25), 0 16px 40px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ===== 顶栏 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 13px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.whoami { color: var(--muted); font-size: 13px; }

/* ===== 按钮 ===== */
.btn {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { box-shadow: var(--shadow-lift); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--bg-soft); }

/* ===== 主区 ===== */
.site-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 36px 28px 76px; }
.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 0;
  font-size: 14px;
  letter-spacing: 0.05em;
}

/* ===== 首页 hero ===== */
.hero { position: relative; padding: 48px 0 32px; }
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -40px;
  width: 380px; height: 380px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  pointer-events: none;
}
.hero .eyebrow {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}
.hero p { color: var(--muted); margin: 0; font-size: 15px; }
.hero .count { margin-top: 18px; color: var(--faint); font-size: 13px; }

/* ===== 分类筛选 ===== */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0 20px; }
.chip {
  font: inherit;
  font-size: 13px;
  padding: 5px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

/* ===== 文章卡片（固定两列，末行孤卡占满整行） ===== */
.post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.post-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px 16px;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: fadeUp 0.35s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.post-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent-line);
}
.post-title {
  font-family: var(--serif);
  font-size: 18.5px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
}
.post-snippet { color: var(--muted); font-size: 13.5px; line-height: 1.75; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .post-meta { margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); }
.cat {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.cat.dev-plan { color: var(--cat-dev); background: color-mix(in srgb, var(--cat-dev) 12%, transparent); }
.cat.ai-tuning { color: var(--cat-ai); background: color-mix(in srgb, var(--cat-ai) 12%, transparent); }
.cat.life { color: var(--cat-life); background: color-mix(in srgb, var(--cat-life) 12%, transparent); }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 32px; }
.page-btn {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.page-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--line-strong); }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-info { font-size: 13px; color: var(--faint); }

/* ===== 详情页 ===== */
.post-layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr) 248px;
  gap: 32px;
  align-items: start;
}
.post-layout.no-toc { grid-template-columns: minmax(0, 1fr) 248px; }
.post-layout.no-aside { grid-template-columns: 176px minmax(0, 1fr); }
.post-layout.no-toc.no-aside { grid-template-columns: minmax(0, 1fr); }
.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 40px 40px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}
.back-link { display: inline-block; margin-bottom: 18px; font-size: 13.5px; color: var(--muted); }
.back-link:hover { color: var(--accent); text-decoration: none; }
.post-head .post-meta { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); }
.post h1.title {
  font-family: var(--serif);
  font-size: clamp(24px, 3.6vw, 32px);
  line-height: 1.45;
  font-weight: 700;
  margin: 0 0 24px;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 16px; }
.super-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.6;
}
.super-banner.warn { background: #fdf3e3; border: 1px solid #eed9b2; color: #7a5b16; }
.super-banner.info { background: #ecf3fe; border: 1px solid #cadcf7; color: #33517c; }
.super-banner a { font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.super-arrow { white-space: nowrap; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .super-banner.warn { background: #3a2f14; border-color: #5c4a1e; color: #e8cf96; }
  .super-banner.info { background: #17263e; border-color: #2c4468; color: #a8c4e8; }
}

/* ===== 目录（左栏） ===== */
.toc-aside {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}
.toc-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-left: 12px;
}
.toc-link {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  padding: 4px 10px 4px 11px;
  border-left: 2px solid var(--line);
  border-radius: 0 8px 8px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.toc-link.lv-h3 { padding-left: 22px; font-size: 12.5px; }
.toc-link:hover { color: var(--ink); text-decoration: none; background: var(--bg-soft); }
.toc-link.on { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.md-body h2, .md-body h3 { scroll-margin-top: 84px; }

/* ===== 相关文章（右栏） ===== */
.post-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
.aside-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; color: var(--faint); text-transform: uppercase; }
.rel-card {
  display: block; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); text-decoration: none; transition: border-color 0.15s ease, transform 0.15s ease;
  box-shadow: var(--shadow);
}
.rel-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.rel-title { font-size: 13.5px; line-height: 1.5; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rel-tags { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 4px; }
.rel-tag { font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }

/* ===== markdown 正文排版 ===== */
.md-body { font-size: 16px; line-height: 1.9; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.45;
  margin: 1.8em 0 0.7em;
}
.md-body h1 { font-size: 25px; }
.md-body h2 { font-size: 21px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.md-body h3 { font-size: 18px; }
.md-body p { margin: 0.95em 0; }
.md-body a {
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: background 0.15s ease;
}
.md-body a:hover { background: var(--accent-soft); text-decoration: none; }
.md-body strong { color: var(--ink); font-weight: 650; }
.md-body blockquote {
  position: relative;
  margin: 1.3em 0;
  padding: 4px 0 4px 20px;
  border: none;
  color: var(--muted);
}
.md-body blockquote::before {
  content: '';
  position: absolute;
  left: 2px; top: 0; bottom: 0;
  width: 4px;
  border-radius: 999px;
  background: var(--accent-line);
}
.md-body ul, .md-body ol { padding-left: 1.6em; }
.md-body li { margin: 0.4em 0; }
.md-body ul li::marker, .md-body ol li::marker { color: var(--accent); }
.md-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 2px 6px;
}
.md-body pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
}
.md-body pre code { background: none; padding: 0; font-size: 13.5px; }
.md-body table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 14px; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.md-body th { background: var(--bg-soft); font-weight: 600; }
.md-body hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.md-body img { max-width: 100%; border-radius: var(--radius-sm); }
.md-body.plain { white-space: pre-wrap; font-family: inherit; }

/* ===== 登录弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 14, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-mask.hidden { display: none; }
.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  width: 100%;
  max-width: 340px;
  padding: 26px 26px 22px;
}
.modal-card h3 { margin: 0 0 14px; font-family: var(--serif); font-size: 19px; }
.modal-card label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; }
.input {
  font: inherit;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}
.input:focus { border-color: var(--accent); }
.login-msg { color: #d05656; font-size: 13px; min-height: 18px; margin-top: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
  padding: 22px 0 26px;
  letter-spacing: 0.04em;
}
.site-footer a { color: var(--faint); margin-left: 14px; }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .post-layout { grid-template-columns: minmax(0, 1fr) 232px; }
  .post-layout.no-aside { grid-template-columns: minmax(0, 1fr); }
  .toc-aside { display: none; }
}
@media (max-width: 900px) {
  .post-layout, .post-layout.no-toc, .post-layout.no-aside { grid-template-columns: minmax(0, 1fr); }
  .post-aside { position: static; border-top: 1px dashed var(--line-strong); padding-top: 18px; }
  .post { padding: 26px 22px 30px; }
}
@media (max-width: 760px) {
  .post-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .site-main { padding: 24px 16px 56px; }
  .hero { padding: 26px 0 10px; }
  .post-card { padding: 18px 20px 14px; }
  .header-inner { padding: 12px 16px; }
  .super-banner { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
