/* The approved birthday storyboard: physical layers over a text-free backdrop. */
.birthday-envelope{display:none}
body[data-envelope="birthday"] #openingScene .opening-inner{background-image:url('/assets/birthday-rich-stage.webp');animation:none;isolation:isolate}
body[data-envelope="birthday"] #openingScene .opening-inner::after{content:'';display:block;position:absolute;inset:0;z-index:7;pointer-events:none;animation:none;opacity:1;background:url('/assets/birthday-rich-stage.webp') center/100% 100%;clip-path:polygon(0 64%,17% 64%,24% 67%,27% 70%,35% 71%,41% 75%,41% 81%,0 81%)}
body[data-envelope="birthday"] #openingScene .opening-event,
body[data-envelope="birthday"] #openingScene .template-letter{display:none}
body[data-envelope="birthday"] #openingScene .template-brand{top:3%;font-size:clamp(28px,4dvh,38px)}
body[data-envelope="birthday"] #openingScene .template-motto{top:13%;font:400 clamp(12px,1.8dvh,16px)/1.4 Georgia,serif;letter-spacing:.02em;text-transform:none}
body[data-envelope="birthday"] #openingScene h1{top:21%;left:18%;width:64%;font:400 clamp(42px,7dvh,66px)/.98 Georgia,serif;letter-spacing:-.045em;text-wrap:balance;transition:opacity .3s}
body[data-envelope="birthday"][data-custom-heading-font="true"] #openingScene h1{font-family:var(--invitation-heading-font)}
body[data-envelope="birthday"] #openingScene .envelope-recipient{top:37.5%;transition:opacity .25s;color:#ffe5b3}
body[data-envelope="birthday"] #openingScene .envelope-recipient strong{font-size:clamp(20px,3dvh,28px)}
body[data-envelope="birthday"] #openingScene .birthday-envelope{position:absolute;display:block;z-index:3;top:47%;left:12%;width:76%;height:29%;perspective:1100px;filter:drop-shadow(0 12px 12px #14010499);--paper-texture:url('/assets/birthday-rich-envelope.webp')}
.birthday-envelope-back{position:absolute;inset:0;background:linear-gradient(135deg,#ad7841,#edd6a7 48%,#a27037);border:1px solid #e1bb77;border-radius:3px;box-shadow:inset 0 0 25px #6c240c66}
.birthday-envelope-pocket{position:absolute;inset:0;z-index:3;background:var(--paper-texture) center/100% 100%;clip-path:polygon(0 0,50% 66%,100% 0,100% 100%,0 100%)}
.birthday-flap{position:absolute;z-index:5;inset:0 0 auto;height:66%;transform-origin:50% 0;transform-style:preserve-3d;transition:transform .7s cubic-bezier(.4,0,.2,1)}
.birthday-flap-front,.birthday-flap-lining{position:absolute;inset:0;background:#e3c084;clip-path:polygon(0 0,100% 0,50% 100%);backface-visibility:hidden;-webkit-backface-visibility:hidden}
.birthday-flap-front{background:var(--paper-texture) top/100% 151.515%;clip-path:polygon(0 0,100% 0,100% 7%,51% 100%,49% 100%,0 7%)}
.birthday-flap-lining::before{content:'';position:absolute;inset:1px;clip-path:polygon(0 0,100% 0,50% 99%)}
.birthday-flap-front span{position:absolute;inset:13% 14% auto;color:#ffe6b3;text-shadow:0 1px 2px #3d0409;text-align:center;text-transform:uppercase;font:400 clamp(12px,1.95dvh,18px)/1.35 Georgia,serif;letter-spacing:.035em;text-wrap:balance;overflow-wrap:anywhere}
.birthday-flap-lining{transform:translateZ(-1px);backface-visibility:visible;-webkit-backface-visibility:visible}
.birthday-flap-lining::before{background:linear-gradient(145deg,#b48b53,#f4e0b3 60%,#be985d)}
.birthday-seal{position:absolute;z-index:6;top:53%;left:50%;width:28%;aspect-ratio:1;transform:translate(-50%,-8%);background:url('/assets/birthday-gold-seal.webp') center/contain no-repeat;filter:drop-shadow(0 5px 4px #190109aa);transition:transform .23s ease-in,opacity .23s}
.birthday-seal span{display:none}
.birthday-letter{position:absolute;z-index:2;top:4%;left:8%;width:84%;height:112%;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 20px;background:var(--paper-texture),linear-gradient(120deg,#fffaf0,#f1dfbd);border:1px solid #dfbd80;outline:1px solid #b58a4d;outline-offset:-7px;color:#671121;text-align:center;transform:translateY(0);transition:transform .8s cubic-bezier(.2,.7,.2,1);overflow:hidden}
.birthday-letter .birthday-card-crown{color:#aa7734;font:28px/1 Georgia,serif}
.birthday-letter strong{font:400 clamp(27px,4.5dvh,41px)/1 Georgia,serif;text-transform:uppercase;overflow-wrap:anywhere;max-width:100%}
.birthday-letter>span:not(.birthday-card-crown){font:400 clamp(12px,1.85dvh,17px)/1.25 Georgia,serif;text-transform:uppercase;text-wrap:balance}
.birthday-letter i{color:#b58a4d;font:16px/1 Georgia,serif}
.birthday-letter small{font:10px/1.5 Georgia,serif;letter-spacing:.16em;text-transform:uppercase;overflow-wrap:anywhere;max-width:100%}
body[data-envelope="birthday"] #openingScene .template-envelope-hit{z-index:8;top:47%;left:12%;width:76%;height:29%}
body[data-envelope="birthday"] #openingScene .template-envelope-hit::after{display:none}
body[data-envelope="birthday"] #openingScene .opening-button{top:auto;bottom:10%;left:17%;width:66%;height:auto;min-height:44px;background:#31050ad9;font-size:17px}
body[data-envelope="birthday"] #openingScene .opening-skip{top:auto;bottom:4.5%;left:25%;min-height:28px}
body[data-envelope="birthday"] #openingScene .opening-owner-access{bottom:1.5%;min-height:28px}
body[data-envelope="birthday"] #openingScene.is-unsealed .birthday-seal{opacity:0;transform:translate(-50%,65%) rotate(12deg) scale(.88)}
body[data-envelope="birthday"] #openingScene.is-flap-open .birthday-flap{transform:rotateX(-180deg)}
body[data-envelope="birthday"] #openingScene.is-card-opening .birthday-flap{z-index:1}
body[data-envelope="birthday"] #openingScene.is-card-opening .birthday-letter{transform:translateY(-82%);visibility:visible}
body[data-envelope="birthday"] #openingScene:not(.is-card-opening) .birthday-letter{visibility:hidden}
body[data-envelope="birthday"] #openingScene:not(.is-card-opening) .birthday-letter{clip-path:inset(0 0 max(0px,calc(100% - 25.9dvh)))}
body[data-envelope="birthday"] #openingScene.is-opening .template-envelope-hit{pointer-events:none}
body[data-envelope="birthday"] #openingScene.is-opening .opening-button{opacity:0;pointer-events:none}
body[data-envelope="birthday"] #openingScene.is-card-opening h1,
body[data-envelope="birthday"] #openingScene.is-flap-open .envelope-recipient{opacity:0}
@media(prefers-reduced-motion:reduce){.birthday-envelope *{transition:none!important}}
/* Let editable names determine the paper height, instead of clipping them. */
.birthday-letter{height:auto;min-height:max(112%,240px);overflow:visible;background:linear-gradient(120deg,#fffaf0,#f1dfbd)}
.birthday-letter strong{font-size:clamp(22px,4dvh,38px)}
@media(max-height:500px){
 body[data-envelope="birthday"] #openingScene{overflow-y:auto;place-items:start center}
 body[data-envelope="birthday"] #openingScene .opening-inner{height:780px;width:min(100vw,390px)}
 body[data-envelope="birthday"] #openingScene:not(.is-card-opening) .birthday-letter{clip-path:inset(0 0 max(0px,calc(100% - 201px)))}
}
/* Fixed touch-target spacing on short phones: percentage offsets placed the
   owner link over Skip animation at 568px tall. Keep both actions reachable. */
@media(min-height:501px) and (max-height:650px){
 body[data-envelope-art="true"] #openingScene .opening-button{top:auto;bottom:82px;height:44px;min-height:44px}
 body[data-envelope-art="true"] #openingScene .opening-skip{top:auto;bottom:43px;min-height:28px}
 body[data-envelope-art="true"] #openingScene .opening-owner-access{top:auto;bottom:8px;min-height:28px}
}
