/* ============================================================
   赤壁 · 沉浸卷 — Three.js 古风交互页
   宏诺文化 / 大都督
   ============================================================ */

@font-face {
  font-family: "Yishanbei Zhuan";
  src: url("fonts/yishanbei-zhuan-full.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/noto-serif-sc-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Yishanbei Zhuan";
  src: url("fonts/yishanbei-zhuan-full.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/noto-serif-sc-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Yishanbei Zhuan";
  src: url("fonts/yishanbei-zhuan-full.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/noto-serif-sc-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Yishanbei Zhuan";
  src: url("fonts/yishanbei-zhuan-full.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("fonts/noto-serif-sc-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #05070b;
  --paper: #E9E0CB;
  --gold: #C8A96A;
  --cinnabar: #C0392B;
  --muted: #8C8474;
  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: "Inter", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", serif;
  --display: "Yishanbei Zhuan", "Kaiti SC", "STKaiti", "KaiTi", serif;
}

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

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  overflow-x: hidden;
}

::selection { background: var(--cinnabar); color: var(--paper); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

/* ---------- canvas layers ---------- */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 70% 20%, #0d1420 0%, #05070b 55%, #030407 100%);
}
.no-webgl #scene { opacity: 0.35; }

#ink {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.7) 100%),
    linear-gradient(180deg, rgba(5, 7, 11, 0.55) 0%, transparent 22%, transparent 78%, rgba(5, 7, 11, 0.8) 100%);
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 30;
  background: linear-gradient(90deg, var(--gold), var(--cinnabar));
}

/* ---------- hud ---------- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(5, 7, 11, 0.94) 0%, rgba(5, 7, 11, 0.7) 55%, rgba(5, 7, 11, 0) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(20px, 4vw, 56px);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: rgba(233, 224, 203, 0.68);
  text-transform: uppercase;
  pointer-events: none;
}
.hud a { pointer-events: auto; }
.hud-back {
  border-bottom: 1px solid rgba(233, 224, 203, 0.25);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}
.hud-back:hover { color: var(--gold); border-color: var(--gold); }
.hud-brand { font-family: "Yishanbei Zhuan", var(--serif); letter-spacing: 0.28em; font-size: 13px; color: rgba(233, 224, 203, 0.78); }
.hud-meta { color: rgba(233, 224, 203, 0.45); }

/* ---------- chapters ---------- */

main { position: relative; z-index: 10; }

.chapter {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: clamp(88px, 12vh, 140px) clamp(24px, 6vw, 96px);
}

.inner { max-width: 620px; }

.kicker {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.34em;
  color: var(--gold);
  text-transform: uppercase;
}

.note {
  margin-top: 26px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: rgba(233, 224, 203, 0.5);
}

.body-text {
  margin-top: 30px;
  max-width: 30em;
  font-size: clamp(15px, 1.1vw, 16.5px);
  line-height: 2.15;
  letter-spacing: 0.06em;
  max-width: 26em;
  color: rgba(233, 224, 203, 0.8);
  text-wrap: pretty;
}

/* hero */

.hero { grid-template-columns: 1fr auto; align-items: center; }

.hero-meta {
  align-self: end;
  padding-bottom: clamp(20px, 6vh, 80px);
}
.hero-sub {
  margin-top: 26px;
  font-size: clamp(19px, 1.7vw, 24px);
  letter-spacing: 0.18em;
  color: rgba(233, 224, 203, 0.86);
}
.hint {
  margin-top: 48px;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: rgba(233, 224, 203, 0.42);
  text-transform: uppercase;
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.hero-title {
  font-family: var(--display);
  writing-mode: vertical-rl;
  font-size: clamp(84px, 15vw, 210px);
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1;
  color: var(--paper);
  text-shadow: 0 0 60px rgba(200, 169, 106, 0.18);
  margin-left: auto;
}

/* vertical quote chapters */

.ch-right .inner { margin-left: auto; text-align: right; }
.ch-right .vquote { margin-left: auto; }

.vquote {
  font-family: var(--display);
  writing-mode: vertical-rl;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 2.1;
  letter-spacing: 0.38em;
  color: var(--paper);
  margin-top: 32px;
  text-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.chapter-title {
  font-feature-settings: "palt" 1;
  text-wrap: balance;
  margin-top: 34px;
  font-family: var(--display);
  font-size: clamp(38px, 5vw, 76px);
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.28;
}

/* seal */

.seal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  place-items: center;
  width: 150px;
  height: 150px;
  margin-top: 44px;
  padding: 8px;
  background: var(--cinnabar);
  color: #f3e7d2;
  font-family: "Yishanbei Zhuan", "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 36px;
  line-height: 1;
  border: 2px solid rgba(243, 231, 210, 0.55);
  box-shadow: inset 0 0 0 4px var(--cinnabar), inset 0 0 0 5px rgba(243, 231, 210, 0.3);
  transform: rotate(-4deg);
}
.seal span { display: grid; place-items: center; line-height: 1; }
.stamp span { display: grid; place-items: center; line-height: 1; }
.ch-right .seal { margin-left: auto; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.stamp {
  position: fixed;
  right: clamp(18px, 4vw, 54px);
  bottom: clamp(18px, 4vh, 46px);
  z-index: 14;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  place-items: center;
  width: 110px;
  height: 110px;
  padding: 6px;
  background: var(--cinnabar);
  color: #f4e7d2;
  font-family: "Yishanbei Zhuan", "Kaiti SC", "STKaiti", "KaiTi", serif;
  font-size: 28px;
  line-height: 1;
  border: 2px solid rgba(244, 231, 210, 0.5);
  box-shadow: inset 0 0 0 3px var(--cinnabar);
  filter: url(#stampRough);
  opacity: 0;
  transform: rotate(-6deg) scale(0.92);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.stamp.show { opacity: 0.94; transform: rotate(-6deg) scale(1); }

.seal-art {
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: transparent !important;
  filter: none !important;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}
.seal-art span { visibility: hidden; }
.stamp.hide { opacity: 0; }

@media (max-width: 820px) {
  .stamp { display: none; }
}

/* last chapter */

.last .inner { max-width: 760px; }
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 44px;
}
.cta a {
  display: inline-block;
  padding: 13px 26px;
  border: 1px solid rgba(200, 169, 106, 0.6);
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.2em;
  color: var(--gold);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.cta a:hover { background: var(--gold); color: #14100a; border-color: var(--gold); }

.credits {
  margin-top: 56px;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 2;
  letter-spacing: 0.12em;
  color: rgba(233, 224, 203, 0.35);
}

/* reveal */

[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 1.1s ease, transform 1.1s cubic-bezier(0.16, 1, 0.3, 1); }
[data-reveal].in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .hud { font-size: 9px; letter-spacing: 0.16em; padding: 18px 20px; }
  .hud-brand { display: none; }
  .hero { grid-template-columns: 1fr; align-content: space-between; }
  .hero-title { font-size: clamp(64px, 22vw, 120px); margin: 0; align-self: center; }
  .hero-meta { align-self: start; padding-bottom: 0; }
  .vquote { font-size: clamp(24px, 7vw, 34px); letter-spacing: 0.24em; }
  .chapter-title { font-size: clamp(32px, 8vw, 48px); }
  .body-text { font-size: 14px; }
  .credits { margin-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hint { animation: none; }
}
