/* Dear Santa: animation styles (used by the site and the previews page) */

/* ---------- overlay + handwriting ---------- */
.fun-overlay { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; padding: 16px; background: rgba(8, 28, 19, .8); backdrop-filter: blur(3px); overflow: hidden; }
.hand { font-family: 'Dancing Script', cursive; font-weight: 700; font-size: 1.6rem; line-height: 1.25; margin: 0 0 6px; color: #2a1a12; }
.hand.small { font-size: 1.2rem; }
ul.hand { padding-left: 22px; margin: 4px 0 10px; }

/* Lined writing paper (the letter, and each folded third of it) */
.paper { box-sizing: border-box; padding: 22px 24px; text-align: left; background-color: #fffdf7; border-radius: 4px;
  background-image: linear-gradient(90deg, transparent 18px, rgba(200,16,46,.18) 18px 19px, transparent 19px),
    repeating-linear-gradient(transparent 0 31px, #e9e2d3 31px 32px); }

/* ---------- the stage: letter on top, envelope below ---------- */
.mail-stage, .scene { position: relative; width: 320px; max-width: 100%; }
.mail-stage { height: 480px; }
.scene { height: 230px; }
.mail-letter { position: absolute; left: 20px; top: 0; width: 280px; z-index: 2; box-shadow: 0 14px 34px rgba(0,0,0,.35); }

/* ---------- the detailed envelope ----------
   Layers (back → front): back + liner (1), the letter (2), front pocket (3), closed flap (4), seal (5).
   The envelope's wrappers never get a transform while a letter is going in or out,
   so the letter really slides *between* the back and the front pocket. */
.xenv { position: absolute; left: 10px; top: 20px; width: 300px; height: 190px; }
.xenv-flipper { position: absolute; inset: 0; }
.xenv-flipper.flipping { transform-style: preserve-3d; }
.xenv-side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.xenv-frontside { transform: rotateY(180deg); }

.xenv-back { position: absolute; inset: 0; z-index: 1; border-radius: 6px; background: #e6d4ae; box-shadow: 0 10px 26px rgba(0,0,0,.35); }
/* the patterned paper lining you see inside the V of the envelope */
.xenv-liner { position: absolute; left: 6px; right: 6px; top: 6px; height: 55%; z-index: 1; clip-path: polygon(0 0, 100% 0, 50% 100%);
  background-color: #a80d26; background-image: linear-gradient(90deg, rgba(31,122,77,.6) 30%, transparent 30% 70%, rgba(31,122,77,.6) 70%), linear-gradient(rgba(255,255,255,.2) 30%, transparent 30% 70%, rgba(255,255,255,.2) 70%);
  background-size: 16px 16px; }
.xenv-pocket { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; display: block; border-radius: 6px; overflow: hidden; }
.xenv-flap { position: absolute; left: 0; right: 0; top: 0; height: 58%; z-index: 4; transform-origin: top center; transform: perspective(700px) rotateX(0deg);
  clip-path: polygon(0 0, 100% 0, 50% 100%); background: linear-gradient(#efe0c0, #e2cfa6); }
.xenv-flap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 60%, rgba(120,90,40,.12)); }
/* once the flap swings open (past edge-on) you see its patterned inside, and it sits behind the letter */
.xenv-flap.open { z-index: 1; background-color: #a80d26;
  background-image: linear-gradient(90deg, rgba(31,122,77,.6) 30%, transparent 30% 70%, rgba(31,122,77,.6) 70%), linear-gradient(rgba(255,255,255,.2) 30%, transparent 30% 70%, rgba(255,255,255,.2) 70%);
  background-size: 16px 16px; }
.xenv-seal { position: absolute; left: 50%; top: 58%; width: 58px; height: 58px; margin: -29px 0 0 -29px; z-index: 5; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
.xenv-seal svg { width: 100%; height: 100%; display: block; }

/* address side */
.xenv-frontside { border-radius: 6px; background: #fbf3e1; box-shadow: 0 10px 26px rgba(0,0,0,.35);
  border: 7px solid transparent; border-image: repeating-linear-gradient(135deg, #c8102e 0 10px, #fbf3e1 10px 18px, #1f7a4d 18px 28px, #fbf3e1 28px 36px) 7; }
.xenv-from { position: absolute; left: 12px; top: 8px; font-size: 1rem; color: #5c4a3a; }
.xenv-stamp { position: absolute; right: 12px; top: 10px; width: 54px; height: 64px; padding: 3px; background: #fff;
  border: 3px dotted #fbf3e1; /* envelope-colored dots bite into the white edge, like perforations */
  box-shadow: 0 1px 2px rgba(0,0,0,.15); display: grid; grid-template-rows: 1fr auto; transform: rotate(3deg); }
.xenv-stamp-art { background: #1d3f63; display: grid; place-items: center; }
.xenv-stamp-art svg { width: 88%; height: 88%; }
.xenv-stamp span { font: 700 .55rem 'Inter', sans-serif; color: #c8102e; text-align: center; line-height: 1.4; }
.xenv-to { position: absolute; left: 70px; top: 76px; display: grid; }
.xenv-to .hand { margin: 0; font-size: 1.7rem; border-bottom: 1.5px solid rgba(90,70,50,.25); }
.xenv-to .hand.small { font-size: 1.2rem; }
.xenv-postmark { position: absolute; right: 44px; top: 24px; width: 92px; height: 70px; transform: rotate(-12deg); }
.xenv-postmark svg { width: 100%; height: 100%; display: block; }
.xenv-forward { position: absolute; left: 14px; bottom: 14px; padding: 3px 8px; border: 2px solid #1f7a4d; color: #1f7a4d; border-radius: 4px;
  font: 800 .62rem 'Inter', sans-serif; letter-spacing: .1em; text-transform: uppercase; transform: rotate(-6deg); opacity: .85; }

/* ---------- the letter folding in thirds ---------- */
.fold { position: absolute; z-index: 2; transform-origin: 50% 50%; filter: drop-shadow(0 10px 16px rgba(0,0,0,.28)); }
.fold-panel { position: absolute; left: 0; width: 100%; transform-style: preserve-3d; }
.fold-panel.p0 { z-index: 3; transform-origin: 50% 100%; }
.fold-panel.p1 { z-index: 1; }
.fold-panel.p2 { z-index: 2; transform-origin: 50% 0; }
.fold-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fold-content { position: absolute; left: 0; border-radius: 0; }
.fold-face.back { transform: rotateX(180deg); background: linear-gradient(#f6efdf, #efe6d2); box-shadow: inset 0 0 0 1px rgba(150,120,70,.15); }

/* ---------- "Sent!" screen ---------- */
.mail-done { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; color: #fffaf0; gap: 6px; }
.mail-done h2 { color: #fffaf0; font-size: 1.8rem; margin: 10px 0 0; }
.mail-done p { margin: 0 0 10px; color: #cfe3d6; }
.postmark { display: grid; justify-items: center; width: 150px; height: 150px; border-radius: 50%; border: 4px solid #e0354f; color: #ff9aa9; place-content: center; transform: rotate(-12deg);
  font: 700 .8rem var(--body, sans-serif); letter-spacing: .12em; box-shadow: inset 0 0 0 6px rgba(224,53,79,.25); }
.postmark b { font-size: 1.25rem; color: #fff; letter-spacing: .08em; margin: 2px 0; }
.sparkle { position: fixed; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #ffe28a; box-shadow: 0 0 8px 2px rgba(255,220,120,.8); pointer-events: none; animation: sparkle .9s ease-out forwards; }
@keyframes sparkle { to { transform: translate(-10px, 30px) scale(.2); opacity: 0; } }

/* ---------- family: first time opening the link ---------- */
.fun-overlay.arrive { background-color: #123d2c; backdrop-filter: none;
  background-image: radial-gradient(rgba(255,255,255,.55) 1.6px, transparent 2.2px), radial-gradient(rgba(255,255,255,.28) 1px, transparent 1.6px);
  background-size: 70px 70px, 37px 37px; background-position: 0 0, 19px 25px; }
.arrive-stage { display: grid; justify-items: center; gap: 14px; text-align: center; max-width: 420px; }
.arrive-kicker { margin: 0; font: 700 2.2rem 'Dancing Script', cursive; color: #ffd98a; line-height: 1.15; text-wrap: balance; }
.arrive-msg { margin: 0; color: #fffaf0; font: 500 1.05rem/1.5 var(--body, serif); }

/* buttons inside the animations (so they look right anywhere, including the previews page) */
.arrive-open, .mail-close { cursor: pointer; border: 0; border-radius: 99px; background: #c8102e; color: #fff; font: 700 1rem var(--body, 'Lora', serif); padding: 12px 26px; }
.arrive-open:hover, .mail-close:hover { filter: brightness(1.1); }
.arrive-open[disabled] { opacity: .6; cursor: default; }

/* ---------- advent tile backs ---------- */
.back-drawing { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 10px; }
.back-drawing svg { width: 82%; height: 82%; }
