/* Конверт с сургучной печатью — общий элемент для главной, обложки и вскрытия */
.envelope {
  --w: min(78vw, 340px);
  position: relative; width: var(--w); aspect-ratio: 1.55; margin-inline: auto;
  border-radius: 8px;
  background: url('/img/scene/envelope-closed.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 22px 26px rgba(0,0,0,.55));
  transform: rotate(-3deg);
}
/* Конверт — фотография: клапан и сургуч со снежинкой уже на ней, нарисованные слои скрыты */
.envelope::before, .envelope .envelope__flap, .envelope .envelope__seal { display: none; }
/* Открытый конверт — вторая фотография, проявляется поверх */
.envelope::after {
  content: ''; position: absolute; left: -2.1%; right: -2.1%; bottom: 0; aspect-ratio: 657 / 606;
  background: url('/img/scene/envelope-open.webp') center bottom / 100% auto no-repeat;
  opacity: 0; transition: opacity .3s var(--ease); pointer-events: none;
}
.envelope.is-open { background-image: none; }
.envelope.is-open::after { opacity: 1; }
/* нижние клапаны */
.envelope::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background:
    linear-gradient(to top right, transparent 49.5%, rgba(91,63,44,.13) 50%, transparent 51%) left bottom / 50% 100% no-repeat,
    linear-gradient(to top left, transparent 49.5%, rgba(91,63,44,.13) 50%, transparent 51%) right bottom / 50% 100% no-repeat;
}
/* верхний клапан */
.envelope__flap {
  position: absolute; left: 0; right: 0; top: 0; height: 58%;
  background: linear-gradient(180deg, #efe2ca, #e4d2b2);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 4px 6px rgba(91,63,44,.25));
  transform-origin: top center;
}
.envelope__seal {
  position: absolute; left: 50%; top: 58%; width: 64px; height: 64px; transform: translate(-50%, -50%);
  border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #b0334f, var(--wine) 45%, var(--wine-deep) 100%);
  box-shadow: 0 4px 10px rgba(58, 10, 22, .55), inset 0 2px 3px rgba(255,255,255,.25), inset 0 -3px 6px rgba(0,0,0,.3);
  display: grid; place-items: center; color: var(--gold-light); font-family: var(--script); font-size: 26px;
}
.envelope__seal::after {
  content: ''; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px dashed rgba(227,196,138,.6);
}
.envelope__to {
  position: absolute; left: 8%; bottom: 9%; z-index: 2; font-family: var(--script); font-size: clamp(20px, 5.5vw, 26px); color: var(--cocoa);
}
.envelope__stamp {
  position: absolute; right: 7%; top: 9%; width: 46px; height: 56px; z-index: 2;
  padding: 5px;
  /* перфорация по краю: светлые зубчики на фоне конверта */
  background: radial-gradient(circle, transparent 2px, var(--paper) 2.5px) -4px -4px / 8px 8px;
  filter: drop-shadow(0 1px 1px rgba(91,63,44,.3));
}
.envelope__stamp span {
  display: grid; place-items: center; height: 100%; color: var(--gold-light); font-family: var(--serif); font-weight: 600; font-size: 18px;
  background: linear-gradient(160deg, var(--pine), var(--pine-deep));
}
.envelope--float { animation: env-float 6s ease-in-out infinite; }
@keyframes env-float { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .envelope--float { animation: none; } }
.envelope.is-open .envelope__to, .envelope.is-open .envelope__stamp { opacity: 0; transition: opacity .2s; }
