/* =========================================================
   拾光手记 · 个人博客 — 全局样式
   暖纸墨主题 · 支持明/暗切换 · 响应式
   ========================================================= */

:root {
  --bg: #f5f0e7;
  --bg-deco: #efe7d8;
  --surface: #fffdf7;
  --surface-2: #f8f2e6;
  --ink: #34302a;
  --ink-2: #756b5e;
  /* 原来是 #9a8f80：对 --bg(#f5f0e7) 的对比度只有约 2.8:1，
     而它承载的是「共 N 篇」「阅读 12」「版权/备案」这类 12-14px 的辅助正文，
     WCAG AA 要求 ≥4.5:1。提深到 #7d7365 后约 4.6:1，视觉层级仍然清晰。 */
  --ink-3: #7d7365;
  --line: #e5dbc9;
  --accent: #c05a38;
  --accent-ink: #9c4226;
  --accent-soft: rgba(192, 90, 56, 0.1);
  --sage: #5e8264;
  --sage-soft: rgba(94, 130, 100, 0.12);
  --shadow-sm: 0 1px 2px rgba(60, 45, 25, 0.05), 0 4px 14px rgba(60, 45, 25, 0.05);
  --shadow-md: 0 2px 6px rgba(60, 45, 25, 0.07), 0 14px 34px rgba(60, 45, 25, 0.09);
  --radius: 14px;
  --radius-sm: 9px;
  --font-serif: Georgia, "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --header-h: 62px;
}

[data-theme="dark"] {
  --bg: #181512;
  --bg-deco: #201b16;
  --surface: #221e19;
  --surface-2: #2a251f;
  --ink: #ece4d8;
  --ink-2: #b3a796;
  --ink-3: #8a7f70;
  --line: #393228;
  --accent: #e07a54;
  --accent-ink: #ef9a76;
  --accent-soft: rgba(224, 122, 84, 0.14);
  --sage: #8fae8f;
  --sage-soft: rgba(143, 174, 143, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.35), 0 14px 34px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(1100px 500px at 85% -60px, var(--accent-soft), transparent 60%),
    radial-gradient(900px 420px at -10% 8%, var(--sage-soft), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.75;
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.4; margin: 0 0 0.6em; }
p { margin: 0 0 1em; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- 顶部导航 ---------------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-head-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.brand-avatar {
  width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--line); flex: none;
  background: var(--surface-2);
}
.brand-avatar img { width: 100%; height: 100%; object-fit: cover; }
.brand-name {
  font-family: var(--font-serif); font-size: 19px; font-weight: 700;
  letter-spacing: 0.05em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-name:hover { text-decoration: none; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: block; padding: 7px 13px; border-radius: 999px;
  color: var(--ink-2); font-size: 15px; transition: all 0.18s ease; white-space: nowrap;
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  /* 36px 是桌面端的紧凑尺寸，但仍然小于 44×44 的最小触控目标。
     用伪元素把命中区扩大到 44px，视觉尺寸保持不变。 */
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); cursor: pointer; flex: none;
  transition: all 0.18s ease; position: relative;
}
.icon-btn::after { content: ''; position: absolute; inset: -4px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .theme-icon-light, .icon-btn .theme-icon-dark { display: inline-flex; }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline-flex; }

.nav-burger { display: none; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 14.5px;
  font-family: inherit; cursor: pointer; transition: all 0.18s ease; white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff8f1; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
[data-theme="dark"] .btn-primary { color: #2a150d; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: color-mix(in srgb, #c0392b 55%, var(--line)); color: #c0392b; }
.btn-danger:hover { background: rgba(192, 57, 43, 0.08); border-color: #c0392b; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------------- 首页 Hero ---------------- */
.hero { padding: 54px 0 34px; }
.hero-inner {
  display: flex; gap: 42px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 40px 44px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.hero-inner::after {
  content: ""; position: absolute; right: -70px; top: -70px; width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 65%);
  pointer-events: none;
}
.hero-avatar { flex: none; }
.hero-avatar img {
  width: 132px; height: 132px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--surface); outline: 2px solid var(--accent); outline-offset: -1px;
  box-shadow: var(--shadow-sm);
}
.hero-info { flex: 1; min-width: 0; position: relative; }
.hero-title {
  font-size: 34px; margin: 0 0 6px;
  background: linear-gradient(120deg, var(--accent-ink), var(--sage));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="dark"] .hero-title {
  background: linear-gradient(120deg, var(--accent), #9ec0a0);
  -webkit-background-clip: text; background-clip: text;
}
.hero-slogan { font-size: 16.5px; color: var(--sage); font-weight: 600; margin-bottom: 10px; font-family: var(--font-serif); }
.hero-bio { color: var(--ink-2); white-space: pre-line; font-size: 15.5px; margin-bottom: 16px; max-width: 62ch; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--ink-3); font-size: 13.5px; margin-bottom: 16px; }
.hero-meta a { color: var(--ink-3); }
.hero-meta a:hover { color: var(--accent-ink); }
.hero-counts { display: flex; gap: 24px; margin-bottom: 18px; }
.hero-counts b { font-family: var(--font-serif); font-size: 22px; display: block; color: var(--ink); }
.hero-counts span { font-size: 13px; color: var(--ink-3); }

/* ---------------- 区块标题 ---------------- */
.section { padding: 26px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
.section-title {
  font-size: 24px; margin: 0; display: flex; align-items: center; gap: 12px;
}
.section-title::before {
  content: ""; width: 6px; height: 24px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--sage)); flex: none;
}
.section-more { font-size: 14px; color: var(--ink-3); }
.section-more:hover { color: var(--accent-ink); }

/* ---------------- 文章卡片 ---------------- */
.article-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-cover { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card:hover .card-cover img { transform: scale(1.05); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-cat {
  display: inline-flex; width: fit-content; font-size: 12.5px; padding: 2px 11px;
  border-radius: 999px; color: var(--sage); background: var(--sage-soft);
  font-weight: 600; letter-spacing: 0.03em;
}
.card-cat:hover { text-decoration: none; filter: brightness(1.06); }
.card-title { font-size: 19px; margin: 0; line-height: 1.45; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent-ink); text-decoration: none; }
.card-excerpt {
  color: var(--ink-2); font-size: 14.5px; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; color: var(--ink-3); font-size: 13px;
}
.tag {
  font-size: 12.5px; color: var(--ink-3); background: var(--surface-2);
  border-radius: 999px; padding: 2px 10px; border: 1px solid transparent;
}
.tag:hover { color: var(--accent-ink); border-color: var(--accent); text-decoration: none; }
.card-cover-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 42px; color: var(--ink-3);
  background: linear-gradient(135deg, var(--surface-2), var(--bg-deco));
}

/* ---------------- 分类药丸条 ---------------- */
.cat-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 14.5px;
  transition: all 0.18s ease;
}
.cat-pill b { color: var(--accent); font-family: var(--font-serif); font-size: 15px; }
.cat-pill:hover { border-color: var(--sage); color: var(--sage); text-decoration: none; transform: translateY(-1px); }

/* ---------------- 相册 ---------------- */
.photo-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.photo-item {
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  aspect-ratio: 4 / 3; border: 1px solid var(--line);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s ease; }
.photo-item:hover img { transform: scale(1.07); }
.photo-item .photo-cap {
  position: absolute; inset: auto 0 0 0; padding: 22px 12px 10px;
  background: linear-gradient(transparent, rgba(24, 18, 12, 0.72));
  color: #f7efe4; font-size: 13px; opacity: 0; transition: opacity 0.25s ease;
  font-family: var(--font-serif); letter-spacing: 0.05em;
}
.photo-item:hover .photo-cap { opacity: 1; }

/* ---------------- 搜索 / 工具条 ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 20px 0 8px; }
.search-box {
  position: relative; flex: 1; min-width: 220px; max-width: 340px;
}
.search-box input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14.5px; outline: none; transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 6px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 14px;
  transition: all 0.16s ease;
}
.pill:hover { color: var(--accent-ink); border-color: var(--accent); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff8f1; }
[data-theme="dark"] .pill.active { color: #2a150d; }
.result-info { color: var(--ink-3); font-size: 13.5px; margin: 14px 2px; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 34px 0 10px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer; font-size: 14.5px; transition: all 0.16s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.page-btn.current { background: var(--accent); border-color: var(--accent); color: #fff8f1; cursor: default; }
[data-theme="dark"] .page-btn.current { color: #2a150d; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { color: var(--ink-3); padding: 0 4px; }

/* ---------------- 文章详情 ---------------- */
.post-page { padding: 30px 0 60px; }
.post-shell { max-width: 860px; margin: 0 auto; }
.post-head { margin-bottom: 26px; text-align: center; }
.post-cat-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.post-title { font-size: clamp(26px, 4.6vw, 38px); margin: 0 0 10px; }
.post-meta {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px;
  color: var(--ink-3); font-size: 13.5px;
}
.post-meta .sep { opacity: 0.6; }
.post-cover {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  margin-bottom: 26px; box-shadow: var(--shadow-sm);
}
.post-cover img { width: 100%; max-height: 520px; object-fit: cover; }
.post-body {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(22px, 4.5vw, 46px); box-shadow: var(--shadow-sm);
}

/* Markdown 正文排版 */
.md-body { font-size: 16.5px; }
.md-body > :last-child { margin-bottom: 0; }
.md-body h2 {
  font-size: 24px; margin: 1.6em 0 0.7em; padding-left: 14px; position: relative;
}
.md-body h2::before {
  content: ""; position: absolute; left: 0; top: 0.14em; bottom: 0.14em; width: 4px;
  border-radius: 3px; background: linear-gradient(180deg, var(--accent), var(--sage));
}
.md-body h3 { font-size: 20px; margin: 1.5em 0 0.6em; }
.md-body p { margin-bottom: 1.1em; }
.md-body a { text-decoration: underline; text-underline-offset: 3px; }
.md-body img { border-radius: 12px; margin: 1.3em auto; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.md-body ul, .md-body ol { padding-left: 1.5em; margin: 0 0 1.1em; }
.md-body li { margin-bottom: 0.35em; }
.md-body blockquote {
  margin: 1.3em 0; padding: 12px 20px; border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--ink-2);
  font-family: var(--font-serif); font-style: italic;
}
.md-body code {
  font-family: var(--mono); font-size: 0.88em; background: var(--surface-2);
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line);
}
.md-body pre {
  background: #26221d; color: #eee6da; padding: 18px 20px; border-radius: 12px;
  overflow-x: auto; line-height: 1.6; margin: 1.3em 0; border: 1px solid #3a342c;
}
[data-theme="dark"] .md-body pre { background: #17140f; border-color: #322c23; }
.md-body pre code { background: transparent; border: 0; padding: 0; color: inherit; font-size: 13.5px; }
.md-body table { border-collapse: collapse; width: 100%; margin: 1.3em 0; font-size: 15px; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 8px 13px; text-align: left; }
.md-body th { background: var(--surface-2); font-weight: 600; }
.md-body hr { border: 0; border-top: 2px dashed var(--line); margin: 2em 0; }
.md-body .task-list-item { list-style: none; margin-left: -1.2em; }
.md-body input[type="checkbox"] { accent-color: var(--sage); margin-right: 8px; transform: translateY(1px); }

/* 附件列表 */
.attach-box {
  margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); padding: 16px 20px;
}
.attach-box h4 { margin: 0 0 10px; font-size: 16px; }
.attach-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 4px;
  border-top: 1px dashed var(--line); font-size: 14.5px;
}
.attach-item:first-of-type { border-top: 0; }
.attach-item .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.attach-item .fsize { color: var(--ink-3); font-size: 13px; flex: none; }
.attach-item a { flex: none; }

.post-tags { margin-top: 26px; display: flex; gap: 8px; flex-wrap: wrap; }
.post-nav {
  display: flex; justify-content: space-between; gap: 16px; margin-top: 34px;
  border-top: 1px dashed var(--line); padding-top: 18px; font-size: 14.5px;
}
.post-nav a { color: var(--ink-2); max-width: 45%; }
.post-nav a:hover { color: var(--accent-ink); }

/* ---------------- 灯箱 ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(14, 10, 6, 0.9); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; flex-direction: column; padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox-img { max-width: min(1000px, 92vw); max-height: 76vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.lightbox-cap { color: #efe6d8; margin-top: 14px; font-family: var(--font-serif); font-size: 15px; letter-spacing: 0.04em; }
.lightbox-count { color: rgba(255, 245, 232, 0.55); font-size: 13px; margin-top: 4px; }
.lb-btn {
  position: absolute; background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease; line-height: 1;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.22); }
.lb-close { top: 22px; right: 26px; }
.lb-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 24px; top: 50%; transform: translateY(-50%); }

/* ---------------- 状态 ---------------- */
.empty-tip {
  text-align: center; color: var(--ink-3); padding: 60px 20px; font-family: var(--font-serif); font-size: 17px;
}
.spinner {
  width: 30px; height: 30px; margin: 60px auto; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-deco) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- 页脚 ---------------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 34px 0 40px; background: var(--surface-2); }
.foot-inner { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.foot-text { color: var(--ink-2); font-size: 14px; }
.foot-text .serif { font-family: var(--font-serif); color: var(--ink); }
.foot-links { display: flex; gap: 18px; align-items: center; font-size: 13.5px; }
.foot-links a { color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.foot-links a:hover { color: var(--accent-ink); }
.foot-links svg { width: 14px; height: 14px; }
.foot-copy { width: 100%; color: var(--ink-3); font-size: 12.5px; text-align: center; }

/* ---------------- 404 ---------------- */
.notfound { text-align: center; padding: 90px 20px 110px; }
.notfound .code { font-family: var(--font-serif); font-size: 88px; line-height: 1; background: linear-gradient(120deg, var(--accent), var(--sage)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 8px; }
.notfound h1 { font-size: 22px; }
.notfound p { color: var(--ink-2); margin-bottom: 24px; }
.notfound-links { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin: 0 0 22px; }
.notfound-links a { color: var(--ink-2); font-size: 14px; }
.notfound-links a:hover { color: var(--accent-ink); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .photo-strip { grid-template-columns: repeat(3, 1fr); }
  .hero-inner { flex-direction: column; text-align: center; padding: 32px 26px; }
  .hero-info { width: 100%; }
  .hero-bio { margin-left: auto; margin-right: auto; }
  .hero-counts { justify-content: center; }
  .hero-meta { justify-content: center; }
}

/* 断点从 720px 提到 1100px：
   导航有 14 个 nowrap 链接，在 721–1080px（iPad 竖屏、半宽桌面窗口）
   这个区间里最小内容宽度超过容器，链接与主题按钮会被挤出视口，
   页面出现横向滚动条。宁可早一点收起成汉堡菜单。 */
@media (max-width: 1100px) {
  :root { --header-h: 56px; }
  .nav-burger { display: inline-flex; }
  .nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 10px 16px 16px;
    gap: 2px; display: none; box-shadow: var(--shadow-md); z-index: 60;
  }
  .nav.open { display: flex; }
  .nav-link { padding: 11px 14px; }
  .brand-name { font-size: 17px; }
  .hero { padding: 20px 0; }
  .hero-avatar img { width: 104px; height: 104px; }
  .article-grid { grid-template-columns: 1fr; }
  .photo-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .post-body { padding: 20px 18px; }
  .post-nav { flex-direction: column; }
  .post-nav a { max-width: none; }
  .lb-btn.lb-prev, .lb-btn.lb-next { top: auto; bottom: 16px; transform: none; }
  .lb-prev { left: 30%; } .lb-next { right: 30%; }
}

@media (max-width: 420px) {
  .photo-strip { grid-template-columns: 1fr; }
  .search-box { max-width: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
}

/* =========================================================
   升级补充：骨架屏 / 图片渐显 / 阅读进度 / 目录 / 灯箱增强
   ========================================================= */

/* ---- 骨架屏 ---- */
.sk {
  position: relative;
  overflow: hidden;
  background: var(--line);
  border-radius: 8px;
}
.sk::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: sk-shimmer 1.4s infinite;
}
[data-theme='dark'] .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); }
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }

.sk-hero { padding: 54px 0 24px; }
.sk-hero-inner { display: flex; gap: 26px; align-items: center; }
.sk-avatar { width: 116px; height: 116px; border-radius: 50%; flex: none; }
.sk-hero-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.sk-line { height: 14px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.sk-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.sk-cover { height: 150px; border-radius: 10px; }
@media (max-width: 720px) {
  .sk-hero-inner { flex-direction: column; align-items: flex-start; }
  .sk-grid { grid-template-columns: 1fr; }
}

/* ---- 图片渐显 / 失败占位 ---- */
.img-fade { opacity: 0; transition: opacity .45s ease; background: var(--accent-soft); }
.img-fade.is-loaded { opacity: 1; background: transparent; }
.img-fade.is-broken { opacity: 1; background: var(--accent-soft); }
.img-fade.is-broken::after { content: '图片加载失败'; display: block; color: var(--ink-3); font-size: 12.5px; text-align: center; padding: 18px 6px; }

/* ---- 顶部阅读进度条 ---- */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; background: transparent; pointer-events: none; }
.read-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--sage)); transition: width .1s linear; }

/* ---- 文章页布局 + 侧边目录 ---- */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; }
.post-toc { display: none; }
@media (min-width: 1200px) {
  .post-layout { grid-template-columns: minmax(0, 860px) auto; gap: 38px; justify-content: center; }
  .post-shell { max-width: 860px; }
  .post-toc { display: block; width: 196px; position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 130px); overflow-y: auto; padding-right: 4px; }
  .post-toc[hidden] { display: none; }
  .toc-title { font-family: var(--font-serif); font-size: 14px; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 10px; padding-left: 11px; }
  .toc-link {
    display: block; padding: 6px 11px; margin-bottom: 2px; font-size: 13px; line-height: 1.5;
    color: var(--ink-3); border-left: 2px solid var(--line); text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .18s, border-color .18s;
  }
  .toc-link:hover { color: var(--accent-ink); border-color: var(--accent); text-decoration: none; }
  .toc-link.h3 { padding-left: 22px; font-size: 12.5px; }
  .toc-link.active { color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
}

/* ---- 灯箱：加载态 / 缩放 ---- */
.lightbox-img { opacity: 0; transition: opacity .25s ease, transform .25s ease; }
.lightbox-img.ready { opacity: 1; }
.lightbox.zoomed .lightbox-img { transform: scale(1.7); cursor: zoom-out; }
.lb-loading {
  display: none; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255, 245, 232, .25); border-top-color: #fff5e8;
  animation: lb-spin .8s linear infinite;
}
.lightbox.loading .lb-loading { display: block; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* =========================================================
   背景音乐播放器（2026-09 新增）
   ========================================================= */
.bgm {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 392px;
  max-width: calc(100vw - 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md, 0 8px 28px rgba(0, 0, 0, 0.12));
  z-index: 80;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif);
  color: var(--ink);
  transition: transform .25s ease, opacity .25s ease;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.bgm.dragging { cursor: grabbing; transition: none !important; }
.bgm.hidden { transform: translateY(120%); opacity: 0; pointer-events: none; }
.bgm.is-playing { border-color: var(--accent); }

.bgm-bar-bg {
  position: relative;
  height: 3px;
  background: var(--line);
  cursor: pointer;
  transition: height .18s ease; /* hover 变高平滑，不突跳 */
}
.bgm-progress {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--sage, #7aa874));
  transition: width .12s linear;
}
.bgm-bar-bg:hover { height: 4px; }

.bgm-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 9px;
}
.bgm-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 4px;
}
.bgm-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.bgm-sub {
  font-size: 11.5px;
  white-space: nowrap;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bgm-sep { opacity: .4; }
.bgm-mode[data-mode='list']::before { content: '列表循环'; }
.bgm-mode[data-mode='loop']::before { content: '单曲循环'; color: var(--accent); }
.bgm-mode[data-mode='shuffle']::before { content: '随机播放'; color: var(--accent); }

.bgm-btn {
  flex: none;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s ease;
}
.bgm-btn:hover { background: var(--accent-soft, rgba(201, 106, 87, .08)); color: var(--accent-ink, var(--ink)); }
.bgm-btn:active { transform: scale(0.98); } /* 微缩即可，去掉明显弹跳 */
.bgm-btn svg { width: 16px; height: 16px; display: block; }
.bgm-btn .ic-pause { display: none; }
.bgm.is-playing .bgm-toggle .ic-play { display: none; }
.bgm.is-playing .bgm-toggle .ic-pause { display: block; }
.bgm-toggle { background: var(--accent, #C96A57); color: #fff !important; width: 38px; height: 38px; border-radius: 50%; }
.bgm-toggle:hover { background: var(--accent-ink, #B55542) !important; color: #fff !important; }
.bgm-toggle svg { width: 18px; height: 18px; }
.bgm-close { font-size: 18px; line-height: 1; }
.bgm-mode-btn { font-weight: 600; }
.bgm-mode-icon { font-size: 15px; }

.bgm-vol-wrap {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.bgm-vol-icon { font-size: 15px; line-height: 1; }
.bgm-vol-slider {
  width: 0;
  opacity: 0;
  margin: 0;
  transition: width .2s ease, opacity .2s ease, margin .2s ease;
  accent-color: var(--accent, #C96A57);
}
.bgm-vol-wrap:hover .bgm-vol-slider,
.bgm-vol-slider:focus {
  width: 72px;
  opacity: 1;
  margin-left: 4px;
}

.bgm-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(35, 28, 26, 0.92);
  color: #fff5e8;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 90;
}
.bgm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  .bgm { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-width: none; cursor: default; }
  .bgm-mode-btn { display: none; }
  .bgm-close { display: inline-flex; }
  .bgm-vol-wrap .bgm-vol-slider { display: none; }
  .bgm-reopen { right: 8px; bottom: 8px; }
  .bgm-list-panel { left: 8px; right: 8px; width: auto; transform: translateY(8px); }
  .bgm-list-panel.show { transform: translateY(0); }
}

/* 播放列表弹窗 */
.bgm-list-panel {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(8px);
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md, 0 8px 28px rgba(0, 0, 0, 0.16));
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  overflow: hidden;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif);
  color: var(--ink);
}
.bgm-list-panel.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.bgm-list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
}
.bgm-list-count { font-style: normal; font-weight: 400; font-size: 12px; color: var(--ink-3, #999); margin-left: 6px; }
.bgm-list-close {
  width: 26px; height: 26px; border: none; background: transparent;
  color: var(--ink-2); font-size: 18px; line-height: 1; cursor: pointer;
  border-radius: 6px;
}
.bgm-list-close:hover { background: var(--accent-soft, rgba(201, 106, 87, .08)); color: var(--accent-ink, var(--ink)); }
.bgm-list-items {
  list-style: none; margin: 0; padding: 5px;
  max-height: min(50vh, 320px);
  overflow-y: auto;
}
.bgm-list-items li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2, #555);
}
.bgm-list-items li:hover { background: var(--accent-soft, rgba(201, 106, 87, .08)); }
.bgm-list-items li.current { color: var(--accent, #C96A57); font-weight: 600; background: rgba(201, 106, 87, .07); }
.bgm-list-items .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgm-list-items .d { flex: none; font-size: 11.5px; color: var(--ink-3, #999); }

/* 关闭播放器后的"重新打开"音符按钮 */
.bgm-reopen {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent, #C96A57);
  color: #fff;
  font-size: 20px;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 8px 28px rgba(0, 0, 0, 0.12));
  z-index: 80;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s ease, background .15s ease;
}
.bgm-reopen:hover { background: var(--accent-ink, #B55542); transform: scale(1.05); }
.bgm-reopen:active { transform: scale(0.97); }

[data-theme='dark'] .bgm { background: var(--surface, #1a1715); border-color: var(--line, rgba(255,245,232,.12)); }
[data-theme='dark'] .bgm-toast { background: rgba(255, 245, 232, 0.92); color: #231c1a; }

/* =========================================================
   时光轨迹 / 时间轴（2026-09 新增）
   ========================================================= */

.tl-hero {
  text-align: center;
  padding: 56px 0 28px;
  position: relative;
}
.tl-hero-kicker {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: .35em;
  color: var(--accent);
  margin-bottom: 14px;
  padding: 2px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  opacity: .85;
}
.tl-hero-title {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: .04em;
}
.tl-hero-sub {
  color: var(--ink-3);
  font-size: 14.5px;
  margin: 0 0 14px;
}
.tl-hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
}
.tl-hero-meta .dot { opacity: .4; }

.tl-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 0 28px;
}
.tl-chip {
  font-size: 13px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all .18s ease;
}
.tl-chip:hover { color: var(--accent-ink); border-color: var(--accent); }
.tl-chip.active {
  background: var(--accent);
  color: #fff5e8;
  border-color: var(--accent);
}

.tl-shell {
  position: relative;
  padding: 12px 0 60px;
}
.tl-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--line) 80px, var(--line) calc(100% - 80px), transparent);
  transform: translateX(-1px);
}
.tl-year {
  position: relative;
  text-align: center;
  margin: 18px 0 22px;
  z-index: 2;
}
.tl-year span {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: .12em;
  color: var(--accent);
  background: var(--bg);
  padding: 0 18px;
  position: relative;
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 52px;
  align-items: start;
  margin: 0 0 34px;
}
.tl-item.tl-left  .tl-card   { grid-column: 1; grid-row: 1; text-align: right; }
.tl-item.tl-left  .tl-marker { grid-column: 2; grid-row: 1; justify-content: flex-start; padding-left: 30px; }
.tl-item.tl-right .tl-marker { grid-column: 1; grid-row: 1; justify-content: flex-end; padding-right: 30px; }
.tl-item.tl-right .tl-card   { grid-column: 2; grid-row: 1; text-align: left; }

.tl-marker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 15px;
  font-size: 13px;
  color: var(--ink-3);
  min-height: 46px;
}
.tl-marker .tl-date {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  letter-spacing: .04em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 9px;
  white-space: nowrap;
}
/* 图标钉在轴线上（.tl-item 为定位祖先） */
.tl-icon {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 0 4px var(--bg);
  z-index: 2;
  line-height: 1;
}
.tl-icon-empty { background: var(--bg); border-color: var(--line); }
.tl-pin { font-size: 13px; }

.tl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tl-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .05);
}
.tl-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .02em;
}
.tl-text {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}
.tl-cover {
  margin: 10px 0;
  border-radius: 10px;
  overflow: hidden;
  max-width: 280px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
}
.tl-cover img { display: block; width: 100%; height: auto; }
.tl-foot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--accent);
}
.tl-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
}

.tl-skel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 52px;
  align-items: start;
  margin: 0 0 34px;
}
.tl-skel-dot {
  grid-column: 1;
  justify-self: end;
  margin-right: -29px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--line);
  margin-top: 14px;
}
.tl-skel-card {
  grid-column: 1;
  margin-right: 30px;
  height: 100px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.tl-skel-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-100%);
  animation: sk-shimmer 1.4s infinite;
}
[data-theme='dark'] .tl-skel-card::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent);
}

.tl-empty {
  text-align: center;
  padding: 60px 20px 80px;
  color: var(--ink-3);
}
.tl-empty-emoji { font-size: 48px; margin-bottom: 14px; }
.tl-empty .btn { margin-top: 16px; }
.tl-error {
  text-align: center;
  color: var(--danger);
  padding: 40px 0;
}

/* 移动端：单列，靠左贴边 */
@media (max-width: 760px) {
  .tl-hero { padding: 36px 0 16px; }
  .tl-hero-title { font-size: 28px; }
  .tl-line { left: 20px; transform: translateX(-1px); }

  .tl-item {
    grid-template-columns: 1fr;
    column-gap: 0;
    padding-left: 46px;
    margin-bottom: 26px;
  }
  .tl-item.tl-left  .tl-card,
  .tl-item.tl-right .tl-card {
    grid-column: 1; grid-row: 2;
    text-align: left;
    padding: 14px 16px;
  }
  .tl-item.tl-left  .tl-marker,
  .tl-item.tl-right .tl-marker {
    grid-column: 1; grid-row: 1;
    justify-content: flex-start;
    padding: 0 0 9px 0;
    min-height: 0;
  }
  /* 图标钉在移动端轴线上（轴线距容器左 20px） */
  .tl-icon {
    left: 20px;
    top: 0;
    transform: translateX(-50%);
    width: 26px; height: 26px;
    font-size: 12.5px;
  }
  .tl-item .tl-date { font-size: 11.5px; padding: 2px 7px; }
  .tl-year { margin: 16px 0 18px; }
  .tl-year span { font-size: 16px; padding: 0 12px; }
  .tl-cover { max-width: 100%; }
  .tl-skel { grid-template-columns: 1fr; column-gap: 0; padding-left: 46px; }
  .tl-skel-dot { display: none; }
  .tl-skel-card { grid-column: 1; grid-row: auto; margin-right: 0; }
}

/* ---- 首页「时光轨迹」预览条 ---- */
.home-tl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.home-tl-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.home-tl-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
  text-decoration: none;
}
.home-tl-dot {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
}
.home-tl-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.home-tl-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em;
}
.home-tl-title {
  font-family: var(--font-serif);
  font-size: 15px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.home-tl-tag { font-size: 11.5px; color: var(--accent); }
@media (max-width: 600px) {
  .home-tl { grid-template-columns: 1fr; }
}

/* =========================================================
 * 日记（diary.html + 首页最近日记）
 * ========================================================= */
.dl-hero { padding: 56px 0 18px; text-align: center; }
.dl-hero-kicker {
  display: inline-block; font-size: 12px; letter-spacing: .35em;
  padding: 4px 12px; border-radius: 999px; color: var(--accent);
  background: var(--accent-bg, rgba(208,90,58,.08));
}
.dl-hero-title { margin: 10px 0 6px; font-size: 36px; }
.dl-hero-sub { color: var(--ink-3); font-size: 14.5px; margin: 0; }
.dl-hero-meta { margin-top: 12px; color: var(--ink-3); font-size: 13.5px; display: flex; gap: 8px; justify-content: center; }
.dl-hero-meta .dot { opacity: .4; }

.dl-filter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 18px; }
.dl-chip {
  padding: 6px 14px; border-radius: 999px;
  background: var(--card-bg, #fff); border: 1px solid var(--border, rgba(0,0,0,.08));
  color: var(--ink-2); cursor: pointer; font-size: 13px; line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.dl-chip:hover { color: var(--accent); border-color: var(--accent); }
.dl-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.dl-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin: 10px 0 32px;
}
.dl-card {
  display: flex; flex-direction: column;
  background: var(--card-bg, #fff); border: 1px solid var(--border, rgba(0,0,0,.06));
  border-radius: 14px; overflow: hidden;
  text-decoration: none; color: inherit;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.dl-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.07);
  border-color: var(--accent);
}
.dl-card-cover {
  aspect-ratio: 16 / 10; background: var(--accent-bg, rgba(208,90,58,.06));
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.dl-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.dl-card-cover-empty { font-size: 40px; color: var(--accent); opacity: .55; }
.dl-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.dl-card-head { display: flex; align-items: center; justify-content: space-between; }
.dl-card-mood { font-size: 20px; }
.dl-card-date { font-size: 12px; color: var(--ink-3); }
.dl-card-title { margin: 2px 0 0; font-size: 16px; font-weight: 600; }
.dl-card-excerpt { margin: 0; font-size: 13px; color: var(--ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dl-card-badge {
  align-self: flex-start; font-size: 11px; color: var(--ink-3);
  background: var(--accent-bg, rgba(208,90,58,.08));
  border-radius: 999px; padding: 2px 8px; margin-top: 4px;
}

.dl-loadmore { display: flex; justify-content: center; margin: 8px 0 32px; }
.dl-skel-card {
  height: 240px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04));
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.dl-empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.dl-empty-emoji { font-size: 48px; margin-bottom: 8px; }
.dl-error { padding: 24px; color: var(--danger, #C96A57); text-align: center; }

/* 详情 */
.dl-detail { max-width: 720px; margin: 18px auto 60px; padding: 0 8px; }
.dl-back { display: inline-block; color: var(--ink-3); font-size: 13px; text-decoration: none; margin-bottom: 14px; }
.dl-back:hover { color: var(--accent); }
.dl-detail-head { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 14px; }
.dl-detail-mood { font-size: 28px; }
.dl-detail-title { margin: 6px 0 18px; font-size: 28px; line-height: 1.3; }
.dl-detail-content p { margin: 0 0 14px; line-height: 1.85; font-size: 15.5px; color: var(--ink-1); }
.dl-detail-imgs { display: grid; gap: 10px; margin-top: 22px; }
.dl-detail-imgs .dl-detail-img { margin: 0; }
.dl-detail-imgs img { width: 100%; border-radius: 12px; display: block; }

/* 首页「最近日记」 */
.home-diary {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.home-diary-item {
  display: flex; gap: 12px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.06));
  border-radius: 12px; padding: 12px;
  text-decoration: none; color: inherit;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.home-diary-item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.06); border-color: var(--accent); }
.home-diary-cover {
  flex: 0 0 80px; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: var(--accent-bg, rgba(208,90,58,.08));
  display: flex; align-items: center; justify-content: center;
}
.home-diary-cover img { width: 100%; height: 100%; object-fit: cover; }
.home-diary-cover-empty { font-size: 30px; color: var(--accent); opacity: .55; }
.home-diary-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.home-diary-mood { font-size: 18px; }
.home-diary-date { font-size: 12px; color: var(--ink-3); }
.home-diary-title { margin: 2px 0 0; font-size: 14.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-diary-excerpt { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 600px) {
  .home-diary { grid-template-columns: 1fr; }
  .dl-hero { padding: 36px 0 12px; }
  .dl-hero-title { font-size: 28px; }
  .dl-detail-title { font-size: 22px; }
  .dl-detail-mood { font-size: 22px; }
}

/* =========================================================
   评论区（文章页）
   ========================================================= */
.comments-box {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px 60px;
}
.comments-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 42px 0 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.comments-head h2 { margin: 0; font-size: 22px; }
.comments-count {
  font-size: 14px; color: var(--ink-3); font-weight: 400;
}
.comment-item {
  padding: 14px 4px;
  border-bottom: 1px dashed var(--line);
}
.comment-item:last-child { border-bottom: 0; }
.comment-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px;
}
.comment-meta b { color: var(--ink); font-size: 14px; }
.comment-del {
  margin-left: auto; border: 0; background: none;
  color: var(--ink-3); font-size: 12px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px;
}
.comment-del:hover { color: #c0392b; background: var(--surface-2); }
.comment-body {
  font-size: 15px; line-height: 1.75; color: var(--ink);
  overflow-wrap: break-word;
}
.comment-empty {
  padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 14px;
}
.comment-form {
  margin-top: 28px; padding: 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
}
.comment-form h3 { margin: 0 0 12px; font-size: 17px; }
.comment-form textarea {
  width: 100%; min-height: 96px; resize: vertical;
  padding: 10px 12px; margin-top: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  font: inherit; font-size: 14.5px; line-height: 1.6;
  box-sizing: border-box;
}
.comment-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.comment-form-row {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
}
.comment-form-row .field { flex: 1 1 220px; margin: 0; }
.comment-form-row .field input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14.5px;
  box-sizing: border-box;
}
.comment-form-row .field input:focus { outline: 2px solid var(--accent); }
.comment-form-row .field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); }
.comment-hint { font-size: 12px; color: var(--ink-3); padding-bottom: 10px; }
.comment-form-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.comment-len { font-size: 12px; color: var(--ink-3); }

/* =========================================================
   留言板
   ========================================================= */
.gb-shell { max-width: 720px; margin: 0 auto; padding: 10px 20px 60px; }
.gb-grid { display: flex; flex-direction: column; gap: 14px; }
.gb-card {
  padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
}
.gb-card-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px;
}
.gb-card-head b { color: var(--ink); font-size: 14.5px; }
.gb-card-head .comment-del { margin-left: auto; }
.gb-card-body {
  font-size: 15px; line-height: 1.75; color: var(--ink);
  overflow-wrap: break-word; white-space: pre-wrap;
}
.gb-form { margin-top: 34px; }

/* =========================================================
   前台登录/注册组件 + 提示条
   ========================================================= */
.auth-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 2px;
}
.auth-identity { font-size: 13.5px; color: var(--ink-2); }
.auth-identity b { color: var(--accent-ink); font-weight: 600; }
.auth-panel {
  margin-top: 4px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2);
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tab {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font: inherit; font-size: 13.5px;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
}
.auth-tab.active {
  background: var(--accent); border-color: var(--accent);
  color: #fffdf7; font-weight: 600;
}
[data-theme="dark"] .auth-tab.active { color: #2a150d; }
.auth-panel .field { margin-bottom: 12px; }
.auth-panel .field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); }
.auth-panel .field input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14.5px;
  box-sizing: border-box;
}
.auth-panel .field input:focus { outline: 2px solid var(--accent); }
.auth-err { margin: 0 0 10px; font-size: 13px; color: #c0392b; min-height: 18px; }
.captcha-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.captcha-q { font-weight: 600; color: var(--accent); min-width: 64px; font-size: 14px; }
.captcha-row input { width: 76px !important; }
.auth-tip { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.pub-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--bg); font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none; z-index: 999; max-width: 86vw;
}
.pub-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pub-toast.err { background: #c0392b; color: #fff; }

/* =========================================================
   追加样式：站内搜索 / 关于 / 友链 / 标签云 / 热门文章 / 代码高亮
   ========================================================= */

/* ---------------- 导航搜索图标 ---------------- */
.nav-search { display: inline-flex; align-items: center; padding: 7px 9px; }
.nav-search svg { width: 17px; height: 17px; }

/* ---------------- 通用页面头 ---------------- */
.page-main { padding: 30px 0 60px; min-height: 46vh; }
.page-head { margin: 6px 0 22px; }
.page-title {
  font-family: var(--font-serif); font-size: clamp(24px, 4vw, 32px);
  margin: 0; letter-spacing: 0.02em;
}
.page-title::before { content: '✦ '; color: var(--accent); font-size: 0.9em; }

/* ---------------- 站内搜索页 ---------------- */
.search-hero {
  display: flex; flex-direction: column; gap: 12px;
  padding: 26px 26px 20px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
}
.search-hero form { display: flex; gap: 10px; flex-wrap: wrap; }
.search-hero .search-box { flex: 1; min-width: 240px; max-width: none; }
.search-big input { padding: 12px 16px 12px 42px; font-size: 15.5px; border-radius: 12px; }
.search-hint { margin: 0; color: var(--ink-3); font-size: 13px; }

/* ---------------- 热门文章（首页） ---------------- */
.hot-list { display: flex; flex-direction: column; gap: 10px; }
.hot-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); transition: all 0.18s ease;
}
.hot-item:hover { border-color: var(--accent); transform: translateX(4px); text-decoration: none; box-shadow: var(--shadow-sm); }
.hot-rank {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 15px;
  color: var(--accent-ink); background: var(--accent-soft);
}
.hot-item:nth-child(1) .hot-rank { background: var(--accent); color: #fff8f1; }
.hot-item:nth-child(2) .hot-rank { background: color-mix(in srgb, var(--accent) 78%, #fff); color: #fff8f1; }
.hot-item:nth-child(3) .hot-rank { background: color-mix(in srgb, var(--accent) 58%, #fff); color: #fff8f1; }
[data-theme="dark"] .hot-item:nth-child(1) .hot-rank,
[data-theme="dark"] .hot-item:nth-child(2) .hot-rank,
[data-theme="dark"] .hot-item:nth-child(3) .hot-rank { color: #2a150d; }
.hot-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hot-title { color: var(--ink); font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-meta { color: var(--ink-3); font-size: 12.5px; }

/* ---------------- 标签云页 ---------------- */
.tag-cloud {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: baseline;
  padding: 30px 26px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.tag-item {
  color: var(--ink-2); background: var(--surface-2);
  border-radius: 999px; padding: 4px 14px; border: 1px solid transparent;
  line-height: 1.6; transition: all 0.16s ease; white-space: nowrap;
}
.tag-item i { font-style: normal; font-size: 0.72em; color: var(--ink-3); margin-left: 4px; }
.tag-item:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; transform: translateY(-2px); }
.tag-tip { margin-top: 14px; color: var(--ink-3); font-size: 13px; }

/* ---------------- 友情链接页 ---------------- */
.links-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.link-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); transition: all 0.18s ease;
}
.link-card b { color: var(--ink); font-size: 16px; }
.link-card span { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.link-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }

/* ---------------- 关于页 ---------------- */
.about-body { padding: 30px 34px; }
.about-body .empty-tip { padding: 30px 0; text-align: center; }

/* ---------------- 代码高亮 ---------------- */
.post-body pre {
  background: var(--code-bg, var(--surface-2));
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; overflow-x: auto; margin: 14px 0;
  line-height: 1.65; font-size: 13.5px;
}
.post-body pre code {
  background: transparent; padding: 0; border-radius: 0;
  font-family: Consolas, "SFMono-Regular", Menlo, "Courier New", monospace;
  color: var(--ink);
}
.post-body code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 6px;
  font-family: Consolas, "SFMono-Regular", Menlo, "Courier New", monospace;
  font-size: 0.92em;
}
.tok-kw { color: #7c5cd6; font-weight: 600; }
.tok-str { color: #2e9e5b; }
.tok-num { color: #c77d1e; }
.tok-cmt { color: var(--ink-3); font-style: italic; }
[data-theme="dark"] .tok-kw { color: #b69af2; }
[data-theme="dark"] .tok-str { color: #6fd3a0; }
[data-theme="dark"] .tok-num { color: #e8a95a; }

/* 移动端收紧 */
@media (max-width: 600px) {
  .about-body { padding: 20px 16px; }
  .search-hero { padding: 18px 16px 14px; }
  .hot-item { padding: 10px 12px; }
  .tag-cloud { padding: 22px 18px; }
}

/* =========================================================
   可访问性 / 移动端补充修正
   ========================================================= */

/* iOS Safari：可聚焦控件的字号只要小于 16px，聚焦时就会强制放大整页，
   失焦后页面停在放大状态、布局错位。这里统一把移动端控件抬到 16px。 */
@media (max-width: 1100px) {
  .search-box input,
  .search-big input,
  .movies-search input,
  #bookSearch,
  .drive-search,
  .comment-form textarea,
  .comment-form .field input,
  .comment-form-row .field input,
  .auth-panel .field input,
  .drive-modal-body input,
  .drive-modal-body select,
  .dl-search input { font-size: 16px; }
}

/* 正文里的宽表格：手机上会撑破文章卡片并让整页横向滚动。
   让表格自己横向滚动，代码块早已这么做（.md-body pre）。 */
.md-body table,
.post-body table {
  display: block; width: 100%; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.md-body thead, .md-body tbody,
.post-body thead, .post-body tbody { display: table; width: 100%; }

/* 相册说明原来只靠 :hover，触屏与键盘用户永远看不到 */
.photo-item:focus-within .photo-cap,
.photo-item:focus .photo-cap { opacity: 1; }
@media (hover: none) {
  .photo-item .photo-cap { opacity: 1; }
}

/* 键盘焦点必须可见。
   站点里有大量 `outline: none`（搜索框、输入框），只靠边框变色
   在部分背景下几乎看不出，键盘用户会完全失去位置感。 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.nav-link:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
.tag:focus-visible,
.page-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 跳转到主内容：键盘与读屏用户不必逐个 Tab 穿过 14 条导航 */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  padding: 10px 16px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

/* 尊重「减少动态效果」偏好（WCAG 2.3.3）。
   原来只有 movie.css 做了这件事，而全局平滑滚动、骨架屏闪烁动画
   都定义在 style.css，前庭敏感用户依然会被强制动画。 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover, .hot-item:hover, .tag-item:hover, .movie-card:hover { transform: none !important; }
  .img-fade { opacity: 1; }
}

