:root {
--bg-paper: #fbfbf9;
--diplomatic-blue: #1c355e;
--history-gold: #c5a059;
--text-main: #2b2b2b;
--text-muted: #666;
--font-title: "Noto Serif SC", serif;
--font-eng: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
}

.article-page-root {
font-family: var(--font-title);
background: var(--fsmag-color-paper);
color: var(--text-main);
line-height: 1.9;
margin: 0;
}

.hidden {
display: none !important;
}

/* 顶部导航与标题区域基础样式（不依赖 Tailwind） */
.article-page-root nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 50;
background: rgba(255, 255, 255, 0.96);
border-bottom: 1px solid var(--fsmag-color-border);
}

.article-page-root nav .nav-inner {
max-width: 960px;
margin: 0 auto;
padding: 0 24px;
height: 56px;
display: flex;
align-items: center;
justify-content: space-between;
}

.article-page-root nav a {
font-size: 12px;
font-weight: 700;
color: var(--diplomatic-blue);
letter-spacing: 0.25em;
text-decoration: none;
}

.article-page-root nav a:hover {
color: var(--history-gold);
}

.article-page-root main {
position: relative;
z-index: 10;
padding-top: 64px;
}

#loading,
#not-found {
min-height: 60vh;
display: flex;
align-items: center;
justify-content: center;
color: var(--fsmag-color-ink-muted);
}

header.article-header {
padding: 4rem 0 2.5rem;
border-bottom: 1px solid var(--fsmag-color-border-soft);
}

.article-header-inner {
max-width: 720px;
margin: 0 auto;
padding: 0 24px;
text-align: center;
}

#meta {
font-size: 11px;
font-family: var(--font-eng);
color: var(--history-gold);
letter-spacing: 0.35em;
text-transform: uppercase;
margin-bottom: 0.75rem;
}

#title {
font-size: clamp(2.2rem, 4vw, 3rem);
font-weight: 700;
line-height: 1.25;
margin: 0 0 0.5rem;
}

#english-title {
font-size: 1.05rem;
font-family: var(--font-eng);
color: var(--text-muted);
letter-spacing: 0.12em;
font-weight: 500;
font-style: italic;
margin: 0 auto 1.5rem;
padding: 0 1rem;
line-height: 1.7;
max-width: 36rem;
text-align: center;
position: relative;
}
#english-title::before {
content: '';
display: block;
width: 2rem;
height: 1px;
background: linear-gradient(90deg, transparent, var(--history-gold));
margin: 0 auto 0.75rem;
}
#english-title:empty::before { display: none; }

/* CMS：dek 简要提示；无 dek 时展示 description 导读（互斥） */
#article-dek {
font-size: 1.05rem;
line-height: 1.75;
color: var(--text-muted);
margin: 0 auto 1.25rem;
padding: 0 1rem;
max-width: 38rem;
text-align: center;
}
#article-description-lede {
font-size: 1.08rem;
line-height: 1.85;
color: var(--fsmag-color-ink-soft);
margin: 0 auto 1.5rem;
padding: 0 1rem;
max-width: 40rem;
text-align: justify;
text-indent: 0;
}

/* 封面图与正文对齐 */
#cover-wrap {
max-width: 720px;
margin: -2.5rem auto 2.5rem;
padding: 0 24px;
}

#cover-wrap.hidden {
display: none;
}

#cover-wrap-inner {
border-radius: 12px;
box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
}

/* 正文排版 - 杂志风格 */
.article-body,
.mag-article {
max-width: 760px;
margin: 0 auto;
padding: 1.5rem 24px 3rem;
font-family: "Noto Serif SC", "Source Han Serif SC", serif;
line-height: 1.9;
color: var(--fsmag-color-ink);
}

.prose-custom,
.mag-content {
font-size: 18px;
}

.prose-custom p,
.mag-content p {
margin-bottom: 28px;
text-align: justify;
text-indent: 2em;
}

/* 首字下沉 - 仅作用于首段（intro）*/
.prose-custom p.intro::first-letter,
.mag-content p.intro::first-letter {
float: left;
font-size: 64px;
line-height: 0.9;
padding-right: 10px;
font-weight: bold;
color: var(--diplomatic-blue);
font-family: var(--font-eng);
}

/* 首段不缩进 */
.prose-custom p.intro,
.mag-content p.intro {
text-indent: 0;
font-size: 1.08rem;
color: var(--text-muted);
margin-top: 1.8em;
margin-bottom: 1.8em;
}

/* Markdown h1（正文内主标题） */
.prose-custom h1,
.mag-content h1 {
font-size: clamp(1.65rem, 3.5vw, 2rem);
font-weight: 700;
margin: 2.5rem 0 1.25rem;
line-height: 1.35;
color: var(--diplomatic-blue);
text-indent: 0;
border-bottom: 1px solid rgba(197, 160, 89, 0.35);
padding-bottom: 0.5rem;
}
.prose-custom h1 + p,
.mag-content h1 + p {
text-indent: 0;
}
/* 分隔线（Markdown ---） */
.prose-custom hr,
.mag-content hr {
border: none;
height: 1px;
margin: 2.75rem 0;
background: linear-gradient(90deg, transparent, rgba(28, 53, 94, 0.2), transparent);
}
/* 标题层级 */
.prose-custom h2,
.mag-content h2 {
font-family: var(--font-eng);
font-size: 26px;
margin-top: 60px;
margin-bottom: 20px;
font-weight: 700;
color: var(--diplomatic-blue);
border-left: 4px solid var(--history-gold);
padding-left: 12px;
text-indent: 0;
}

.prose-custom h3,
.mag-content h3 {
font-size: 20px;
margin-top: 40px;
margin-bottom: 15px;
font-weight: 600;
text-indent: 0;
}

.prose-custom h2 + p,
.prose-custom h3 + p,
.mag-content h2 + p,
.mag-content h3 + p {
text-indent: 0;
margin-top: 2em;
}

.prose-custom h4,
.mag-content h4 {
margin: 2rem 0 0.75rem;
font-size: 1.1rem;
font-weight: 600;
text-indent: 0;
}

/* 图片与图注 */
.prose-custom figure.prose-figure,
.mag-content figure {
margin: 60px 0;
text-align: center;
}

/* 正文图默认：无圆角阴影（竖版/横版自然混排，通栏版心宽） */
.prose-custom figure.prose-figure img,
.mag-content figure img,
.mag-content p > img {
display: block;
border-radius: 0;
box-shadow: none;
}

/* 正文图不按 #focus 裁切；横版铺满版心，竖版不超过阅读区约 2/3、居中 */
.mag-content figure.mag-prose-figure img.mag-prose-img,
.prose-custom figure.mag-prose-figure img.mag-prose-img {
width: 100%;
max-width: 100%;
height: auto;
margin: 0;
}

.mag-content figure.mag-prose-figure img.mag-prose-img--portrait,
.prose-custom figure.mag-prose-figure img.mag-prose-img--portrait {
width: auto;
max-width: 66.666%;
margin-left: auto;
margin-right: auto;
}

/* 独立图片（未被 figure 包裹时）居中 */
.prose-custom p > img,
.mag-content p > img {
display: block;
margin: 1.5rem auto;
}

.prose-custom figcaption.prose-figcaption,
.mag-content figcaption {
font-size: 14px;
color: var(--fsmag-color-ink-muted);
margin-top: 10px;
text-align: center;
font-style: italic;
}

/* 引用块 */
.prose-custom blockquote,
.mag-content blockquote {
margin: 40px 0;
padding: 20px 30px;
background: var(--fsmag-color-surface-soft);
border-left: 4px solid var(--history-gold);
font-style: italic;
color: var(--fsmag-color-ink);
font-size: 1.05rem;
}
.prose-custom blockquote p,
.mag-content blockquote p {
text-indent: 0;
margin-bottom: 0.75em;
}
.prose-custom blockquote p:last-child,
.mag-content blockquote p:last-child {
margin-bottom: 0;
}

/* 列表 */
.prose-custom ul,
.prose-custom ol,
.mag-content ul,
.mag-content ol {
margin: 30px 0;
padding-left: 24px;
}

.prose-custom li,
.mag-content li {
margin-bottom: 12px;
}

.prose-custom strong,
.mag-content strong {
font-weight: 700;
}

.article-page-root footer {
border-top: 1px solid var(--fsmag-color-border-soft);
padding: 3rem 0;
text-align: center;
font-size: 0.85rem;
color: var(--fsmag-color-ink-muted);
}

.article-page-root footer a {
color: var(--diplomatic-blue);
text-decoration: none;
}

.article-page-root footer a:hover {
color: var(--history-gold);
}

@media (max-width: 768px) {
.mag-article {
    padding: 0 18px;
}
#title {
    font-size: 32px;
}
}

.noise-bg {
position: fixed;
inset: 0;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
pointer-events: none;
z-index: 0;
}

/* ── 梅贻琦日记 · 民国纸张风格 ── */
.mei-diary-page {
background: #f7f2e8;
}
.mei-diary-page main {
background: transparent;
}
.diary-paper {
max-width: 760px;
margin: 0 auto 3rem;
padding: 0 24px;
}
.diary-paper-inner {
position: relative;
padding: 2.5rem 2.25rem 3rem;
background: #fbf7ec;
border: 1px solid rgba(120, 90, 60, 0.28);
box-shadow: 0 20px 55px rgba(0, 0, 0, 0.16);
background-image:
    linear-gradient(to bottom, rgba(120, 90, 60, 0.08) 0, rgba(120, 90, 60, 0.02) 30%, transparent 55%),
    repeating-linear-gradient(#fdf9ee, #fdf9ee 28px, #f6ecda 29px);
}
.diary-paper-inner::before {
content: '';
position: absolute;
top: 2.2rem;
bottom: 2.4rem;
left: 1.7rem;
width: 1px;
background: linear-gradient(to bottom, rgba(180, 60, 60, 0.55), rgba(140, 40, 40, 0.2));
}
.diary-meta {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1.75rem;
font-family: "Noto Serif SC", "Songti SC", serif;
}
.diary-meta-left {
display: flex;
align-items: baseline;
gap: 0.35rem;
padding-left: 1.9rem;
}
.diary-title-main {
font-size: 1.35rem;
letter-spacing: 0.32em;
font-weight: 700;
}
.diary-sep {
opacity: 0.6;
}
.diary-date {
font-size: 0.9rem;
color: #8b5a2b;
letter-spacing: 0.18em;
}
.diary-week {
font-size: 0.7rem;
color: #a07b4f;
letter-spacing: 0.22em;
}
.diary-meta-stamp {
min-width: 3rem;
min-height: 3rem;
border-radius: 3px;
border: 1px solid rgba(160, 40, 40, 0.9);
background: radial-gradient(circle at 20% 20%, #fbe4e4, #c72727);
color: rgba(255, 255, 255, 0.96);
font-family: "Ma Shan Zheng", "KaiTi", serif;
font-size: 1.15rem;
display: flex;
align-items: center;
justify-content: center;
transform: rotate(-10deg);
box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 3px 8px rgba(0, 0, 0, 0.35);
}
.diary-text {
position: relative;
padding-left: 1.9rem;
font-size: 17px;
line-height: 2;
color: #2b2118;
}
.diary-text p {
text-indent: 2em;
margin-bottom: 1.4em;
}
.diary-text p.intro {
text-indent: 0;
color: #6b5b45;
font-size: 0.98rem;
}
@media (max-width: 768px) {
.diary-paper-inner {
    padding: 1.9rem 1.5rem 2.4rem;
}
.diary-paper-inner::before {
    left: 1.2rem;
}
.diary-meta-left {
    padding-left: 1.5rem;
    flex-wrap: wrap;
}
.diary-title-main {
    font-size: 1.15rem;
}
.diary-text {
    padding-left: 1.5rem;
}
}

/* ── 暗色模式 ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-paper:        #1a1a1a;
    --text-main:       #e8e4dc;
    --text-muted:      #9a9690;
    --diplomatic-blue: #7fa8d4;
    --history-gold:    #c5a059;
    --border-color:    #2e2e2e;
  }

  .article-page-root body {
    background-color: var(--bg-paper);
    color: var(--text-main);
  }

  /* 导航 */
  .article-page-root nav {
    background: rgba(26,26,26,0.97) !important;
    border-bottom-color: #2e2e2e !important;
  }
  .article-page-root nav a { color: #c8c4bc !important; }

  /* 文章头部 */
  .article-header {
    background: var(--bg-paper) !important;
  }
  #title {
    color: #f0ece4 !important;
  }
  #english-title {
    color: var(--diplomatic-blue) !important;
  }
  #article-dek, #meta {
    color: var(--text-muted) !important;
  }

  /* 正文 */
  .mag-content, .prose-custom {
    color: var(--text-main);
  }
  .mag-content p, .mag-content li {
    color: #d4d0c8;
  }
  .mag-content h2, .mag-content h3, .mag-content h4 {
    color: #f0ece4;
    border-color: #3a3a3a;
  }
  .mag-content blockquote {
    border-left-color: var(--history-gold);
    background: #242424;
    color: #c8c4bc;
  }
  .mag-content a {
    color: var(--diplomatic-blue);
  }
  .mag-content a:hover {
    color: var(--history-gold);
  }
  .mag-content code, .mag-content pre {
    background: #242424;
    color: #c8c4bc;
    border-color: #3a3a3a;
  }
  .mag-content hr {
    border-color: #3a3a3a;
  }
  .mag-content figure figcaption {
    color: var(--text-muted);
  }

  /* 封面模糊层 */
  .fsmag-cover-blur {
    opacity: 0.4 !important;
  }

  /* 页脚 */
  .article-page-root footer {
    border-top-color: #2e2e2e !important;
    color: var(--text-muted) !important;
  }
  .article-page-root footer a {
    color: var(--text-muted) !important;
  }
}

/* ── 相关阅读 ────────────────────────────────────────────── */
.related-articles {
  max-width: 780px;
  margin: 4rem auto 2rem;
  padding: 0 1.5rem;
  border-top: 1px solid var(--border-color, #e8e4dc);
  padding-top: 2.5rem;
}
.related-heading {
  font-family: var(--font-eng, 'Montserrat', sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, #666);
  margin-bottom: 1.5rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}
.related-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
  overflow: hidden;
  transition: opacity 0.2s;
}
.related-card:hover { opacity: 0.8; }
.related-card-cover {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #f0ece4;
}
.related-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.related-card-body {
  padding: 0.75rem 0;
}
.related-card-section {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--diplomatic-blue, #1c355e);
  margin-bottom: 0.4rem;
}
.related-card-title {
  font-family: var(--font-title, 'Noto Serif SC', serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-main, #2b2b2b);
  margin: 0 0 0.4rem;
}
.related-card-dek {
  font-size: 0.82rem;
  color: var(--text-muted, #666);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 640px) {
  .related-grid { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  .related-articles { border-top-color: #2e2e2e; }
  .related-card-cover { background: #242424; }
  .related-card-title { color: #f0ece4; }
}
