:root {
  color-scheme: light;
  --green: #155e48;
  --paper: #f4eee6;
  --rose: #eaaaba;
  --env-w: min(540px, calc(100vw - 52px), calc((100svh - 176px) * 1.4));
  --card-w: min(470px, calc(100vw - 36px), calc((100svh - 174px) * .7142857));
  --lift: clamp(150px, 35vw, 230px);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  color: var(--green);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* {box-sizing:border-box}
html,body {margin:0;min-height:100%;width:100%}
body {background:radial-gradient(ellipse at 50% 35%,#fffaf2 0%,#f4eee6 73%);overflow-x:hidden}
body::before {content:"";position:fixed;inset:0;background:url('assets/papel.svg') repeat;opacity:.35;pointer-events:none;z-index:20}
button,a {-webkit-tap-highlight-color:transparent}
button {font:inherit;color:inherit;cursor:pointer}
button:focus-visible,a:focus-visible {outline:2px solid var(--green);outline-offset:6px}
button {border:0}
[hidden] {display:none!important}
.invitation {min-height:100svh;display:flex;flex-direction:column;align-items:center;padding:0 18px}
.intro {height:76px;flex:none;display:flex;align-items:center;justify-content:center;gap:17px;transition:opacity .6s ease}
.intro h1 {font-weight:400;font-size:1.18rem;margin:0;letter-spacing:.012em}
.intro-line {width:25px;height:1px;background:currentColor;opacity:.28}
.stage {width:100%;height:calc(100svh - 174px);max-height:840px;min-height:220px;position:relative;flex:none;perspective:1400px}
.envelope {width:var(--env-w);height:calc(var(--env-w) * .6666667);position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);perspective:1400px;isolation:isolate}
.envelope-back {position:absolute;inset:0;border-radius:3px;background:#e9a8b8;box-shadow:0 25px 45px -18px #623d3c36,0 3px 7px #623d3c0c;z-index:0}
.lining {position:absolute;inset:5px 5px 8px;background:#f7e9d7;clip-path:polygon(0 0,100% 0,100% 100%,0 100%);z-index:1}
.paper::after {content:"";position:absolute;inset:0;background:url('assets/papel.svg');opacity:.6;mix-blend-mode:multiply;pointer-events:none;border-radius:inherit}
.envelope-front {position:absolute;inset:0;width:100%;height:100%;z-index:4;pointer-events:none;filter:drop-shadow(0 -1px 1px #9d617209)}
.flap {position:absolute;top:0;left:0;width:100%;height:62%;transform-origin:50% 0;transform-style:preserve-3d;z-index:6}
.flap-face {position:absolute;inset:0;backface-visibility:hidden;clip-path:polygon(0 0,100% 0,50% 100%);border-radius:2px}
.flap-front {background:#e9a8b8;filter:drop-shadow(0 2px 1px #9c5e711b)}
.flap-back {background:#f4d2d2;transform:rotateX(180deg)}
.seal {position:absolute;width:67px;height:67px;top:51%;left:50%;transform:translate(-50%,-50%);z-index:7;filter:drop-shadow(0 3px 2px #563d2f21);pointer-events:none}
.seal svg,.seal img {display:block;width:100%;height:100%}
.envelope-note {position:absolute;left:0;right:0;bottom:11%;text-align:center;font-size:1rem;letter-spacing:.018em;opacity:.84;z-index:5;pointer-events:none}
.open-envelope {position:absolute;inset:-10px;background:transparent;z-index:10;border-radius:12px}
.open-envelope:focus-visible {outline-offset:10px}
.open-envelope:hover~* {color:inherit}
.card {padding:0;position:absolute;width:var(--card-w);aspect-ratio:5/7;top:50%;left:50%;z-index:3;transform:translate(-50%,-50%) translateY(40px) scale(.5) rotate(-2deg);opacity:0;background:#fff4e3;box-shadow:0 12px 40px -14px #382f2638;border-radius:1px;cursor:zoom-in;will-change:transform,opacity;visibility:hidden;transform-origin:50% 50%}
.card img {display:block;width:100%;height:100%;object-fit:contain;border-radius:inherit;user-select:none}
.footer {height:98px;flex:none;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;position:relative;gap:12px;width:100%;padding:8px 0 15px}
.hint {font-size:1rem;line-height:1.4;margin:0;transition:opacity .3s ease;letter-spacing:.012em}
.share-action {font-size:1rem;line-height:1.4;display:flex;align-items:center;gap:8px;background:none;padding:6px 9px;opacity:.68;transition:opacity .2s}
.share-action:hover {opacity:1}
.actions {display:flex;align-items:center;gap:25px;min-height:28px;justify-content:center}
.primary-action,.text-action {font-size:1rem;background:transparent;padding:3px 0;line-height:1.4}
.primary-action {border-bottom:1px solid #155e4860}
.text-action {opacity:.65}
.text-action:hover {opacity:1}
.invitation[data-state="opening"] .open-envelope {pointer-events:none}
.invitation[data-state="opening"] .card {visibility:visible;animation:card-unfold 2.35s cubic-bezier(.22,.72,.25,1) both}
.invitation[data-state="opening"] .flap {animation:flap-open 2.35s ease-in-out both}
.invitation[data-state="opening"] .seal {animation:seal-open 2.35s ease both}
.invitation[data-state="opening"] .envelope-back,
.invitation[data-state="opening"] .lining,
.invitation[data-state="opening"] .envelope-front,
.invitation[data-state="opening"] .envelope-note {animation:envelope-away 2.35s ease-in-out both}
.invitation[data-state="opening"] .hint {opacity:0}
.invitation[data-state="open"] .card {visibility:visible;opacity:1;transform:translate(-50%,-50%);z-index:8}
.invitation[data-state="open"] .envelope-part,
.invitation[data-state="open"] .flap,
.invitation[data-state="open"] .seal,
.invitation[data-state="open"] .envelope-note {visibility:hidden;opacity:0;pointer-events:none}
@keyframes seal-open {
  0%,3% {opacity:1;transform:translate(-50%,-50%) scale(1)}
  13%,100% {opacity:0;transform:translate(-50%,-50%) scale(.82)}
}
@keyframes flap-open {
  0%,5% {transform:rotateX(0);z-index:6}
  24%,47% {transform:rotateX(-180deg);z-index:2;opacity:1}
  66% {transform:translateY(90px) rotateX(-180deg);opacity:0;z-index:2}
  100% {transform:translateY(145px) rotateX(-180deg);opacity:0;z-index:2}
}
@keyframes envelope-away {
  0%,44% {transform:translateY(0);opacity:1}
  70%,100% {transform:translateY(145px);opacity:0}
}
@keyframes card-unfold {
  0%,17% {opacity:0;z-index:3;transform:translate(-50%,-50%) translateY(40px) scale(.5) rotate(-2deg)}
  25% {opacity:1;z-index:3;transform:translate(-50%,-50%) translateY(24px) scale(.5) rotate(-2deg)}
  49% {opacity:1;z-index:3;transform:translate(-50%,-50%) translateY(calc(-1 * var(--lift))) scale(.5) rotate(-2deg)}
  60% {opacity:1;z-index:5;transform:translate(-50%,-50%) translateY(calc(-.76 * var(--lift))) scale(.64) rotate(-1deg)}
  100% {opacity:1;z-index:8;transform:translate(-50%,-50%) translateY(0) scale(1) rotate(0)}
}
.lightbox {padding:0;border:0;background:transparent;width:min(92vw,780px);max-width:92vw;max-height:94svh;overflow:visible;outline:none}
.lightbox::backdrop {background:#122b24d9;backdrop-filter:blur(7px)}
.lightbox-scroll {max-height:84svh;overflow:auto;overscroll-behavior:contain;box-shadow:0 12px 65px #0004;background:#fff4e3}
.lightbox img {display:block;width:100%;height:auto}
.close-lightbox {position:absolute;right:-12px;top:-17px;width:42px;height:42px;background:#fff4e3;border-radius:50%;display:grid;place-items:center;z-index:2;box-shadow:0 3px 14px #0002}
.download {display:block;width:fit-content;margin:13px auto 0;color:#fff4e3;font-size:1rem;text-underline-offset:5px;line-height:1.5}
.sr-only {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media (max-width:520px) {
  .intro {height:68px}
  .intro h1 {font-size:1.12rem}
  .stage {height:calc(100svh - 166px)}
  .seal {width:55px;height:55px}
  .envelope-note {font-size:.94rem}
  .footer {gap:10px;padding-top:6px}
  .actions {gap:23px}
}
@media (max-height:520px) and (orientation:landscape) {
  :root {--env-w:min(380px,calc((100svh - 118px) * 1.4));--card-w:min(340px,calc((100svh - 118px) * .7142857));--lift:100px}
  .intro {height:48px}
  .intro h1 {font-size:1rem}
  .stage {height:calc(100svh - 118px);min-height:140px}
  .footer {height:70px;gap:1px;padding:0}
  .seal {width:42px;height:42px}
  .envelope-note {font-size:.85rem}
  .share-action {font-size:.9rem}
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {scroll-behavior:auto!important}
  .invitation[data-state="opening"] .card {animation:gentle-card .18s ease both}
  .invitation[data-state="opening"] .envelope-part,
  .invitation[data-state="opening"] .seal,
  .invitation[data-state="opening"] .flap,
  .invitation[data-state="opening"] .envelope-note {animation:gentle-fade .18s ease both}
  .intro,.hint {transition:none}
  @keyframes gentle-card {from {opacity:0;transform:translate(-50%,-50%)}to {opacity:1;transform:translate(-50%,-50%)}}
  @keyframes gentle-fade {to {opacity:0}}
}
