/* 意中阁 · 视觉系统（半卷书 · 乙档） */

/* 门楼入斋：卷首语淡入一次；页脚回门楼链接 */
@keyframes yzg-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.welcome.is-arriving { animation: yzg-arrive .9s ease-out both; }
.foot-gate { font-size: 11px; color: var(--ink-soft); border-bottom: 1px solid var(--gold); }
.foot-gate:hover, .foot-gate:focus-visible { color: var(--seal); border-bottom-color: var(--seal); }
@media (prefers-reduced-motion: reduce) { .welcome.is-arriving { animation: none; } }

:root {
  --paper: #F7F3E9;
  --card: #FBF8F0;
  --deep: #EFE7D5;
  --page: #E7E0D0;
  --ink: #2C2A26;
  --ink-soft: #5C5548;
  --ink-faint: #8A8172;
  --line: #D9CFB8;
  --line-soft: #E9DFC9;
  --seal: #A32D2D;
  --gold: #A8987C;
  --fz-body: 17px;
  --fz-verse: 21px;
  --serif: "LXGW WenKai", "霞鹜文楷", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
}

body[data-mode="night"] {
  --paper: #24221E;
  --card: #2C2924;
  --deep: #332F28;
  --page: #191815;
  --ink: #EAE2D0;
  --ink-soft: #C6BDA9;
  --ink-faint: #968D7B;
  --line: #4A443A;
  --line-soft: #3A352E;
  --seal: #C26055;
  --gold: #AA9A7E;
}

body[data-size="large"] { --fz-body: 19px; --fz-verse: 24px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fz-body);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.paper {
  max-width: 1080px;
  margin: 28px auto 48px;
  padding: 18px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, rgba(120,105,80,.022) 0 1px, transparent 1px 5px);
  border: 1px solid var(--line);
}
body[data-mode="night"] .paper {
  background-image: repeating-linear-gradient(0deg, rgba(255,240,210,.014) 0 1px, transparent 1px 5px);
}
.frame { border: 1px solid var(--line-soft); padding: 26px 30px 18px; }

/* ── 中堂题匾 ── */
.hall-head { position: relative; text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.plaque-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.rule { height: 1px; width: 88px; background: var(--line); }
.plaque {
  margin: 0; padding: 5px 26px;
  font-size: 26px; font-weight: 400; letter-spacing: .28em;
  border: 1px solid var(--gold); color: var(--ink);
}
.seal {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 2px;
  background: var(--seal); color: var(--paper);
  font-size: 12px; line-height: 1; letter-spacing: 0;
}
.seal-head { margin-left: -6px; }
.motto { margin: 14px 0 0; color: var(--ink-faint); font-size: 13px; letter-spacing: .12em; }
.head-tools { position: absolute; right: 0; top: 0; display: flex; gap: 6px; }
.tool {
  border: 1px solid var(--line); background: transparent; color: var(--ink-faint);
  font-size: 12px; padding: 3px 9px; letter-spacing: .08em; line-height: 1.6;
}
.tool:hover, .tool.is-on { border-color: var(--gold); color: var(--seal); }

/* ── 书斋主体与竖排题签廊 ── */
.hall-body { display: flex; gap: 26px; padding: 24px 0 18px; min-height: 520px; }
.view { flex: 1; min-width: 0; }
.signboard {
  width: 126px; flex: none; position: relative;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: row-reverse; justify-content: flex-start;
  align-items: flex-start; gap: 12px;
  padding: 16px 8px 76px 16px;
}
.sign-col {
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: 15px; letter-spacing: .22em; color: var(--ink-soft);
  padding: 4px 2px; border-bottom: 1px solid transparent;
}
.sign-col:hover { color: var(--seal); }
.sign-col.is-current { color: var(--seal); border-bottom-color: var(--seal); }
.signboard-gloss {
  position: absolute; left: 0; right: 0; bottom: 16px;
  text-align: center; font-size: 11px; color: var(--ink-faint);
  line-height: 1.9; letter-spacing: .04em;
}
.hall-foot {
  border-top: 1px solid var(--line); padding-top: 12px;
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-faint); letter-spacing: .08em;
}

/* ── 通用标题与窗 ── */
.welcome { text-align: center; padding: 4px 0 20px; }
.welcome-line { font-size: 19px; letter-spacing: .2em; margin: 0 0 6px; }
.welcome-sub { font-size: 12px; color: var(--ink-faint); letter-spacing: .1em; margin: 0; }
.windows { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 16px; }
.win { background: var(--card); border: 1px solid var(--line); padding: 18px 20px; display: flex; flex-direction: column; }
.win--poem { grid-row: span 2; }
.sec-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.sec-name { font-size: 16px; letter-spacing: .14em; }
.sec-gloss { font-size: 11px; color: var(--ink-faint); flex: 1; }
.sec-more { font-size: 11px; color: var(--seal); white-space: nowrap; }
.sec-more:hover { text-decoration: underline; }

.mini-verse {
  writing-mode: vertical-rl; text-orientation: mixed;
  height: 196px; line-height: 2; letter-spacing: .14em; font-size: 18px;
  width: max-content; max-width: 100%;
  margin: 8px auto; overflow: hidden; flex: none; align-self: center;
}
.mini-verse p, .verse p { margin: 0; white-space: nowrap; }
/* 竖排列内居中：vertical-rl 下 text-align 作用于 inline 轴（垂直方向） */
.mini-verse p:not(.verse-title), .verse p:not(.verse-title) { text-align: center; }
.byline { color: var(--ink); font-size: 12px; letter-spacing: .18em; }
.verse-title { padding-top: 2.2em; color: var(--ink-faint); font-size: .82em; letter-spacing: .2em; }
.win-seal { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: auto; }
.win-note { font-size: 11px; color: var(--ink-faint); }

/* ── 曲签 ── */
.track { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.track:last-child { border-bottom: none; }
.track-cover { width: 38px; height: 38px; flex: none; background: var(--deep); border: 1px solid var(--line); display: grid; place-items: center; font-size: 17px; color: var(--ink-soft); }
.track-body { flex: 1; min-width: 0; }
.track-body h3 { margin: 0; font-size: 14px; font-weight: 400; letter-spacing: .08em; }
.track-body p { margin: 2px 0 0; font-size: 11px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-go { font-size: 11px; color: var(--seal); white-space: nowrap; }
.track-go:hover { text-decoration: underline; }
.track-go--off { color: var(--ink-faint); }
.track-list--full .track { padding: 15px 2px; }
.track-list--full .track-cover { width: 48px; height: 48px; font-size: 21px; }
.track-list--full .track-body h3 { font-size: 16px; }

/* ── 随笔条目 ── */
.essay-row { display: flex; flex-direction: column; gap: 2px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.essay-row:last-child { border-bottom: none; }
.essay-title { font-size: 14px; letter-spacing: .06em; }
.essay-meta { font-size: 11px; color: var(--ink-faint); }
.essay-row:hover .essay-title { color: var(--seal); }

/* ── 内页通用 ── */
.crumb { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--ink-faint); margin-bottom: 16px; letter-spacing: .08em; }
.crumb a { color: var(--seal); }
.page-title { margin: 0 0 6px; font-size: 22px; font-weight: 400; letter-spacing: .18em; }
.page-sub { margin: 0 0 22px; font-size: 12px; color: var(--ink-faint); letter-spacing: .1em; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.poem-card { background: var(--card); border: 1px solid var(--line); padding: 16px 18px; display: block; }
.poem-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 400; letter-spacing: .12em; }
.poem-card .pmeta { font-size: 11px; color: var(--ink-faint); }
.poem-card .pline { margin: 12px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.8; }
.poem-card:hover { border-color: var(--gold); }
.poem-card:hover h3 { color: var(--seal); }

/* ── 诗笺册页 ── */
.poem-layout { display: grid; grid-template-columns: 142px minmax(0, 1fr) 148px; gap: 16px; align-items: start; }
.side-col { font-size: 12px; }
.side-head { font-size: 13px; letter-spacing: .14em; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); margin: 0 0 12px; }
.side-head span { font-size: 11px; color: var(--ink-faint); margin-left: 6px; }
.sheet { background: var(--card); border: 1px solid var(--line); padding: 20px 24px; }
.sheet-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; letter-spacing: .08em; }
.verse {
  writing-mode: vertical-rl; text-orientation: mixed;
  height: 272px; line-height: 2.05; letter-spacing: .16em; font-size: var(--fz-verse);
  margin: 22px 0; overflow: auto; padding-bottom: 6px;
}
/* 长调（八句以上）收紧列宽，十二句仍可一屏横列排完，不出横向滚动 */
.verse--long { height: 248px; line-height: 1.72; letter-spacing: .09em; font-size: calc(var(--fz-verse) * .86); }
.sheet-foot { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); padding-top: 12px; font-size: 11px; color: var(--ink-faint); }
.sheet-note { margin: 0 0 0 auto; font-size: 11px; }
.colo { padding: 8px 0; border-bottom: 1px dashed var(--line-soft); }
.colo p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--ink-soft); }
.colo span { font-size: 11px; color: var(--ink-faint); }
.ghost { display: block; width: 100%; margin-top: 8px; padding: 6px 8px; border: 1px solid var(--line); background: transparent; color: var(--ink-soft); font-size: 12px; letter-spacing: .08em; text-align: left; }
.ghost:hover { border-color: var(--gold); color: var(--seal); }
.pager { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; font-size: 11px; color: var(--seal); }
.tool-hint { font-size: 11px; color: var(--ink-faint); line-height: 1.7; margin-top: 14px; }

/* ── 长文与主人页 ── */
.prose, .about { background: var(--card); border: 1px solid var(--line); padding: 26px 30px; max-width: 720px; }
.prose p, .about p { margin: 0 0 1.3em; line-height: 2.05; text-indent: 2em; }
.prose-meta { font-size: 11px; color: var(--ink-faint); text-indent: 0; border-bottom: 1px solid var(--line-soft); padding-bottom: 12px; margin-bottom: 22px; letter-spacing: .08em; }
.about h2 { font-size: 18px; font-weight: 400; letter-spacing: .16em; margin: 0 0 14px; }
.about .now { border-left: 2px solid var(--gold); padding-left: 14px; text-indent: 0; color: var(--ink-soft); font-size: 13px; }
.link-list { display: flex; gap: 18px; font-size: 12px; color: var(--ink-faint); margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.notice { margin-top: 22px; padding: 12px 14px; border: 1px dashed var(--line); font-size: 11px; color: var(--ink-faint); line-height: 1.9; background: var(--paper); }
.notice p { margin: 0; text-indent: 0; }
.colo-list { max-width: 720px; }
.colo-item { background: var(--card); border: 1px solid var(--line); padding: 14px 18px; margin-bottom: 12px; }
.colo-item p { margin: 0 0 6px; font-size: 14px; line-height: 1.9; }
.colo-item span { font-size: 11px; color: var(--ink-faint); }

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--ink); color: var(--paper);
  font-size: 12px; padding: 9px 18px; border-radius: 2px;
  opacity: 0; pointer-events: none; z-index: 20;
  transition: opacity .2s, transform .2s;
  max-width: 80vw; text-align: center; letter-spacing: .06em;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── 手机端：竖排一律降级横排 ── */
@media (max-width: 900px) {
  .paper { margin: 0; border: none; padding: 8px; }
  .frame { padding: 18px 14px 12px; }
  .hall-head { padding-bottom: 14px; }
  .head-tools { position: static; justify-content: center; margin-top: 10px; }
  .plaque { font-size: 22px; padding: 5px 16px; }
  .rule { width: 34px; }
  .hall-body { flex-direction: column; gap: 14px; padding: 16px 0; min-height: 0; }
  .signboard {
    order: -1; width: auto; border-left: none; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; justify-content: center;
    gap: 6px 18px; padding: 0 0 12px;
  }
  .sign-col { writing-mode: horizontal-tb; letter-spacing: .08em; font-size: 14px; padding: 3px 0; }
  .signboard-gloss { display: none; }
  .windows { grid-template-columns: 1fr; }
  .win--poem { grid-row: auto; }
  .poem-layout { grid-template-columns: 1fr; }
  .verse, .mini-verse {
    writing-mode: horizontal-tb; text-orientation: mixed;
    width: auto; max-width: none; height: auto; line-height: 2.1; text-align: center;
    letter-spacing: .12em; overflow: visible; flex: none; align-self: stretch;
  }
  .verse p, .mini-verse p { margin: 0 0 2px; white-space: normal; }
  .verse-title { padding-top: 0; font-size: 1em; color: var(--ink-soft); }
  .side-col { order: 2; }
  .tool-hint { display: none; }
}
@media (max-width: 520px) {
  .prose, .about, .sheet { padding: 18px 16px; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-note { margin-left: 0; width: 100%; }
  .hall-foot { flex-direction: column; gap: 4px; }
}
