/* 墙外有风，我希望并肩而行 —— 一笔 */
:root {
  --bg: #ece7dd;
  --ink: #161412;
  --mute: rgba(22, 20, 18, .52);
  --accent: #e2462c;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: #fff; }

/* ---------- stage ---------- */
.stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#world { display: block; width: 100%; height: 100%; overflow: visible; }
#glyphs path {
  fill: none; stroke: var(--ink);
  stroke-linecap: round; stroke-linejoin: round;
}
#cursor { fill: var(--accent); }
#cursor.blink { animation: blink 1.06s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.p-line { fill: none; stroke: var(--ink); stroke-linecap: round; vector-effect: non-scaling-stroke; }
.p-fill { fill: var(--ink); }
.p-bg { fill: var(--bg); }
.p-acc { fill: var(--accent); }
.p-acc-line { fill: none; stroke: var(--accent); stroke-linecap: round; vector-effect: non-scaling-stroke; }
.p-mono { font-family: var(--mono); fill: var(--ink); }
.p-txt { font-family: var(--serif); fill: var(--ink); }
.p-lab { font-family: var(--mono); fill: var(--mute); letter-spacing: .08em; }

/* ---------- chapters (fixed overlay, driven by the master timeline) ---------- */
.chapters { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.ch {
  position: absolute;
  opacity: 0; visibility: hidden;
  max-width: 30em;
}
.ch h2 {
  margin: 0 0 .9em;
  font-size: clamp(30px, 3.1vw, 46px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: .06em;
}
.ch p { margin: 0 0 .7em; }
.yr {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .28em;
  color: var(--accent);
  margin: 0 0 1.1em !important;
}
.yr::before { content: ""; display: inline-block; width: 2.2em; height: 1px; background: currentColor; vertical-align: middle; margin-right: .9em; }

.ch--left, .ch--right { top: 50%; width: min(31vw, 30em); }
.ch--left { left: 7vw; }
.ch--right { left: 60vw; }
.ch--long { font-size: 16px; line-height: 1.85; }
.ch--quiet { color: var(--ink); }
.lucky { margin-top: 1.2em !important; font-size: 1.15em; letter-spacing: .08em; }
.lucky::first-letter { color: var(--accent); }

/* hero */
.ch--hero { inset: 0; max-width: none; }
.hero-title {
  position: absolute; left: 0; top: 0;
  margin: 0;
  writing-mode: vertical-rl;
  font-size: clamp(30px, 4.2vh, 50px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .32em;
  white-space: nowrap;
  will-change: transform;
}
.hero-title span { display: block; }
.hero-title span:last-child { margin-top: 2.4em; }
.hero-hint {
  position: absolute; left: 50%; bottom: 4.2vh;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--mono); font-size: 12px; letter-spacing: .3em;
  color: var(--mute);
  white-space: nowrap;
}
.hero-hint i {
  display: inline-block; width: 1px; height: 26px; margin-right: 14px;
  background: var(--ink); vertical-align: middle;
  transform-origin: top; animation: hint 2.4s cubic-bezier(.6,0,.3,1) infinite;
}
@keyframes hint { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); transform-origin: top; } 55% { transform: scaleY(1); transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* 未完待续 */
.greet { font-size: 1.18em; line-height: 1.8; margin-top: 1em !important; }
.caret {
  display: inline-block; width: .5em; height: 1.05em; margin-left: .2em;
  background: var(--accent); vertical-align: -0.16em;
  animation: blink 1.06s steps(1, end) infinite;
}
.lock { margin-top: 2.2em; padding-top: 1.2em; border-top: 1px solid var(--mute); font-family: var(--mono); }
.lock p { margin: 0 !important; }
.lock__k { font-size: 12px; letter-spacing: .3em; color: var(--mute); }
.lock__v { font-size: 17px; letter-spacing: .06em; margin-top: .3em !important; }
.lock__c { font-size: 13px; color: var(--accent); letter-spacing: .08em; margin-top: .4em !important; font-variant-numeric: tabular-nums; }

/* 揭晓 */
.ch--end {
  left: 0; right: 0; top: 64vh;
  max-width: none; text-align: center;
  pointer-events: auto;
}
.end-line { font-size: 16px; letter-spacing: .4em; color: var(--mute); margin: 0 0 1.6em !important; }
.end-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.contact { list-style: none; margin: 0; padding: 0; display: flex; gap: 2.6em; justify-content: center; font-family: var(--mono); font-size: 16px; letter-spacing: .06em; }
.contact a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border: 1px solid rgba(22,20,18,.35); border-radius: 999px;
  background: rgba(22,20,18,.05); color: var(--ink); text-decoration: none;
  transition: background .35s ease, transform .35s ease;
}
.contact a:hover, .contact a:focus-visible { background: rgba(22,20,18,.12); color: var(--ink); outline: none; transform: translateY(-1px); }

.scroll { position: relative; z-index: 1; width: 1px; height: 2000vh; pointer-events: none; }

/* ---------- 手机竖屏：单独构图 ---------- */
@media (max-aspect-ratio: 3/4) {
  body { font-size: 15px; line-height: 1.85; }
  .ch--left, .ch--right {
    top: auto; left: 7.5vw; right: 7.5vw; width: auto; max-width: none;
    bottom: calc(5.5vh + env(safe-area-inset-bottom));
  }
  .ch h2 { font-size: 27px; margin-bottom: .6em; }
  .yr { font-size: 11px; margin-bottom: .8em !important; }
  .ch p { margin-bottom: .5em; }
  .ch--long { font-size: 13.6px; line-height: 1.75; }
  .ch--long h2 { margin-bottom: .45em; }
  .hero-title { font-size: 4.9vw; letter-spacing: .16em; }
  .hero-title span:last-child { margin-top: 1.2em; }
  .hero-hint { bottom: calc(3.5vh + env(safe-area-inset-bottom)); font-size: 11px; }
  .greet { font-size: 1.1em; }
  .lock { margin-top: 1.3em; padding-top: .9em; }
  .ch--end { top: 60vh; }
  .end-line { font-size: 13px; letter-spacing: .3em; }
  .contact { flex-direction: row; gap: 12px; justify-content: center; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #cursor.blink, .caret, .hero-hint i { animation: none; }
}
