/* =========================================================
   听风录 · motion layer
   开屏 / 章节钉住与揭开 / 文字入场 / 身世字台 / 书 / 红叶
   ========================================================= */

@property --hole{syntax:'<length>';inherits:true;initial-value:0px}

.vh{
  position:absolute !important;width:1px;height:1px;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;
}

/* =========================================================
   1. 开屏 —— 金叶 / 一闪 / 俳句三句依次落墨
   ========================================================= */
.js body.is-splashing{overflow:hidden}
.js body.is-splashing .hero *,
.js body.is-splashing .hero{animation-play-state:paused !important}

.splash{
  --hh:min(84svh, 880px);                /* haiku block height */
  --hw:calc(var(--hh) * .4908);          /* traced block is 1712 × 3488 */
  position:fixed;inset:0;z-index:1000;
  background:#040404;
  overflow:hidden;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:none;
}
.splash.is-cut{background:transparent}
.splash.is-gone{display:none}

/* ---- 黑底与金叶（一刀之后裂成两半） ---- */
.sp-night{
  position:absolute;inset:0;
  background:
    radial-gradient(ellipse 36% 30% at 50% 50%, rgba(130,64,10,.18), transparent 70%),
    #040404;
  will-change:transform,opacity;
}
.sp-night.half{transition:transform 1.05s cubic-bezier(.62,0,.18,1), opacity 1.05s ease .1s}
.splash.is-slash .sp-night.half-a{clip-path:var(--clip-a)}
.splash.is-slash .sp-night.half-b{clip-path:var(--clip-b)}
.splash:not(.is-slash) .sp-night.half-b{visibility:hidden}
.splash.is-split .sp-night.half-a{transform:translate3d(var(--ax),var(--ay),0);opacity:0}
.splash.is-split .sp-night.half-b{transform:translate3d(var(--bx),var(--by),0);opacity:0}

.sp-gold{
  position:absolute;left:50%;top:50%;
  width:min(34vmin, 300px);aspect-ratio:1;
  transform:translate(-50%,-50%) rotate(-6deg);
  opacity:0;
  filter:drop-shadow(0 0 22px rgba(255,186,70,.36)) drop-shadow(0 0 60px rgba(255,150,40,.18));
  transition:opacity 1.4s ease .2s, filter .7s ease, transform 1.6s cubic-bezier(.16,1,.3,1);
}
.sp-gold svg{width:100%;height:100%;display:block}
.splash.is-on .sp-gold{opacity:1;animation:goldBreath 3.6s ease-in-out infinite}
.splash.is-wake .sp-gold{
  filter:drop-shadow(0 0 30px rgba(255,214,120,.8)) drop-shadow(0 0 90px rgba(255,170,60,.5)) brightness(1.18);
  transform:translate(-50%,-50%) rotate(-2deg) scale(1.06);
}
@keyframes goldBreath{
  0%,100%{translate:0 0;rotate:0deg}
  50%{translate:0 -1.2%;rotate:2.4deg}
}

/* ---- 剑光 ---- */
.sp-slash{
  position:absolute;left:var(--sx,0);top:var(--sy,0);
  width:var(--sl,140vmax);height:2px;
  transform-origin:0 50%;
  transform:rotate(var(--sa,25deg)) scaleX(0);
  background:linear-gradient(90deg, rgba(200,255,250,0) 0%, #f4fffd 8%, #ffffff 50%, #e8fffb 92%, rgba(200,255,250,0) 100%);
  box-shadow:0 0 10px 2px rgba(170,255,245,.85), 0 0 40px 8px rgba(120,220,230,.45);
  opacity:0;pointer-events:none;z-index:4;
}
.splash.is-slash .sp-slash{
  animation:slashDraw .36s cubic-bezier(.7,0,.2,1) forwards, slashWide .9s cubic-bezier(.2,.8,.2,1) .34s forwards;
}
@keyframes slashDraw{
  0%{opacity:1;transform:rotate(var(--sa)) scaleX(0)}
  100%{opacity:1;transform:rotate(var(--sa)) scaleX(1)}
}
@keyframes slashWide{
  0%{opacity:1;height:2px;filter:blur(0)}
  35%{opacity:.95;height:26px;filter:blur(3px)}
  100%{opacity:0;height:120px;filter:blur(18px)}
}
.sp-flash{
  position:absolute;inset:0;z-index:3;pointer-events:none;
  background:radial-gradient(ellipse at 50% 50%, rgba(235,255,252,.9), rgba(200,240,240,.35) 60%, transparent 100%);
  opacity:0;
}
.splash.is-split .sp-flash{animation:flash .7s ease-out}
@keyframes flash{0%{opacity:0}18%{opacity:.75}100%{opacity:0}}

/* ---- 宣纸与俳句 ---- */
.sp-paper{
  position:absolute;inset:0;
  background:radial-gradient(ellipse 70% 62% at 50% 46%, #ece9d3 0%, #e6e2c9 52%, #d3cfb2 100%);
}
.sp-paper::before{
  content:"";position:absolute;inset:0;pointer-events:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .55' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .38 0 0 0 0 .26 0 0 0 .55 -.18'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity:.55;mix-blend-mode:multiply;
}
.sp-paper::after{
  content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(ellipse at 50% 50%, transparent 56%, rgba(90,80,40,.16) 100%);
}
.splash.is-leaving .sp-paper{
  -webkit-mask:radial-gradient(circle at 50% 50%, transparent var(--hole), #000 calc(var(--hole) + 120px));
          mask:radial-gradient(circle at 50% 50%, transparent var(--hole), #000 calc(var(--hole) + 120px));
  animation:holeOpen 1.4s cubic-bezier(.66,0,.2,1) .25s both;
}
@keyframes holeOpen{from{--hole:0px}to{--hole:170vmax}}

.sp-haiku{
  position:absolute;left:50%;top:50%;
  height:var(--hh);width:var(--hw);
  transform:translate(-50%,-50%);
  overflow:visible;
}
.sp-haiku .ink path{fill:#1b1914}
.sp-haiku .light path{fill:#6c695b}
.sp-haiku .ch{transition:transform 1.1s cubic-bezier(.5,0,.2,1), opacity .9s ease}
.sp-haiku .light .ch{opacity:0;filter:blur(5px);transition:opacity 1.5s ease, filter 1.6s ease, transform 1.1s cubic-bezier(.5,0,.2,1)}
.sp-haiku .light .ch.is-on{opacity:1;filter:none}

.sp-redleaf{
  position:absolute;
  left:calc(50% - var(--hw) / 2);top:44%;
  width:calc(var(--hw) * .95);aspect-ratio:1;
  transform:translate3d(-130%,10%,0) rotate(-60deg);
  filter:drop-shadow(10px 18px 16px rgba(90,20,10,.28));
  pointer-events:none;z-index:2;
  opacity:0;
}
.splash.is-leaf .sp-redleaf{animation:redSweep 2.7s linear forwards}
@keyframes redSweep{
  0%  {opacity:1;transform:translate3d(calc(var(--hw) / 2 - 50vw - 100%), 26%, 0) rotate(-84deg) scale(.78);animation-timing-function:cubic-bezier(.2,.7,.3,1)}
  30% {opacity:1;transform:translate3d(-14%, -2%, 0) rotate(-28deg) scale(1);animation-timing-function:cubic-bezier(.4,0,.6,1)}
  64% {opacity:1;transform:translate3d(-2%, -9%, 0) rotate(-12deg) scale(1.04);animation-timing-function:cubic-bezier(.5,0,.8,.4)}
  100%{opacity:1;transform:translate3d(calc(var(--hw) / 2 - 50vw - 120%), 56%, 0) rotate(-112deg) scale(.84)}
}

.sp-skip{
  position:absolute;right:clamp(14px,2.4vw,34px);top:clamp(14px,2.4vw,30px);z-index:6;
  font-family:var(--serif);font-size:11px;letter-spacing:.4em;
  padding:8px 10px 8px 16px;border-radius:30px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(200,160,90,.28);
  color:rgba(220,180,110,.7);cursor:pointer;
  transition:color .6s, border-color .6s, background .4s;
}
.splash.is-cut .sp-skip{color:rgba(100,92,60,.7);border-color:rgba(100,92,60,.25)}
.sp-skip:hover{background:rgba(255,255,255,.14)}

/* =========================================================
   2. 卷首 —— 立绘滑入
   ========================================================= */
.js .hero:not(.is-in) .fig-ribbons,
.js .hero:not(.is-in) .fig-char{opacity:0;animation:none}
.js .hero.is-in .fig-ribbons{
  animation:ribbonsIn 1.8s cubic-bezier(.16,1,.3,1) both, ribbonDrift 26s ease-in-out 1.8s infinite;
}
.js .hero.is-in .fig-char{animation:charIn 1.5s cubic-bezier(.16,1,.3,1) .32s both}
.js .hero:not(.is-in) .hero-sun{opacity:0;animation:none}
.js .hero.is-in .hero-sun{animation:sunIn 2s cubic-bezier(.16,1,.3,1) both, sunBreath 14s ease-in-out 2s infinite}
@keyframes ribbonsIn{
  0%{opacity:0;transform:translate3d(26vw,0,0) scaleX(1.08);filter:blur(8px)}
  55%{filter:blur(0)}
  100%{opacity:.9;transform:none;filter:none}
}
@keyframes charIn{
  0%{opacity:0;transform:translate3d(18vw,0,0) skewX(-7deg);filter:blur(12px) drop-shadow(0 22px 34px rgba(90,50,30,.16))}
  55%{opacity:1;filter:blur(0) drop-shadow(0 22px 34px rgba(90,50,30,.16))}
  100%{opacity:1;transform:none;filter:drop-shadow(0 22px 34px rgba(90,50,30,.16))}
}
@keyframes sunIn{
  from{opacity:0;transform:translate(-50%,-50%) scale(.72)}
  to{opacity:.92;transform:translate(-50%,-50%) scale(1)}
}

/* =========================================================
   3. 章节 —— 外层 stage 管“读完钉住”，章节本身管“揭开时钉住”
      两次钉住都交给 sticky（合成线程），不跟滚动抢帧
   ========================================================= */
.js .stage{position:sticky;top:0;pointer-events:none}
/* the stage overlaps the chapter before it; only the chapter itself takes clicks
   (a hidden or clipped chapter is not hit-testable outside what is showing) */
.js .stage > .scene{pointer-events:auto}
.js .scene{position:sticky;top:0;min-height:100vh}
.js .scene:not(.hero){min-height:100lvh}
.hero{background:var(--paper)}
.origin,.poem{background:linear-gradient(to bottom,var(--paper),#ebe2d1)}
.journey{background:#1d130d}
.scene.is-opening{will-change:clip-path}
.scene-veil{
  position:absolute;inset:0;z-index:45;pointer-events:none;
  background:var(--veil-c,#1d1915);
  opacity:0;
}
#tx-canvas{
  position:fixed;inset:0;width:100%;height:100%;
  pointer-events:none;z-index:64;
}

/* =========================================================
   4. 代码手写的标题
   ========================================================= */
.ink-title[data-tint="red"] path.trace{stroke:var(--vermilion)}
.ink-title .stamp-box{fill:var(--vermilion)}
.ink-title .stamp-glyph{fill:#f5ecdc}
.ink-title.is-stamp svg{transform-origin:50% 50%;opacity:0}
.ink-title.is-stamp.is-inked svg{animation:stampDown .85s cubic-bezier(.3,1.4,.4,1) forwards}
@keyframes stampDown{
  0%{opacity:0;transform:scale(1.9) rotate(-16deg)}
  45%{opacity:1;transform:scale(.92) rotate(-5deg)}
  70%{transform:scale(1.03) rotate(-6deg)}
  100%{opacity:1;transform:scale(1) rotate(-5deg)}
}
.ink-title .cut-flash{
  stroke:#e9fffb;stroke-width:3;vector-effect:non-scaling-stroke;
  filter:drop-shadow(0 0 6px rgba(160,255,240,.9));
  stroke-dasharray:1;stroke-dashoffset:1;opacity:0;
}
.ink-title .cut-half{transition:transform 1.1s cubic-bezier(.16,1,.3,1), opacity .5s ease}

/* =========================================================
   5. 文字入场 —— 八种笔意
   ========================================================= */
.ch{display:inline-block;text-indent:0}
.js [data-enter="rise"]{opacity:0;transform:translateY(16px);transition:opacity 1s var(--ease-out), transform 1.1s var(--ease-out)}
.js [data-enter="rise"].is-entered{opacity:1;transform:none}

.js [data-enter="ink"] .ch{
  opacity:0;filter:blur(7px);transform:scale(1.22);
  transition:opacity .9s ease, filter 1.1s ease, transform 1.2s var(--ease-out);
  transition-delay:calc(var(--i) * var(--step, 22ms));
}
.js [data-enter="ink"].is-entered .ch{opacity:1;filter:none;transform:none}

.js [data-enter="wind"] .ch{
  opacity:0;
  transform:translate3d(var(--dx,2em),var(--dy,-.6em),0) rotate(var(--r,30deg));
  transition:opacity .7s ease, transform 1.15s cubic-bezier(.2,.8,.2,1);
  transition-delay:calc(var(--i) * var(--step, 24ms));
}
.js [data-enter="wind"].is-entered .ch{opacity:1;transform:none}

.js [data-enter="brush"] .ch{
  clip-path:inset(0 0 100% 0);
  opacity:.25;
  transition:clip-path .34s cubic-bezier(.4,0,.2,1), opacity .5s ease;
  transition-delay:calc(var(--i) * var(--step, 36ms));
}
.js [data-enter="brush"].is-entered .ch{clip-path:inset(0 0 0 0);opacity:1}

.js [data-enter="write"] .ch{
  clip-path:inset(-10% 100% -10% 0);
  transition:clip-path .3s cubic-bezier(.4,0,.2,1), color 1.4s ease;
  transition-delay:calc(var(--i) * var(--step, 46ms));
  color:var(--vermilion);
}
.js [data-enter="write"].is-entered .ch{clip-path:inset(-10% -4% -10% 0);color:inherit}
.js [data-enter="write"].is-entered em .ch{color:var(--vermilion)}

.js [data-enter="cut"] > *{
  position:relative;
  clip-path:inset(-20% 100% -20% 0);
  transition:clip-path 1s cubic-bezier(.7,0,.2,1);
  transition-delay:calc(var(--k) * 220ms);
}
.js [data-enter="cut"].is-entered > *{clip-path:inset(-20% -2% -20% 0)}
.cut-glint{
  position:absolute;top:-10%;bottom:-10%;left:0;width:2px;
  background:linear-gradient(to bottom,transparent,#effffc 30%,#ffffff 50%,#effffc 70%,transparent);
  box-shadow:0 0 12px 2px rgba(150,240,230,.7);
  opacity:0;pointer-events:none;
}
.js [data-enter="cut"].is-entered .cut-glint{animation:glint 1s cubic-bezier(.7,0,.2,1) both;animation-delay:calc(var(--k) * 220ms)}
@keyframes glint{0%{left:0;opacity:1}88%{opacity:1}100%{left:100%;opacity:0}}

.js [data-enter="glow"] .ch{
  opacity:0;color:#fff;
  text-shadow:0 0 18px rgba(210,245,240,.95), 0 0 2px #fff;
  transition:opacity 1.2s ease, color 2.2s ease, text-shadow 2.4s ease;
  transition-delay:calc(var(--i) * var(--step, 30ms));
}
.js [data-enter="glow"].is-entered .ch{opacity:1;color:inherit;text-shadow:0 0 0 rgba(210,245,240,0)}

.js [data-enter="item"]{
  opacity:0;transform:translateX(-26px);
  transition:opacity .9s ease, transform 1.1s var(--ease-out);
}
.js [data-enter="item"]::before{transform:scale(0)}
.js [data-enter="item"].is-entered{opacity:1;transform:none}
.js [data-enter="item"].is-entered::before{transform:scale(1);transition:transform .6s cubic-bezier(.3,1.6,.5,1) .25s, background .5s}
.js [data-enter="item"].is-entered.is-on::before{transform:scale(1.35)}
.js [data-enter="item"] h3{clip-path:inset(0 100% 0 0);transition:clip-path .9s cubic-bezier(.6,0,.2,1) .2s}
.js [data-enter="item"].is-entered h3{clip-path:inset(0 -4% 0 0)}

.js [data-enter="hang"]:not(.is-entered) > *{opacity:0}
.js [data-enter="hang"].is-entered > *{
  animation:hangIn 1.5s cubic-bezier(.3,.7,.3,1) backwards;
  animation-delay:calc(var(--k) * 110ms);
}
@keyframes hangIn{
  0%{opacity:0;transform:translateY(-90px) rotate(-16deg)}
  45%{opacity:1;transform:translateY(0) rotate(7deg)}
  65%{transform:rotate(-3.5deg)}
  82%{transform:rotate(1.4deg)}
  100%{transform:none}
}

.js [data-enter="frame"] .skill-frame{
  clip-path:polygon(0 0,0 0,0 100%,0 100%);
  transition:clip-path 1.3s cubic-bezier(.7,0,.2,1);
}
.js [data-enter="frame"].is-entered .skill-frame{
  clip-path:polygon(0 1.5%,4% 0,22% .9%,48% .2%,72% 1.2%,96% 0,100% 2%,99.2% 26%,100% 52%,99% 78%,100% 98%,74% 99.4%,50% 98.6%,26% 99.6%,3% 98.8%,0 97%,.8% 72%,0 48%,.9% 24%);
}
.js [data-enter="frame"] figcaption{opacity:0;transform:translateX(-14px);transition:opacity 1s ease .8s, transform 1s var(--ease-out) .8s}
.js [data-enter="frame"].is-entered figcaption{opacity:1;transform:none}

.js [data-enter="stars"] .star{opacity:0;scale:.2;transition:opacity .6s ease, scale .8s cubic-bezier(.3,1.6,.5,1);transition-delay:calc(var(--k) * 140ms + .2s)}
.js [data-enter="stars"].is-entered .star{opacity:1;scale:1}
.js [data-enter="stars"] .const-lines path{stroke-dashoffset:900;transition:stroke-dashoffset 2.4s ease .9s}
.js [data-enter="stars"].is-entered .const-lines path{stroke-dashoffset:0}

.js [data-enter="stamp"] .seal{opacity:0;animation:none}
.js [data-enter="stamp"].is-entered .seal{animation:stampDown .8s cubic-bezier(.3,1.4,.4,1) forwards}
.js [data-enter="stamp"] .end-meta{opacity:0;transform:translateX(-10px);transition:opacity 1s ease .5s, transform 1s var(--ease-out) .5s}
.js [data-enter="stamp"].is-entered .end-meta{opacity:1;transform:none}

/* =========================================================
   6. 身世 —— 右侧字台 + 出处
   ========================================================= */
.origin-grid{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);
  gap:clamp(30px,5vw,80px);
  align-items:start;
}
.origin-stage{position:sticky;top:12vh;height:76vh;display:flex;align-items:center;justify-content:center}
.os-card{position:relative;width:min(100%, 62vh);aspect-ratio:1;display:grid;place-items:center}
.os-enso{position:absolute;inset:0;width:100%;height:100%;color:rgba(178,58,43,.16);filter:url(#ink-bleed)}
.os-enso path{stroke-dasharray:1000;stroke-dashoffset:1000}
.os-enso.is-drawing path{animation:enso 1.6s cubic-bezier(.6,0,.2,1) forwards}
@keyframes enso{to{stroke-dashoffset:0}}
.os-glyph{position:relative;width:58%;aspect-ratio:1}
.os-glyph svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;transition:opacity .7s ease, filter .7s ease, transform .9s var(--ease-out)}
.os-glyph svg.is-leaving{opacity:0;filter:blur(10px);transform:translate3d(14%,-6%,0) rotate(6deg) scale(1.06)}
.os-glyph path.fill{fill:var(--ink);opacity:0;filter:url(#ink-bleed)}
.os-glyph path.trace{fill:none;stroke:var(--vermilion);stroke-width:2.6;vector-effect:non-scaling-stroke;opacity:.7}
.os-no{
  position:absolute;left:4%;top:6%;margin:0;
  font-family:var(--brush);font-size:clamp(18px,1.7vw,26px);
  color:var(--vermilion);writing-mode:vertical-rl;letter-spacing:.2em;
  transition:opacity .4s ease;
}
.os-cap{
  position:absolute;right:2%;bottom:6%;margin:0;
  font-family:var(--disp);font-size:clamp(13px,1.05vw,16px);letter-spacing:.5em;
  color:var(--ink-faint);transition:opacity .4s ease;
}
.os-seal{
  position:absolute;right:6%;top:8%;writing-mode:vertical-rl;
  font-family:var(--brush);font-size:13px;letter-spacing:.06em;
  color:#f6ede0;background:var(--vermilion);
  padding:6px 3px;border-radius:2px;opacity:.85;
}
.os-fade{opacity:0}
.tl-src{
  display:block;margin-top:10px;
  font-style:normal;font-size:11px;letter-spacing:.26em;color:var(--ink-faint);
}
.tl-src::before{content:"—— "}

/* =========================================================
   7. 诗与剑 —— 一本书，往下滚动一页一页翻过，翻过的被风带走
   ========================================================= */
.poem{padding:0}
.poem-pin{
  position:relative;
  height:100vh;height:100svh;
  display:flex;align-items:center;
  padding:0 var(--gut);
  overflow:visible;
}
.js .poem-pin{position:sticky;top:0}
.poem-runway{display:none}
.js .poem-runway{display:block;height:300vh}
.poem .section-mark{top:clamp(40px,10vh,110px)}
.poem-layout{
  width:100%;max-width:1200px;margin:0 auto;
  display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);
  gap:clamp(30px,6vw,100px);align-items:center;
}
.poem-head{padding:0}
.book-count{
  margin:clamp(20px,4vh,40px) 0 10px;
  display:flex;align-items:baseline;gap:10px;
  font-family:var(--brush);color:var(--vermilion);
}
.book-count b{font-weight:400;font-size:clamp(40px,4.4vw,64px);line-height:1;transition:opacity .3s}
.book-count span{font-size:16px;letter-spacing:.2em;color:var(--ink-faint)}
.book-hint{font-size:11.5px;letter-spacing:.3em;line-height:2.2;color:var(--ink-faint);margin:0}

.book{
  position:relative;justify-self:center;
  width:min(30vw, 380px);
  height:min(72vh, 600px);
  perspective:2000px;
  cursor:pointer;
}
.book::after{                       /* 书脊（右侧，和装本） */
  content:"";position:absolute;top:-1.5%;bottom:-1.5%;right:-10px;width:12px;
  background:linear-gradient(to right,#6c2a1c,#8f3a26 40%,#5a2216);
  border-radius:2px;
  box-shadow:0 18px 30px -18px rgba(60,30,10,.6);
}
.page,.book-back{position:absolute;inset:0}
.page{transform-style:preserve-3d;transform-origin:100% 50%;will-change:transform}
.face{
  position:absolute;inset:0;
  backface-visibility:hidden;-webkit-backface-visibility:hidden;
  border-radius:2px 0 0 2px;
  overflow:hidden;
}
.face.front{
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.55), transparent 60%),
    linear-gradient(to left, #e3d7bf 0%, #f6f0e2 7%, #f3ecdc 60%, #ebe1cc 100%);
  box-shadow:0 30px 50px -36px rgba(70,45,20,.6), inset 0 0 0 1px rgba(80,60,40,.08);
  writing-mode:vertical-rl;
  padding:clamp(26px,4vh,40px) clamp(22px,2.4vw,34px);
  display:flex;flex-direction:column;gap:clamp(14px,1.6vw,24px);
}
.face.front::after{                 /* 翻动时的阴影 */
  content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(to left, rgba(40,25,10,.35), rgba(40,25,10,.08) 60%, transparent);
  opacity:var(--shade,0);
}
.face.back{
  transform:rotateY(180deg);
  background:linear-gradient(to right, #d8cbb0 0%, #ece3d0 9%, #e8dfcb 100%);
  box-shadow:inset 0 0 0 1px rgba(80,60,40,.1);
}
.face.back::before{
  content:"";position:absolute;inset:22% 18%;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 3c1 3.4 2.3 5.2 4.6 6.1-.6 2.4.4 4 2.4 4.9-1 2.3-.4 4.1 1.5 5.3-1.6 2-1.4 3.9.2 5.6-2.2 1.6-2.5 3.4-1.5 5.7-3 .4-4 2-4.1 4.6h-2.5c-.1-2.6-1.1-4.2-4.1-4.6 1-2.3.7-4.1-1.5-5.7 1.6-1.7 1.8-3.6.2-5.6 1.9-1.2 2.5-3 1.5-5.3 2-.9 3-2.5 2.4-4.9C17.7 8.2 19 6.4 20 3Z' fill='%23b23a2b'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity:.06;
}
.pg-no{font-family:var(--latin);font-style:italic;font-size:13px;letter-spacing:.3em;color:var(--vermilion)}
.pg-title{
  margin:0;font-family:var(--disp);font-weight:400;
  font-size:clamp(24px,2.3vw,32px);letter-spacing:.26em;color:var(--ink);
}
.pg-body{
  margin:0;max-height:100%;
  font-size:clamp(13px,.95vw,15px);line-height:2.1;letter-spacing:.12em;
  color:var(--ink-soft);
}
.pg-waka{
  margin:0;padding-right:clamp(12px,1.2vw,18px);
  border-right:1px solid rgba(178,58,43,.25);
  font-family:var(--brush);font-size:clamp(17px,1.5vw,21px);
  line-height:1.9;letter-spacing:.14em;color:var(--vermilion);
}
.pg-kind{
  position:absolute;left:clamp(14px,1.6vw,22px);bottom:clamp(16px,2.4vh,26px);
  writing-mode:vertical-rl;
  font-family:var(--brush);font-size:13px;letter-spacing:.1em;
  color:#f6ede0;background:var(--vermilion);
  padding:7px 3px;border-radius:2px;
}

.book-back{
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(178,58,43,.06), transparent 70%),
    linear-gradient(170deg, #f3ecdc, #e6dcc6);
  box-shadow:0 30px 50px -36px rgba(70,45,20,.6), inset 0 0 0 1px rgba(80,60,40,.1);
  padding:clamp(22px,3vh,32px) clamp(18px,2vw,28px) clamp(18px,2.4vh,26px);
  display:flex;flex-direction:column;
  border-radius:2px;
  cursor:default;
}
.book-back .const-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0}
.book-back .const-head h3{font-family:var(--disp);font-weight:400;font-size:clamp(20px,1.9vw,26px);letter-spacing:.3em;margin:0}
.book-back .const-head p{margin:0;font-family:var(--brush);font-size:15px;letter-spacing:.1em;color:var(--vermilion)}
.book-back .const-sky{position:relative;flex:1;height:auto;margin:14px 34% 10px 6%}
.book-back .const-lines{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.book-back .star em{left:calc(100% + 2px);top:50%;transform:translateY(-50%)}
.book-back .const-note{
  margin:0;padding-top:12px;border-top:1px solid rgba(80,60,40,.14);
  font-family:var(--serif);font-size:12.5px;line-height:1.9;letter-spacing:.06em;color:var(--ink-soft);
  min-height:4.2em;transition:opacity .3s;
}
.book.is-done{cursor:default}

/* =========================================================
   8. 红叶（可拾取）
   ========================================================= */
.maple-pick{
  position:absolute;z-index:30;
  width:clamp(46px,3.7vw,60px);aspect-ratio:1;
  padding:0;border:0;background:none;cursor:pointer;
  filter:drop-shadow(0 8px 10px rgba(110,25,12,.32));
  animation:mapleSway 5.4s ease-in-out infinite;
  transition:transform .5s var(--ease-out), opacity .4s;
  -webkit-tap-highlight-color:transparent;
}
.maple-pick svg{width:100%;height:100%;display:block;transform:rotate(-16deg);position:relative;z-index:1}
.maple-pick::before{
  content:"";position:absolute;inset:-34%;border-radius:50%;
  background:radial-gradient(circle, rgba(226,80,46,.28), rgba(226,80,46,0) 64%);
  animation:mapleGlow 2.8s ease-in-out infinite;
}
.maple-pick::after{
  content:"拾";
  position:absolute;left:50%;top:calc(100% + 4px);transform:translate(-50%,4px);
  font-family:var(--brush);font-size:14px;color:var(--vermilion);
  opacity:0;transition:opacity .35s, transform .35s;
}
.maple-pick:hover{transform:scale(1.18) rotate(8deg)}
.maple-pick:hover::after,.maple-pick:focus-visible::after{opacity:1;transform:translate(-50%,0)}
.maple-pick.is-taken{visibility:hidden;pointer-events:none}
.blade .maple-pick,.journey .maple-pick{filter:drop-shadow(0 0 14px rgba(255,90,60,.45))}
.blade .maple-pick::after{color:#f0a48a}
@keyframes mapleSway{
  0%,100%{translate:0 0;rotate:0deg}
  30%{translate:2px -7px;rotate:7deg}
  60%{translate:-2px -3px;rotate:-5deg}
}
@keyframes mapleGlow{0%,100%{opacity:.45;transform:scale(.86)}50%{opacity:1;transform:scale(1.08)}}
.maple-fly{position:fixed;z-index:120;pointer-events:none;filter:drop-shadow(0 8px 12px rgba(110,25,12,.35))}
.maple-fly svg{width:100%;height:100%;display:block}
.leaf-count .lc-icon{width:18px;height:18px}
.leaf-count.bump{transform:scale(1.18)}
.leaf-count.is-full .lc-icon{filter:drop-shadow(0 0 6px rgba(255,220,180,.8))}
.lc-toast{
  position:absolute;right:calc(100% + 14px);top:50%;margin-top:-.7em;line-height:1.4;
  font-family:var(--brush);font-size:16px;letter-spacing:.14em;white-space:nowrap;
  color:var(--vermilion);opacity:0;pointer-events:none;
}
.lc-toast.is-on{animation:toastUp 2.2s var(--ease-out) forwards}
body.dark-mode .lc-toast{color:#f0a48a}
@keyframes toastUp{
  0%{opacity:0;transform:translateX(10px)}
  16%{opacity:1;transform:none}
  78%{opacity:1}
  100%{opacity:0;transform:translateX(-8px)}
}

/* =========================================================
   9. 卷尾 —— 月亮、下半句、悄悄话
   ========================================================= */
.js .end .end-moon{animation:none;opacity:0}
.js .end.is-arrived .end-moon{animation:moonUp 3s var(--ease-out) .4s both}
.end-poem{
  display:flex;align-items:center;flex-wrap:wrap;gap:.2em;
  font-family:var(--brush);
  font-size:clamp(24px,2.6vw,38px);
  letter-spacing:.14em;color:#e7cfb4;
  margin:0 0 10px;
}
.end-poem .ep-b{display:inline-block;height:1.1em;opacity:1;filter:none}
.end-poem .ep-b svg{height:100%;width:auto}
.end-poem .ep-b path.trace{fill:none;stroke:#e7cfb4;stroke-width:1.1;vector-effect:non-scaling-stroke;opacity:.75;stroke-dasharray:3 4}
.end-poem .ep-b path.fill{fill:#f0b394;opacity:0}
.ep-hint{
  margin:0 0 clamp(30px,5vh,56px);
  font-size:11.5px;letter-spacing:.28em;color:#7c9a96;
  transition:opacity .8s ease;
}
.end-poem.is-complete + .ep-hint{opacity:0}
.end-whisper[hidden]{display:none}

@media (max-width:1020px){
  .origin-grid{grid-template-columns:1fr}
  .origin-stage{display:none}
  .poem-layout{grid-template-columns:1fr;gap:16px}
  .book-count{margin:6px 0 2px}
  .book-hint{display:none}
  .book{width:min(76vw, 360px);height:min(58svh, 520px)}
}
@media (max-width:620px){
  .maple-pick{width:44px}
  .poem-title{height:56px !important}
  .book-count b{font-size:34px}
}

@media (prefers-reduced-motion: reduce){
  .splash{display:none}
  .js .scene,.js .stage{position:relative}
  .js [data-enter] .ch,.js [data-enter],.js [data-enter] > *{opacity:1 !important;transform:none !important;filter:none !important;clip-path:none !important}
  .js .hero .fig-ribbons,.js .hero .fig-char,.js .hero .hero-sun{opacity:1 !important;animation:none !important}
}

/* the second half fills in once all five leaves are home */
.end-poem.is-complete .ep-b path.fill{opacity:1;transition:opacity 1.1s ease calc(var(--i) * .28s + .3s)}
.end-poem.is-complete .ep-b path.trace{opacity:0;transition:opacity 1.6s ease 1.4s}
.sp-haiku .ch{transform-box:fill-box;transform-origin:center}

.stage-tail{display:block;pointer-events:none}
@media (max-width:620px){
  .ink-title[data-glyphs="一刀"]{height:104px;top:34px;opacity:.26}
  .blade-text{padding-right:44px}
}

/* 长段落用思源宋体：站酷小薇的句读偏西文，放在大段正文里会显得别扭 */
.end-copy,.journey-text,.wind-lead,.blade-lead{font-family:var(--serif);font-weight:500}
.end-copy{letter-spacing:.08em}

/* 竖排信：每一段都从顶端起笔（flex 在竖排里会把短段落叠进同一列） */
.vertical-letter{display:block}
.vertical-letter p{display:block}

.tl-year{padding-left:14px}

/* =========================================================
   10. 书页 —— 左侧（竖排的行尾方向）留出页边，放不下就自动缩小字号
   ========================================================= */
.face.front{
  padding:clamp(28px,4.4vh,44px) clamp(22px,2.4vw,34px) clamp(28px,4.4vh,44px) clamp(58px,5vw,72px);
}
.pg-title{font-size:calc(var(--fz,1) * clamp(24px,2.3vw,32px))}
.pg-body{font-size:calc(var(--fz,1) * clamp(13px,.95vw,15px))}
.pg-waka{font-size:calc(var(--fz,1) * clamp(17px,1.5vw,21px))}
.pg-kind{left:clamp(18px,1.8vw,26px)}

/* =========================================================
   11. 枫红座 —— 照官方命之座界面：深青星空、翠色纹样、星与连线
   ========================================================= */
.book-back{
  background:
    radial-gradient(ellipse 55% 38% at 22% 58%, rgba(40,140,130,.35), transparent 70%),
    radial-gradient(ellipse 50% 40% at 78% 30%, rgba(30,110,140,.28), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 45%, #134a4a 0%, #0c2f31 55%, #071b1d 100%);
  box-shadow:0 30px 50px -30px rgba(10,30,30,.75), inset 0 0 0 1px rgba(120,220,200,.12), inset 0 0 60px rgba(0,0,0,.45);
  color:#cfeee6;
  overflow:hidden;
}
.book-back .cs-dust{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.book-back .cs-head{position:relative;display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.book-back .cs-head h3{margin:0;font-family:var(--disp);font-weight:400;font-size:clamp(20px,1.9vw,26px);letter-spacing:.3em;color:#e9fbf6}
.book-back .cs-head p{margin:0;font-family:var(--latin);font-style:italic;font-size:14px;letter-spacing:.12em;color:#7fc7b5}
.cs-sky{position:relative;flex:1;min-height:0;display:grid;place-items:center;margin:8px 0 10px}
.cs-frame{position:relative;height:100%;max-width:100%;aspect-ratio:1166/1218}
.cs-frame svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.cs-emblem{fill:#2aa77f;filter:drop-shadow(0 0 3px rgba(60,230,170,.45))}
.cs-line{stroke:#e2fff7;stroke-width:1.3;vector-effect:non-scaling-stroke;fill:none;opacity:.85;
  filter:drop-shadow(0 0 3px rgba(150,255,235,.9))}
.cs-star{
  position:absolute;width:15%;aspect-ratio:1;transform:translate(-50%,-50%);
  padding:0;border:0;background:none;cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.cs-star svg{width:100%;height:100%;display:block;overflow:visible;
  filter:drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px rgba(255,236,190,.85));
  transition:transform .5s cubic-bezier(.3,1.6,.5,1), filter .4s}
.cs-star em{
  position:absolute;left:50%;top:calc(100% - 6px);transform:translateX(-50%);
  font-style:normal;font-family:var(--brush);font-size:13px;letter-spacing:.12em;white-space:nowrap;
  color:#fff3d6;text-shadow:0 0 8px rgba(0,0,0,.8);
  opacity:0;transition:opacity .3s;pointer-events:none;
}
.cs-star:hover svg,.cs-star.is-on svg{transform:scale(1.45) rotate(45deg);filter:drop-shadow(0 0 6px #fff) drop-shadow(0 0 16px rgba(255,220,150,1))}
.cs-star:hover em,.cs-star.is-on em{opacity:1}
.cs-star:focus-visible{outline:1px dashed rgba(255,240,200,.7);outline-offset:2px;border-radius:50%}
.book-back .const-note{
  position:relative;margin:0;padding-top:12px;
  border-top:1px solid rgba(160,230,210,.18);
  font-family:var(--serif);font-size:12.5px;line-height:1.85;letter-spacing:.05em;color:#bfe3da;
  min-height:5.6em;transition:opacity .3s;
}
.book-back .const-note b{display:block;font-family:var(--brush);font-weight:400;font-size:16px;letter-spacing:.12em;color:#ffe2b3;margin-bottom:2px}

/* the chart lights up only once the last page has gone */
.js .book-back .cs-emblem{opacity:0;filter:blur(6px);transition:opacity 1.6s ease, filter 1.8s ease}
.js .book-back.is-lit .cs-emblem{opacity:1;filter:drop-shadow(0 0 3px rgba(60,230,170,.45))}
.js .book-back .cs-line{stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1s ease}
.js .book-back.is-lit .cs-line{stroke-dashoffset:0;transition-delay:calc(var(--k) * 180ms + 1.1s)}
.js .book-back .cs-star{opacity:0;scale:.2;transition:opacity .5s ease, scale .7s cubic-bezier(.3,1.6,.5,1)}
.js .book-back.is-lit .cs-star{opacity:1;scale:1;transition-delay:calc(var(--k) * 160ms + .5s)}

/* =========================================================
   12. 书信 —— 六封信，从上到下按年份排开
   ========================================================= */
.letters{
  position:relative;
  padding:clamp(100px,15vh,160px) var(--gut) clamp(90px,14vh,150px);
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255,250,238,.7), transparent 70%),
    linear-gradient(to bottom, #ece3d2 0%, #e6dac4 60%, #ddcfb5 100%);
}
.letters-head{max-width:1100px;margin:0 auto clamp(50px,9vh,100px);padding-left:clamp(0px,8vw,120px)}
.letters-title{height:clamp(84px,8.6vw,124px);margin:0 0 12px}
.letters-title svg{height:100%;width:auto}
.letters-sub{margin:0;font-size:12px;letter-spacing:.3em;color:var(--ink-faint)}
.letter-stack{
  list-style:none;margin:0 auto;padding:0;max-width:1100px;
  position:relative;
  display:flex;flex-direction:column;gap:clamp(56px,11vh,120px);
}
.letter-stack::before{
  content:"";position:absolute;left:50%;top:-30px;bottom:-30px;width:1px;
  background:linear-gradient(to bottom, transparent, rgba(178,58,43,.35) 6%, rgba(178,58,43,.35) 94%, transparent);
}
.letter-item{position:relative;display:flex;align-items:flex-start;gap:clamp(48px,10vw,140px)}
.letter-item.is-r{flex-direction:row}
.li-year{
  flex:1 1 0;min-width:0;
  margin:clamp(20px,4vh,40px) 0 0;
  display:flex;flex-direction:column;gap:6px;
  position:sticky;top:18vh;
}
.letter-item.is-l .li-year{align-items:flex-start;order:2}
.letter-item.is-l .sheet{order:1}
.letter-item.is-r .li-year{align-items:flex-end;text-align:right}
.li-year span{font-family:var(--latin);font-style:italic;font-size:clamp(46px,5.4vw,84px);line-height:1;color:rgba(178,58,43,.78);letter-spacing:.02em}
.li-year em{font-style:normal;font-family:var(--brush);font-size:18px;letter-spacing:.3em;color:var(--ink-faint)}
.letter-item::after{
  content:"";position:absolute;left:50%;top:clamp(46px,8vh,70px);width:9px;height:9px;margin-left:-4.5px;
  border-radius:50%;background:var(--vermilion);box-shadow:0 0 0 4px rgba(178,58,43,.14);
}
.sheet{
  position:relative;flex:1 1 0;min-width:0;
  padding:clamp(26px,3.4vw,44px) clamp(24px,3vw,40px) clamp(30px,3.4vw,44px);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.7), transparent 60%),
    linear-gradient(170deg, #fbf6ea, #f1e7d3);
  box-shadow:0 30px 60px -40px rgba(70,45,20,.7), 0 2px 0 rgba(255,255,255,.6) inset, inset 0 0 0 1px rgba(80,60,40,.08);
  transform:rotate(var(--tilt,0deg));
  font-size:clamp(14px,1vw,16px);
}
.sheet::before{
  content:"";position:absolute;left:0;right:0;top:33.3%;height:33.4%;pointer-events:none;
  border-top:1px solid rgba(120,95,60,.08);border-bottom:1px solid rgba(255,255,255,.5);
  background:linear-gradient(to bottom, rgba(120,95,60,.05), transparent 30%, transparent 70%, rgba(120,95,60,.04));
}
.sh-meta{
  display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;
  margin:0 0 14px;padding-bottom:10px;border-bottom:1px solid rgba(178,58,43,.22);
  font-size:11px;letter-spacing:.24em;color:var(--ink-faint);
}
.sh-title{margin:0 0 16px;font-family:var(--brush);font-weight:400;font-size:clamp(26px,2.4vw,34px);letter-spacing:.14em;color:var(--vermilion)}
.sh-body p{margin:0 0 .9em;line-height:2.15;letter-spacing:.06em;color:var(--ink-soft);text-indent:2em}
.sh-gift{
  display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;
  margin:18px 0 0;padding-top:14px;border-top:1px dashed rgba(80,60,40,.2);
  font-size:11.5px;letter-spacing:.18em;color:var(--ink-faint);
}
.sh-gift b{font-weight:500;color:var(--ink-soft);padding:3px 10px;border:1px solid rgba(178,58,43,.28);border-radius:20px;background:rgba(255,250,240,.6)}
.sh-seal{
  position:absolute;right:clamp(16px,2vw,26px);bottom:-12px;
  writing-mode:vertical-rl;font-family:var(--brush);font-size:15px;letter-spacing:.08em;
  color:#f6ede0;background:var(--vermilion);padding:8px 4px;border-radius:2px;
  box-shadow:inset 0 0 0 2px rgba(255,240,225,.25);
  transform:rotate(-6deg);
}

/* a letter arrives folded and opens out */
.js [data-enter="sheet"]{
  opacity:0;
  transform:perspective(1400px) translateY(60px) rotateX(-62deg) rotate(var(--tilt,0deg));
  transform-origin:50% 0;
  transition:opacity .9s ease, transform 1.5s cubic-bezier(.16,1,.3,1);
}
.js [data-enter="sheet"].is-entered{opacity:1;transform:rotate(var(--tilt,0deg))}
.js [data-enter="sheet"] .sh-seal{opacity:0}
.js [data-enter="sheet"].is-entered .sh-seal{animation:sealDrop .8s cubic-bezier(.3,1.4,.4,1) 1.1s both}
@keyframes sealDrop{
  0%{opacity:0;transform:scale(1.9) rotate(-18deg)}
  50%{opacity:1;transform:scale(.92) rotate(-5deg)}
  100%{opacity:1;transform:rotate(-6deg)}
}

@media (max-width:1020px){
  .letter-stack::before,.letter-item::after{left:14px}
  .letter-item,.letter-item.is-r{flex-direction:column;gap:12px;padding-left:40px}
  .li-year,.letter-item.is-l .li-year,.letter-item.is-r .li-year{position:static;flex:none;order:0;margin:0;flex-direction:row;align-items:baseline;gap:14px;text-align:left}
  .letter-item.is-l .sheet{order:1}
  .sheet{flex:none;width:100%}
  .letter-item::after{top:18px}
}
@media (max-width:620px){
  .letters{padding-top:110px}
  .letter-item,.letter-item.is-r{padding-left:30px}
  .letter-stack::before,.letter-item::after{left:8px}
  .li-year span{font-size:40px}
  .sheet{padding:22px 18px 28px}
}

/* tighter vertical rhythm so a page rarely needs to shrink its type */
.book{width:min(32vw, 420px)}
.face.front{gap:clamp(10px,1.1vw,16px);padding-left:clamp(40px,3.6vw,52px)}
.pg-no{line-height:1.4}
.pg-title{line-height:1.25}
.pg-waka{line-height:1.62;padding-right:clamp(10px,1vw,14px)}
.pg-kind{left:clamp(12px,1.2vw,16px)}
