/* ============================================================
   Torillic × 镜衍都市
   保留 Torillic 的版式（A4 纸页 / 双栏 / 书卷字体），
   把配色换成正式站 body.pm-dlc-on 的实际色值。

   Torillic 原色：
     --offwhite #fcf5e5  --green #e0e5c1  --yellow #c9ad6a
     --red      #822000  --purple #704cd9
   镜衍都市对应：
     纸底 #f8edd6 / #f4e6c8 / #fffcf5
     墨   #3d3424 / #4a3b28 / #5a4630 / #8a7355
     赭石 #8f6230 / #b8894a / #c4a36a
     青   #3d6f6a    朱 #ac4142
   ============================================================ */

:root {
  /* 关键：换成带中文回落的字体栈。
     Crimson Text / Alegreya 没有汉字字形，必须补中文衬线，
     否则中文会掉到浏览器默认 sans，整页变成「拉丁书卷 + 中文黑体」的割裂感。 */
  --head: 'Crimson Text', "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --body: 'Alegreya', "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --mono: 'Source Code Pro', "Source Han Serif SC", "SimSun", monospace;

  /* Torillic 内部用了 --text-color 但从未定义，补上 */
  --text-color: #3d3424;

  /* ---------- 纸与墨 ---------- */
  --offwhite: #fdf7e9;   /* 纸面：比站底色略亮，读起来像「纸」 */
  --green:    #f2e5c9;   /* 表格隔行 / 引述块 / 代码块底色 */
  --yellow:   #b8894a;   /* 细线与下划线 */
  --red:      #8f6230;   /* 标题 / 加粗 / 序号 / 分隔：赭石 */
  --purple:   #3d6f6a;   /* 链接悬停：青 */

  /* ---------- 桌面（页面外背景）---------- */
  --desk:     #2b231a;
  --desk-2:   #1b150f;
}

/* ---------- 背景：替换原来的 4.6MB 场景图 ---------- */
.torillic-background,
content,
.typora-export-content {
  background-image:
    radial-gradient(ellipse at 50% 0%, #3a2f23 0%, #241d15 45%, #171210 100%);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
}

/* 桌面加一点极细的横向纹理，避免大面积纯渐变 */
.torillic-background::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .35;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 235, 200, .022) 0 1px,
    rgba(0, 0, 0, 0) 1px 4px
  );
}
.torillic-header,
.torillic-page {
  position: relative;
  z-index: 1;
}

/* ---------- 页眉：原来是白字压在深色照片上 ---------- */
.torillic-header h1,
.torillic-header h3,
.torillic-header a,
.torillic-header a:hover {
  color: #f4e6c8;
}
.torillic-header h1 {
  font-family: var(--head);
  letter-spacing: .06em;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, .55);
}
.torillic-header h3 {
  color: #b8894a;
  font-weight: 400;
  letter-spacing: .22em;
  margin-top: -.4em;
}

/* ---------- 导航 ---------- */
/* Torillic 原始 nav 是 grid + auto-flow:column，在中文短词下会竖排堆叠。
   改为横排换行，符合中文规则书的目录习惯。 */
.torillic-header nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .4rem 1.2rem;
}
nav a,
nav a:visited {
  text-decoration-color: rgba(184, 137, 74, .75);
  color: #e6d5b4;
  text-underline-offset: .22em;
  white-space: nowrap;
}
nav a:hover {
  text-decoration-color: #c4a36a;
  color: #fffcf5;
}
nav a.current {
  font-weight: 700;
  color: #f4e6c8;
  text-decoration-color: #c4a36a;
}

/* ---------- 纸页 ---------- */
.torillic-page {
  background-color: var(--offwhite);
  /* 纸纤维：保留 Torillic 的 paper-texture.png，再叠一层暖光 */
  background-image:
    radial-gradient(ellipse at 30% 0%, rgba(255, 252, 245, .8), rgba(253, 247, 233, 0) 60%),
    url("assets/paper-texture.png");
  box-shadow:
    inset 0 0 .1cm .05cm rgba(120, 90, 40, .10),
    0 1px 0 rgba(255, 252, 245, .6) inset,
    1.2cm 1.2cm 1.6cm .2cm rgba(0, 0, 0, .58);
  color: var(--text-color);
}

/* ---------- 标题 ---------- */
h1, h2, h3, h4 {
  font-family: var(--head);
  font-weight: 700;
  font-variant: normal;      /* small-caps 对中文无效，只会让拉丁字母变怪 */
  letter-spacing: .02em;
  color: var(--red);
}
h1 {
  border-bottom: 2pt solid rgba(184, 137, 74, .5);
  padding-bottom: .18em;
  letter-spacing: .06em;
}
h2 {
  letter-spacing: .04em;
}
h3 {
  color: #5a4630;
}
h4 {
  color: #5a4630;
  border-bottom: 1pt solid var(--yellow);
}
h5, h6 {
  color: #4a3b28;
}
h6 {
  text-decoration-color: var(--yellow);
}

/* 正文里 Torillic 用 --red 做加粗色，赭石在纸面上略淡，
   加粗改用深墨以保证可读性，靠字重区分而非靠色相 */
strong, b {
  color: #4a3b28;
}

/* ---------- 链接 ---------- */
a {
  color: #8f6230;
  text-decoration-color: rgba(184, 137, 74, .8);
}
a:visited {
  color: #6b5840;
  text-decoration-color: rgba(184, 137, 74, .5);
}
a:hover {
  color: #3d6f6a;
  text-decoration-color: #3d6f6a;
}
h1 a, h2 a, h3 a, h4 a, strong a {
  color: var(--red);
}

/* ---------- 分隔线：Torillic 那条 8cm 宽的赭石块 ---------- */
hr {
  border-left-color: rgba(184, 137, 74, .32);
}

/* ---------- 引述 ---------- */
blockquote {
  background-color: var(--green);
  border-top: 2pt solid rgba(143, 98, 48, .55);
  border-bottom: 2pt solid rgba(143, 98, 48, .55);
  color: #4a3b28;
}
blockquote blockquote {
  background-color: rgba(255, 252, 245, .65);
}
blockquote p:first-child strong,
blockquote p:first-child b {
  color: #8f6230;
}

/* ---------- 表格 ---------- */
thead, th {
  color: #4a3b28;
  border-bottom: 1.5pt solid rgba(143, 98, 48, .45);
  letter-spacing: .04em;
}
tbody tr:nth-child(odd) {
  background-color: var(--green);
}
td, th {
  border-bottom: .5pt solid rgba(120, 90, 40, .16);
}
tbody tr:hover {
  background-color: rgba(184, 137, 74, .14);
}

/* ---------- 代码 ---------- */
code, pre {
  font-family: var(--mono);
  color: #5a4630;
}
code {
  background: rgba(184, 137, 74, .16);
  padding: .08em .34em;
  border-radius: 2px;
  font-size: .9em;
}
pre {
  background: var(--green);
  border: 1px solid rgba(120, 90, 40, .22);
  border-radius: 2px;
  color: #4a3b28;
}
pre code {
  background: none;
  padding: 0;
}

/* ---------- 列表 ---------- */
li::marker {
  color: #8f6230;
}

/* ---------- 高亮 / 删除线 ---------- */
mark {
  background-color: #e8d9ab;
  color: #3d3424;
}
del {
  text-decoration-color: #ac4142;
}

/* ---------- 图片：Torillic 的 splash 装饰保留，描边改暖色 ---------- */
img {
  background-image: url(assets/splash.png);
}

/* ---------- 页脚 ---------- */
footer.torillic-page {
  color: #6b5840;
  font-size: .92em;
  margin-top: 0;
}
footer.torillic-page a {
  color: #8f6230;
}

/* ---------- 打印：纸面不重复铺底 ---------- */
@media print {
  .torillic-background,
  content,
  .typora-export-content {
    background: none !important;
  }
  .torillic-background::before {
    display: none;
  }
  .torillic-page {
    box-shadow: none;
  }
  .torillic-header h1,
  .torillic-header h3 {
    color: #3d3424;
    text-shadow: none;
  }
  nav {
    display: none;
  }
}
