/* ============================================================
 *  沐阳乘曦 · mychengxi.top
 *  排版 · 备案页尾 · 移动端
 * ============================================================ */

:root {
  --journey: 820vh;
  --ui: #edf4f8;
  --ui-dim: rgba(159, 180, 194, .72);
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Source Han Serif CN",
           "Noto Serif CJK SC", "Noto Serif SC", "STZhongsong", "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
          "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: #05080f; }

html, body {
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

body {
  font-family: var(--sans);
  color: var(--ui);
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* 滚动行程 */
.spacer { height: var(--journey); pointer-events: none; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  opacity: 0;
  animation: scene-in 1.6s ease forwards .1s;
}
@keyframes scene-in { to { opacity: 1; } }

/* ---------------- 覆盖层 ---------------- */
.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(120% 78% at 50% 46%, rgba(0,0,0,0) 42%, rgba(0,0,0,.30) 78%, rgba(0,0,0,.52) 100%),
    linear-gradient(180deg, rgba(0,0,0,.22) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 76%, rgba(0,0,0,.24) 100%);
  mix-blend-mode: multiply;
}

/* 绢纹 / 颗粒 */
.grain {
  position: fixed; inset: -50%; z-index: 3; pointer-events: none;
  opacity: .055;
  mix-blend-mode: overlay;
  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='0.85' numOctaves='3' stitchTiles='stitch'/>\
<feColorMatrix type='saturate' values='0'/></filter>\
<rect width='220' height='220' filter='url(%23n)'/></svg>");
  animation: grain-shift 6s steps(4) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate3d(0,0,0); }
  25%  { transform: translate3d(-2%, 1%, 0); }
  50%  { transform: translate3d(1%, -2%, 0); }
  75%  { transform: translate3d(-1%, -1%, 0); }
  100% { transform: translate3d(0,0,0); }
}

/* 纸绢托底：晨雾散尽，露出承载文字的纸面 */
.paperscrim {
  position: fixed; inset: 0; z-index: 1;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(244, 241, 233, 0) 0%,
    rgba(244, 241, 233, .06) 14%,
    rgba(244, 241, 233, .30) 28%,
    rgba(244, 241, 233, .66) 44%,
    rgba(244, 241, 233, .90) 60%,
    rgba(244, 241, 233, .97) 80%,
    rgba(244, 241, 233, .99) 100%);
  -webkit-backdrop-filter: blur(10px) saturate(1.03);
  backdrop-filter: blur(10px) saturate(1.03);
}

/* ---------------- 舞台 ---------------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.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;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: absolute;
  top: clamp(20px, 3.4vh, 40px);
  left: clamp(20px, 3.6vw, 56px);
  right: clamp(20px, 3.6vw, 56px);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  letter-spacing: .34em;
  color: var(--ui);
  opacity: 0;
  transition: color .6s linear;
  text-shadow: 0 1px 12px rgba(3, 10, 17, .18);
}
.tb-name { font-family: var(--serif); font-weight: 600; letter-spacing: .40em; }
.tb-rule { flex: 0 0 auto; width: clamp(24px, 6vw, 88px); height: 1px;
           background: currentColor; opacity: .38; }
.tb-domain { font-size: 10.5px; letter-spacing: .30em; color: var(--ui-dim); }
.tb-kind {
  margin-left: auto;
  font-size: 10.5px; letter-spacing: .34em; color: var(--ui-dim);
  padding-left: 14px; border-left: 1px solid currentColor;
}

/* ---------------- 滚动提示 ---------------- */
.cue {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 5vh, 56px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  opacity: 0;
}
.cue-txt {
  font-family: var(--serif);
  font-size: 11px; letter-spacing: .50em; text-indent: .50em;
  color: var(--ui); opacity: .78;
}
.cue-line {
  width: 1px; height: clamp(34px, 6vh, 62px);
  background: linear-gradient(to bottom, currentColor, rgba(255,255,255,0));
  color: var(--ui);
  opacity: .5;
  animation: cue-drop 2.6s cubic-bezier(.5,0,.3,1) infinite;
  transform-origin: top;
}
@keyframes cue-drop {
  0%   { transform: scaleY(.2); opacity: 0; }
  35%  { transform: scaleY(1);  opacity: .55; }
  100% { transform: scaleY(1);  opacity: 0; }
}

/* ---------------- 终章题字（DOM） ---------------- */
.couplet {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  width: min(900px, 78vw);
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  color: #1B2C31;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.cp-l1, .cp-l2 { margin: 0; letter-spacing: .28em; text-indent: .28em; }
.cp-l1 { font-size: clamp(28px, 4.4vw, 58px); margin-bottom: 22px; }
.cp-l2 { font-size: clamp(28px, 4.4vw, 58px); letter-spacing: .40em; text-indent: .40em; }

/* ---------------- 印章 ---------------- */
.seal {
  position: absolute;
  width: clamp(40px, 3.6vw, 56px);
  height: clamp(40px, 3.6vw, 56px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  background: linear-gradient(150deg, #c0392b, #96271c);
  border-radius: 3px;
  box-shadow: 0 2px 14px rgba(150, 40, 25, .35);
  opacity: 0;
  transform: rotate(-2.4deg);
}
.seal span {
  font-family: var(--serif);
  font-weight: 700;
  color: #fdf3ec;
  font-size: clamp(11px, 1.05vw, 16px);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(120, 25, 15, .5);
}

/* ---------------- 页尾 ---------------- */
.foot {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 clamp(22px, 4vw, 64px) clamp(26px, 4.4vh, 52px);
  opacity: 0;
  color: #16262b;
}
.foot-rule {
  height: 1px;
  background: linear-gradient(to right,
    rgba(22,38,43,0), rgba(22,38,43,.34) 18%, rgba(22,38,43,.34) 82%, rgba(22,38,43,0));
  transform: scaleX(0);
  transform-origin: center;
  margin-bottom: clamp(20px, 3vh, 34px);
}
.foot-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.foot-col { display: flex; flex-direction: column; gap: 8px; }
.foot-col-r { align-items: flex-end; text-align: right; }
.foot-name {
  font-family: var(--serif);
  font-size: clamp(17px, 1.5vw, 22px);
  letter-spacing: .30em;
  color: #16262b;
}
.foot-domain {
  font-size: 10.5px; letter-spacing: .28em;
  color: rgba(22,38,43,.55);
}
.foot-verse {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(12px, 1.05vw, 15px);
  letter-spacing: .26em;
  color: rgba(22,38,43,.72);
  padding-bottom: 2px;
}
.beian {
  font-size: 11.5px; letter-spacing: .18em;
  color: rgba(22,38,43,.86);
  text-decoration: none;
  border-bottom: 1px solid rgba(22,38,43,.28);
  padding-bottom: 3px;
  transition: color .3s ease, border-color .3s ease;
}
.beian:hover { color: #8a5a1e; border-color: rgba(138,90,30,.6); }
.beian-gongan { display: inline-flex; align-items: center; gap: 5px; border-bottom: none; padding-bottom: 0; }
.beian-gongan-icon { height: 14px; width: auto; display: inline-block; }
.beian-ext { font-size: 9px; margin-left: 4px; opacity: .6; }
.foot-year { font-size: 10.5px; letter-spacing: .28em; color: rgba(22,38,43,.45); }

/* ---------------- 无脚本 ---------------- */
.noscript {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 32px;
  background: linear-gradient(180deg, #05080f, #16273a);
  color: #e8f0f4;
}
.noscript h1 { font-family: var(--serif); font-size: 40px; letter-spacing: .3em; margin: 0; }
.noscript p { margin: 0; font-size: 13px; letter-spacing: .2em; color: rgba(232,240,244,.7); }
.noscript a { color: #d6a858; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 860px) {
  :root { --journey: 680vh; }

  .topbar { gap: 10px; font-size: 10.5px; letter-spacing: .26em; }
  .tb-kind { display: none; }
  .tb-rule { width: 22px; }

  .foot-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .foot-col-r { align-items: flex-start; text-align: left; }
  .foot-verse { order: 3; }
  .seal { width: 38px; height: 38px; }
  .seal span { font-size: 10px; }
  .grain { opacity: .04; }
}

@media (max-width: 420px) {
  .foot-name { letter-spacing: .22em; }
}

/* 横屏矮视口 */
@media (max-height: 560px) {
}

@media (prefers-reduced-motion: reduce) {
  #scene { animation: none; opacity: 1; }
  .grain { animation: none; }
  .cue-line { animation: none; transform: scaleY(1); opacity: .5; }
}
