/* The sticky stage and its scroll runway use the native document scrollbar. */
.story { display: none; }
.has-intro .story { display: block; }
.story.ready::after { content: ""; display: block; height: 720svh; }
/* The opening owns the whole screen; the show header follows it and sticks once the opening scrolls away. */
.story-pin { position: sticky; top: 0; height: max(320px,100svh); display: grid; background: #fff4f5; }
.story-stage { position: relative; overflow: hidden; isolation: isolate; background: var(--stock); container-type: size; }
.story-field { position: relative; margin: auto; width: min(100%,1800px); height: 100%; container-type: size; --px: 0; --py: 0; }
.story-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* --d is how far a cutout drifts with the pointer; nearer paper drifts further. */
@property --bob { syntax: "<number>"; inherits: false; initial-value: 0; }
.piece { position: absolute; left: var(--x,50%); top: var(--y,50%); translate: calc(-50% + var(--px) * var(--d,10) * 1px) calc(-50% + var(--py) * var(--d,10) * 1px + var(--bob) * 1px); width: var(--w,auto); margin: 0; visibility: hidden; pointer-events: none; user-select: none; }
img.piece { max-width: none; }
.story:not(.ready) :is(.season,.poster,.cover-print,.camera,.whisper) { visibility: visible; }
.season, .whisper { z-index: 5; --x: 26%; white-space: nowrap; text-align: center; }
.season { --y: 18%; color: #a33762; font: 600 clamp(12px,1.1cqw,17px)/1.3 var(--body); letter-spacing: .08em; }
.season i { display: inline-block; width: 24px; height: 1px; margin: 0 7px; background: #bd738e; vertical-align: middle; }
.poster { --x: 26%; --y: 48%; --w: min(40cqw,77cqh); z-index: 6; --d: 30; }
/* The logo is twelve separate stickers so each glyph can land and bounce on its own. */
.title-set { container-type: inline-size; display: grid; justify-items: center; }
.title-set .row { display: flex; align-items: center; justify-content: center; }
.title-set .row + .row { margin-top: -3.5cqw; }
.title-set .row[data-row="0"] { translate: -9cqw 0; }
.title-set .row[data-row="2"] { translate: 3cqw 0; }
.glyph { display: block; flex: none; margin: 0 -.7cqw; }
.glyph img { display: block; height: auto; max-width: none; filter: drop-shadow(1px 4px 2px #88446126); animation: glyph-bob 1.9s ease-in-out infinite alternate; animation-delay: calc(var(--i,0) * -.23s); }
.g-heart { align-self: flex-start; margin: -2cqw 0 0 -1.5cqw; }
@keyframes glyph-bob { from { translate: 0 -2.5%; rotate: -1.5deg; } to { translate: 0 2.5%; rotate: 1.5deg; } }
/* Idle life between scroll steps: stickers float and sway a little. */
.bob, .guest, .camera, .bow, .soda, .flowers, .heart, .verdict, .seal, .pick { animation: bob 2.6s ease-in-out infinite alternate, sway 3.4s ease-in-out infinite alternate; animation-delay: var(--delay,0s); }
.r-heart, .r-ship, .pick-2 { --delay: -1.3s; } .r-sweet, .r-both, .pick-3 { --delay: -.6s; } .camera, .soda { --delay: -2s; }
@keyframes bob { from { --bob: -4; } to { --bob: 4; } }
@keyframes sway { from { rotate: -1.6deg; } to { rotate: 1.6deg; } }
.whisper { --y: 80%; color: #85455e; font: 400 clamp(14px,1.45cqw,21px)/1.4 var(--cute); }
.cover-print { --x: 72%; --y: 48%; --w: min(52cqw,112cqh); z-index: 4; filter: drop-shadow(0 8px 4px #82405b25); }
.camera { --x: 53%; --y: 76%; --w: min(12cqw,23cqh); z-index: 8; }
.villa-print, .date-print, .home-print { filter: drop-shadow(0 8px 6px #9a516733); }
.villa-print { --x: 50%; --y: 59%; --w: min(63cqw,116cqh); z-index: 1; }
.location-print { width: 100%; height: 100%; display: block; object-fit: cover; background: #fffbf1; padding: clamp(5px,.8cqw,12px); padding-bottom: clamp(10px,1.3cqw,23px); clip-path: var(--paper-edge); }
.tear-window { position: relative; aspect-ratio: 1.72; }
.house-type, .mail-type, .date-type, .home-type { z-index: 8; --w: min(37cqw,59cqh); filter: drop-shadow(0 4px 2px #98435c20); }
.house-type { --y: 17%; }
.guest { --w: min(16cqw,27cqh); z-index: 5; padding: 1% 1% .65%; background: #fffcf1; box-shadow: 2px 6px 10px #78394d3d; text-align: center; }
.guest::after { content: ""; position: absolute; width: 38%; height: 9%; top: -4.5%; left: 32%; rotate: -5deg; background: repeating-linear-gradient(-40deg,#f5b5c7e6 0 3px,#ffd5e2e6 3px 6px); }
.cast-shot { aspect-ratio: 1; background: url("/singularity/paper-show/intro-cast.webp") no-repeat; background-size: 300% 200%; }
.cast-iris { background-position: 0 0; } .cast-ash { background-position: 50% 0; }
.cast-mio { background-position: 100% 0; } .cast-noel { background-position: 0 100%; }
.guest figcaption { margin-top: .22em; font: 400 clamp(14px,2.2cqw,33px)/1.2 var(--cute); color: #a42c59; }
.guest-far-a,.guest-far-b { z-index: 3; --w: min(12cqw,20cqh); --y: 38%; }
.guest-far-a { --x: 14%; } .guest-far-b { --x: 86%; }
.guest-a { --x: 23%; --y: 65%; } .guest-b { --x: 77%; --y: 66%; }
.bow { --x: 69%; --y: 20%; --w: min(12cqw,20cqh); z-index: 8; }
.mail-type { --y: 14%; --w: min(32cqw,54cqh); }
.envelope { --x: 50%; --y: 65%; --w: min(39cqw,69cqh); aspect-ratio: 1.48; perspective: 900px; z-index: 5; filter: drop-shadow(1px 5px 3px #83375030); }
.mail-back, .mail-lid, .mail-pocket { position: absolute; inset: 0; background: url("/singularity/paper-show/letter.webp") center / 100% 100% no-repeat; }
.mail-back { inset: 5% 2% 1%; border-radius: 5%; background: #db91a8 url("/singularity/paper.png"); background-blend-mode: multiply; }
.mail-lid { z-index: 3; transform-origin: 50% 5%; clip-path: polygon(0 0,100% 0,100% 10%,56% 58%,51% 65%,47% 64%,0 12%); }
.mail-pocket { z-index: 2; clip-path: polygon(0 6%,47% 53%,52% 56%,100% 5%,100% 100%,0 100%); }
.mail-note { position: absolute; inset: 9% 7% 9%; padding: 5% 7%; background: repeating-linear-gradient(0deg,transparent 0 21px,#e6adbb55 21px 22px),#fff9ed; box-shadow: 0 1px 4px #90405f44; rotate: -3deg; z-index: 1; font: 400 clamp(14px,2cqw,30px)/1.45 var(--cute); color: #94425b; }
.mail-note b,.mail-note small { display: block; font-size: .72em; }
.mail-note small { text-align: right; } .mail-note p { margin: 5% 0 0; }
.reply, .date-line, .home-note { background: #fff9ed; color: #8d3359; text-align: center; width: max-content; max-width: 83%; padding: .45em .9em; box-shadow: 1px 3px 3px #91436124; font: 400 clamp(16px,2.2cqw,34px)/1.25 var(--cute); z-index: 7; }
.reply { --x: 69%; --y: 69%; background: #ffcbdc; } .reply small { display: block; text-align: right; font-size: .58em; }
.red-thread { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:4; visibility:hidden; overflow:visible; }
.red-thread path { fill:none; stroke:#ce4770; stroke-width:3; stroke-linecap:round; stroke-dasharray:1; stroke-dashoffset:1; filter:drop-shadow(0 1px 1px #fff6ee); }
.date-print { --x: 64%; --y: 50%; --w: min(69cqw,128cqh); aspect-ratio: 1.48; z-index: 1; }
.date-type { --x: 26%; --y: 21%; --w: min(41cqw,67cqh); }
.date-line { --x: 28%; --y: 43%; } .line-two { --x: 34%; --y: 55%; background: #ffdbe7; } .line-three { --x: 29%; --y: 67%; }
.soda { --x: 77%; --y: 76%; --w: min(13cqw,24cqh); z-index: 6; }
.verdict { --x: 56%; --y: 71%; --w: min(19cqw,33cqh); z-index: 9; --d: 44; filter: drop-shadow(1px 5px 3px #8a2f5238); }
.home-print { --x: 43%; --y: 54%; --w: min(75cqw,128cqh); aspect-ratio: 1.58; z-index: 2; }
.home-type { --x: 72%; --y: 29%; --w: min(38cqw,62cqh); }
.flowers { --x: 76%; --y: 65%; --w: min(15cqw,26cqh); z-index: 6; }
.heart { --x: 67%; --y: 49%; --w: min(9cqw,17cqh); z-index: 7; }
.home-note { --x: 50%; --y: 87%; font-size: clamp(15px,1.6cqw,25px); }

/* Depth for the pointer parallax. */
.cover-print, .villa-print, .date-print, .home-print, .official-print { --d: 12; }
.guest, .envelope, .reply, .date-line, .home-note, .season, .whisper { --d: 24; }
.house-type, .mail-type, .date-type, .home-type, .official-type, .pick { --d: 34; }
.camera, .bow, .soda, .flowers, .heart, .seal { --d: 42; }
/* Chapter titles slam down in the middle first; --sx/--sy is the trip from their corner. */
.house-type { --sx: 0cqw; --sy: 33cqh; } .mail-type { --sx: 0cqw; --sy: 36cqh; }
.date-type { --sx: 24cqw; --sy: 29cqh; } .home-type { --sx: -22cqw; --sy: 21cqh; }
/* Generated variety-show captions. */
.react { --w: min(18cqw,32cqh); z-index: 9; --d: 46; filter: drop-shadow(1px 5px 3px #8a2f5233); }
.r-aaa { --x: 41%; --y: 81%; }
.r-letter { --x: 16%; --y: 32%; --w: min(15cqw,27cqh); }
.r-heart { --x: 75%; --y: 27%; --w: min(19cqw,34cqh); }
.r-sweet { --x: 70%; --y: 25%; --w: min(13cqw,24cqh); }
.r-ship { --x: 14%; --y: 84%; --w: min(16cqw,28cqh); }
.r-both { --x: 14%; --y: 80%; --w: min(16cqw,29cqh); }
.r-faith { --x: 22%; --y: 22%; --w: min(21cqw,36cqh); }
.official-print { --x: 37%; --y: 54%; --w: min(56cqw,100cqh); aspect-ratio: 4/3; z-index: 2; filter: drop-shadow(0 8px 6px #9a516733); }
.official-type { --x: 74%; --y: 17%; --w: min(36cqw,58cqh); --sx: -24cqw; --sy: 33cqh; z-index: 8; filter: drop-shadow(0 4px 2px #98435c20); }
.pick { --y: 41%; --w: min(12cqw,21cqh); z-index: 7; text-align: center; }
.pick img { display: block; width: 100%; filter: drop-shadow(1px 4px 2px #6f2a4530); }
.pick figcaption { display: inline-block; margin-top: -4%; padding: .15em .7em; border-radius: 99px; background: #fff9ed; color: #a42c59; box-shadow: 0 1px 3px #91436130; font: 400 clamp(12px,1.2cqw,19px)/1.3 var(--cute); }
.pick-1 { --x: 67%; } .pick-2 { --x: 79%; } .pick-3 { --x: 91%; }
.seal { --x: 80%; --y: 76%; --w: min(21cqw,38cqh); z-index: 9; filter: drop-shadow(2px 8px 5px #8a1f4a40); }
/* Effects: speed lines, camera flash, live comments, particles. */
.speed-lines { position: absolute; inset: -40%; z-index: 7; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 50%, #fff0 0 3.4deg, #fffdf8e6 3.4deg 4.6deg, #fff0 4.6deg 8.2deg, #ff9fbe99 8.2deg 9deg);
  -webkit-mask: radial-gradient(closest-side, #0000 36%, #000 70%); mask: radial-gradient(closest-side, #0000 36%, #000 70%); }
.flash { position: absolute; inset: -10%; z-index: 30; opacity: 0; pointer-events: none; background: radial-gradient(circle at 53% 72%, #fff 0 30%, #fff8f0 70%); }
.danmaku { position: absolute; inset: 0; z-index: 12; overflow: hidden; pointer-events: none; }
.danmaku span { position: absolute; left: 0; top: 0; opacity: 0; white-space: nowrap; will-change: transform; color: #fff; font: 700 clamp(13px,1.3vw,20px)/1.25 var(--body); letter-spacing: .02em;
  text-shadow: 1px 1px 0 #c0306a, -1px 1px 0 #c0306a, 1px -1px 0 #c0306a, -1px -1px 0 #c0306a, 0 2px 4px #8d1f4a66; }
.danmaku span.hot { padding: .22em .8em; border-radius: 99px; background: #ff5d93e6; box-shadow: 0 2px 0 #b3245c66; text-shadow: 0 1px 0 #a8204f; }
.story-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 11; pointer-events: none; }
/* Controls float over the picture: story-style chapter bars on top, skip in the corner,
   the scroll hint and autoplay at the bottom. */
.story-controls { position: absolute; inset: 0; z-index: 20; pointer-events: none; color: #873954; }
.story-controls > * { pointer-events: auto; }
.story-marks { position: absolute; top: 14px; left: clamp(14px,3vw,44px); right: clamp(14px,3vw,44px); display: flex; gap: clamp(4px,.6vw,8px); }
.story-marks button { flex: 1; min-width: 0; position: relative; padding: 11px 0 4px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #8d4a63; opacity: .72; font: 600 12px/1.2 var(--body); text-shadow: 0 1px 0 #fff8, 0 0 6px #fff9; }
.story-marks button::before, .story-marks button::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 4px; }
.story-marks button::before { background: #ffffffb3; box-shadow: 0 0 0 1px #c9577f1f; }
.story-marks button::after { background: #e04a84; transform: scaleX(var(--fill,0)); transform-origin: left; }
.story-marks button[aria-current="step"], .story-marks button:hover { color: #b02a5f; opacity: 1; }
.story-skip, .scroll-cue, .story-play { position: absolute; white-space: nowrap; border-radius: 99px; background: #fffaf5e6; border: 1px solid #ecb3c6; box-shadow: 0 3px 10px #9c40621f; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.story-skip { top: 44px; right: clamp(14px,3vw,44px); padding: 8px 15px; color: #a72d59; font: 600 13px/1.2 var(--body); }
.story-skip:hover, .story-play:hover, .scroll-cue:hover { background: #ffe4ee; }
.scroll-cue { left: 50%; bottom: clamp(14px,3vh,28px); translate: -50% 0; padding: 10px 20px; color: #a72d59; font: 400 clamp(15px,1.4vw,20px)/1.2 var(--cute); transition: opacity .35s, translate .35s; }
.scroll-cue span { display: inline-block; margin-left: 4px; color: #d33878; animation: cue-bob 1.1s ease-in-out infinite alternate; }
@keyframes cue-bob { to { translate: 0 4px; } }
.story:not(.cue-on) .scroll-cue { opacity: 0; translate: -50% 12px; pointer-events: none; }
.story-play { right: clamp(14px,3vw,44px); bottom: clamp(14px,3vh,28px); padding: 8px 14px; color: #8d4a63; font: 600 13px/1.2 var(--body); }
@media (max-width:600px) {
  .story-marks { top: 10px; gap: 4px; } .story-marks button { font-size: 11px; padding-top: 9px; }
  .story-skip { top: 36px; padding: 6px 12px; font-size: 12px; }
  .scroll-cue { padding: 8px 16px; } .story-play { padding: 7px 11px; font-size: 12px; }
  .story:not(.cue-on) .story-play { opacity: .8; }
}
@media (max-aspect-ratio: 1/1) {
  .season { --x:50%; --y:10%; } .poster { --x:50%; --y:29%; --w:min(70cqw,45cqh); }
  .cover-print { --x:50%; --y:66%; --w:min(87cqw,72cqh); }
  .camera { --x:20%; --y:80%; --w:min(19cqw,18cqh); }
  .whisper { --x:50%; --y:86%; }
  .house-type,.mail-type { --y:15%; --w:min(60cqw,49cqh); }
  .villa-print { --w:89cqw; --y:48%; } .guest { --w:min(27cqw,23cqh); }
  .guest-far-a,.guest-far-b { --w:min(21cqw,16cqh); --y:40%; }
  .guest-a,.guest-b { --y:70%; } .bow { --x:73%; --y:26%; --w:18cqw; }
  .envelope { --w:min(61cqw,48cqh); --y:63%; } .reply { --x:61%; --y:77%; }
  .date-print { --x:51%; --y:44%; --w:86cqw; } .date-type { --x:38%; --y:15%; --w:59cqw; }
  .date-line { --x:33%; --y:66%; } .line-two { --x:45%; --y:74%; } .line-three { --x:36%; --y:82%; }
  .soda { --x:79%; --y:63%; --w:19cqw; } .verdict { --x:61%; --y:56%; }
  .home-print { --x:48%; --y:52%; --w:90cqw; } .home-type { --x:57%; --y:22%; --w:64cqw; }
  .flowers { --x:80%; --y:69%; --w:21cqw; } .heart { --x:74%; --y:35%; --w:14cqw; }
  .home-note { --y:82%; }
  .house-type,.mail-type { --sx:0cqw; --sy:35cqh; } .date-type { --sx:12cqw; --sy:35cqh; } .home-type { --sx:-7cqw; --sy:28cqh; }
  .react { --w:30cqw; }
  .r-aaa { --x:50%; --y:89%; } .r-letter { --x:24%; --y:31%; } .r-heart { --x:76%; --y:31%; --w:32cqw; }
  .r-sweet { --x:80%; --y:78%; --w:22cqw; } .r-ship { --x:78%; --y:89%; --w:28cqw; }
  .verdict { --w:30cqw; }
  .official-print { --x:50%; --y:40%; --w:90cqw; } .official-type { --x:50%; --y:11%; --w:62cqw; --sx:0cqw; --sy:38cqh; }
  .pick { --y:73%; --w:23cqw; } .pick-1 { --x:20%; } .pick-2 { --x:50%; } .pick-3 { --x:80%; }
  .seal { --x:56%; --y:78%; --w:38cqw; } .r-both { --x:22%; --y:91%; --w:28cqw; }
  .r-faith { --x:28%; --y:70%; --w:36cqw; }
  .danmaku span { font-size: 12px; }
}
@media (max-aspect-ratio: 4/5) {
  .story-field { --mail-lift: -18cqh; }
  .envelope { --y:60%; }
  .mail-type { --w:72cqw; }
}
@media (prefers-reduced-motion:reduce) {
  .story.ready::after { height:260svh; }
  .bob, .guest, .camera, .bow, .soda, .flowers, .heart, .verdict, .seal, .pick, .glyph img { animation: none; }
  .story-fx, .danmaku, .speed-lines, .flash { display: none; }
}
