/* 书桌手帐主题：木纹桌面、黄铜铭牌、皮革按钮、有纸张质感的笔记本 */

:root {
  --ink: #2b2520;
  --ink-soft: #6f6253;
  --pen-blue: #1f3f8a;
  --red-ink: #b3261e;
  --paper: #fbf7ec;
  --rule: rgba(80, 120, 185, 0.32);
  --grid: rgba(90, 130, 190, 0.2);
  --margin-red: rgba(205, 70, 70, 0.55);
  --desk: #4e301d;
  --brass: linear-gradient(180deg, #fbeab4 0%, #e3be68 22%, #b8883a 50%, #e8c876 72%, #a6762a 100%);
  --brushed: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 3px);
  --shadow-paper: 0 1px 1px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.2), 0 14px 26px -8px rgba(0, 0, 0, 0.5);

  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-hand: "LXGW WenKai Screen", "KaiTi", "STKaiti", "Kaiti SC", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-type: "Special Elite", "Courier New", monospace;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

.no-hand {
  --font-hand: var(--font-serif);
}

/* ---------- 基础 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

/* 桌面：木纹 + 每 240px 一条木板缝，相邻木板深浅略有不同 */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--desk);
  background-image:
    url(../images/wood.svg),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0 240px, rgba(0, 0, 0, 0.08) 240px 480px, rgba(0, 0, 0, 0) 480px 720px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 238px, rgba(0, 0, 0, 0.42) 238px 240px);
  background-size: 1000px 640px, auto, auto;
  -webkit-tap-highlight-color: transparent;
}

.desk-oak {
  --desk: #b07f4c;
}

.desk-felt {
  --desk: #2d4a3a;
  background-image:
    url(../images/felt.svg),
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.07), transparent 70%);
  background-size: 240px 240px, auto;
}

.has-desk-img {
  background: var(--desk-img) center / cover fixed, var(--desk);
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

button {
  font: inherit;
}

::selection {
  background: rgba(255, 214, 64, 0.6);
  color: #1d1a16;
}

/* 台灯：左上角一团暖光，四周压暗 */
.lamp {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 12% 0%, rgba(255, 210, 140, 0.28), transparent 70%),
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  animation: lamp-on 1.2s ease-out both;
}

@keyframes lamp-on {
  from { opacity: 0; }
}

/* ---------- 顶部：黄铜铭牌和皮革按钮 ---------- */

.site-header {
  position: relative;
  z-index: 5;
  padding: 28px 20px 8px;
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.nameplate {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 2.6rem 0.7rem;
  text-decoration: none;
  background: var(--brushed), var(--brass);
  border-radius: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(110, 75, 20, 0.45),
    0 1px 0 #6a4714,
    0 6px 14px rgba(0, 0, 0, 0.55);
}

.nameplate::before,
.nameplate::after,
.page-head::before,
.page-head::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  background: url(../images/screw.svg) center / contain no-repeat;
}

.nameplate::before,
.page-head::before {
  left: 12px;
}

.nameplate::after,
.page-head::after {
  right: 12px;
  transform: rotate(70deg);
}

.plate-title {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  line-height: 1.3;
  letter-spacing: 0.14em;
  color: #5a3c0f;
  /* 刻字：上暗下亮 */
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.75), 0 -1px 0 rgba(70, 40, 5, 0.5);
}

.plate-sub {
  margin-top: 0.1rem;
  font-size: 0.78rem;
  line-height: 1.4;
  letter-spacing: 0.22em;
  color: #6b4b17;
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.6);
}

.plate-logo {
  display: block;
  max-height: 56px;
  width: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* 皮革按钮：压线 + 按下去会陷进去 */
.btn-leather {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 1.15rem;
  border: 0;
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  color: #f5e7cd;
  text-decoration: none;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.65);
  background: url(../images/leather.svg) 0 0 / 300px 300px, linear-gradient(#80503a, #5a3322 60%, #4a2918);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 190, 0.28),
    inset 0 -2px 3px rgba(0, 0, 0, 0.3),
    0 1px 0 #24130a,
    0 3px 7px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s;
}

.btn-leather::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(245, 231, 205, 0.45);
  border-radius: 4px;
  pointer-events: none;
}

.btn-leather:hover {
  filter: brightness(1.15);
}

.btn-leather:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 #24130a, 0 1px 2px rgba(0, 0, 0, 0.4);
}

.btn-leather:focus-visible {
  outline: 2px solid #f3cf72;
  outline-offset: 3px;
}

.btn-brass {
  color: #4f340b;
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.7);
  background: var(--brushed), var(--brass);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 0 #6a4714,
    0 3px 7px rgba(0, 0, 0, 0.45);
}

.btn-brass::before {
  border-color: rgba(90, 60, 15, 0.35);
}

.btn-leather.nav-toggle {
  display: none;
}

/* ---------- 布局、纸张面板、标签机贴纸 ---------- */

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
}

.main-col,
.side-col {
  min-width: 0;
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding-top: 6px;
}

.panel {
  position: relative;
  padding: 2rem 1.3rem 1.3rem;
  background: url(../images/paper.svg), var(--paper);
  border-radius: 3px;
  box-shadow: var(--shadow-paper);
}

.panel-title {
  position: absolute;
  top: -13px;
  left: 16px;
  z-index: 2;
  transform: rotate(-2deg);
}

.panel-lead {
  margin: 0;
  color: var(--ink-soft);
}

/* 标签机打出来的塑料标签：白色凸字 */
.dymo {
  display: inline-block;
  margin: 0;
  padding: 0.22rem 0.8rem 0.2rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.2em;
  white-space: nowrap;
  color: #fcfcfc;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 38%, rgba(0, 0, 0, 0.2)), var(--dymo, #1f1f22);
  border-radius: 3px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 -1px 0 rgba(255, 255, 255, 0.25);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 6px -3px rgba(0, 0, 0, 0.4);
}

.dymo-red {
  --dymo: #b3261e;
}

.dymo-blue {
  --dymo: #24498c;
}

.dymo-green {
  --dymo: #2e6a46;
}

/* 半透明胶带 */
.tape {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 110px;
  height: 28px;
  margin-left: -55px;
  background: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.4));
  transform: rotate(-3deg);
  clip-path: polygon(3% 0, 97% 4%, 100% 30%, 97% 60%, 100% 100%, 2% 96%, 0 70%, 3% 40%, 0 10%);
}

/* ---------- 首页便利贴 ---------- */

.memo {
  position: relative;
  z-index: 0;
  --tilt: -1.2deg;
  max-width: 540px;
  margin: 4px 0 42px 10px;
}

.memo-paper {
  position: relative;
  padding: 1.7rem 1.7rem 1.5rem;
  background: linear-gradient(180deg, rgba(150, 120, 0, 0.1), transparent 1.6rem), url(../images/paper.svg), #fff2a0;
  border-bottom-right-radius: 60px 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 10px -4px rgba(0, 0, 0, 0.3);
}

/* 右下角翘起来的阴影 */
.memo-paper::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 14px;
  bottom: 14px;
  width: 55%;
  height: 40%;
  box-shadow: 0 16px 14px rgba(0, 0, 0, 0.5);
  transform: rotate(3deg) skewX(10deg);
}

.memo-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-hand);
  font-size: 1.45rem;
  font-weight: normal;
  color: var(--red-ink);
}

.memo-text {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 1.12rem;
  line-height: 1.9;
  color: #3b3322;
  white-space: pre-line;
}

/* ---------- 文章列表：一页页纸 ---------- */

.note-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* 外层负责倾斜和动画，里层是纸；纸下面两角翘起的阴影用 z-index:-1 的伪元素 */
.note-card {
  position: relative;
  z-index: 0;
  --tilt: -0.5deg;
}

.note-card:nth-child(3n + 2) {
  --tilt: 0.45deg;
}

.note-card:nth-child(3n) {
  --tilt: -0.2deg;
}

.sheet {
  position: relative;
  display: flow-root;
  padding: 1.5rem 1.7rem 1.3rem;
  background: url(../images/paper.svg), var(--paper);
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.14), 0 2px 5px rgba(0, 0, 0, 0.16);
}

.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 14px;
  width: 46%;
  height: 36%;
  max-height: 140px;
  box-shadow: 0 16px 16px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.3s;
}

.sheet::before {
  left: 14px;
  transform: rotate(-3deg);
}

.sheet::after {
  right: 14px;
  transform: rotate(3deg);
}

.note-card:hover .sheet::before,
.note-card:hover .sheet::after {
  box-shadow: 0 26px 20px rgba(0, 0, 0, 0.45);
}

.pushpin {
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 3;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  background: url(../images/pushpin.svg) center / contain no-repeat;
}

/* 拍立得照片 + 回形针 */
.card-photo {
  float: right;
  position: relative;
  z-index: 1;
  width: 210px;
  margin: -0.3rem -0.5rem 0.8rem 1.4rem;
  padding: 8px 8px 28px;
  background: #fdfdfb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 14px -4px rgba(0, 0, 0, 0.35);
  transform: rotate(2.5deg);
  transition: transform 0.3s ease;
}

.card-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.card-photo:hover {
  transform: rotate(0deg) scale(1.03);
}

.paperclip {
  position: absolute;
  top: -24px;
  left: 24px;
  z-index: 2;
  width: 18px;
  height: 54px;
  background: url(../images/paperclip.svg) center / contain no-repeat;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.35));
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-bottom: 0.5rem;
}

/* 撕页日历：红色页头 + 大号日期，下面露出两页 */
.calendar {
  flex: none;
  width: 64px;
  overflow: hidden;
  text-align: center;
  background: #fff;
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 3px 0 -1px #ece7db,
    0 3px 2px -1px rgba(0, 0, 0, 0.25),
    0 6px 0 -2px #e2dccd,
    0 6px 2px -2px rgba(0, 0, 0, 0.2);
}

.cal-top {
  display: block;
  padding: 0.22rem 0 0.12rem;
  font-family: var(--font-type);
  font-size: 0.72rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(#d64538, #a62b21);
}

.cal-day {
  display: block;
  padding-top: 0.1rem;
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.1;
  color: #2b2520;
}

.cal-week {
  display: block;
  padding-bottom: 0.3rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.card-titles {
  min-width: 0;
  padding-top: 0.1rem;
}

.card-titles .dymo {
  margin-bottom: 0.4rem;
  transform: rotate(-1.5deg);
}

.card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.42rem;
  line-height: 1.45;
}

/* 标题悬停时像荧光笔划过 */
.card-title a {
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(transparent 58%, rgba(255, 214, 64, 0.7) 58%, rgba(255, 214, 64, 0.7) 92%, transparent 92%)
    no-repeat 0 0 / 0% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 0.45s ease;
}

.card-title a:hover,
.card-title a:focus-visible {
  background-size: 100% 100%;
}

.card-weather {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.lock {
  margin-right: 0.2em;
  font-size: 0.8em;
}

.card-excerpt {
  margin: 0.5rem 0 1.1rem;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  line-height: 1.85;
  color: #4b4136;
}

.card-foot {
  clear: both;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(110, 90, 60, 0.35);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.views {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.card-more {
  padding: 0.42rem 1rem;
  font-size: 0.88rem;
}

.empty-sheet p {
  margin: 1.2rem 0;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--ink-soft);
}

/* 分类：牛皮纸文件夹的耳朵 */
.folder-tab {
  display: inline-block;
  padding: 0.2rem 0.8rem 0.12rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #5a4318;
  text-decoration: none;
  background: url(../images/paper.svg), linear-gradient(#f3dfab, #e1c27f);
  border-radius: 7px 7px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 0 #c9a660, 0 2px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.folder-tab:hover {
  transform: translateY(-2px);
}

/* 标签：带打孔的牛皮纸吊牌 */
.kraft-tag {
  position: relative;
  display: inline-block;
  padding: 0.2rem 0.75rem 0.14rem 1.35rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #46301a;
  text-decoration: none;
  background:
    radial-gradient(circle at 0.62rem 50%, #fbf7ec 0 0.17rem, #8b7d68 0.19rem 0.25rem, transparent 0.27rem),
    url(../images/paper.svg),
    linear-gradient(#d8b47c, #c39a5f);
  clip-path: polygon(0.6rem 0, 100% 0, 100% 100%, 0.6rem 100%, 0 50%);
  transition: transform 0.2s;
}

.kraft-tag:hover {
  transform: rotate(-4deg);
}

/* ---------- 侧边栏 ---------- */

/* 名片：挂绳证件卡 */
.id-card {
  position: relative;
  --tilt: 1.2deg;
  padding: 1.5rem 1.2rem 1.1rem;
  overflow: hidden;
  background: url(../images/paper.svg), linear-gradient(#ffffff, #f3f0e8);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), var(--shadow-paper);
}

.id-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 6px, transparent 6px 12px),
    linear-gradient(#2c4c80, #1d3560);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.id-slot {
  position: absolute;
  top: 11px;
  left: 50%;
  z-index: 1;
  width: 48px;
  height: 9px;
  margin-left: -24px;
  border-radius: 5px;
  background: #2e1d12;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.35);
}

.id-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-top: 10px;
}

.id-photo {
  flex: none;
  width: 76px;
  height: 94px;
  object-fit: cover;
  background: #dfe6ee;
  border: 3px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.id-text {
  min-width: 0;
  padding-top: 28px;
}

.id-name {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1.3;
  color: #1f2a3c;
  overflow-wrap: anywhere;
}

.id-line {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.id-bio {
  margin: 0.9rem 0 0;
  padding-top: 0.7rem;
  font-family: var(--font-hand);
  font-size: 1.02rem;
  color: var(--pen-blue);
  border-top: 1px dashed rgba(0, 0, 0, 0.15);
}

.id-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0.9rem 0 0;
  padding: 0.6rem 0 0;
  list-style: none;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.id-stats li + li {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.9);
}

.id-stats b {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.3;
  color: #1f2a3c;
}

.id-stats span {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* 分类：一排挂着的文件夹，耳朵错开 */
.file-drawer {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-drawer a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 12px;
  padding: 0.5rem 0.8rem 0.45rem;
  font-size: 0.92rem;
  color: #4e3914;
  text-decoration: none;
  background: url(../images/paper.svg), linear-gradient(#f3dfab, #e0c07c);
  border-radius: 0 6px 4px 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 -1px 3px rgba(0, 0, 0, 0.18), 0 1px 1px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.file-drawer a::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  width: 38%;
  height: 11px;
  background: #f3dfab;
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 -1px 2px rgba(0, 0, 0, 0.14);
}

.file-drawer li:nth-child(3n + 2) a::before {
  left: 31%;
}

.file-drawer li:nth-child(3n) a::before {
  left: 62%;
}

.file-drawer a:hover {
  transform: translateY(-4px);
}

.file-drawer em {
  font-style: normal;
  font-family: var(--font-type);
  font-size: 0.8rem;
  color: #7a5c22;
}

.tag-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.45rem;
}

/* 最近写的：黄色便笺本，顶上是红色的胶装 */
.legal-pad {
  --line: 1.95rem;
  position: relative;
  padding: 2.1rem 0.9rem 0.9rem 2.7rem;
  background-color: #fcf3a8;
  background-image:
    linear-gradient(
      90deg,
      transparent 2rem,
      var(--margin-red) 2rem,
      var(--margin-red) calc(2rem + 1px),
      transparent calc(2rem + 1px),
      transparent 2.2rem,
      var(--margin-red) 2.2rem,
      var(--margin-red) calc(2.2rem + 1px),
      transparent calc(2.2rem + 1px)
    ),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent calc(var(--line) - 1px),
      var(--rule) calc(var(--line) - 1px),
      var(--rule) var(--line)
    ),
    url(../images/paper.svg);
  background-position: 0 0, 0 2.1rem, 0 0;
  border-radius: 0 0 3px 3px;
  box-shadow: var(--shadow-paper);
}

.legal-pad::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: url(../images/leather.svg) 0 0 / 300px 300px, linear-gradient(#8e2b22, #6a1d16);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.pad-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pad-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  height: var(--line);
  line-height: var(--line);
}

.pad-list a {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-hand);
  font-size: 1.02rem;
  color: var(--pen-blue);
  text-decoration: none;
}

.pad-list a:hover {
  text-decoration: underline;
}

.pad-list time {
  flex: none;
  font-family: var(--font-type);
  font-size: 0.75rem;
  color: #8a7a52;
}

/* 目录：夹着一根红色书签带 */
.toc-panel {
  position: sticky;
  top: 20px;
}

.toc-panel[hidden] {
  display: none;
}

.ribbon {
  position: absolute;
  top: -6px;
  right: 22px;
  width: 20px;
  height: 64px;
  background: linear-gradient(90deg, #8f1d17, #d0382d 45%, #a5241c);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}

.toc {
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow: auto;
}

.toc a {
  display: block;
  padding: 0.22rem 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
  text-decoration: none;
  border-radius: 3px;
}

.toc a.lv3 {
  padding-left: 1.4rem;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.toc a:hover {
  background: rgba(0, 0, 0, 0.05);
}

.toc a.active {
  color: #1d1a16;
  background: linear-gradient(transparent 15%, rgba(255, 214, 64, 0.65) 15%, rgba(255, 214, 64, 0.65) 90%, transparent 90%);
}

/* ---------- 笔记本 ---------- */

.layout-note {
  padding-top: 6px;
}

.book-stage {
  position: relative;
  perspective: 2400px;
}

/* 右边和下边一层层的纸边，看起来是一本有厚度的本子 */
.notebook {
  position: relative;
  padding: 2.5rem 2.4rem 2.2rem 4.4rem;
  background: url(../images/paper.svg), var(--paper);
  border-radius: 3px 6px 6px 3px;
  box-shadow:
    1px 1px 0 #e7decb,
    2px 2px 0 #f8f3e7,
    3px 3px 0 #e4dac5,
    4px 4px 0 #f6f0e2,
    5px 5px 0 #dcd1b9,
    0 16px 30px -6px rgba(0, 0, 0, 0.6),
    0 3px 8px rgba(0, 0, 0, 0.3);
}

/* 学习笔记左边的金属线圈 */
.notebook::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 22px;
  bottom: 22px;
  z-index: 3;
  width: 46px;
  background: url(../images/rings.svg) center top / 46px 34px repeat-y;
  pointer-events: none;
}

.paper-grid {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    url(../images/paper.svg);
  background-size: 22px 22px, 22px 22px, auto;
}

.paper-dot {
  background-image: radial-gradient(circle, rgba(90, 110, 150, 0.4) 1px, transparent 1.4px), url(../images/paper.svg);
  background-size: 22px 22px, auto;
}

.paper-ruled .note-body,
.paper-diary .note-body {
  --line: 2.2rem;
  line-height: var(--line);
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent calc(var(--line) - 1px),
    var(--rule) calc(var(--line) - 1px),
    var(--rule) var(--line)
  );
  /* 横线往上挪一点，让字坐在线上 */
  background-position: 0 -0.45rem;
}

.paper-ruled .note-body p,
.paper-diary .note-body p,
.paper-ruled .note-body li,
.paper-diary .note-body li {
  line-height: var(--line);
}

.paper-ruled .note-body p,
.paper-diary .note-body p {
  margin: 0 0 var(--line);
}

/* 日记：线装本，左边是装订的阴影和缝线，下面露出一根书签带 */
.paper-diary {
  padding-left: 3.2rem;
  background:
    linear-gradient(90deg, rgba(60, 40, 20, 0.22), rgba(60, 40, 20, 0.06) 1.4rem, transparent 3rem),
    url(../images/paper.svg),
    #fbf4e2;
}

.paper-diary::before {
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(180deg, rgba(120, 85, 50, 0.55) 0 12px, transparent 12px 26px);
}

.paper-diary::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 64px;
  bottom: -46px;
  width: 18px;
  height: 70px;
  background: linear-gradient(90deg, #8f1d17, #cf392e 45%, #a4241c);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
}

.paper-diary .note-body {
  padding-left: 2.6rem;
  margin-left: -1rem;
  font-size: 1.15rem;
  background-position: 0 0, 0 -0.45rem;
  background-image:
    linear-gradient(
      90deg,
      transparent 1.6rem,
      var(--margin-red) 1.6rem,
      var(--margin-red) calc(1.6rem + 1px),
      transparent calc(1.6rem + 1px)
    ),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent calc(var(--line) - 1px),
      var(--rule) calc(var(--line) - 1px),
      var(--rule) var(--line)
    );
}

/* 单独页面（关于我等）：一张没有线圈的白纸 */
.paper-page {
  padding-left: 2.4rem;
}

.paper-page::before {
  display: none;
}

.desk-photo {
  position: absolute;
  z-index: 4;
  width: 130px;
  padding: 7px 7px 24px;
  background: #fdfdfb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 10px 16px -6px rgba(0, 0, 0, 0.4);
  transform: rotate(var(--rot, 0deg));
  pointer-events: none;
  animation: photo-drop 0.6s cubic-bezier(0.2, 1.2, 0.4, 1) 1.8s both;
}

.desk-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.desk-photo::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 20px;
  margin-left: -35px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  transform: rotate(-5deg);
}

@keyframes photo-drop {
  from { opacity: 0; transform: translateY(-30px) rotate(var(--rot, 0deg)) scale(1.15); }
}

.note-head {
  position: relative;
  margin-bottom: 1.6rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(120, 90, 60, 0.3);
}

.dateline {
  margin: 0 0 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.3rem;
  font-family: var(--font-hand);
  font-size: 1.02rem;
  color: var(--ink-soft);
}

.dl-item {
  margin-left: 0.6rem;
}

.dateline .dl-item:first-child {
  margin-left: 0;
}

.blank {
  display: inline-block;
  min-width: 2.2em;
  padding: 0 0.35em;
  margin: 0 0.15em;
  text-align: center;
  font-size: 1.1rem;
  color: var(--pen-blue);
  border-bottom: 1px solid rgba(90, 70, 50, 0.55);
}

.note-head .dymo {
  transform: rotate(-1.5deg);
}

.note-title {
  margin: 0.7rem 0 0.8rem;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  line-height: 1.35;
  color: #1f1b17;
}

/* ---------- 正文 ---------- */

.note-body {
  font-family: var(--font-hand);
  font-size: 1.08rem;
  line-height: 1.95;
  color: #2e2822;
  overflow-wrap: anywhere;
}

.note-body > :first-child {
  margin-top: 0;
}

.note-body h1,
.note-body h2,
.note-body h3,
.note-body h4 {
  font-family: var(--font-serif);
  font-weight: 900;
  line-height: 1.5;
  color: #1f1b17;
  scroll-margin-top: 20px;
}

/* 二级标题用荧光笔涂一道 */
.note-body h2 {
  display: table;
  margin: 2.2rem 0 1rem;
  padding: 0 0.25em;
  font-size: 1.5rem;
  background: linear-gradient(transparent 58%, rgba(255, 214, 64, 0.55) 58%, rgba(255, 214, 64, 0.55) 92%, transparent 92%);
}

.note-body h3 {
  margin: 1.8rem 0 0.8rem;
  font-size: 1.22rem;
  color: var(--pen-blue);
}

.note-body h3::before {
  content: "▍";
  color: var(--red-ink);
}

.note-body h4 {
  font-size: 1.08rem;
}

.note-body a {
  color: var(--pen-blue);
  text-decoration: underline;
  text-decoration-color: rgba(31, 63, 138, 0.4);
  text-underline-offset: 4px;
}

.note-body a:hover {
  text-decoration-color: currentColor;
}

.note-body strong {
  background: linear-gradient(transparent 62%, rgba(255, 214, 64, 0.6) 62%);
}

.note-body mark {
  padding: 0 0.15em;
  background: rgba(255, 214, 64, 0.7);
}

.note-body del {
  text-decoration-color: var(--red-ink);
}

.note-body ul {
  padding-left: 1.5rem;
  list-style: none;
}

.note-body ul > li {
  position: relative;
}

.note-body ul > li::before {
  content: "";
  position: absolute;
  left: -1.1rem;
  top: 0.8em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pen-blue);
  opacity: 0.75;
}

.note-body ol {
  padding-left: 1.8rem;
}

.note-body ol > li::marker {
  font-family: var(--font-serif);
  font-weight: 900;
  color: var(--red-ink);
}

/* 引用：贴上去的黄色便利贴 */
.note-body blockquote {
  position: relative;
  margin: 1.6rem 0.4rem;
  padding: 1rem 1.2rem;
  background: url(../images/paper.svg), #fff4a8;
  border-bottom-right-radius: 40px 6px;
  transform: rotate(-0.6deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 12px -6px rgba(0, 0, 0, 0.35);
}

.note-body blockquote::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 42%;
  width: 84px;
  height: 22px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  transform: rotate(-4deg);
}

.note-body blockquote p {
  margin: 0;
}

.note-body blockquote p + p {
  margin-top: 0.6em;
}

.note-body blockquote p:last-child {
  margin-bottom: 0;
}

.note-body code {
  padding: 0.1em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(60, 50, 40, 0.07);
  border: 1px solid rgba(60, 50, 40, 0.14);
  border-radius: 4px;
}

/* 代码块：针式打印机的连续纸，两边有齿孔，绿白相间 */
.note-body pre,
.note-body shiki-code {
  --holes: radial-gradient(circle, rgba(110, 95, 70, 0.22) 0 0.25rem, transparent 0.28rem);
  --perf: linear-gradient(
    90deg,
    transparent 1.6rem,
    rgba(0, 0, 0, 0.12) 1.6rem,
    rgba(0, 0, 0, 0.12) calc(1.6rem + 1px),
    transparent calc(1.6rem + 1px),
    transparent calc(100% - 1.6rem - 1px),
    rgba(0, 0, 0, 0.12) calc(100% - 1.6rem - 1px),
    rgba(0, 0, 0, 0.12) calc(100% - 1.6rem),
    transparent calc(100% - 1.6rem)
  );
  position: relative;
  display: block;
  margin: 1.6rem 0;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 12px -6px rgba(0, 0, 0, 0.35);
}

.note-body pre {
  padding: 1rem 2.4rem;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #24292f;
  background:
    var(--holes) left top / 1.6rem 1.6rem repeat-y,
    var(--holes) right top / 1.6rem 1.6rem repeat-y,
    var(--perf),
    repeating-linear-gradient(180deg, #e7f2e1 0 4.32rem, #fbfdf8 4.32rem 8.64rem) 0 1rem,
    #fbfdf8;
}

/* 装了 Shiki 代码高亮插件时，代码在 shiki-code 组件里，只给外面加齿孔纸边 */
.note-body shiki-code {
  padding: 0.3rem 1.8rem;
  overflow: hidden;
  background:
    var(--holes) left top / 1.6rem 1.6rem repeat-y,
    var(--holes) right top / 1.6rem 1.6rem repeat-y,
    #fbfdf8;
}

.note-body shiki-code pre {
  margin: 0;
  box-shadow: none;
}

.note-body pre code {
  padding: 0;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
}

/* 图片：拍立得相片 */
.note-body img {
  display: block;
  height: auto;
  margin: 1.8rem auto;
  padding: 10px 10px 34px;
  background: #fdfdfb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 20px -8px rgba(0, 0, 0, 0.4);
  transform: rotate(-1deg);
  transition: transform 0.3s ease;
}

.note-body img:hover {
  transform: rotate(0deg) scale(1.02);
}

/* 表格：账本 */
.note-body table {
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.4rem 0;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.6;
  background: url(../images/paper.svg), #fffdf6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.note-body th,
.note-body td {
  padding: 0.45rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(80, 120, 185, 0.25);
}

.note-body td + td,
.note-body th + th {
  border-left: 1px solid rgba(179, 38, 30, 0.2);
}

.note-body th {
  font-family: var(--font-serif);
  color: #1f1b17;
  background: rgba(80, 120, 185, 0.06);
  border-bottom: 3px double rgba(179, 38, 30, 0.55);
}

/* 分隔线：剪刀 + 虚线 */
.note-body hr {
  position: relative;
  height: 1.6rem;
  margin: 2rem 0;
  padding-left: 1.8rem;
  border: 0;
  background: linear-gradient(90deg, rgba(90, 70, 50, 0.45) 50%, transparent 50%) 0 50% / 12px 1px repeat-x;
  background-clip: content-box;
  overflow: visible;
}

.note-body hr::before {
  content: "✂";
  position: absolute;
  left: 0;
  top: 50%;
  font-size: 1.1rem;
  line-height: 1;
  color: #6b5d4b;
  transform: translateY(-55%);
}

.note-sign {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.4rem;
  margin-top: 2.4rem;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* 红色橡皮章：用噪点遮罩做出没盖匀的效果，滚动到这里时才盖下去 */
.ink-stamp {
  display: inline-block;
  padding: 0.3rem 0.9rem 0.25rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.25em;
  color: #b9231c;
  border: 4px double #b9231c;
  border-radius: 6px;
  -webkit-mask: url(../images/grunge.svg) 0 0 / 160px 160px;
  mask: url(../images/grunge.svg) 0 0 / 160px 160px;
  mix-blend-mode: multiply;
  transform: rotate(-9deg);
}

@keyframes stamp {
  from { transform: rotate(-24deg) scale(2.4); opacity: 0; }
  to { transform: rotate(-9deg) scale(1); opacity: 1; }
}

/* ---------- 翻开的封面 ---------- */

.book-cover {
  position: absolute;
  inset: 0;
  z-index: 20;
  transform-origin: left center;
  transform-style: preserve-3d;
  animation: book-open 1.3s cubic-bezier(0.55, 0.06, 0.3, 1) 0.5s both;
  cursor: pointer;
}

.cover-front,
.cover-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 4px 10px 10px 4px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.cover-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  padding: clamp(48px, 10vh, 110px) 2.5rem 0 3rem;
}

/* 日记：深棕皮面，压线，烫金字，松紧带，黄铜包角 */
.cover-diary .cover-front {
  background:
    url(../images/leather.svg) 0 0 / 300px 300px,
    radial-gradient(ellipse at 35% 18%, #7d3f2c, #52241a 55%, #391811);
  box-shadow:
    inset 10px 0 16px -8px rgba(0, 0, 0, 0.7),
    inset 0 0 60px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 30px -8px rgba(0, 0, 0, 0.6);
}

.cover-diary .cover-front::before {
  content: "";
  position: absolute;
  inset: 14px 14px 14px 32px;
  border: 2px dashed rgba(232, 204, 160, 0.5);
  border-radius: 4px 8px 8px 4px;
  pointer-events: none;
}

.cover-front::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 4px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.08));
}

.foil-kind,
.foil-title,
.foil-date {
  color: transparent;
  background: linear-gradient(180deg, #fff3bf 0%, #e3b955 40%, #9d6c1e 58%, #f0d283 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.65));
}

.foil-kind {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.45em;
}

.foil-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  max-width: 78%;
  padding: 1.2rem 1.6rem;
  border: 2px solid #c9a04a;
  border-radius: 4px;
  outline: 1px solid rgba(201, 160, 74, 0.6);
  outline-offset: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.foil-title {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-align: center;
}

.foil-date {
  font-family: var(--font-type);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
}

.cover-photo {
  width: min(170px, 46%);
  height: auto;
  padding: 6px 6px 18px;
  background: #fdfdfb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transform: rotate(-2deg);
}

.elastic {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 46px;
  width: 14px;
  background: linear-gradient(90deg, #070707, #3d3d3d 40%, #1b1b1b 62%, #050505);
  box-shadow: 3px 0 5px rgba(0, 0, 0, 0.55), -2px 0 3px rgba(0, 0, 0, 0.45);
}

.corner {
  position: absolute;
  right: 0;
  width: 40px;
  height: 40px;
  background: var(--brass);
}

.corner-t {
  top: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.corner-b {
  bottom: 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* 学习笔记：深蓝布面，书脊包一条布，中间贴一张写着科目的标签 */
.cover-study .cover-front {
  gap: 1.4rem;
  padding-left: 4.5rem;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.09) 0 1px, transparent 1px 3px),
    url(../images/paper.svg),
    linear-gradient(135deg, #3a5788, #243c66);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.35), 0 18px 30px -8px rgba(0, 0, 0, 0.6);
}

.cover-study .cover-front::after {
  left: 44px;
}

.cloth-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 44px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
    linear-gradient(90deg, #142542, #1d3356 70%, #13233f);
}

.cover-label {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(330px, 82%);
  padding: 1rem 1.3rem 1.1rem;
  background: url(../images/paper.svg), #fbf9f1;
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 3px #fbf9f1,
    inset 0 0 0 4px #3a5788,
    0 2px 0 rgba(0, 0, 0, 0.15),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

.label-head {
  padding-bottom: 0.4rem;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: #24406e;
  border-bottom: 2px solid #3a5788;
}

.label-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid rgba(36, 64, 110, 0.4);
}

.label-line small {
  flex: none;
  font-size: 0.78rem;
  color: #4a5f85;
}

.label-line b {
  flex: 1;
  min-width: 0;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  font-weight: normal;
  line-height: 1.5;
  color: var(--pen-blue);
}

/* 封面内侧：大理石纹衬纸 */
.cover-back {
  transform: rotateY(180deg);
  background: url(../images/paper.svg), repeating-radial-gradient(circle at 30% 40%, #e9dbbf 0 7px, #f1e6cf 7px 14px);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2);
}

.cover-study .cover-back {
  background: url(../images/paper.svg), repeating-linear-gradient(45deg, #e3e8f0 0 10px, #eef1f6 10px 20px);
}

@keyframes book-open {
  0% { transform: rotateY(0deg); opacity: 1; }
  15% { transform: rotateY(-8deg); }
  75% { opacity: 1; }
  100% { transform: rotateY(-178deg); opacity: 0; visibility: hidden; }
}

.book-stage:not(.no-open) .notebook {
  animation: page-reveal 1.2s ease 0.6s both;
}

@keyframes page-reveal {
  from { filter: brightness(0.78); }
  to { filter: none; }
}

.book-stage.opened .book-cover {
  display: none;
}

.book-stage.opened .notebook {
  filter: none;
}

/* ---------- 上一篇 / 下一篇：带索引耳朵的纸条 ---------- */

.note-cursor {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px 18px;
  margin-top: 40px;
}

.page-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 0 1 calc(50% - 9px);
  min-width: 0;
  padding: 0.8rem 1.2rem 0.85rem;
  color: var(--ink);
  text-decoration: none;
  background: url(../images/paper.svg), var(--paper);
  border-radius: 3px;
  box-shadow: var(--shadow-paper);
  transition: transform 0.25s ease;
}

.page-tab.next {
  margin-left: auto;
  text-align: right;
}

.page-tab small {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.page-tab span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-serif);
  font-weight: 600;
}

.page-tab::after {
  content: "";
  position: absolute;
  top: -10px;
  left: 16px;
  width: 46px;
  height: 11px;
  background: linear-gradient(#e8f0ff, #b9cdee);
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 -1px 2px rgba(0, 0, 0, 0.15);
}

.page-tab.next::after {
  left: auto;
  right: 16px;
  background: linear-gradient(#fff0f0, #f0bcbc);
}

.page-tab:hover {
  transform: translateY(-4px);
}

/* 评论组件在 Shadow DOM 里，只能通过它提供的变量改颜色 */
.comment-panel {
  margin-top: 46px;
  --halo-cw-primary-1-color: #6a3b26;
  --halo-cw-primary-3-color: #a8744f;
  --halo-cw-text-1-color: #2b2520;
  --halo-cw-base-font-family: var(--font-body);
}

/* ---------- 分类 / 标签 / 作者 / 归档页头：黄铜标签框 ---------- */

.page-head {
  position: relative;
  margin: 0 0 36px;
  padding: 12px 36px;
  background: var(--brushed), var(--brass);
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 2px 0 #6a4714,
    0 8px 16px rgba(0, 0, 0, 0.5);
}

.head-card {
  padding: 0.9rem 1.4rem 1rem;
  background: url(../images/paper.svg), #fbfaf4;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.head-kind {
  font-family: var(--font-type);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  color: var(--red-ink);
}

.head-name {
  margin: 0.1rem 0 0.2rem;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 900;
  line-height: 1.3;
  color: #1f1b17;
}

.head-desc {
  margin: 0 0 0.2rem;
  font-family: var(--font-hand);
  color: #4b4136;
}

.head-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- 归档：分年的牛皮纸隔页 ---------- */

.planner {
  padding: 2rem 1.8rem 1.6rem;
}

.year-tab {
  display: inline-block;
  margin: 1.4rem 0 0;
  padding: 0.3rem 1.4rem 0.2rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.4;
  color: #4e3914;
  background: url(../images/paper.svg), linear-gradient(#f3dfab, #e9cf91);
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 -1px 2px rgba(0, 0, 0, 0.15);
}

.planner > .year-tab:first-child {
  margin-top: 0;
}

.year-body {
  padding: 0.6rem 1.2rem 1rem;
  background: url(../images/paper.svg), linear-gradient(#e9cf91, #f2e2b9 3rem, #f7ecd0);
  border-radius: 0 6px 6px 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.month-head {
  margin: 0.9rem 0 0.3rem;
  line-height: 1.4;
}

.month-cal {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  padding: 0.05rem 0.7rem;
  font-size: 0.8rem;
  font-weight: normal;
  color: #fff;
  background: linear-gradient(#d64538, #a62b21);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.month-cal b {
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.entry-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.3rem 0;
}

.entry-list a {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.entry-list a:hover {
  color: var(--pen-blue);
}

.leader {
  flex: 1;
  min-width: 1.5rem;
  border-bottom: 2px dotted rgba(90, 70, 50, 0.35);
  transform: translateY(-0.3em);
}

.entry-list time {
  flex: none;
  font-family: var(--font-type);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- 分类页：一个个牛皮纸文件夹 ---------- */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 42px 26px;
  margin: 0;
  padding: 16px 0 0;
  list-style: none;
}

.folder-item {
  position: relative;
  z-index: 0;
}

.folder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 150px;
  padding: 1.1rem 1.1rem 1rem;
  color: #4e3914;
  text-decoration: none;
  background: url(../images/paper.svg), linear-gradient(172deg, #f4e1b0, #e2c27f);
  border-radius: 0 8px 6px 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.3),
    0 12px 20px -8px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease;
}

/* 文件夹里露出来的一张纸 */
.folder::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -8px;
  left: 34%;
  right: 12px;
  height: 30px;
  background: url(../images/paper.svg), #fff;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  transform: rotate(-2deg);
  transition: transform 0.25s ease;
}

.folder:hover {
  transform: translateY(-4px);
}

.folder:hover::before {
  transform: rotate(-4deg) translateY(-8px);
}

.folder-ear {
  position: absolute;
  top: -21px;
  left: 0;
  height: 22px;
  padding: 0.15rem 0.9rem 0;
  font-family: var(--font-type);
  font-size: 0.75rem;
  line-height: 1.6;
  background: url(../images/paper.svg), #f4e1b0;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 -1px 2px rgba(0, 0, 0, 0.15);
}

.folder-label {
  margin-top: 0.5rem;
  padding: 0.35rem 0.9rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.4;
  color: #1f1b17;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transform: rotate(-1deg);
}

.folder-desc {
  margin-top: 0.7rem;
  font-family: var(--font-hand);
  font-size: 0.98rem;
  line-height: 1.6;
  color: #6a5122;
}

/* 子分类：父文件夹下面的小文件夹 */
.folder-item > .folder-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 10px;
  padding-top: 24px;
}

.folder-item > .folder-grid .folder {
  min-height: 0;
  padding: 0.3rem 0.7rem 0.4rem;
}

.folder-item > .folder-grid .folder-label {
  margin: 0;
  padding: 0.15rem 0.6rem;
  font-size: 0.92rem;
}

.folder-item > .folder-grid .folder-ear {
  top: -16px;
  height: 17px;
  padding: 0 0.6rem;
  font-size: 0.65rem;
}

.folder-item > .folder-grid .folder-desc,
.folder-item > .folder-grid .folder::before {
  display: none;
}

/* ---------- 标签页：挂绳牛皮纸吊牌 ---------- */

.tag-board {
  padding: 2.4rem 1.4rem 1.8rem;
}

.tag-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 22px;
  padding-top: 14px;
}

.hang-tag {
  position: relative;
  display: block;
  width: 124px;
  color: #3f2a12;
  text-decoration: none;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
  transform-origin: 50% -14px;
}

/* 穿过孔的绳子，颜色用标签在后台设置的颜色 */
.hang-tag::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  z-index: 1;
  width: 16px;
  height: 32px;
  margin-left: -8px;
  border: 2px solid var(--string, #9a7b4f);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.tag-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1.9rem 0.6rem 0.9rem;
  text-align: center;
  background:
    radial-gradient(circle at 50% 14px, #fbf7ec 0 5px, #8b7d68 5.5px 7.5px, transparent 8px),
    url(../images/paper.svg),
    linear-gradient(#dbb882, #c39a60);
  clip-path: polygon(24% 0, 76% 0, 100% 18%, 100% 100%, 0 100%, 0 18%);
}

.tag-name {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tag-count {
  font-style: normal;
  font-family: var(--font-type);
  font-size: 0.78rem;
  color: #6b4e25;
}

.hang-tag:hover {
  animation: swing 1s ease;
}

@keyframes swing {
  0% { rotate: 0deg; }
  20% { rotate: 7deg; }
  45% { rotate: -5deg; }
  70% { rotate: 2.5deg; }
  100% { rotate: 0deg; }
}

/* ---------- 分页 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.pager-info {
  padding: 0.3rem 1rem;
  font-family: var(--font-type);
  font-size: 0.95rem;
  background: url(../images/paper.svg), var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: rotate(-1.5deg);
}

/* ---------- 页脚：桌子前沿，上面随手放着笔和回形针 ---------- */

.site-footer {
  position: relative;
  margin-top: 30px;
}

.desk-items {
  position: relative;
  max-width: 1180px;
  height: 96px;
  margin: 0 auto;
  pointer-events: none;
}

.item {
  position: absolute;
  background: center / contain no-repeat;
  filter: drop-shadow(4px 6px 4px rgba(0, 0, 0, 0.5));
}

.pencil {
  left: 4%;
  bottom: 18px;
  width: 280px;
  height: 28px;
  background-image: url(../images/pencil.svg);
  rotate: -7deg;
}

.pen {
  right: 5%;
  bottom: 28px;
  width: 290px;
  height: 31px;
  background-image: url(../images/pen.svg);
  rotate: 9deg;
}

.clip-a,
.clip-b {
  width: 17px;
  height: 51px;
  background-image: url(../images/paperclip.svg);
}

.clip-a {
  left: 44%;
  bottom: 26px;
  rotate: 72deg;
}

.clip-b {
  left: calc(44% + 34px);
  bottom: 34px;
  rotate: 118deg;
}

.desk-edge {
  position: relative;
  padding: 24px 20px 28px;
  background:
    linear-gradient(180deg, rgba(255, 230, 190, 0.22) 0, rgba(255, 230, 190, 0.06) 3px, rgba(0, 0, 0, 0.1) 4px, rgba(0, 0, 0, 0.45) 100%),
    url(../images/wood.svg) 0 0 / 1000px 640px,
    var(--desk);
  box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.35);
}

.desk-felt .desk-edge {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0, rgba(255, 255, 255, 0.03) 3px, rgba(0, 0, 0, 0.1) 4px, rgba(0, 0, 0, 0.45) 100%),
    url(../images/felt.svg) 0 0 / 240px 240px,
    var(--desk);
}

.has-desk-img .desk-edge {
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.72));
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  text-align: center;
}

.footer-plate {
  display: inline-block;
  margin: 0 0 0.7rem;
  padding: 0.3rem 1.6rem;
  font-family: var(--font-serif);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #5a3c0f;
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.7), 0 -1px 0 rgba(70, 40, 5, 0.5);
  background: var(--brushed), var(--brass);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 0 #6a4714, 0 4px 8px rgba(0, 0, 0, 0.5);
}

.footer-powered {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(240, 224, 196, 0.78);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}

.footer-powered a {
  color: #f3cf72;
}

/* 回到顶部：黄铜圆按钮 */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  font-size: 0.95rem;
  color: #5a3c0f;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.7), 0 -1px 0 rgba(70, 40, 5, 0.4);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff4c9, #e1b95d 42%, #a5741f 85%, #7a5214);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    inset 0 -3px 5px rgba(0, 0, 0, 0.3),
    0 0 0 3px rgba(60, 35, 10, 0.55),
    0 6px 12px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(16px) scale(0.85);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.to-top.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top:active {
  transform: translateY(2px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(60, 35, 10, 0.55), 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ---------- 404：被撕掉的一页 ---------- */

.lost {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 0 10px;
}

.torn-wrap {
  width: min(540px, 100%);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5));
  transform: rotate(-1.5deg);
}

.torn-page {
  padding: 2.6rem 2rem 4rem;
  text-align: center;
  background: url(../images/paper.svg), var(--paper);
  clip-path: polygon(
    0 0, 100% 0, 100% 93%, 96% 96%, 92% 92%, 87% 97%, 82% 93%, 77% 98%, 71% 94%, 66% 97%, 60% 93%,
    55% 98%, 49% 94%, 44% 97%, 38% 92%, 33% 97%, 27% 94%, 22% 98%, 16% 93%, 11% 97%, 6% 94%, 0 97%
  );
}

.lost-code {
  margin: 0;
  font-family: var(--font-type);
  font-size: clamp(4rem, 14vw, 6.5rem);
  font-weight: normal;
  line-height: 1;
  letter-spacing: 0.1em;
  color: #2b2520;
}

.lost-title {
  margin: 0.6rem 0 0.2rem;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 900;
}

.lost-detail {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
}

.crumple {
  width: 120px;
  margin-top: -6px;
  animation: roll-in 1s cubic-bezier(0.3, 1.2, 0.5, 1) 0.3s both;
}

@keyframes roll-in {
  from { transform: translateX(160px) rotate(220deg); opacity: 0; }
}

/* ---------- 动画：纸张落到桌上、盖章、翻页跳转 ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(-16px) rotate(var(--tilt, 0deg)) scale(1.035);
}

.js .reveal.in {
  opacity: 1;
  transform: rotate(var(--tilt, 0deg));
  transition: opacity 0.45s ease, transform 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

/* .reveal.in 的 transform 优先级更高，悬停效果要单独再写一遍 */
.js .note-card.reveal.in:hover {
  transform: rotate(0deg) translateY(-6px);
  transition: transform 0.35s ease;
}

.js .entry-list li.reveal.in:hover {
  transform: translateX(6px);
  transition: transform 0.2s;
}

.js .ink-stamp {
  opacity: 0;
}

.js .ink-stamp.in {
  animation: stamp 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) 0.2s both;
}

.js body:not(.page-post) .site-main {
  animation: turn-in 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  transform-origin: 100% 50%;
}

@keyframes turn-in {
  from { transform: perspective(1800px) rotateY(24deg) translateX(3%); opacity: 0; }
}

body.page-leaving .site-main {
  animation: turn-out 0.42s cubic-bezier(0.5, 0, 0.75, 0) forwards;
  transform-origin: 0 50%;
}

@keyframes turn-out {
  to { transform: perspective(1800px) rotateY(-70deg) translateX(-4%); opacity: 0; }
}

/* ---------- 手机 ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc-panel {
    display: none;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding-top: 18px;
  }

  .header-inner {
    justify-content: center;
  }

  .nameplate {
    padding: 0.5rem 2.2rem 0.6rem;
  }

  .btn-leather.nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    width: 100%;
    justify-content: center;
    padding: 0.9rem;
    background: url(../images/paper.svg), var(--paper);
    border-radius: 4px;
    box-shadow: var(--shadow-paper);
  }

  .site-nav.open {
    display: flex;
    animation: drop-in 0.3s ease;
  }

  .site-main {
    padding: 14px 16px 30px;
  }

  .memo {
    margin-left: 0;
  }

  .sheet {
    padding: 1.3rem 1.1rem 1.1rem;
  }

  .card-photo {
    float: none;
    display: block;
    width: 82%;
    margin: 0.4rem auto 1.1rem;
  }

  .card-title {
    font-size: 1.25rem;
  }

  .notebook {
    padding: 2rem 1.1rem 1.6rem 2.6rem;
  }

  .notebook:not(.paper-diary)::before {
    left: -14px;
    width: 36px;
    background-size: 36px 27px;
  }

  .paper-diary {
    padding-left: 1.9rem;
  }

  .paper-diary .note-body {
    padding-left: 1.8rem;
    margin-left: -0.6rem;
  }

  .paper-page {
    padding-left: 1.2rem;
  }

  .cover-front {
    padding-left: 2rem;
    padding-right: 1.5rem;
  }

  .cover-study .cover-front {
    padding-left: 3.4rem;
  }

  .cloth-spine {
    width: 30px;
  }

  .cover-study .cover-front::after {
    left: 30px;
  }

  .elastic {
    right: 22px;
    width: 11px;
  }

  .page-tab {
    flex-basis: 100%;
  }

  .page-head {
    padding: 10px 28px;
  }

  .planner {
    padding: 2rem 1rem 1.2rem;
  }

  .year-body {
    padding: 0.5rem 0.8rem 0.8rem;
  }

  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 38px 16px;
  }

  .tag-wall {
    justify-content: center;
    gap: 32px 14px;
  }

  .hang-tag {
    width: 104px;
  }

  .desk-items {
    height: 70px;
  }

  .pencil {
    left: 2%;
    width: 170px;
    height: 17px;
  }

  .pen {
    right: 2%;
    bottom: 22px;
    width: 170px;
    height: 18px;
  }

  .clip-a,
  .clip-b {
    display: none;
  }
}

@keyframes drop-in {
  from { transform: translateY(-8px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .book-cover {
    display: none;
  }
}
