/* =====================================================================
   万泉部-诗词世界 · 样式
   色板：月白纸面 / 墨 / 靛夜 / 缃月 / 胭脂印
   字体：马善政（题）· 霞鹜文楷（文）· Cormorant Garamond（西文）
   ===================================================================== */
@import url("../vendor/fonts/wenkai/wenkai.css");
@import url("../vendor/fonts/mashanzheng/mashanzheng.css");
@import url("../vendor/fonts/cormorant/cormorant.css");

:root {
  --paper: #e4eae8;
  --paper-2: #d7dfdd;
  --paper-3: #c5cfcd;
  --ink: #242a30;
  --ink-2: #4b545c;
  --ink-3: #7c868e;
  --night: #1c2b3d;
  --night-2: #263a51;
  --night-ink: #d8e1e3;
  --night-dim: #8fa0ad;
  --gold: #c8a35a;
  --gold-pale: #efe2bd;
  --seal: #a0353a;
  --jade: #5f8a82;

  --f-display: "Ma Shan Zheng", "LXGW WenKai", "STKaiti", "KaiTi", serif;
  --f-body: "LXGW WenKai", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --f-latin: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", "Noto Serif", serif;

  /* 纯四度音阶 1.333 */
  --s-2: 0.563rem;
  --s-1: 0.75rem;
  --s0: 1rem;
  --s1: 1.333rem;
  --s2: 1.777rem;
  --s3: 2.369rem;
  --s4: 3.157rem;
  --s5: 4.209rem;
  --s6: 5.61rem;

  --gutter: clamp(20px, 4vw, 64px);
  --ease: cubic-bezier(0.65, 0.05, 0.25, 1);
  --nav-h: 64px;
}

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

html { font-size: 17px; -webkit-text-size-adjust: 100%; }
@media (max-width: 640px) { html { font-size: 16px; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  line-height: 1.8;
  font-feature-settings: "palt" 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 宣纸纤维：极淡的噪点，保持冷调 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.15 0 0 0 0 0.18 0 0 0 0 0.2 0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
body.has-paper::before { background-image: url("../img/paper_texture.webp"); background-size: 512px; opacity: 0.22; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }

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

::selection { background: var(--gold-pale); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* 竖排 */
.vert {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-feature-settings: "vert" 1;
}
.vert .latin { text-orientation: sideways; }

/* ---------------------------------------------------------------- 导航 */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  color: var(--ink);
  transition: color 0.5s var(--ease), background-color 0.5s var(--ease);
}
.nav.is-night { color: var(--night-ink); }
.nav.is-solid { background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); }
.nav.is-solid.is-night { background: color-mix(in srgb, var(--night) 88%, transparent); }

.brand { display: flex; align-items: center; gap: 12px; }
.seal-logo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 38px; height: 38px;
  padding: 3px;
  background: var(--seal);
  color: #f3e9e4;
  font-family: var(--f-display);
  font-size: 15px;
  line-height: 16px;
  text-align: center;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px rgba(243, 233, 228, 0.55);
  direction: rtl; /* 印文右起竖读：诗词 / 世界 */
}
.seal-logo span { writing-mode: vertical-rl; }
.brand-name { font-family: var(--f-display); font-size: var(--s1); letter-spacing: 0.1em; }

.nav-links { display: flex; gap: clamp(14px, 2.4vw, 36px); font-size: var(--s0); }
.nav-links a { position: relative; padding: 4px 0; opacity: 0.82; transition: opacity 0.3s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; bottom: -4px; width: 5px; height: 5px;
  margin-left: -2.5px; border-radius: 50%; background: var(--seal);
}
@media (max-width: 640px) {
  .brand { gap: 8px; min-width: 0; }
  .brand-name { display: block; max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; letter-spacing: 0; }
  .nav-links { gap: 11px; font-size: 0.76rem; white-space: nowrap; }
}

/* ---------------------------------------------------------------- 名篇印 */
.seal {
  display: inline-block;
  vertical-align: 0.15em;
  margin-inline-start: 0.4em;
  padding: 0 0.28em;
  font-family: var(--f-display);
  font-size: 0.62em;
  line-height: 1.5;
  color: #f3e9e4;
  background: var(--seal);
  border-radius: 2px;
  letter-spacing: 0;
}
.vert .seal { margin-inline-start: 0.3em; padding: 0.28em 0; vertical-align: baseline; }

/* ---------------------------------------------------------------- 过场：遮罩 */
.veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  transform: translateY(-110%);
  color: var(--night-ink);
  display: grid;
  place-items: center;
}
.veil-body { position: absolute; inset: 0; background: var(--night); }
.veil-edge { position: absolute; left: 0; right: 0; height: 90px; color: var(--night); }
.veil-edge.top { bottom: 100%; transform: scaleY(-1); }
.veil-edge.bottom { top: 100%; }
.veil-edge svg { width: 100%; height: 100%; display: block; }
.veil-word {
  position: relative;
  font-family: var(--f-display);
  font-size: clamp(56px, 12vw, 132px);
  writing-mode: vertical-rl;
  letter-spacing: 0.15em;
  opacity: 0;
}
.veil.is-active { pointer-events: all; }

/* ---------------------------------------------------------------- 开场 */
.splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--night);
  color: var(--night-ink);
  display: grid;
  place-items: center;
  --r: 0px;
  -webkit-mask-image: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%), transparent var(--r), #000 calc(var(--r) + 1px));
  mask-image: radial-gradient(circle at var(--cx, 50%) var(--cy, 50%), transparent var(--r), #000 calc(var(--r) + 1px));
}
.splash-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.28;
  filter: saturate(0.72) sepia(0.12);
  pointer-events: none;
}
.splash-verse {
  position: absolute;
  top: 50%;
  right: calc(50% + 120px);
  transform: translateY(-50%);
  font-family: var(--f-display);
  font-size: clamp(22px, 3.2vw, 34px);
  letter-spacing: 0.35em;
  line-height: 2.2;
  display: flex;
  gap: 0.6em;
}
.splash-verse .col { writing-mode: vertical-rl; }
.splash-verse .ch { opacity: 0; display: inline-block; }
.splash-ring { width: 180px; height: 180px; }
.splash-ring circle { fill: none; stroke: var(--gold); stroke-width: 1.4; }
.splash-ring .track { stroke: rgba(200, 163, 90, 0.18); }
.splash-note {
  position: absolute;
  bottom: 9vh;
  left: 0; right: 0;
  text-align: center;
  font-size: var(--s-1);
  color: var(--night-dim);
  letter-spacing: 0.2em;
}
.moon-flyer {
  position: fixed;
  z-index: 310;
  border-radius: 50%;
  pointer-events: none;
}
@media (max-width: 720px) {
  .splash-verse { right: 50%; transform: translate(50%, -50%); top: 30%; font-size: 22px; }
}

/* 月 */
.moon {
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.55), transparent 42%),
    radial-gradient(circle at 62% 58%, rgba(170, 130, 60, 0.18) 0 9%, transparent 10%),
    radial-gradient(circle at 40% 66%, rgba(170, 130, 60, 0.14) 0 6%, transparent 7%),
    radial-gradient(circle at 70% 34%, rgba(170, 130, 60, 0.12) 0 5%, transparent 6%),
    radial-gradient(circle at 50% 50%, var(--gold-pale), #e2c88b 62%, var(--gold));
  box-shadow: 0 0 80px 10px rgba(200, 163, 90, 0.22);
}

/* ---------------------------------------------------------------- 首屏 */
.hero {
  position: relative;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
}
.hero-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #dbe4e4 0%, var(--paper) 55%, var(--paper-2) 100%);
  z-index: -3;
}
.hero-art {
  position: absolute;
  inset: -6% -3% -6% -3%;
  z-index: -2;
  background-size: cover;
  background-position: center 62%;
  mix-blend-mode: multiply;
  filter: saturate(0.75) contrast(1.02);
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.hero-art.is-loaded { opacity: 0.9; }
.hero-ridges { position: absolute; left: 0; right: 0; bottom: 0; height: 62%; z-index: -1; }
.hero-ridges svg { position: absolute; left: -5%; width: 110%; bottom: 0; height: 100%; }
.hero-art.is-loaded ~ .hero-ridges { opacity: 0.35; }

.hero-moon {
  position: absolute;
  width: clamp(130px, 17vw, 240px);
  aspect-ratio: 1;
  left: 16%;
  top: 17%;
  z-index: -2;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero-title {
  position: absolute;
  top: calc(var(--nav-h) + 3vh);
  right: var(--gutter);
  font-family: var(--f-display);
  font-size: clamp(64px, 11.5vh, 132px);
  line-height: 1;
  letter-spacing: 0.06em;
  writing-mode: vertical-rl;
  color: var(--ink);
  margin: 0;
  font-weight: 400;
}
.hero-title .ch { display: inline-block; }

.daily {
  position: absolute;
  top: calc(var(--nav-h) + 6vh);
  right: calc(var(--gutter) + clamp(96px, 15vh, 170px));
  height: min(58vh, 520px);
  display: flex;
  flex-direction: row-reverse;
  gap: 18px;
}
.daily-label {
  writing-mode: vertical-rl;
  font-size: var(--s-1);
  color: var(--ink-3);
  letter-spacing: 0.3em;
  border-inline-start: 1px solid var(--paper-3);
  padding-inline-start: 10px;
}
.daily-poem { writing-mode: vertical-rl; font-size: clamp(19px, 2.3vh, 24px); line-height: 2.05; letter-spacing: 0.16em; }
.daily-poem .line { display: block; }
.daily-poem .line .ch { display: inline-block; }
.daily-meta { writing-mode: vertical-rl; font-size: var(--s-1); color: var(--ink-2); padding-top: 2.2em; letter-spacing: 0.15em; }
.daily-meta a { border-inline-start: 1px solid currentColor; }
.daily-meta a:hover { color: var(--seal); }
.daily-swap {
  writing-mode: vertical-rl;
  margin-top: auto;
  font-size: var(--s-1);
  color: var(--ink-3);
  letter-spacing: 0.2em;
  padding: 6px 2px;
}
.daily-swap:hover { color: var(--seal); }

.hero-foot {
  position: absolute;
  left: var(--gutter);
  bottom: 7vh;
  max-width: 34rem;
  z-index: 2;
}
.hero-lede { font-size: var(--s1); line-height: 1.75; margin: 0 0 1.2rem; color: var(--ink); }
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1.5px solid var(--ink);
  padding: 4px 0 8px;
  max-width: 28rem;
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: var(--s1);
  outline: none;
  min-width: 0;
}
.search input::placeholder { color: var(--ink-3); }
.search button { font-size: var(--s0); padding: 2px 4px; }
.search button:hover { color: var(--seal); }
.hero-scrollhint {
  position: absolute;
  bottom: 7vh;
  right: var(--gutter);
  font-size: var(--s-1);
  color: var(--ink-3);
  writing-mode: vertical-rl;
  letter-spacing: 0.3em;
}
@media (max-width: 860px) {
  .hero-title { font-size: 64px; }
  .daily { right: calc(var(--gutter) + 80px); height: 46vh; top: calc(var(--nav-h) + 4vh); }
  .daily-poem { font-size: 18px; }
  .hero-moon { left: 8%; top: 14%; }
  .hero-foot { right: var(--gutter); bottom: 5vh; }
  .hero-lede { font-size: var(--s0); }
  .hero-scrollhint { display: none; }
}

/* ---------------------------------------------------------------- 通用段落 */
.section { position: relative; padding: clamp(80px, 14vh, 160px) var(--gutter); }
.section-head { display: flex; align-items: flex-start; gap: clamp(20px, 4vw, 56px); margin-bottom: clamp(36px, 7vh, 80px); }
.section-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(52px, 8vw, 104px);
  line-height: 1;
  margin: 0;
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
}
.section-intro { max-width: 30rem; font-size: var(--s1); line-height: 1.8; margin: 0.4em 0 0; color: var(--ink-2); }
.night { background: var(--night); color: var(--night-ink); }
.night .section-intro { color: var(--night-dim); }

/* ---------------------------------------------------------------- 长河（横向连续滚动） */
.river { position: relative; height: 100svh; overflow: hidden; background: var(--paper); }
.river-head {
  position: absolute;
  top: calc(var(--nav-h) + 2vh);
  left: var(--gutter);
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.river-head h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--s3); margin: 0; letter-spacing: 0.1em; }
.river-head p { margin: 0; color: var(--ink-3); font-size: var(--s-1); }
.river-ridge { position: absolute; left: 0; bottom: 0; height: 46%; width: 260vw; z-index: 0; pointer-events: none; }
.river-ridge svg { width: 100%; height: 100%; }
.river-track {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: stretch;
  padding-left: 30vw;
  padding-right: 20vw;
  will-change: transform;
}
.era {
  position: relative;
  flex: 0 0 auto;
  width: min(74vw, 1040px);
  height: 100%;
  padding: calc(var(--nav-h) + 12vh) 4vw 18vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(20px, 3vw, 48px);
}
.era.is-minor { width: min(34vw, 420px); grid-template-columns: auto minmax(0, 1fr); }
.era-name {
  font-family: var(--f-display);
  font-size: clamp(110px, 21vh, 220px);
  line-height: 0.9;
  writing-mode: vertical-rl;
  margin: 0;
  font-weight: 400;
  color: var(--ink);
  align-self: start;
}
.era.is-minor .era-name { font-size: clamp(70px, 13vh, 120px); color: var(--ink-2); }
.era-name .ch { display: inline-block; }
.era-body { align-self: start; max-width: 26rem; }
.era-span { font-family: var(--f-latin); font-size: var(--s1); color: var(--ink-3); margin: 0 0 0.6rem; letter-spacing: 0.04em; }
.era-blurb { font-size: var(--s0); line-height: 1.9; margin: 0 0 1.2rem; }
.era-stat { font-size: var(--s-1); color: var(--ink-2); margin: 0 0 0.9rem; }
.era-poets { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--s0); }
.era-poets a { border-bottom: 1px solid transparent; }
.era-poets a:hover { border-color: var(--seal); color: var(--seal); }
.era-poems { display: flex; flex-direction: row-reverse; gap: 22px; align-self: start; height: min(52vh, 460px); }
.era-poem {
  writing-mode: vertical-rl;
  font-size: var(--s0);
  line-height: 1.95;
  letter-spacing: 0.12em;
  max-height: 100%;
  overflow: hidden;
  padding-inline-start: 14px;
  border-inline-start: 1px solid var(--paper-3);
  transition: color 0.3s;
}
.era-poem b { font-weight: 400; font-family: var(--f-display); font-size: var(--s1); display: block; margin-block-end: 0.6em; }
.era-poem small { display: block; color: var(--ink-3); font-size: var(--s-1); margin-block-start: 0.4em; }
.era-poem:hover { color: var(--seal); }
.era-figure {
  position: absolute;
  right: 3vw;
  bottom: 9vh;
  width: min(30vw, 420px);
  aspect-ratio: 3 / 2;
  opacity: 0.92;
  z-index: -1;
}
.era-figure img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; filter: saturate(0.8); }
.river-ruler {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 5vh;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  font-size: var(--s-1);
  color: var(--ink-3);
  border-top: 1px solid var(--paper-3);
  padding-top: 8px;
}
.river-ruler button { padding: 2px 0; transition: color 0.3s; }
.river-ruler button.is-on { color: var(--seal); }
.river-ruler .needle {
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--seal);
  transform: translateX(-3.5px);
}

/* 窄屏/减少动效：长河改成纵向 */
.river.is-stacked { height: auto; }
.river.is-stacked .river-track { flex-direction: column; padding: calc(var(--nav-h) + 80px) 0 40px; }
.river.is-stacked .era,
.river.is-stacked .era.is-minor { width: auto; height: auto; padding: 40px var(--gutter); grid-template-columns: auto minmax(0, 1fr); }
.river.is-stacked .era-poems { grid-column: 1 / -1; height: 320px; overflow-x: auto; }
.river.is-stacked .era-figure { position: relative; right: auto; bottom: auto; width: 100%; grid-column: 1 / -1; }
.river.is-stacked .river-ruler, .river.is-stacked .river-ridge { display: none; }

/* ---------------------------------------------------------------- 四时（分段） */
.seasons { position: relative; }
.season {
  position: relative;
  height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  padding: var(--nav-h) var(--gutter) 0;
  gap: clamp(24px, 5vw, 80px);
  box-shadow: 0 -30px 60px -40px rgba(28, 43, 61, 0.35);
}
.season[data-s="春"] { background: #e3ebe2; }
.season[data-s="夏"] { background: #d9e6e4; }
.season[data-s="秋"] { background: #e6e3db; }
.season[data-s="冬"] { background: #e8edf1; }
.scroll-mount {
  justify-self: center;
  width: min(32vw, 360px);
  aspect-ratio: 2 / 3.3;
  padding: 18px 16px 34px;
  background: #cfd5d0;
  box-shadow: inset 0 0 0 1px rgba(36, 42, 48, 0.12), 0 24px 50px -30px rgba(28, 43, 61, 0.55);
  position: relative;
}
.scroll-mount::before,
.scroll-mount::after {
  content: "";
  position: absolute;
  left: -12px; right: -12px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #6a5640, #3e3226);
}
.scroll-mount::before { top: -8px; }
.scroll-mount::after { bottom: -8px; }
.scroll-mount .painting { width: 100%; height: 100%; overflow: hidden; position: relative; }
.scroll-mount img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.painting-fallback { position: absolute; inset: 0; }
.season-text { display: flex; flex-direction: row-reverse; align-items: flex-start; gap: clamp(20px, 3vw, 44px); height: min(70vh, 600px); }
.season-char {
  font-family: var(--f-display);
  font-size: clamp(120px, 24vh, 240px);
  line-height: 1;
  margin: 0;
  font-weight: 400;
  writing-mode: vertical-rl;
}
.season-poem { writing-mode: vertical-rl; font-size: clamp(18px, 2.4vh, 23px); line-height: 2.05; letter-spacing: 0.15em; max-height: 100%; }
.season-poem b { font-weight: 400; font-family: var(--f-display); font-size: 1.3em; display: block; margin-block-end: 0.5em; }
.season-poem .by { display: block; font-size: var(--s-1); color: var(--ink-3); margin-block-start: 0.8em; }
.season-poem .line { display: block; }
.season-next { writing-mode: vertical-rl; font-size: var(--s-1); color: var(--ink-3); letter-spacing: 0.25em; align-self: flex-end; }
.season-next:hover { color: var(--seal); }
.season-index {
  position: absolute;
  left: var(--gutter);
  bottom: 6vh;
  display: flex;
  gap: 14px;
  font-family: var(--f-display);
  font-size: var(--s1);
  color: var(--ink-3);
}
.season-index span.is-on { color: var(--ink); }
@media (max-width: 860px) {
  .season { grid-template-columns: 1fr; align-content: center; gap: 28px; }
  .scroll-mount { width: 44vw; display: none; }
  .season-text { height: 62vh; justify-content: center; }
}

/* ---------------------------------------------------------------- 万国 */
.world { min-height: 100svh; overflow: hidden; }
.world-bg { position: absolute; inset: 0; opacity: 0.28; background-size: cover; background-position: center; transition: opacity 0.8s; }
.world-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--night) 25%, rgba(28, 43, 61, 0.55)); }
.world-inner { position: relative; display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); }
.region-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.region-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(216, 225, 227, 0.14);
  font-size: var(--s1);
  color: var(--night-dim);
  transition: color 0.3s;
}
.region-list button small { font-family: var(--f-latin); font-size: var(--s0); }
.region-list button[aria-selected="true"], .region-list button:hover { color: var(--night-ink); }
.region-list button[aria-selected="true"] { border-color: var(--gold); }
.desk { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: clamp(28px, 4vw, 56px) clamp(24px, 3vw, 48px); align-content: start; }
.wpoem { display: block; padding-top: 14px; border-top: 1px solid rgba(216, 225, 227, 0.18); }
.wpoem:hover .wpoem-zh { color: var(--gold-pale); }
.wpoem-orig { font-family: var(--f-latin); font-style: italic; font-size: var(--s1); line-height: 1.25; margin: 0; color: var(--night-ink); }
.wpoem-zh { font-family: var(--f-display); font-size: var(--s2); margin: 4px 0 2px; color: var(--gold); transition: color 0.3s; font-weight: 400; }
.wpoem-by { font-size: var(--s-1); color: var(--night-dim); margin: 0 0 10px; }
.wpoem-lines { font-family: var(--f-latin); font-size: var(--s0); line-height: 1.55; white-space: pre-line; color: var(--night-ink); opacity: 0.86; margin: 0; max-height: 9.5em; overflow: hidden; }
.wpoem-lines.zh { font-family: var(--f-body); opacity: 0.7; margin-top: 10px; max-height: 7.6em; }
.world-empty { color: var(--night-dim); font-size: var(--s1); max-width: 30rem; }
@media (max-width: 760px) { .world-inner { grid-template-columns: 1fr; } .region-list { flex-direction: row; flex-wrap: wrap; gap: 0 18px; } .region-list button { width: auto; border: 0; } }

/* ---------------------------------------------------------------- 名家 */
.masters-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 24px 28px; }
.master { display: flex; flex-direction: column; gap: 8px; min-height: 150px; border-top: 1px solid var(--paper-3); padding-top: 14px; }
.master-name { font-family: var(--f-display); font-size: var(--s2); line-height: 1.15; transition: color 0.3s; }
.master-meta { font-size: var(--s-1); color: var(--ink-3); letter-spacing: 0.1em; }
.master-line { font-size: var(--s0); color: var(--ink-2); letter-spacing: 0.08em; line-height: 1.7; }
.master:hover .master-name { color: var(--seal); }

/* ---------------------------------------------------------------- 入口 & 页脚 */
.gate { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px; border-top: 1px solid var(--paper-3); }
.gate h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(40px, 6vw, 80px); line-height: 1.15; margin: 0 0 0.3em; }
.gate p { margin: 0; color: var(--ink-2); max-width: 36rem; font-size: var(--s1); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: var(--s1);
  transition: background-color 0.3s, color 0.3s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.footer { padding: 48px var(--gutter) 56px; background: var(--paper-2); color: var(--ink-2); font-size: var(--s-1); line-height: 1.9; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.footer h3 { font-family: var(--f-display); font-weight: 400; font-size: var(--s1); color: var(--ink); margin: 0 0 6px; }
.footer a { border-bottom: 1px solid var(--paper-3); }
.footer a:hover { color: var(--seal); border-color: var(--seal); }

/* ---------------------------------------------------------------- 书库 */
.page { padding: calc(var(--nav-h) + 48px) var(--gutter) 80px; min-height: 100vh; position: relative; z-index: 2; }
.lib-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: start; margin-bottom: 36px; }
.lib-head h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(56px, 8vw, 100px); writing-mode: vertical-rl; margin: 0; line-height: 1; }
.lib-search { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; max-width: 46rem; }
.lib-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: var(--s2); min-width: 0; }
.lib-search input::placeholder { color: var(--ink-3); }
.lib-hint { color: var(--ink-3); font-size: var(--s-1); margin: 10px 0 0; }
.filters { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.frow { display: flex; gap: 14px; align-items: baseline; }
.frow-label { flex: 0 0 3.2em; font-size: var(--s-1); color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.chip {
  padding: 2px 11px;
  border-radius: 999px;
  border: 1px solid var(--paper-3);
  font-size: var(--s-1);
  line-height: 1.9;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.is-seal[aria-pressed="true"] { background: var(--seal); border-color: var(--seal); }
.chip small { opacity: 0.6; margin-left: 4px; }
.frow.is-collapsed .chips { max-height: 2.1em; overflow: hidden; }
.frow-more { font-size: var(--s-1); color: var(--ink-3); white-space: nowrap; }
.frow-more:hover { color: var(--seal); }
.lib-status { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 30px 0 6px; font-size: var(--s-1); color: var(--ink-3); border-bottom: 1px solid var(--paper-3); padding-bottom: 10px; }
.lib-status strong { color: var(--ink); font-weight: 400; font-family: var(--f-latin); font-size: var(--s1); }
.loadbar { height: 2px; background: var(--paper-3); margin-top: 6px; overflow: hidden; display: none; }
.loadbar.is-on { display: block; }
.loadbar i { display: block; height: 100%; width: 0; background: var(--seal); transition: width 0.3s; }
.results { list-style: none; margin: 0; padding: 0; columns: 2 30rem; column-gap: clamp(28px, 5vw, 72px); }
.result { break-inside: avoid; border-bottom: 1px solid var(--paper-2); }
.result a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 12px 0; }
.result-title { font-size: var(--s1); line-height: 1.4; transition: color 0.2s; }
.result-by { font-size: var(--s-1); color: var(--ink-3); text-align: right; white-space: nowrap; align-self: center; }
.result-first { grid-column: 1 / -1; font-size: var(--s-1); color: var(--ink-2); }
.result-first.latin { font-family: var(--f-latin); font-style: italic; font-size: var(--s0); }
.result a:hover .result-title { color: var(--seal); }
.result mark { background: none; color: var(--seal); }
.empty { padding: 60px 0; color: var(--ink-2); font-size: var(--s1); }
.sentinel { height: 1px; }

/* 阅读浮层 */
.reader {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  backdrop-filter: blur(6px);
  overflow: auto;
  overscroll-behavior: contain;
}
.reader.is-open { display: block; }
.reader-close {
  position: fixed;
  top: 18px;
  right: var(--gutter);
  z-index: 3;
  font-size: var(--s0);
  padding: 8px 14px;
  border: 1px solid var(--paper-3);
  border-radius: 999px;
  background: var(--paper);
}
.reader-close:hover { border-color: var(--ink); }

/* ---------------------------------------------------------------- 诗页 / 阅读 */
.poem-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: clamp(28px, 5vw, 80px); align-items: start; max-width: 1280px; margin: 0 auto; }
.poem-stage { display: flex; flex-direction: row-reverse; gap: clamp(20px, 3vw, 44px); justify-content: center; min-height: 70vh; overflow-x: auto; padding-bottom: 20px; }
.poem-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(40px, 6vh, 64px); line-height: 1.15; margin: 0; writing-mode: vertical-rl; letter-spacing: 0.06em; max-height: 76vh; }
.poem-by { writing-mode: vertical-rl; font-size: var(--s0); color: var(--ink-2); letter-spacing: 0.2em; padding-top: 0.4em; }
.poem-by a:hover { color: var(--seal); }
.poem-body { writing-mode: vertical-rl; font-size: clamp(20px, 2.8vh, 26px); line-height: 2.15; letter-spacing: 0.17em; max-height: 76vh; margin: 0; }
.poem-body .line { display: block; }
.poem-stage.is-horizontal { flex-direction: column; align-items: flex-start; min-height: 0; max-width: 40rem; margin: 0 auto; }
.poem-stage.is-horizontal .poem-title,
.poem-stage.is-horizontal .poem-by,
.poem-stage.is-horizontal .poem-body { writing-mode: horizontal-tb; max-height: none; }
.poem-stage.is-horizontal .poem-body { font-size: var(--s1); line-height: 2.1; letter-spacing: 0.06em; }
.poem-stage.is-horizontal .poem-body .line { margin-bottom: 0.2em; }
.poem-side { position: sticky; top: calc(var(--nav-h) + 24px); font-size: var(--s-1); color: var(--ink-2); }
.poem-side h3 { font-family: var(--f-display); font-weight: 400; font-size: var(--s1); color: var(--ink); margin: 22px 0 8px; }
.poem-side h3:first-child { margin-top: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 0 9px; border: 1px solid var(--paper-3); border-radius: 999px; line-height: 1.9; }
.tag:hover { border-color: var(--seal); color: var(--seal); }
.mdpath { font-family: var(--f-latin); word-break: break-all; font-size: var(--s-1); color: var(--ink-3); }
.poem-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.poem-tools button, .poem-tools a { padding: 4px 12px; border: 1px solid var(--paper-3); border-radius: 999px; }
.poem-tools button:hover, .poem-tools a:hover { border-color: var(--ink); }
.poem-notes { max-width: 46rem; margin: 56px auto 0; font-size: var(--s0); line-height: 1.9; }
.poem-notes h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--s2); margin: 36px 0 10px; }
.poem-notes ol { padding-left: 1.2em; color: var(--ink-2); }
.poem-nav { display: flex; justify-content: space-between; gap: 16px; max-width: 1280px; margin: 64px auto 0; padding-top: 18px; border-top: 1px solid var(--paper-3); font-size: var(--s0); }
.poem-nav a:hover { color: var(--seal); }
.poem-nav small { display: block; color: var(--ink-3); font-size: var(--s-1); }
.poem-nav .next { text-align: right; }

/* 外文诗 */
.wreader { max-width: 1100px; margin: 0 auto; }
.wreader-head { margin-bottom: 40px; }
.wreader-head h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(40px, 6vw, 72px); margin: 0; line-height: 1.15; }
.wreader-head .orig { font-family: var(--f-latin); font-style: italic; font-size: var(--s2); margin: 6px 0 10px; color: var(--ink-2); }
.wreader-head .by { color: var(--ink-2); }
.wreader-head .by a:hover { color: var(--seal); }
.wcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: clamp(28px, 5vw, 72px); }
.wcol h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--s1); margin: 0 0 14px; color: var(--ink-2); }
.wcol .text { white-space: pre-line; font-size: var(--s1); line-height: 1.65; margin: 0; }
.wcol .text.latin { font-family: var(--f-latin); font-size: 1.42rem; line-height: 1.55; }
.wcol .text.zh { font-family: var(--f-body); font-size: var(--s1); line-height: 2; }
.wsummary { max-width: 46rem; margin: 48px 0 0; font-size: var(--s0); line-height: 1.95; }
.wsummary h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--s2); margin: 0 0 10px; }
@media (max-width: 900px) {
  .poem-wrap { grid-template-columns: 1fr; }
  .poem-side { position: static; }
  .poem-stage { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- 手机单屏阅读 */
@media (max-width: 760px) {
  :root { --nav-h: 58px; --gutter: 18px; }
  .page { padding-top: calc(var(--nav-h) + 20px); padding-bottom: 20px; }
  .nav { height: var(--nav-h); padding-inline: 14px; }
  .seal-logo { width: 34px; height: 34px; font-size: 13px; line-height: 14px; }
  .brand-name { max-width: 108px; }

  /* 诗文是主内容，辅助标签不挤占手机首屏。 */
  #main:has(.poem-wrap) { height: calc(100svh - var(--nav-h)); min-height: 0; overflow: hidden; padding: calc(var(--nav-h) + 12px) 16px 12px; }
  #main > .poem-wrap { display: flex; flex-direction: column; justify-content: flex-start; gap: 0; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
  #main > .poem-wrap .poem-side { display: none; }
  #main > .poem-wrap .poem-notes, #main > .poem-wrap .wsummary { display: none; }
  #main > .poem-wrap .poem-stage,
  #main > .poem-wrap .poem-stage.is-horizontal { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; min-height: 0; max-width: none; overflow: hidden; padding: 0; }
  #main > .poem-wrap .poem-title,
  #main > .poem-wrap .poem-by,
  #main > .poem-wrap .poem-body,
  #main > .poem-wrap .poem-stage.is-horizontal .poem-title,
  #main > .poem-wrap .poem-stage.is-horizontal .poem-by,
  #main > .poem-wrap .poem-stage.is-horizontal .poem-body { writing-mode: horizontal-tb; max-height: none; }
  #main > .poem-wrap .poem-title { flex: 0 0 auto; max-width: 100%; font-size: calc(2rem * var(--reader-scale, 1)); line-height: 1.1; letter-spacing: 0.08em; text-align: center; }
  #main > .poem-wrap .poem-by { flex: 0 0 auto; padding: 0; font-size: calc(0.82rem * var(--reader-scale, 1)); letter-spacing: 0.08em; line-height: 1.35; }
  #main > .poem-wrap .poem-body,
  #main > .poem-wrap .poem-stage.is-horizontal .poem-body { flex: 0 1 auto; width: 100%; max-width: 34rem; font-size: calc(1.08rem * var(--reader-scale, 1)); line-height: 1.42; letter-spacing: 0.04em; text-align: center; }
  #main > .poem-wrap .poem-body .line { display: block; margin: 0; white-space: nowrap; }

  /* 外文的原文、英译、中译同屏并列，避免读者在多个区域之间翻页。 */
  #main > .poem-wrap.wreader { display: flex; }
  #main > .poem-wrap.wreader .wreader-head { flex: 0 0 auto; margin: 0 0 8px; text-align: center; }
  #main > .poem-wrap.wreader .wreader-head h1 { font-size: calc(1.85rem * var(--reader-scale, 1)); line-height: 1.08; }
  #main > .poem-wrap.wreader .wreader-head .orig { font-size: calc(0.82rem * var(--reader-scale, 1)); line-height: 1.22; margin: 3px 0; }
  #main > .poem-wrap.wreader .wreader-head .by { font-size: calc(0.72rem * var(--reader-scale, 1)); line-height: 1.25; margin: 0; }
  #main > .poem-wrap.wreader .wcols { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 7px; min-height: 0; overflow: hidden; }
  #main > .poem-wrap.wreader .wcol { min-width: 0; overflow: hidden; }
  #main > .poem-wrap.wreader .wcol h2 { font-size: calc(0.78rem * var(--reader-scale, 1)); line-height: 1.2; margin: 0 0 4px; white-space: nowrap; }
  #main > .poem-wrap.wreader .wcol .text,
  #main > .poem-wrap.wreader .wcol .text.latin,
  #main > .poem-wrap.wreader .wcol .text.zh { font-size: calc(0.76rem * var(--reader-scale, 1)); line-height: 1.35; overflow-wrap: anywhere; }
  #main > .poem-wrap.wreader .wcol:only-child { grid-column: 1 / -1; }

  /* 首页首屏在窄屏上留出品牌和完整搜索区。 */
  .hero { min-height: 0; }
  .hero-title { right: 9vw; top: 15vh; font-size: 56px; }
  .daily { right: 28vw; top: calc(var(--nav-h) + 5vh); height: 42vh; }
  .daily-poem { font-size: 16px; }
  .hero-foot { left: var(--gutter); right: var(--gutter); bottom: 4vh; }
  .hero-lede { max-width: 19rem; line-height: 1.65; }
  .hero-foot .search { width: 100%; }
  .hero-moon { width: 29vw; height: 29vw; left: 7%; top: 18%; }
  .world-inner { gap: 20px; }
  .region-list { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .region-list button { flex: 0 0 auto; }
}

/* 书库弹出的阅读器复用独立诗页的手机单屏布局。 */
@media (max-width: 760px) {
  .reader.is-open { height: 100svh; overflow: hidden; }
  .reader .poem-wrap { display: flex; flex-direction: column; justify-content: flex-start; gap: 0; width: 100%; height: 100%; min-height: 0; max-width: none; margin: 0; padding: calc(var(--nav-h) + 12px) 16px 12px; overflow: hidden; }
  .reader .poem-wrap .poem-side, .reader .poem-wrap .poem-notes, .reader .poem-wrap .wsummary { display: none; }
  .reader .poem-wrap .poem-stage, .reader .poem-wrap .poem-stage.is-horizontal { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; min-height: 0; max-width: none; overflow: hidden; padding: 0; }
  .reader .poem-wrap .poem-title, .reader .poem-wrap .poem-by, .reader .poem-wrap .poem-body,
  .reader .poem-wrap .poem-stage.is-horizontal .poem-title, .reader .poem-wrap .poem-stage.is-horizontal .poem-by, .reader .poem-wrap .poem-stage.is-horizontal .poem-body { writing-mode: horizontal-tb; max-height: none; }
  .reader .poem-wrap .poem-title { flex: 0 0 auto; max-width: 100%; font-size: calc(2rem * var(--reader-scale, 1)); line-height: 1.1; letter-spacing: 0.08em; text-align: center; }
  .reader .poem-wrap .poem-by { flex: 0 0 auto; padding: 0; font-size: calc(0.82rem * var(--reader-scale, 1)); letter-spacing: 0.08em; line-height: 1.35; }
  .reader .poem-wrap .poem-body, .reader .poem-wrap .poem-stage.is-horizontal .poem-body { flex: 0 1 auto; width: 100%; max-width: 34rem; font-size: calc(1.08rem * var(--reader-scale, 1)); line-height: 1.42; letter-spacing: 0.04em; text-align: center; }
  .reader .poem-wrap .poem-body .line { display: block; margin: 0; white-space: nowrap; }
  .reader .poem-wrap.wreader { display: flex; }
  .reader .poem-wrap.wreader .wreader-head { flex: 0 0 auto; margin: 0 0 8px; text-align: center; }
  .reader .poem-wrap.wreader .wreader-head h1 { font-size: calc(1.85rem * var(--reader-scale, 1)); line-height: 1.08; }
  .reader .poem-wrap.wreader .wreader-head .orig { font-size: calc(0.82rem * var(--reader-scale, 1)); line-height: 1.22; margin: 3px 0; }
  .reader .poem-wrap.wreader .wreader-head .by { font-size: calc(0.72rem * var(--reader-scale, 1)); line-height: 1.25; margin: 0; }
  .reader .poem-wrap.wreader .wcols { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 7px; min-height: 0; overflow: hidden; }
  .reader .poem-wrap.wreader .wcol { min-width: 0; overflow: hidden; }
  .reader .poem-wrap.wreader .wcol h2 { font-size: calc(0.78rem * var(--reader-scale, 1)); line-height: 1.2; margin: 0 0 4px; white-space: nowrap; }
  .reader .poem-wrap.wreader .wcol .text, .reader .poem-wrap.wreader .wcol .text.latin, .reader .poem-wrap.wreader .wcol .text.zh { font-size: calc(0.76rem * var(--reader-scale, 1)); line-height: 1.35; overflow-wrap: anywhere; }
  .reader .poem-wrap.wreader .wcol:only-child { grid-column: 1 / -1; }

  /* 超长作品不截断正文，改为自然展开，读者仍能完整访问全文。 */
  #main:has(.poem-wrap.is-long), .reader:has(.poem-wrap.is-long) { overflow: auto; }
  #main > .poem-wrap.is-long, .reader .poem-wrap.is-long { height: auto; min-height: 100%; overflow: visible; }
  #main > .poem-wrap.is-long .poem-stage, .reader .poem-wrap.is-long .poem-stage,
  #main > .poem-wrap.is-long .wcols, .reader .poem-wrap.is-long .wcols { overflow: visible; }
}

/* ---------------------------------------------------------------- 诗人 */
.author-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: start; margin-bottom: 40px; }
.author-name { font-family: var(--f-display); font-weight: 400; font-size: clamp(72px, 12vw, 150px); writing-mode: horizontal-tb; margin: 0; line-height: 1.05; letter-spacing: 0.08em; }
.author-sub { font-size: var(--s1); color: var(--ink-2); margin: 0 0 14px; }
.author-sub .latin { font-family: var(--f-latin); font-style: italic; }
.author-bio { max-width: 40rem; line-height: 2; font-size: var(--s0); margin: 0; }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5em, 1fr)); gap: 4px 18px; }
.dir-grid a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--paper-2); }
.dir-grid a small { color: var(--ink-3); font-family: var(--f-latin); }
.dir-grid a:hover { color: var(--seal); }
.dir-era { margin: 48px 0 16px; display: flex; align-items: baseline; gap: 14px; }
.dir-era h2 { font-family: var(--f-display); font-weight: 400; font-size: var(--s3); margin: 0; }
.dir-era p { margin: 0; color: var(--ink-3); font-size: var(--s-1); }

@media (max-width: 760px) {
  .author-head { display: block; margin-bottom: 28px; }
  .author-name { font-size: clamp(48px, 16vw, 76px); margin-bottom: 14px; }
  .masters-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .master { min-height: 120px; }
  .master-name { font-size: var(--s1); }
}

/* 无数据提示 */
.offline {
  position: fixed;
  inset: auto var(--gutter) 24px;
  z-index: 400;
  padding: 16px 20px;
  background: var(--seal);
  color: #f6eeea;
  border-radius: 6px;
  font-size: var(--s0);
}

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