/* Design "Восъчен печат": burgundy velvet envelope, cream wax seal, blush paper with roses */
body.theme-vosak { --paper: #fbf3ee; --paper-2: #f3e2da; --ink: #3d2426; --muted: #8a6a68; --accent: #7e2433; --accent-2: #c7848b; --gold: #b4874a; --gold-2: #ecd3a2; --line: rgb(126 36 51 / .16); }

/* ── opening ── */
.opening.wax {
  --velvet: #5a1621; --velvet-2: #7a2332; --velvet-3: #3a0d15;
  background:
    radial-gradient(120% 80% at 50% 30%, rgb(255 210 190 / .10), transparent 60%),
    radial-gradient(90% 70% at 50% 110%, rgb(0 0 0 / .45), transparent 70%),
    var(--velvet-3);
  display: grid; place-items: center; perspective: 1400px;
}
.opening.wax::before { /* damask on the table */
  content: ""; position: absolute; inset: 0; opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='128' viewBox='0 0 96 128'%3E%3Cg fill='none' stroke='%23d79aa3' stroke-width='1' opacity='.9'%3E%3Cpath d='M48 14c-9 13-9 29 0 42 9-13 9-29 0-42z'/%3E%3Cpath d='M48 56c-11-3-23 3-26 15 10-1 19-6 26-15zM48 56c11-3 23 3 26 15-10-1-19-6-26-15z'/%3E%3Cpath d='M24 74c-8 6-8 16 1 19 6 2 9-5 4-8M72 74c8 6 8 16-1 19-6 2-9-5-4-8'/%3E%3Cpath d='M48 56v40M40 100c4-3 12-3 16 0'/%3E%3Ccircle cx='48' cy='106' r='2.2'/%3E%3Cpath d='M0 0l6 6-6 6M96 0l-6 6 6 6M0 128l6-6-6-6M96 128l-6-6 6-6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 128px;
}
.envelope { position: relative; width: min(86vw, 430px); aspect-ratio: 4 / 5; transform-style: preserve-3d; margin-top: 8vh; }
.envelope .shadow { position: absolute; inset: 6% -2% -6%; background: radial-gradient(closest-side, rgb(0 0 0 / .55), transparent); filter: blur(18px); transform: translateZ(-1px); }
.envelope .back { position: absolute; inset: 0; border-radius: 6px; background: linear-gradient(#2c0910, #45121b); }
.envelope .back::after { /* gold liner, seen once the flap is up */
  content: ""; position: absolute; inset: 4% 4% 40%; border-radius: 4px; opacity: .9;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M20 4c4 8 12 8 12 16s-8 8-12 16c-4-8-12-8-12-16s8-8 12-16z' fill='none' stroke='%237a5320' stroke-width='.8' opacity='.55'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #e9cf98, #b8873f 55%, #f1dcae);
  background-size: 40px 40px, auto;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.envelope .card { position: absolute; z-index: 2; inset: 7% 7% 9%; border-radius: 4px; display: grid; align-content: center; justify-items: center; gap: 4px; text-align: center;
  background: linear-gradient(#fdf8f4, #f5e6de); box-shadow: 0 2px 0 rgb(255 255 255 / .6) inset, 0 20px 40px -20px rgb(0 0 0 / .6); color: var(--accent); }
.envelope .card .script { font-size: clamp(34px, 10vw, 50px); }
.envelope .card .caps { font-size: 11px; color: var(--muted); }
.envelope .card .mini-date { font: 400 16px/1 var(--caps); letter-spacing: .26em; color: var(--ink); }

.flap { position: absolute; inset: 0; }
.flap .face { position: absolute; inset: 0; }
.flap svg.edge { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.flap svg.edge polyline { fill: none; stroke: var(--gold-2); stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .85; }
.velvet {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='128' viewBox='0 0 96 128'%3E%3Cg fill='none' stroke='%23e7a7b0' stroke-width='1' opacity='.32'%3E%3Cpath d='M48 14c-9 13-9 29 0 42 9-13 9-29 0-42z'/%3E%3Cpath d='M48 56c-11-3-23 3-26 15 10-1 19-6 26-15zM48 56c11-3 23 3 26 15-10-1-19-6-26-15z'/%3E%3Cpath d='M24 74c-8 6-8 16 1 19 6 2 9-5 4-8M72 74c8 6 8 16-1 19-6 2-9-5-4-8'/%3E%3Cpath d='M48 56v40M40 100c4-3 12-3 16 0'/%3E%3Ccircle cx='48' cy='106' r='2.2'/%3E%3Cpath d='M0 0l6 6-6 6M96 0l-6 6 6 6M0 128l6-6-6-6M96 128l-6-6 6-6'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(140% 100% at 30% 20%, var(--velvet-2), var(--velvet) 55%, var(--velvet-3));
  background-size: 96px 128px, auto;
}
.f-left .face { clip-path: polygon(0 0, 53% 52%, 0 100%); filter: brightness(1.04); }
.f-right .face { clip-path: polygon(100% 0, 47% 52%, 100% 100%); filter: brightness(.94); }
.f-bottom .face { clip-path: polygon(0 100%, 50% 47%, 100% 100%); filter: brightness(1.1); }
.f-left .face::after, .f-right .face::after, .f-bottom .face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to var(--to, right), rgb(0 0 0 / .28), transparent 60%); }
.f-right .face { --to: left; }
.f-bottom .face { --to: top; }

/* the top flap hinges on the envelope's top edge; its back is the gold liner */
.f-top { inset: 0 0 auto; height: 60%; transform-origin: 50% 0; transform-style: preserve-3d; z-index: 4; }
.f-top .face { backface-visibility: hidden; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.f-top .face.front { filter: drop-shadow(0 6px 6px rgb(0 0 0 / .4)); }
.f-top .face.front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgb(255 255 255 / .06), rgb(0 0 0 / .25)); }
.f-top .face.inner { transform: rotateX(180deg); background: linear-gradient(135deg, #f1dcae, #b8873f 60%, #e9cf98); }
.f-left, .f-right, .f-bottom { z-index: 3; }

/* the wax seal sits on the tip of the top flap */
.seal { position: absolute; left: 50%; top: 60%; width: clamp(96px, 28vw, 132px); aspect-ratio: 1; transform: translate(-50%, -50%); z-index: 6; filter: drop-shadow(0 8px 10px rgb(0 0 0 / .45)); }
.seal svg { width: 100%; height: 100%; }
.seal .half { position: absolute; inset: 0; opacity: 0; }
.seal .half.l { clip-path: polygon(0 0, 52% 0, 46% 22%, 55% 40%, 44% 58%, 54% 78%, 47% 100%, 0 100%); }
.seal .half.r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 47% 100%, 54% 78%, 44% 58%, 55% 40%, 46% 22%); }
.glow { position: absolute; left: 50%; top: 52%; width: 160vmax; height: 160vmax; transform: translate(-50%, -50%); border-radius: 50%; opacity: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(closest-side, rgb(255 246 226 / .95), rgb(255 214 170 / .45) 30%, transparent 62%); }
.flash { position: absolute; inset: 0; background: #fff8ee; opacity: 0; z-index: 8; pointer-events: none; }
.opening.wax .tap-hint { color: var(--gold-2); }

/* ── letter ── */
.bouquet { width: min(92vw, 520px); height: auto; margin: 0 auto; }
.bouquet.top { margin-bottom: -10px; }
.bouquet.bottom { transform: scaleY(-1); margin-top: 10px; }
.cover .bouquet.top { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); }
.cover .bouquet.bottom { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%) scaleY(-1); }
.arch { position: absolute; inset: 12px; border: 1px solid var(--line); border-radius: 260px 260px 18px 18px; pointer-events: none; }
.arch::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgb(180 135 74 / .35); border-radius: 252px 252px 12px 12px; }
.opening.wax.clear::before { opacity: 0; }
/* on wide screens the arch frames the content, not the whole window */
@media (min-width: 700px) { .cover .arch { left: 50%; right: auto; width: min(640px, calc(100% - 24px)); transform: translateX(-50%); } }
