/* =========================================================================
   BASE — 变量、全局、开场围巾、章节导航
   ========================================================================= */

:root {
  --ink: #070a12;
  --ink-2: #0b111c;
  --text: #e9ecf3;
  --muted: rgba(233, 236, 243, 0.58);
  --faint: rgba(233, 236, 243, 0.32);
  --gold: #e9c07a;
  --amber: #f2a765;
  --rose: #d98b93;
  --ice: #a9c1de;
  --line: rgba(255, 255, 255, 0.1);

  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC",
    "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Hiragino Sans GB", sans-serif;
  --num: "Bodoni MT", "Didot", "Times New Roman", serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(20px, 6vw, 96px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 720px at 72% -8%, #172038 0%, transparent 62%),
    radial-gradient(900px 700px at 8% 108%, #2a171b 0%, transparent 58%),
    linear-gradient(180deg, #070a12 0%, #080b14 55%, #06080f 100%);
}

body.is-loading {
  overflow: hidden;
}

/* ---------- 加载页：先解码围巾贴图，再掀开开场 ---------- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 120; /* 盖在围巾 z-index:100 之上 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: rgba(120, 92, 52, 0.62);
  background: radial-gradient(120% 90% at 50% 30%, #efe4cd 0%, #e3d6bd 52%, #d3c2a4 100%);
  transition: opacity 0.8s ease;
}

#boot .boot__text {
  margin: 0;
  text-indent: 0.3em;
}

#boot .boot__bar {
  position: relative;
  display: block;
  width: 168px;
  height: 2px;
  overflow: hidden;
  background: rgba(120, 92, 52, 0.22);
}

#boot .boot__bar b {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(170, 92, 70, 0.5), #a8563c);
  box-shadow: 0 0 10px rgba(168, 86, 60, 0.45);
  transition: width 0.45s cubic-bezier(0.22, 0.9, 0.3, 1);
}

#boot .boot__pct {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: rgba(120, 92, 52, 0.5);
  font-variant-numeric: tabular-nums;
}

#boot.is-gone {
  opacity: 0;
  pointer-events: none;
}

html.no-scroll,
body.no-scroll {
  overflow: hidden;
}

::selection {
  background: rgba(233, 192, 122, 0.28);
  color: #fff;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 6px;
}

img {
  max-width: 100%;
}

/* ---------- 质感层 ---------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 70;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 1.2s steps(2) infinite;
}

@keyframes grainShift {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-1.5%, 1%);
  }
  100% {
    transform: translate(1%, -1.5%);
  }
}

.snow {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.75;
}

.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle,
    rgba(233, 192, 122, 0.09) 0%,
    rgba(233, 192, 122, 0.035) 38%,
    transparent 66%
  );
  transition: opacity 0.8s ease;
  will-change: transform;
}

@media (pointer: fine) {
  .cursor-glow {
    opacity: 1;
  }
}

/* ---------- 顶部进度 / 品牌 ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 62;
  height: 2px;
  background: rgba(255, 255, 255, 0.04);
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8a5a3c, var(--gold) 55%, var(--rose));
  box-shadow: 0 0 12px rgba(233, 192, 122, 0.55);
}

.brand {
  position: fixed;
  top: clamp(20px, 3.4vh, 34px);
  left: var(--gutter);
  z-index: 58;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: rgba(233, 192, 122, 0.75);
  pointer-events: none;
}

.brand i {
  width: 22px;
  height: 1px;
  background: rgba(233, 192, 122, 0.4);
}

/* ---------- 右侧章节点 ---------- */
.dots {
  position: fixed;
  top: 50%;
  right: clamp(12px, 2vw, 26px);
  z-index: 58;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 13px;
  transform: translateY(-50%);
}

.dots button {
  position: relative;
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  transition: height 0.5s var(--ease), background 0.5s var(--ease),
    box-shadow 0.5s var(--ease);
}

.dots button:hover {
  background: rgba(233, 192, 122, 0.65);
}

.dots button.is-active {
  height: 22px;
  background: var(--gold);
  box-shadow: 0 0 14px rgba(233, 192, 122, 0.55);
}

.dots button span {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%) translateX(6px);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: rgba(233, 236, 243, 0.7);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s var(--ease);
}

.dots button:hover span,
.dots button:focus-visible span {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 640px) {
  .dots {
    right: 9px;
    gap: 10px;
  }
  .dots button {
    width: 5px;
    height: 5px;
  }
  .dots button.is-active {
    height: 16px;
  }
}

/* ---------- 通用 ---------- */
.sec {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
  min-height: 100vh;
  padding: clamp(76px, 11vh, 128px) var(--gutter) clamp(56px, 8vh, 92px);
  overflow: hidden;
}

.sec > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(233, 192, 122, 0.72);
}

.chapter {
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 2.4vw, 28px);
  margin-bottom: clamp(26px, 5vh, 54px);
}

.chapter__no {
  font-family: var(--num);
  font-size: clamp(40px, 6.4vw, 78px);
  line-height: 0.82;
  letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(233, 192, 122, 0.5);
  opacity: 0.9;
}

.chapter__en {
  font-size: 9.5px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(233, 192, 122, 0.72);
}

.chapter__title {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(27px, 4.4vw, 46px);
  line-height: 1.42;
  letter-spacing: 0.04em;
  white-space: pre-line;
  color: rgba(245, 246, 250, 0.94);
  text-wrap: balance;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--d, 0s);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border: 1px solid rgba(233, 192, 122, 0.28);
  border-radius: 99px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(233, 192, 122, 0.86);
  transition: border-color 0.4s ease, background 0.4s ease, color 0.4s ease;
}

.ghost-btn::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.ghost-btn:hover {
  border-color: rgba(233, 192, 122, 0.6);
  background: rgba(233, 192, 122, 0.07);
  color: var(--gold);
}

.solid-btn {
  padding: 11px 22px;
  border-radius: 99px;
  background: linear-gradient(135deg, #e9c07a, #d99a63);
  color: #241708;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  transition: transform 0.4s var(--ease), box-shadow 0.4s ease, opacity 0.4s ease;
  box-shadow: 0 6px 24px rgba(233, 192, 122, 0.18);
}

.solid-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(233, 192, 122, 0.28);
}

.solid-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---------- 开场 · 围巾 ---------- */
.veil {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: opacity 0.9s ease 0.35s;
}

.veil__shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 50%, #11131b 0%, #06070c 70%);
}

.veil__wing {
  position: absolute;
  top: -8%;
  width: 57%;
  height: 116%;
  transition: transform 1.35s cubic-bezier(0.76, 0, 0.24, 1);
  will-change: transform;
}

.veil__wing--l {
  left: -3%;
  transform-origin: left center;
}

.veil__wing--r {
  right: -3%;
  transform-origin: right center;
}

.scarf {
  position: absolute;
  inset: 0;
  background-color: #c9ac85;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(124, 45, 45, 0) 0 34px,
      rgba(124, 45, 45, 0.5) 34px 42px,
      rgba(124, 45, 45, 0) 42px 78px,
      rgba(32, 28, 25, 0.24) 78px 81px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(124, 45, 45, 0) 0 34px,
      rgba(124, 45, 45, 0.42) 34px 42px,
      rgba(124, 45, 45, 0) 42px 78px,
      rgba(32, 28, 25, 0.2) 78px 81px
    ),
    repeating-linear-gradient(
      102deg,
      rgba(0, 0, 0, 0) 0 74px,
      rgba(0, 0, 0, 0.07) 74px 78px,
      rgba(255, 255, 255, 0.05) 78px 82px,
      rgba(0, 0, 0, 0) 82px 156px
    ),
    linear-gradient(112deg, #a98a64 0%, #d9c19b 34%, #c3a37a 64%, #9d7f5b 100%);
  box-shadow: inset 0 0 140px rgba(30, 16, 8, 0.5), inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.scarf::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 70% at 50% 0%, rgba(255, 244, 224, 0.18), transparent 60%);
}

/* 流苏 */
.scarf--l::after,
.scarf--r::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  background: repeating-linear-gradient(
    90deg,
    #c6a880 0 3px,
    rgba(120, 90, 55, 0.55) 3px 4px,
    transparent 4px 9px
  );
  filter: brightness(0.92);
}

.scarf--l::after {
  right: -15px;
}

.scarf--r::after {
  left: -15px;
}

.veil__knot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 30px 42px;
  color: #f3e5cc;
  text-align: center;
}

.veil__knot::before,
.veil__knot::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243, 229, 204, 0.5));
}

.veil__knot::before {
  right: 100%;
}

.veil__knot::after {
  left: 100%;
  transform: scaleX(-1);
}

.veil__tag {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: 0.24em;
  color: #f6ead4;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5);
}

.veil__hint {
  font-size: 10px;
  letter-spacing: 0.36em;
  color: rgba(246, 234, 212, 0.66);
  animation: hintPulse 2.6s ease-in-out infinite;
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.veil.is-open .veil__wing--l {
  transform: translateX(-108%) rotate(-3.5deg);
}

.veil.is-open .veil__wing--r {
  transform: translateX(108%) rotate(3.5deg);
}

.veil.is-open .veil__knot {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.veil.is-open .veil__shade {
  opacity: 0;
  transition: opacity 1.1s ease 0.4s;
}

.veil.is-gone {
  display: none;
}

/* ---------- 其它 ---------- */
.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.1em;
}

@media (max-width: 720px) {
  .chapter {
    gap: 12px;
  }
  .chapter__title {
    line-height: 1.5;
  }
}
