/* The plate and its matching cutout share coordinates in the original 1672 × 941 frame. */
#ritual{height:calc(100svh - 119px);min-height:350px;container-type:size;display:block;padding:0;background:#171313;overflow:hidden}
#ritual>*{--plate:min(max(100cqw,177.68cqh),190cqw)}
.still{position:absolute;inset:0;background:#1a1413 url('./art/writing-desk.webp') center/var(--plate) auto no-repeat;z-index:-2}
.still:after{content:"";position:absolute;inset:0;background:#1a1413 url('./art/empty-desk.webp') center/var(--plate) auto no-repeat;opacity:0;transition:opacity .45s,filter 1.2s}
#ritual:not([data-phase=resting]) .still:after{opacity:1;filter:brightness(.53) blur(2px)}
.introcopy,.guide{position:absolute;left:5%;right:5%;text-align:center;margin:0;pointer-events:none}
.introcopy{top:5%;z-index:1}.introcopy h1{font-size:clamp(28px,4.5cqh,53px);letter-spacing:-.04em}.guide{bottom:2.5%;max-width:none;min-height:0}.guide button{pointer-events:auto}.notches{display:none}.ornament{font-size:12px;margin-bottom:4px}
#ritual .packet{position:absolute;left:50%;top:53%;width:min(750px,86vw,87cqh);aspect-ratio:820/532;transform:translate(-50%,-50%) rotate(4deg);filter:drop-shadow(3px 28px 19px #000b);transition:transform 1.15s cubic-bezier(.22,.72,.22,1),top 1.15s,width 1.15s,filter 1.15s,opacity .7s;transform-origin:center;isolation:isolate}
#ritual[data-phase=resting] .packet{top:calc(50% + var(--plate)*.04336);left:calc(50% - var(--plate)*.00060);width:calc(var(--plate)*.49043);transform:translate(-50%,-50%);filter:none}
.prop{position:absolute;inset:0;background:center/100% 100% no-repeat;pointer-events:none}
.prop.body{background-image:url('./art/envelope-inside.webp')}
.prop.lid{background-image:url('./art/envelope-flap.webp');transform-origin:45% 11.6%;transform:rotate(-5.24deg) scaleY(1) rotate(5.24deg);transition:transform .85s cubic-bezier(.28,.65,.2,1),filter .8s}
#ritual[data-phase=resting] .prop{opacity:0}

#ritual .seal{width:22%;height:31%;min-width:0;left:49%;top:55%;filter:none;cursor:pointer;z-index:3}
#ritual .seal:before{display:none}#ritual .seal:hover{background:radial-gradient(ellipse,#ffe0c50b,transparent 65%)}
#ritual[data-phase=resting] .seal{inset:0;width:100%;height:100%;transform:none}
#ritual[data-phase=resting] .seal:after{content:"";position:absolute;left:39%;top:41%;width:20%;height:27%;background:radial-gradient(ellipse at 38% 32%,#f4b9a266,transparent 35%);mix-blend-mode:screen;animation:candle-glint 3.8s ease-in-out infinite}
@keyframes candle-glint{0%,75%,100%{opacity:.08}41%{opacity:.79}}
#ritual[data-phase=drawing] .packet{animation:leave-hand 1.15s .55s both}#ritual[data-phase=drawing] :is(.guide,.introcopy){opacity:0;transition:opacity .5s}
@keyframes leave-hand{to{opacity:0;translate:0 24vh;rotate:6deg}}
.reflected-light{position:fixed;inset:0;pointer-events:none;z-index:5;mix-blend-mode:screen;background:radial-gradient(ellipse at var(--origin),#f8d3b3,#ab3a4055 27%,transparent 72%);opacity:0}
#cinema{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:8}
#letter{background:linear-gradient(#16111288,#100e0fbb),url('./art/empty-desk.webp') center/cover}
.document{width:min(540px,92vw,max(290px,55svh));animation:none}
.landing-sheet #letter{position:fixed;inset:75px 0 auto;visibility:hidden;pointer-events:none}
#gateway{background:#080809}
.gate-scene{background:url('./art/gate.webp') center/cover no-repeat;transform-origin:50% 57%;animation:passage 4.2s both}
.mist{position:absolute;left:50%;top:57%;width:11%;height:37%;transform:translate(-50%,-50%);background:radial-gradient(ellipse,#ede8edb5,#c1afb94d 36%,transparent 69%);mix-blend-mode:screen;filter:blur(5px);animation:part-mist 4.2s both}
@keyframes passage{0%{opacity:.25;transform:scale(1)}21%{opacity:1}49%{transform:scale(1.08)}84%{opacity:1}100%{transform:scale(7.2);opacity:.12}}
@keyframes part-mist{0%,24%{opacity:.15;scale:.12 1}60%{opacity:.78;scale:1.05 1.1}100%{opacity:.08;scale:1.8 1.25}}
#gateway h2{position:absolute;bottom:12vh;font:normal clamp(26px,3.7vw,62px)/1.12 Georgia,serif;letter-spacing:-.035em}
@media(max-width:650px){#ritual{height:calc(100svh - 103px)}.landing-sheet #letter{top:59px}.still,.still:after{background-color:#171313}.introcopy{top:7%}.guide{bottom:5%}}
@media(prefers-reduced-motion:reduce){#ritual .seal:after{opacity:.2}.mist{opacity:.35}}
#ritual[data-phase=open]{touch-action:none}
#ritual .packet{width:min(870px,91vw,94cqh)}
.prop.lid:after{content:"";position:absolute;inset:0;background:url('./art/fold-reverse.webp') center/100% 100%;opacity:0;transition:opacity .25s .22s}
#ritual:is([data-phase=open],[data-phase=drawing]) .lid{transform:rotate(-5.24deg) scaleY(-.55) rotate(5.24deg);filter:brightness(.94);background-image:none}
#ritual:is([data-phase=open],[data-phase=drawing]) .lid:after{opacity:1;transition:none}
#ritual:not([data-phase=resting]) .introcopy{opacity:0;transition:opacity .45s}
.wax-detail{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.seam{fill:none;stroke:#230c0c;stroke-width:1.85;stroke-linecap:round;stroke-linejoin:bevel;filter:drop-shadow(.75px .6px .18px #c08a8280);stroke-dasharray:160;stroke-dashoffset:160;transition:stroke-dashoffset .32s ease-out}
[data-hits="1"] .seam-one,[data-hits="2"] :is(.seam-one,.seam-two),[data-hits="3"] .seam{stroke-dashoffset:0}
.tucked-sheet,.pocket-face{position:absolute;pointer-events:none;opacity:0}
.tucked-sheet{left:16%;top:13%;width:68%;aspect-ratio:3/2;background:url('./art/carta-do-reino.webp') center/100% 100%;transform:translateY(calc(-1 * var(--pull,0px))) rotate(-4deg);transform-origin:center;filter:brightness(.80);z-index:2}
.pocket-face{inset:0;background:url('./art/pocket-front.webp') center/100% 100%;z-index:3}
#ritual:is([data-phase=open],[data-phase=drawing]) :is(.pocket-face,.tucked-sheet){opacity:1}
#ritual[data-phase=open] .tucked-sheet{transition:opacity .35s .15s}
#ritual[data-phase=drawing] .packet{animation:none;opacity:1}
#ritual[data-phase=drawing] :is(.prop,.pocket-face){animation:pocket-away 1.4s .6s both}
@keyframes pocket-away{to{opacity:0;translate:0 12vh}}
.document{position:relative;width:min(760px,94vw,103svh);background:#ac9376;color:#30221c}
.document .writ{display:block;width:100%;height:auto}
.document .signline{position:absolute;inset:49% 14% auto;margin:0;padding:0;border:0;background:transparent}
.signline label strong{display:block;font:normal clamp(15px,2.2vw,27px)/1.12 Georgia,serif;color:#432b22}
.signline label span{font:italic clamp(11px,1.2vw,15px)/1.2 Georgia,serif;color:#4a322a}
.signline input{width:72%;margin:0 auto 5px;font-size:clamp(18px,2.4vw,28px);line-height:1.05}
.signline .sign{font-size:clamp(11px,1vw,14px);padding:4px 10px}
@media(max-width:470px){.document .signline{inset:47% 8% auto}.signline label strong{font-size:15px}.signline input{font-size:17px}.signline .sign{padding:3px 8px}}

#ritual:is([data-phase=open],[data-phase=drawing]) .body{background-image:url("./art/pocket-lining.webp")}
#ritual:is([data-phase=open],[data-phase=drawing]) .wax-detail{visibility:hidden}
