:root { color-scheme: light; font-family: "Songti SC", "Noto Serif CJK SC", SimSun, serif; background: #672e3c; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: radial-gradient(ellipse at top, #ad6471, #682e3c 72%); }
button { font: inherit; cursor: pointer; }
.invitation { display: grid; place-items: center; width: 100%; height: 100%; height: 100dvh; }
.paper { position: relative; height: min(100%, 177.7778vw); width: min(100vw, 56.25dvh); overflow: hidden; background: #a64e61; box-shadow: 0 15px 80px #45182466; touch-action: pan-x; isolation: isolate; container-type: inline-size; }
.page { position: absolute; inset: 0; background: #a64e61; }
.page[hidden] { display: none; }
.page img { display: block; width: 100%; height: 100%; object-fit: contain; }
.scene { position: absolute; inset: 0; visibility: hidden; }
.page.is-ready .scene { visibility: visible; }
.page .scene .layer { position: absolute; display: block; object-fit: fill; transform-origin: center; }
.page .scene .layer--guest { left: 5%; width: 90%; display: flex; align-items: center; justify-content: center; color: #a64e61; font-family: "Songti SC", "Noto Serif CJK SC", SimSun, serif; line-height: 1; white-space: nowrap; }
.page.is-active.is-ready .layer:where(:not(.layer--background):not(.layer--overlay)) { animation: layer-in 850ms cubic-bezier(.18,.8,.25,1.18) both; animation-delay: var(--delay); }
.page.is-active.is-ready .layer--title { animation-name: title-in; }
.page.is-active.is-ready .layer--photo, .page.is-active.is-ready .layer--person, .page.is-active.is-ready .layer--map { animation-name: photo-in; }
.page.is-active.is-ready .layer--decoration, .page.is-active.is-ready .layer--sparkle { animation-name: decoration-in; }
.page.is-active.is-ready .layer--photo, .page.is-active.is-ready .layer--person { animation: photo-in 850ms cubic-bezier(.18,.8,.25,1.18) var(--delay) both, photo-float 5s ease-in-out calc(var(--delay) + 850ms) infinite; }
.page.is-active.is-ready .layer--decoration, .page.is-active.is-ready .layer--sparkle { animation: decoration-in 850ms cubic-bezier(.18,.8,.25,1.18) var(--delay) both, decoration-float 3.6s ease-in-out calc(var(--delay) + 850ms) infinite; }
.music { position: absolute; z-index: 2; top: max(12px, 2.2%); right: 4%; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid #fff9; border-radius: 50%; color: white; background: #773849a8; font-size: 24px; line-height: 1; }
.music[aria-pressed="true"] span { animation: rotate 5s linear infinite; }
.page-control { position: absolute; z-index: 2; bottom: max(10px, 1.5%); right: 4%; display: flex; align-items: center; gap: 7px; color: #fff; font: 10px Georgia, serif; letter-spacing: .12em; text-shadow: 0 1px 5px #4d1b29; }
.page-control button { width: 27px; height: 27px; border: 1px solid #fff9; border-radius: 50%; background: #773849b8; color: white; font: 23px/20px Georgia, serif; }
.page-control button:disabled { opacity: .4; cursor: default; }
.hint { position: absolute; bottom: 10px; left: 4%; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 20px; color: #fff; background: #773849d9; font-size: 10px; letter-spacing: .08em; text-shadow: 0 1px 5px #5c2935; white-space: nowrap; pointer-events: none; }
.hint[hidden] { display: none; }
.envelope-intro { position: absolute; inset: 0; z-index: 10; overflow: hidden; display: flex; flex-direction: column; align-items: center; color: #faefdd; background: radial-gradient(ellipse at 50% 36%, #bb7280 0, #a65366 51%, #8c4355 100%); }
.envelope-intro[hidden] { display: none; }
.envelope-intro::before { content: ''; position: absolute; inset: 3.5%; border: 1px solid #f7dfc255; pointer-events: none; }
.envelope-intro::after { content: ''; position: absolute; inset: 4.4%; border: 1px solid #f7dfc223; pointer-events: none; }
.intro-ornament { margin-top: 16%; font-size: 6cqw; color: #f0d3ad; }
.intro-kicker { margin: 5% 0 0; font: 2.3cqw Georgia, serif; letter-spacing: .3em; }
.intro-title { margin: 4% 0 0; font-size: 5.3cqw; letter-spacing: .15em; }
.envelope-button { position: relative; display: block; flex: none; width: 79%; aspect-ratio: 1.35; margin-top: 21%; padding: 0; border: 0; background: transparent; color: #843f50; perspective: 900px; filter: drop-shadow(0 12px 12px #57243355); }
.envelope-button:focus-visible { outline: 2px solid #fff6df; outline-offset: 8px; }
.envelope-back, .envelope-front, .envelope-flap, .envelope-letter, .envelope-recipient, .envelope-seal { position: absolute; display: block; }
.envelope-back { inset: 0; background: #e5c5ad; border-radius: 3px; }
.envelope-letter { inset: 8% 7% 9%; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11%; background: #faf4e7; color: #a45161; border: 1px solid #e2cebb; transition: transform .8s cubic-bezier(.2,.7,.2,1) .35s; }
.letter-small, .letter-date { font: 1.8cqw Georgia, serif; letter-spacing: .2em; }
.letter-title { font-size: 4.6cqw; letter-spacing: .12em; }
.envelope-front { inset: 0; z-index: 2; background: linear-gradient(148deg, #efdac4 0 49.5%, #e6c8b4 50% 100%); clip-path: polygon(0 0, 50% 49%, 100% 0, 100% 100%, 0 100%); border-radius: 3px; }
.envelope-flap { inset: 0; z-index: 4; background: linear-gradient(#f6e6d2, #e6c5b2); clip-path: polygon(0 0, 100% 0, 50% 53%); transform-origin: top; transition: transform .6s ease, z-index 0s .3s; }
.envelope-recipient { z-index: 5; bottom: 12%; left: 5%; width: 90%; text-align: center; line-height: 1.25; white-space: nowrap; color: #904a59; }
.envelope-seal { z-index: 5; top: 41%; left: 50%; display: grid; place-items: center; width: 14%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #a44d60; color: #f9e7ce; border: 3px double #e7c8aa; font-size: 4cqw; box-shadow: 0 2px 4px #6f344244; transition: opacity .2s, transform .3s; }
.intro-prompt { margin: 11% 0 0; font-size: 3cqw; letter-spacing: .12em; animation: prompt-float 2s ease-in-out infinite; }
.intro-prompt span { display: inline-block; margin-left: 5px; }
.intro-signature { position: absolute; bottom: 7%; margin: 0; font: 2.2cqw Georgia, serif; letter-spacing: .2em; color: #f5dfcf; }
.intro-signature span { padding: 0 4px; opacity: .55; }
.envelope-intro.is-opening { animation: intro-leave .45s ease 1.12s forwards; }
.is-opening .envelope-flap { transform: rotateX(180deg); z-index: 0; }
.is-opening .envelope-seal { opacity: 0; transform: translate(-50%, -50%) scale(.65); }
.is-opening .envelope-letter { transform: translateY(-72%); }
@keyframes intro-leave { to { opacity: 0; } }
@keyframes prompt-float { 50% { transform: translateY(-5px); opacity: .7; } }
.chevron { width: 9px; height: 9px; border-left: 1px solid white; border-top: 1px solid white; transform: rotate(45deg); animation: float 1.4s infinite; }
@keyframes layer-in { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes title-in { from { opacity: 0; transform: translateY(-65px) scale(.93); } to { opacity: 1; transform: none; } }
@keyframes photo-in { from { opacity: 0; transform: translate(calc(var(--direction) * 75px), 75px) rotate(calc(var(--direction) * 8deg)) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes decoration-in { from { opacity: 0; transform: scale(.35) rotate(-18deg); } to { opacity: 1; transform: none; } }
@keyframes photo-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(.6deg); } }
@keyframes decoration-float { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(5deg); } }
@keyframes float { 50% { transform: translateY(-5px) rotate(45deg); opacity: .55; } }
@keyframes rotate { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
