/* Real material layers, shared by all illustrated occasion envelopes.
   The established birthday scene keeps its own artwork and composition. */
body[data-envelope-art="true"] #openingScene{
 --stock:#fffaed;--stock-ink:#663523;--stock-texture:url('/assets/envelope-pearl-material.webp');
 --seal-position:50% 65%;--seal-size:480% 1000%;
}
body[data-envelope="dedication"] #openingScene{--stock:#bfdae9;--stock-ink:#224564;--seal-position:50% 67.3%}
body[data-envelope="debut"] #openingScene{--stock:#f3b5bd;--stock-ink:#6c2032;--seal-position:50% 67.7%}
body[data-envelope="baby"] #openingScene{--stock:#f4caa8;--stock-ink:#75452e;--seal-position:50% 65.6%}
body[data-envelope="party"] #openingScene{--stock:#292e31;--stock-ink:#ffe5ad;--seal-position:50% 69%}
body[data-envelope="anniversary"] #openingScene{--stock:#88313e;--stock-ink:#ffe6b9;--seal-position:50% 65.2%}
body[data-envelope="graduation"] #openingScene{--stock:#264766;--stock-ink:#ffe6b9;--seal-position:50% 66.8%}
body[data-envelope="corporate"] #openingScene{--stock:#353a36;--stock-ink:#f2e7c9;--seal-position:50% 61.8%}
body[data-envelope="church"] #openingScene{--stock:#9eaa86;--stock-ink:#314128;--seal-position:50% 69.3%}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .opening-inner{
 background-image:var(--envelope-stage);animation:none;isolation:isolate;
}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .opening-event,
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .template-letter{display:none}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .template-brand{top:5%;font-size:clamp(28px,4.6dvh,42px)}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .template-motto{top:15%;left:18%;width:64%;font-size:clamp(10px,1.5dvh,13px);letter-spacing:.08em}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene h1{top:23%;left:12%;width:76%;font-size:clamp(36px,6.2dvh,58px);transition:opacity .3s}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .envelope-recipient{top:36%;left:16%;width:68%;color:var(--envelope-ink);transition:opacity .3s}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .envelope-recipient strong{font-size:clamp(18px,2.8dvh,27px)}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .birthday-envelope{
 display:block;position:absolute;z-index:3;top:50%;left:12%;width:76%;height:27%;
 perspective:1100px;filter:drop-shadow(0 14px 12px #28140b66);--paper-texture:var(--stock-texture);
}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-envelope-back{background:linear-gradient(135deg,#bd965d,#f0debd 50%,#b58b55);border-color:#d8b577}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-envelope-pocket{
 background-color:var(--stock);background-blend-mode:multiply;box-shadow:inset 0 -1px 0 #d3ac6c;
 clip-path:polygon(0 0,50% 66%,100% 0,100% 100%,0 100%);
}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-flap-front{background-color:var(--stock);background-blend-mode:multiply}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-flap-front::after{content:'';position:absolute;inset:0;background:linear-gradient(135deg,#f6df9d,#b1833c 45%,#fbe6ad 80%);clip-path:polygon(0 0,50% 100%,100% 0,99.4% 0,50% 98.7%,.6% 0);pointer-events:none}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-flap-front span{inset:12% 13% auto;color:var(--stock-ink);text-shadow:none;font-size:clamp(11px,1.7dvh,16px);line-height:1.4;letter-spacing:.055em}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-seal{
 top:54%;width:26%;background-image:var(--envelope-art);background-size:var(--seal-size);background-position:var(--seal-position);background-repeat:no-repeat;clip-path:circle(48%);filter:drop-shadow(0 4px 3px #38180088);
}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-letter{
 background:linear-gradient(120deg,#fffcf5,#f1e5cd);min-height:max(105%,215px);box-shadow:0 8px 24px #2e1b1b33;color:#5d3429;
}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) .birthday-letter strong{font-family:var(--invitation-heading-font,Georgia),serif;font-size:clamp(22px,3.5dvh,34px)}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .template-envelope-hit{z-index:8;top:50%;left:12%;width:76%;height:27%}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .template-envelope-hit::after{display:none}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-unsealed .birthday-seal{opacity:0;transform:translate(-50%,65%) rotate(12deg) scale(.88)}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-flap-open .birthday-flap{transform:rotateX(-180deg)}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-card-opening .birthday-flap{z-index:1}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-card-opening .birthday-letter{transform:translateY(-82%);visibility:visible}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene:not(.is-card-opening) .birthday-letter{visibility:hidden}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-opening .template-envelope-hit{pointer-events:none}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-opening .opening-button{opacity:0;pointer-events:none}
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-flap-open h1,
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene.is-flap-open .envelope-recipient{opacity:0}
@media(max-height:500px){
 body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene{overflow-y:auto;place-items:start center}
 body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .opening-inner{height:780px;width:min(100vw,390px)}
}
@media(prefers-reduced-motion:reduce){body[data-envelope-art="true"] .birthday-envelope *{transition:none!important}}

/* The closed experience uses the exact catalog artwork, not a simplified
   reconstruction. It dissolves into aligned physical layers only on opening. */
body[data-envelope-art="true"] #openingScene .opening-inner::after{
 content:'';display:block;position:absolute;inset:0;z-index:4;pointer-events:none;
 background:var(--envelope-art) center/100% 100% no-repeat;clip-path:none;
 opacity:1;animation:none;transition:opacity .45s ease;
}
body[data-envelope-art="true"] #openingScene .opening-event,
body[data-envelope-art="true"]:not([data-envelope="birthday"]) #openingScene .opening-event{
 display:block;position:absolute;z-index:5;top:51.5%;left:22%;width:56%;margin:0;
 color:var(--stock-ink,#ffe6b3);font:400 clamp(11px,1.8dvh,17px)/1.4 Georgia,serif;
 letter-spacing:.055em;text-transform:uppercase;text-wrap:balance;overflow-wrap:anywhere;
 transition:opacity .2s;
}
body[data-envelope="birthday"] #openingScene .opening-event{color:#ffe6b3}
body[data-envelope-art="true"] #openingScene :is(.template-brand,.template-motto,h1,.envelope-recipient,.opening-button,.template-footer,.opening-skip,.opening-owner-access){z-index:8}
body[data-envelope-art="true"] #openingScene .template-envelope-hit{z-index:9}
body[data-envelope-art="true"] #openingScene.is-opening .opening-inner::after,
body[data-envelope-art="true"] #openingScene.is-opening .opening-event{opacity:0}
body[data-envelope-art="true"] #openingScene:not(.is-opening) .birthday-flap-front span{visibility:hidden}
body[data-envelope-art="true"] #openingScene.is-opening .birthday-flap-front span{visibility:visible}
body[data-envelope-art="true"] #openingScene .birthday-envelope{top:47%;height:29%}
body[data-envelope-art="true"] #openingScene .template-envelope-hit{top:47%;height:29%}
