/* The completed story becomes a single two-sided paper leaf. */
.chapter-turn-layer{position:fixed;inset:0;z-index:35;perspective:1900px;perspective-origin:50% 45%;pointer-events:none;overflow:hidden}
.chapter-turn-leaf{position:absolute;inset:0;transform-origin:0 50%;transform-style:preserve-3d;transform:rotateY(0deg);will-change:transform;transition:transform 1.6s cubic-bezier(.42,0,.18,1)}
.chapter-turn-front,.chapter-turn-back{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;background:var(--paper);overflow:hidden}
.chapter-turn-front{transform:translateZ(1px);box-shadow:12px 0 40px #4d2d3222}
.chapter-turn-front:after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,#6d4f3520,transparent 35%,#6d4f3555);opacity:0;transition:opacity 1.1s ease}
.chapter-turn-back{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;transform:rotateY(180deg) translateZ(1px);background:linear-gradient(270deg,#dfd0b6,#fff8ea 14%,#f6eddd);box-shadow:inset -2px 0 #bfa98466;color:#a17c62}
.chapter-turn-back img{width:190px;height:40px;object-fit:contain}
.chapter-turn-back p{font-family:var(--serif);font-size:30px;font-style:italic}
.chapter-turn-layer.is-turning .chapter-turn-leaf{transform:rotateY(-110deg)}
.chapter-turn-layer.is-turning .chapter-turn-front:after{opacity:.6}
.chapter-turn-snapshot{position:absolute;top:0;left:0;background:var(--paper);width:100%;height:100%}
.chapter-turn-snapshot .story-stage{position:absolute!important;top:0!important;left:0!important;max-width:none!important;margin:0!important}
.chapter-turn-snapshot *,.chapter-turn-snapshot *:before,.chapter-turn-snapshot *:after{animation:none!important;transition:none!important}
body.chapter-is-turning .topbar{z-index:40;background:var(--paper)}
@media(max-width:700px){.chapter-turn-layer{perspective:1100px}.chapter-turn-layer.is-turning .chapter-turn-leaf{transform:rotateY(-100deg)}}
@media(prefers-reduced-motion:reduce){.chapter-turn-leaf,.chapter-turn-front:after{transition:none}}
