/* The delivery: a night sky, a messenger crow, a scroll, and the poem written in calligraphy as the voice-over speaks.
   Reads the variables from style.css (--f-cal, --f-jp, --cream, ...). */

body.dv #fx { z-index: 75; }
body.dv #grain { z-index: 76; }
body.dv #hud { z-index: 77; }
body.dv .era { opacity: 0; }

#delivery { position: fixed; inset: 0; z-index: 70; overflow: hidden; background: #04020a; color: var(--cream); touch-action: manipulation; }
#delivery[hidden] { display: none; }
.dv-cut { position: absolute; inset: 0; z-index: 90; background: #000; pointer-events: none; }
.dv-bg { position: absolute; inset: -3%; background: url("../img/ds/forest.webp") 50% 38% / cover no-repeat; filter: brightness(.4) saturate(1.1) blur(3px); }
.dv-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 3, 20, .78), rgba(18, 10, 48, .2) 46%, rgba(6, 3, 20, .72)); }
#dvStars { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.dv-moon { position: absolute; right: 13%; top: 8%; width: min(26vw, 170px); aspect-ratio: 1; border-radius: 50%; opacity: .94;
  background: radial-gradient(circle at 36% 34%, #FFFBE8, #F3E3B0 58%, #D9C284);
  box-shadow: 0 0 60px 20px rgba(255, 236, 190, .26), 0 0 240px 100px rgba(190, 170, 255, .15); }
.dv-wash { position: absolute; inset: 0; pointer-events: none; }
.dv-wash i, .dv-wash img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; mix-blend-mode: screen; pointer-events: none; }
.dv-wash .warm { background: radial-gradient(90% 70% at 18% 88%, rgba(242, 163, 58, .6), transparent 70%); }
.dv-wash .cool { background: linear-gradient(rgba(80, 110, 200, .5), rgba(40, 60, 140, .45)); mix-blend-mode: normal; }
.dv-wash .heal { background: radial-gradient(70% 60% at 50% 55%, rgba(200, 170, 255, .55), transparent 76%); }
.dv-wash .gold { background: radial-gradient(70% 60% at 50% 62%, rgba(255, 214, 130, .55), transparent 76%); }
.dv-wash .grid { background-image: linear-gradient(rgba(140, 190, 255, .35) 1px, transparent 1px), linear-gradient(90deg, rgba(140, 190, 255, .35) 1px, transparent 1px); background-size: 36px 36px; mix-blend-mode: screen; -webkit-mask-image: radial-gradient(75% 65% at 50% 50%, #000 30%, transparent 100%); mask-image: radial-gradient(75% 65% at 50% 50%, #000 30%, transparent 100%); }
.dv-wash .flash { background: #fff; mix-blend-mode: normal; }
.dv-wash img { mix-blend-mode: screen; }
.dv-fog { position: absolute; left: -10%; right: -10%; bottom: -4%; height: 50%; background: url("../img/ds/fog.webp") 50% 100% / cover no-repeat; mix-blend-mode: screen; opacity: .32; pointer-events: none; animation: fogA 44s ease-in-out infinite alternate; }
.dv-canopy { position: absolute; left: 50%; top: -2%; height: max(clamp(120px, 27dvh, 290px), 21.5vw); display: flex; transform: translateX(-50%); pointer-events: none; animation: sway 10s ease-in-out infinite alternate; transform-origin: 50% 0; opacity: .96; }
.dv-enso { width: min(110vw, 86dvh); aspect-ratio: 1; color: rgba(200, 53, 47, .55); -webkit-mask-image: conic-gradient(from 0deg at 50% 50%, #000 var(--a), transparent calc(var(--a) + 5deg)); mask-image: conic-gradient(from 0deg at 50% 50%, #000 var(--a), transparent calc(var(--a) + 5deg)); filter: drop-shadow(0 0 20px rgba(200, 53, 47, .4)); overflow: visible; }

.dv-stage { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; }
.crow { position: absolute; left: 0; top: 0; width: 640px; height: 600px; transform-origin: 330px 360px; pointer-events: none; will-change: transform; display: none; z-index: 8; }
.crow canvas { display: block; }
.dv-caw { position: absolute; left: 0; top: 0; z-index: 9; font-size: clamp(54px, 15vw, 110px); color: var(--cream); letter-spacing: .04em; opacity: 0; pointer-events: none; white-space: nowrap;
  text-shadow: 0 0 2px #000, 0 3px 0 rgba(0, 0, 0, .7), 0 0 30px rgba(167, 139, 224, .6); -webkit-text-stroke: 2px rgba(8, 4, 20, .9); paint-order: stroke fill; }
.dv-call { position: absolute; left: 0; right: 0; bottom: 17dvh; text-align: center; padding: 0 22px; font-size: clamp(20px, 5.6vw, 34px); --w: 600; letter-spacing: .06em; opacity: 0; text-shadow: 0 2px 18px rgba(0, 0, 0, .85); pointer-events: none; }

/* ---------- the scroll ---------- */
.scroll { position: relative; z-index: 3; width: min(90vw, 520px); display: grid; place-items: center; }
.scroll > .sc-roll, .scroll > .sc-open { grid-area: 1 / 1; }
.sc-roll { position: relative; width: min(78vw, 380px); aspect-ratio: 340 / 96; opacity: 0; cursor: pointer; z-index: 2; }
.sc-roll svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sc-roll.glow svg { animation: rollGlow 2.6s ease-in-out infinite; }
@keyframes rollGlow { 50% { filter: drop-shadow(0 0 22px rgba(255, 210, 122, .85)); } }
.sc-hint { position: absolute; left: 0; right: 0; top: calc(50% + 70px); text-align: center; font-size: 26px; opacity: 0; pointer-events: none; text-shadow: 0 2px 14px rgba(0, 0, 0, .8); }
.sc-open { position: relative; width: 100%; display: flex; flex-direction: column; opacity: 0; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .6)); }
.sc-rod { position: relative; height: 26px; margin: 0 -8px; border-radius: 7px; z-index: 2;
  background: linear-gradient(#7a5530, #4a2f17 50%, #24150a); box-shadow: inset 0 1px 0 rgba(255, 224, 170, .4), 0 6px 14px rgba(0, 0, 0, .5); }
.sc-rod::before, .sc-rod::after { content: ""; position: absolute; top: 50%; width: 22px; height: 40px; margin-top: -20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F6DB92, #B98C37 55%, #5E4112); box-shadow: 0 3px 8px rgba(0, 0, 0, .55); }
.sc-rod::before { left: -16px; }
.sc-rod::after { right: -16px; }
.sc-paper { position: relative; height: 0; overflow: hidden; margin: 0 4px; background: linear-gradient(135deg, #2A1B63, #3C2A84 48%, #231656); }
.sc-paper::before { content: ""; position: absolute; inset: 11px; z-index: 0; border-radius: 2px;
  background-color: #EDDDB3;
  background-repeat: no-repeat; background-size: 700px 800px, auto;                           /* one big sheet of noise: no tile seams */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='800'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .55' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .7 -.22'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 50% 40%, rgba(255, 248, 224, .55), transparent 70%);
  box-shadow: inset 0 0 40px rgba(120, 80, 30, .28), 0 0 0 1px rgba(232, 194, 106, .75), 0 0 0 4px #2A1B63, 0 0 0 5px rgba(232, 194, 106, .45); }
.sc-paper > * { position: absolute; z-index: 1; }
.sc-paper > .sc-ghost { inset: 11px; z-index: 0; display: grid; place-items: center; overflow: hidden; pointer-events: none; }
.sc-ghost .gk { grid-area: 1 / 1; font-family: var(--f-jp); font-size: min(86vw, 58dvh); line-height: 1; color: rgba(139, 30, 36, .15); mix-blend-mode: multiply; opacity: 0; }
.sc-title { left: 0; right: 0; top: 24px; text-align: center; display: grid; gap: 2px; opacity: 0; }
.st-en { font-size: clamp(13px, 3.4vw, 17px); --w: 800; letter-spacing: .28em; text-transform: uppercase; color: #8B1E24; }
.st-sub { font-size: clamp(13px, 3.4vw, 16px); letter-spacing: .14em; color: #5A4A7A; }
.sc-jp { right: 20px; top: 24px; writing-mode: vertical-rl; font-size: 20px; letter-spacing: .12em; color: rgba(139, 30, 36, .75); opacity: 0; display: none; }
.sc-hanko { right: 26px; bottom: 26px; width: 46px; height: 46px; display: grid; place-items: center; background: #B8292A; color: #FBE9D2; font-style: normal; font-size: 30px; line-height: 1; border-radius: 6px; transform: rotate(-4deg); opacity: 0; box-shadow: inset 0 0 0 2px rgba(251, 233, 210, .35); }
.sc-text { left: 7%; right: 7%; top: 92px; bottom: 28px; display: grid; place-items: center; }
.st { grid-area: 1 / 1; display: flex; flex-direction: column; gap: .12em; text-align: center; opacity: 0; font-family: var(--f-cal); font-size: clamp(25px, 6.6vw, 38px); line-height: 1.22; color: #1B1230; }
.st .ln { display: block; text-wrap: balance; }
.st .w { display: inline-block; padding: .14em .12em .2em; margin: -.14em -.12em -.2em; color: #3A2A78; transition: color 1.4s ease;
  --p: -14%; -webkit-mask-image: linear-gradient(90deg, #000 var(--p), transparent calc(var(--p) + 14%)); mask-image: linear-gradient(90deg, #000 var(--p), transparent calc(var(--p) + 14%)); }
.st .w.dry { color: #1B1230; }

/* ---------- the things that pop while it is read ---------- */
.dv-pops { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.dv-pops.back { z-index: 2; }                       /* big art and glyphs peek out from behind the scroll, never over the words */
.pop { position: absolute; will-change: transform, opacity; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .55)); }
.p-tl { left: 4vw; top: 8dvh; }
.p-tr { right: 4vw; top: 8dvh; }
.p-bl { left: 4vw; bottom: 4dvh; }
.p-br { right: 4vw; bottom: 4dvh; }
.p-l { left: 3vw; top: 8dvh; }
.p-r { right: 3vw; top: 8dvh; }
.p-top { left: 50%; top: 2.5dvh; translate: -50% 0; }
.p-top.pop-icon { width: clamp(54px, 13vw, 84px); }
.p-bot { left: 50%; bottom: 2dvh; translate: -50% 0; }
.pop-icon { width: clamp(72px, 21vw, 112px); aspect-ratio: 1; color: var(--cream); }
.pop-icon svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 10px rgba(255, 210, 122, .45)); }
.pop-icon::before { content: ""; position: absolute; inset: -26%; z-index: -1; border-radius: 50%; background: radial-gradient(circle, rgba(18, 10, 44, .72), rgba(18, 10, 44, 0) 68%); }
.pop-icon .d { stroke-dasharray: 1; stroke-dashoffset: 1; }
.pop-icon .f { opacity: 0; }
.pop-plate { width: clamp(112px, 30vw, 230px); background: #F2E6C8; padding: 6px 6px 8px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(232, 194, 106, .65); transform-origin: 50% 0; }
.pop-plate img { width: 100%; height: auto; max-height: 30dvh; object-fit: cover; }
.pop-plate figcaption { margin-top: 5px; font-size: clamp(14px, 3.6vw, 17px); color: #3A2A78; text-align: center; line-height: 1.15; }
.pop-plate::before { content: ""; position: absolute; left: 50%; top: -9px; width: 54px; height: 16px; margin-left: -27px; background: rgba(216, 200, 245, .75); }
.pop-art { height: clamp(110px, 16dvh, 190px); width: auto; filter: drop-shadow(0 0 18px rgba(255, 143, 181, .35)) drop-shadow(0 12px 22px rgba(0, 0, 0, .55)); }
.pop-art.hero { height: clamp(170px, 32dvh, 360px); }
.pop-art.wide { height: auto; width: min(92vw, 620px); }
.pop-art.blade { filter: drop-shadow(0 0 22px rgba(120, 190, 255, .55)); }
.pop-art.tree { height: clamp(150px, 26dvh, 250px); filter: drop-shadow(0 0 30px rgba(167, 139, 224, .45)); }
.pop-ar { font-family: var(--f-ar); font-weight: 700; font-size: clamp(40px, 11vw, 78px); line-height: 1.3; color: #F3D27E; white-space: nowrap; text-shadow: 0 0 22px rgba(255, 210, 122, .65), 0 3px 0 rgba(0, 0, 0, .35); direction: rtl; }
.pop-kanji { font-family: var(--f-jp); font-size: clamp(72px, 21vw, 150px); line-height: 1; color: var(--cream); text-shadow: 0 0 26px rgba(167, 139, 224, .7), 0 4px 0 rgba(0, 0, 0, .4); }
.pop-stamp { width: clamp(68px, 18vw, 104px); aspect-ratio: 1; display: grid; place-items: center; background: #B8292A; color: #FBE9D2; border-radius: 8px; font-family: var(--f-jp); font-size: clamp(26px, 7vw, 40px); line-height: 1.02; letter-spacing: .02em; text-align: center; box-shadow: inset 0 0 0 3px rgba(251, 233, 210, .4); }
.pop-word { padding: 10px 18px 12px; background: #EAD9AE; color: #2A1B63; font-family: var(--f-disp); font-weight: 700; font-size: clamp(26px, 7vw, 42px); letter-spacing: .04em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(120, 80, 30, .5); }
.pop-word s { text-decoration-thickness: 3px; text-decoration-color: #B8292A; }
/* the closing doorway fills the night behind the scroll: the paper stays readable, the light spills out around it */
.pop-doors { height: 100dvh; aspect-ratio: 1894 / 992; overflow: hidden; filter: none; }
.pop-doors .light { position: absolute; inset: 0; background: radial-gradient(70% 90% at 50% 60%, #FFF6D2, #FFD27A 35%, #F29A3A 70%, #8F4A8F); }
.pop-doors img { position: absolute; top: 0; height: 100%; width: 50.1%; max-width: none; }
.pop-doors .l { left: 0; }
.pop-doors .r { right: 0; }
.p-center { left: 50%; top: 50%; translate: -50% -50%; }
.dv-rings { width: min(100vw, 78dvh); aspect-ratio: 1; }
.dv-rings i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(216, 200, 245, .5); box-shadow: 0 0 40px rgba(216, 200, 245, .3), inset 0 0 40px rgba(216, 200, 245, .15); }

.dv-end { position: absolute; z-index: 8; left: 0; right: 0; bottom: max(3.5dvh, 18px); display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 0 16px; }
.dv-end[hidden] { display: none; }
.dv-btn { display: inline-flex; gap: 10px; align-items: center; font-size: 20px; padding: 10px 20px; border-radius: 99px; color: var(--cream); border: 1.5px solid rgba(246, 235, 212, .5); background: rgba(15, 10, 34, .55); backdrop-filter: blur(6px); pointer-events: auto; }

@media (min-width: 900px) {
  .scroll { width: min(90vw, 640px); }
  .sc-text { left: 6%; right: 14%; }
  .st { font-size: clamp(30px, 3vw, 42px); }
  .sc-jp { display: block; }
  /* the slots hug the sides of the (640px) scroll: left ones end 28px before it, right ones start 28px after it */
  .p-tl, .p-l, .p-bl { left: auto; right: calc(50% + min(45vw, 320px) + 28px); }
  .p-tr, .p-r, .p-br { right: auto; left: calc(50% + min(45vw, 320px) + 28px); }
  .p-tl, .p-tr { top: 17dvh; }
  .p-l, .p-r { top: 12dvh; }
  .p-bl, .p-br { top: auto; bottom: 12dvh; }
  .pop-icon { width: clamp(80px, 8vw, 130px); }
  .pop-plate { width: clamp(180px, 17vw, 260px); }
  /* art fills the room beside the scroll and never runs off the screen */
  .pop-art, .pop-art.blade, .pop-art.tree, .pop-art.hero { width: min(calc(50vw - min(45vw, 320px) - 40px), 440px); height: auto; max-height: 66dvh; object-fit: contain; }
  .pop-art.wide { width: min(92vw, 620px); }
  .pop-kanji { font-size: clamp(96px, 11vw, 170px); }
  .pop-stamp { width: clamp(84px, 8vw, 120px); }
}
@media (prefers-reduced-motion: reduce) { .dv-fog, .dv-canopy { animation: none; } }
