:root {
  --paper: #f7f5f0;
  --paper-deep: #f1eee7;
  --paper-card: #fbfaf7;
  --ink: #1f1d1a;
  --ink-body: #3b352d;
  --ink-soft: #4b463f;
  --muted: #8b8478;
  --faint: #a8a196;
  --line: #e2dcd1;
  --line-soft: #ece7dd;
  --accent: #a4472b;
  --accent-soft: #f3e5dc;
  --serif: "Noto Serif SC", "Songti SC", "STSong", SimSun, Georgia, serif;
  --sans: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --maxw: 760px;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* 防止 iOS 横竖屏切换时自动放大字号 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* 兜底：任何元素溢出都不产生横向滚动 */
  overflow-x: hidden;
}

body {
  background-color: var(--paper);
  /* 多层柔光：顶部一束光、左右两抹暖/冷微晕、底部一抹沉色，营造大气留白 */
  background-image:
    radial-gradient(125% 80% at 50% -12%, rgba(255, 255, 255, 0.62), transparent 58%),
    radial-gradient(80% 60% at 12% 5%, rgba(164, 71, 43, 0.05), transparent 55%),
    radial-gradient(72% 55% at 88% 1%, rgba(74, 96, 108, 0.05), transparent 55%),
    radial-gradient(95% 90% at 50% 116%, rgba(120, 108, 90, 0.05), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

/* 细腻纸纹质感：极淡的灰度噪点叠加，温润、安静、克制，不喧宾夺主 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.045;
  mix-blend-mode: multiply;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

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

/* 全局兜底：图片不溢出、长单词/长英文自动换行 */
img { max-width: 100%; }
h1, h3, p, span, div, a { overflow-wrap: break-word; word-break: break-word; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 245, 240, 0.88);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
}
.brand-dot { color: var(--accent); margin: 0 0.25em; }
.date-nav { display: flex; gap: 8px; }
.date-nav button {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
  transition: all 0.22s ease;
  line-height: 1.6;
}
.date-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.date-nav .today-btn {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 400;
}

/* 阅读进度条 */
.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #c9704c);
  pointer-events: none;
}

/* ---------- Hero ---------- */
.hero { padding: 96px 24px 56px; text-align: center; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  letter-spacing: 0.4em;
  color: var(--muted);
  margin-bottom: 30px;
}
.hero-kicker::before,
.hero-kicker::after {
  content: "";
  width: 38px;
  height: 1px;
  background: var(--line);
}
.hero-date {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(46px, 9.5vw, 96px);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.hero-date #monthDay { display: block; }
.hero-date #yearLabel {
  font-size: 0.4em;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.38em;
  display: block;
  margin-top: 16px;
}
.hero-sub {
  margin-top: 28px;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.1em;
}

[hidden] { display: none !important; }

/* ---------- 目录首页：九宫格（只列「一本书 / 一幅画 …」） ---------- */
.toc {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-bottom: 44px;
}
.toc-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  min-height: 152px;
  padding: 22px 16px;
  text-align: center;
  font-family: var(--sans);
  /* 半透磨砂：让底层纸纹微透出来，更温润、更大气 */
  background: rgba(251, 250, 247, 0.68);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(2px) saturate(1.05);
  -webkit-backdrop-filter: blur(2px) saturate(1.05);
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
@media (hover: hover) and (pointer: fine) {
  .toc-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: rgba(251, 250, 247, 0.86);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 16px 30px -20px rgba(33, 31, 28, 0.45);
  }
  .toc-item:hover .toc-item-name { color: var(--accent); }
}
.toc-item:focus-visible { outline-offset: -3px; border-radius: 14px; }
.toc-item-num {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.26em;
  color: var(--accent);
}
.toc-item-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(17px, 3.4vw, 20px);
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ink);
  transition: color 0.25s ease;
}
.toc-item-en {
  font-size: 10.5px;
  letter-spacing: 0.28em;
  color: var(--faint);
  text-transform: uppercase;
}
/* ---------- 第二层：栏目内容页 ---------- */
.section-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  padding-bottom: 4px;
}
.section-date {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--faint);
  white-space: nowrap;
}

/* 内容页的条目：约束进 760 阅读栏并居中，与顶栏/返回按钮左缘对齐，避免文字贴边 */
.entry.section-page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 24px 70px;
  border-top: none;
}
.entry.section-page::after { content: none; }
.entry.section-page:last-child { border-bottom: none; }

.back-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 22px;
  cursor: pointer;
  transition: all 0.22s ease;
}
.back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.back-btn-sm { font-size: 12px; padding: 5px 16px; }

.back-wrap {
  text-align: center;
  padding: 30px 24px 14px;
}
.back-btn-big {
  font-size: 14px;
  letter-spacing: 0.22em;
  padding: 13px 44px;
  box-shadow: 0 12px 26px -18px rgba(33, 31, 28, 0.55);
}
.back-tip {
  margin-top: 13px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.entry {
  position: relative;
  padding: 78px 0 70px;
  border-top: 1px solid var(--line-soft);
  scroll-margin-top: 78px;
}
.entry:last-child { border-bottom: 1px solid var(--line-soft); }
/* 分隔线上的菱形断点装饰 */
.entry::after {
  content: "◆";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7px;
  line-height: 1;
  color: var(--line);
  background: var(--paper);
  padding: 0 10px;
}

/* cover image */
.entry-media {
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, var(--paper-deep), var(--line));
  margin-bottom: 46px;
  box-shadow: 0 1px 2px rgba(33, 31, 28, 0.04), 0 20px 42px -26px rgba(33, 31, 28, 0.5);
}
.entry-media.is-photo { background: var(--paper-deep); }
.entry-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.entry-media img.loaded { opacity: 1; }
/* 图片加载失败兜底：换用内联 SVG 封面继续显示，保持 3:2 版式不塌陷 */
.entry-media.is-fallback { background: linear-gradient(160deg, var(--paper-deep), var(--line)); }
.entry-media.is-fallback img { opacity: 1; }
.entry-media.is-fallback .media-credit { color: var(--faint); opacity: 0.75; }
/* 极端情况（连兜底封面都不可用）：用配色块保住高度，避免出现空白 */
.entry-media.is-fallback-empty { min-height: 0; }
.entry-media.is-fallback-empty::before {
  content: "";
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: linear-gradient(160deg, var(--paper-deep), var(--line));
}
.entry-media.is-fallback-empty img { display: none; }
/* 仅对真正支持 hover 的设备启用，避免移动端点击后缩放卡住 */
@media (hover: hover) and (pointer: fine) {
  .entry-media:hover img.loaded { transform: scale(1.022); }
}
.media-credit {
  display: block;
  text-align: right;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding: 9px 15px 7px;
  background: rgba(255, 255, 255, 0.5);
}

/* ---------- Entry head ---------- */
.entry-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 14px;
  margin-bottom: 30px;
}
.entry-num {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: 3px 11px;
  line-height: 1.6;
}
.entry-label {
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.entry-label .cn {
  margin-left: 10px;
  letter-spacing: 0.14em;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.entry-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line), transparent);
}

/* ---------- Title block ---------- */
.entry-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(27px, 4.6vw, 37px);
  line-height: 1.4;
  letter-spacing: 0.015em;
  margin-bottom: 8px;
  color: var(--ink);
}
.entry-title-en {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 20px;
}
.entry-sub {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.85;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  padding-left: 15px;
  border-left: 2px solid var(--accent);
  margin-bottom: 6px;
}
.entry-sub-en {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--faint);
  font-family: Georgia, "Times New Roman", serif;
  padding-left: 17px;
  margin-bottom: 26px;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.entry-meta span {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  background: rgba(255, 255, 255, 0.45);
}
/* 第二组 meta 是标签，用 accent 色区分 */
.entry-meta + .entry-meta span {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}

/* ---------- 正文：中文段 + 英文段逐段对照 ---------- */
.entry-detail {
  margin-top: 24px;
}
.entry-detail p { text-wrap: pretty; }

/* 中文段落 */
.entry-detail p.p-zh {
  font-size: 16.5px;
  line-height: 2.06;
  color: var(--ink-body);
  letter-spacing: 0.012em;
  margin: 0 0 10px;
}
/* 首段作为导语：更大、更沉 */
.entry-detail p.p-zh:first-child {
  font-size: 17.5px;
  line-height: 1.96;
  color: var(--ink);
}

/* 紧跟其后的英文对照段：缩进 + 左侧细线，形成一组 */
.entry-detail p.p-en {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.95;
  color: #6f675a;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  margin: 0 0 30px;
  letter-spacing: 0.01em;
}
.entry-detail p:last-child { margin-bottom: 0; }

/* ---------- 诗歌引用块 ---------- */
.entry-quote {
  position: relative;
  margin: 32px 0 4px;
  padding: 28px 28px 24px;
  background: linear-gradient(180deg, var(--paper-card), #f4f1ea);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px 14px 14px 4px;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 2.15;
  color: var(--ink);
  white-space: pre-line;
  box-shadow: 0 12px 26px -22px rgba(33, 31, 28, 0.55);
}
.entry-quote::before {
  content: "\201C";
  position: absolute;
  top: 4px;
  left: 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 48px;
  line-height: 1;
  color: rgba(164, 71, 43, 0.14);
  pointer-events: none;
}
.entry-quote .poem-zh { position: relative; }
.entry-quote .poem-en {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid rgba(33, 31, 28, 0.1);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.95;
  color: var(--muted);
}

/* ---------- 思考问题栏目 ---------- */
.entry-question {
  position: relative;
  padding-left: 26px;
  font-family: var(--serif);
  font-size: clamp(23px, 4.2vw, 31px);
  font-weight: 600;
  line-height: 1.62;
  letter-spacing: 0.015em;
  margin-bottom: 22px;
  color: var(--ink);
}
.entry-question::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 6px;
  height: 1.05em;
  background: var(--accent);
  border-radius: 3px;
}

/* ---------- 今日特供标 ---------- */
.entry-special {
  display: inline-block;
  font-size: 11.5px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 3px 13px;
  letter-spacing: 0.12em;
  margin-bottom: 18px;
  box-shadow: 0 6px 16px -10px rgba(164, 71, 43, 0.9);
}

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 28px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  box-shadow: 0 10px 24px -14px rgba(33, 31, 28, 0.7);
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 60px 24px 76px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
}
.site-footer::before {
  content: "";
  display: block;
  width: 30px;
  height: 1px;
  background: var(--line);
  margin: 0 auto 28px;
}
.footer-main {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.footer-note {
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.24em;
}
.footer-license {
  font-size: 11px;
  color: var(--faint);
  margin-top: 14px;
  letter-spacing: 0.04em;
}

/* 页脚下载源码按钮 */
.download-btn,
.download-btn:link,
.download-btn:visited {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 24px;
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 28px;
  text-decoration: none !important;
  -webkit-text-decoration: none !important;
  cursor: pointer;
  transition: all 0.22s ease;
  outline: none;
}
.download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.download-btn.is-loading {
  pointer-events: none;
  opacity: 0.72;
  color: var(--muted);
  border-color: var(--line);
}
.download-btn-ico {
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
}
.download-tip {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--faint);
}

/* PWA 安装提示 */
.install-tip {
  margin-top: 14px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  opacity: 0.85;
}

/* ---------- 滚动显现动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .entry-media img { transition: none; }
  .toc-item { transition: none; }
  .to-top { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .wrap { padding: 0 20px; }
  body { font-size: 15.5px; }
  .hero { padding: 56px 20px 42px; }
  .hero-kicker { gap: 10px; letter-spacing: 0.24em; font-size: 11.5px; }
  .hero-kicker::before, .hero-kicker::after { width: 20px; }
  .hero-date { letter-spacing: 0; }
  .hero-sub { margin-top: 22px; font-size: 14px; letter-spacing: 0.06em; }
  .entry { padding: 52px 0 46px; }
  .entry-media { margin-bottom: 32px; border-radius: 12px; }
  .entry-head { margin-bottom: 24px; gap: 10px; }
  .entry-label { font-size: 10px; letter-spacing: 0.22em; }
  .entry-label .cn { font-size: 12px; margin-left: 8px; }
  .entry-title { line-height: 1.42; margin-bottom: 6px; }
  .entry-sub { font-size: 16px; padding-left: 13px; }
  .entry-sub-en { padding-left: 15px; font-size: 13px; margin-bottom: 22px; }
  .entry-detail { margin-top: 18px; }
  .entry-detail p.p-zh {
    font-size: 16px;
    line-height: 2.0;
    margin-bottom: 8px;
  }
  .entry-detail p.p-zh:first-child { font-size: 16.5px; line-height: 1.95; }
  .entry-detail p.p-en {
    font-size: 16px;
    line-height: 1.95;
    padding-left: 15px;
    margin-bottom: 28px;
  }
  .entry-quote { padding: 22px 20px 20px; font-size: 15.5px; line-height: 2.05; }
  .entry-quote::before { font-size: 38px; left: 10px; }
  .entry-question { padding-left: 20px; line-height: 1.6; }
  .header-inner { height: 54px; }
  .brand { font-size: 16px; letter-spacing: 0.05em; }
  .date-nav button { padding: 4px 11px; font-size: 13px; }
  .date-nav { gap: 6px; }

  /* 目录九宫格：两列，最后一个奇数项占满整行 */
  .hero { padding: 48px 20px 34px; }
  .toc { grid-template-columns: repeat(2, 1fr); gap: 12px; padding-bottom: 30px; }
  .toc-item { min-height: 128px; padding: 18px 14px; gap: 7px; border-radius: 13px; }
  .toc-item:last-child:nth-child(odd) { grid-column: span 2; }
  .toc-item-name { font-size: 17px; }
  .toc-item-en { font-size: 10px; letter-spacing: 0.2em; }
  /* 内容页返回按钮 */
  .section-topbar { padding-top: 16px; }
  .entry.section-page { padding: 18px 20px 46px; }
  .back-wrap { padding: 24px 20px 10px; }
  .back-btn-big { font-size: 13px; letter-spacing: 0.18em; padding: 12px 36px; }
  .back-tip { font-size: 11px; }

  .to-top {
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 40px;
    height: 40px;
  }
  .media-credit { padding: 8px 12px 6px; font-size: 10px; }
}
