/* ============================================================
   Приглашение на день рождения Светланы — 28 ноября 2026
   Милый конверт с сердечком-печатью → письмо
   ============================================================ */

:root {
  --paper: #fffaf6;
  --paper-deep: #f8e8e1;
  --ink: #573f42;
  --ink-soft: #7a5c5d;
  --ink-mute: #a6868a;
  --gold: #c49a6c;
  --gold-soft: #e2cba6;
  --wine: #9c4157;
  --wine-deep: #6f2436;
  --rose: #e7b4bb;
  --rose-soft: #fbeae6;

  --card-w: 380px;
  --card-h: 620px;
  --card-closed: .55;
  --card-fit: 1.2;

  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --serif: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --script: "Great Vibes", "Snell Roundhand", "Segoe Script", cursive;
  --sans: "Montserrat", "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;

  --heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21C4.8 16.4 1 12.6 1 8.4 1 5 3.7 2.3 7 2.3c2 0 3.7 1 4.9 2.6C13.3 3.3 15 2.3 17 2.3c3.3 0 6 2.7 6 6.1 0 4.2-3.8 8-11 12.6Z' fill='%23000'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(130% 100% at 50% -20%, #fffbf7 0%, #fdf0ea 34%, #f8ddd6 70%, #f1cec7 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- фон ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: .5;
}
.glow--1 {
  width: 46vmax; height: 46vmax;
  left: -14vmax; top: -18vmax;
  background: radial-gradient(circle, #f9d5d4 0%, rgba(249, 213, 212, 0) 70%);
}
.glow--2 {
  width: 52vmax; height: 52vmax;
  right: -20vmax; bottom: -22vmax;
  background: radial-gradient(circle, #f0d6b8 0%, rgba(240, 214, 184, 0) 70%);
  opacity: .45;
}
.glow--3 {
  width: 34vmax; height: 34vmax;
  right: 8vw; top: 2vh;
  background: radial-gradient(circle, #fff6e6 0%, rgba(255, 246, 230, 0) 70%);
  opacity: .8;
}

.branch {
  position: absolute;
  width: clamp(170px, 21vw, 310px);
  height: auto;
  color: #c49a6c;
  opacity: .4;
}
.branch--tl { left: -2vw; top: -3vh; }
.branch--br {
  right: -2vw; bottom: -3vh;
  transform: rotate(180deg);
  opacity: .28;
}

.bg-heart {
  position: absolute;
  width: 14px;
  height: 13px;
  background: #dd9aa6;
  opacity: .26;
  -webkit-mask: var(--heart) center / contain no-repeat;
  mask: var(--heart) center / contain no-repeat;
  animation: float-heart 16s ease-in-out infinite;
}
.bg-heart--1 { left: 15%; top: 24%; animation-delay: -3s; }
.bg-heart--2 { right: 20%; top: 17%; width: 9px; height: 8px; opacity: .2; animation-delay: -7s; animation-duration: 19s; }
.bg-heart--3 { left: 9%; bottom: 20%; width: 11px; height: 10px; opacity: .18; animation-delay: -11s; animation-duration: 15s; }

@keyframes float-heart {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%      { transform: translateY(-18px) rotate(8deg); }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .28;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, rgba(255, 250, 245, 0) 45%, rgba(120, 75, 70, .13) 100%);
}

/* ---------- сцена ---------- */

.page {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.stage {
  position: relative;
  width: min(92vw, 600px);
  aspect-ratio: 1.5;
  perspective: 1500px;
  perspective-origin: 50% 32%;
}

/* ---------- конверт ---------- */

.env-back-layer,
.env-front-layer,
.env-flap-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity .55s ease, translate .7s var(--ease-out);
}
.env-back-layer { z-index: 1; }
.env-front-layer { z-index: 3; }
.env-flap-layer {
  z-index: 4;
  perspective: 1500px;
  perspective-origin: 50% 0%;
}

.env-back,
.env-liner {
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.env-back {
  background:
    linear-gradient(163deg, #fffdfb 0%, #fdf1eb 48%, #fae4dc 100%);
  box-shadow:
    0 34px 46px -22px rgba(120, 72, 62, .42),
    0 8px 18px -10px rgba(120, 72, 62, .22),
    inset 0 0 0 1px rgba(196, 154, 108, .38),
    inset 0 2px 0 rgba(255, 255, 255, .95);
}

.env-liner {
  overflow: hidden;
  background:
    radial-gradient(rgba(196, 122, 134, .22) 1.3px, rgba(196, 122, 134, 0) 1.4px) 0 0 / 15px 15px,
    linear-gradient(158deg, #fdeee8 0%, #f9dfd8 100%);
}

/* створки переднего кармана */
.env-side,
.env-bottom {
  position: absolute;
  display: block;
  backface-visibility: hidden;
}

.env-side--l {
  left: 0; top: 0; width: 51%; height: 100%;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  background: linear-gradient(102deg, #fffdfb 0%, #fdf3ee 72%, #fbeae3 100%);
  filter: drop-shadow(2px 0 2px rgba(150, 100, 95, .09));
}
.env-side--r {
  right: 0; top: 0; width: 51%; height: 100%;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
  background: linear-gradient(258deg, #fffdf9 0%, #fdf1ec 72%, #fae7e0 100%);
  filter: drop-shadow(-2px 0 2px rgba(150, 100, 95, .09));
}
.env-bottom {
  left: 0; bottom: 0; width: 100%; height: 56%;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  background: linear-gradient(0deg, #fffdfb 0%, #fdf3ee 58%, #fbe7df 100%);
  filter: drop-shadow(0 -2px 3px rgba(150, 100, 95, .1));
}

/* адрес на конверте */
.env-address {
  position: absolute;
  left: 0;
  right: 0;
  top: 81%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  color: var(--wine);
}
.env-address__to {
  font-family: var(--script);
  font-size: 33px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .85);
}
.env-address__note {
  font-family: var(--sans);
  font-size: 7.5px;
  font-weight: 400;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* наклейка-сердечко */
.env-sticker {
  position: absolute;
  right: 4%;
  bottom: 12%;
  z-index: 2;
  width: 8.4%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px dashed rgba(196, 122, 134, .6);
  background: linear-gradient(155deg, #fffaf6, #fbe6e2);
  color: #d18a97;
  box-shadow: 0 3px 6px rgba(120, 70, 60, .13);
  transform: rotate(-9deg);
  pointer-events: none;
}
.env-sticker svg { width: 52%; height: auto; fill: currentColor; }

/* клапан */
.env-flap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 66%;
  transform-origin: top center;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
  transition: transform .95s cubic-bezier(.38, 1.08, .42, 1) .05s;
  will-change: transform;
}

.flap-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 12px 12px 0 0;
}

.flap-front {
  background:
    radial-gradient(rgba(196, 122, 134, .14) 1.4px, rgba(196, 122, 134, 0) 1.5px) 0 0 / 17px 17px,
    linear-gradient(178deg, #fff8f4 0%, #fbe8e1 66%, #f8dcd3 100%);
  filter: drop-shadow(0 5px 7px rgba(140, 88, 80, .17));
}
.flap-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, 0) 44%);
}

.env-stitch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(196, 122, 134, .45);
}

.flap-back {
  transform: rotateX(180deg);
  background:
    radial-gradient(rgba(196, 122, 134, .26) 1.3px, rgba(196, 122, 134, 0) 1.4px) 0 0 / 14px 14px,
    linear-gradient(180deg, #fbe4dc 0%, #f7d6cc 100%);
  border-radius: 12px 12px 0 0;
}

/* сердечко-печать */
.seal {
  position: absolute;
  left: 50%;
  top: 66%;
  z-index: 5;
  width: 96px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 14px rgba(112, 36, 54, .32));
  transition: opacity .38s ease .04s, transform .45s var(--ease-out) .04s, filter .4s ease, translate .7s var(--ease-out);
  animation: seal-breathe 4.4s ease-in-out infinite;
  will-change: transform;
}

.seal__shape { display: block; width: 100%; height: auto; }

.seal::before,
.seal::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  opacity: .85;
  background:
    linear-gradient(90deg, transparent 44%, rgba(196, 154, 108, .9) 50%, transparent 56%),
    linear-gradient(0deg, transparent 44%, rgba(196, 154, 108, .9) 50%, transparent 56%);
}
.seal::before { left: -19px; top: 6px; transform: rotate(18deg) scale(.9); }
.seal::after { right: -13px; bottom: 6px; transform: rotate(12deg) scale(1.15); }

@keyframes seal-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  50%      { transform: translate(-50%, -50%) scale(1.04) rotate(2deg); }
}

/* кликабельная зона */
.env-hit {
  position: absolute;
  inset: 0;
  z-index: 6;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.env-hit:focus-visible {
  outline: 2px solid rgba(196, 122, 134, .55);
  outline-offset: 5px;
}

@media (hover: hover) {
  body:not(.open) .stage:hover .env-back-layer,
  body:not(.open) .stage:hover .env-front-layer,
  body:not(.open) .stage:hover .env-flap-layer,
  body:not(.open) .stage:hover .seal { translate: 0 -6px; }
  body:not(.open) .stage:hover .seal { animation-play-state: paused; }
}

/* ---------- письмо ---------- */

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: var(--card-w);
  height: var(--card-h);
  padding: 0;
  border-radius: 4px;
  color: var(--ink);
  background:
    linear-gradient(172deg, #fffdf9 0%, #fdf6ee 52%, #fbeade 100%);
  box-shadow:
    0 42px 78px -34px rgba(96, 56, 48, .48),
    0 12px 26px -14px rgba(96, 56, 48, .3),
    inset 0 0 0 1px rgba(196, 154, 108, .24);
  transform: translate(-50%, -50%) scale(var(--card-closed));
  transform-origin: 50% 50%;
  will-change: transform;
  overflow: hidden;
  outline: none;
}

.card.is-settled,
body.open .card.is-settled {
  transform: translate(-50%, -50%) scale(var(--card-fit));
  animation: none;
  transition: transform .45s var(--ease-out);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(104deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .6) 50%, rgba(255, 255, 255, 0) 62%);
  transform: translateX(-120%);
  opacity: 0;
}
body.open .card::after {
  animation: foil-sweep 1.5s ease-out 1.15s 1 both;
}
@keyframes foil-sweep {
  0%   { transform: translateX(-120%); opacity: 0; }
  18%  { opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.card__frame {
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(196, 154, 108, .36);
  border-radius: 2px;
  pointer-events: none;
}
.card__frame::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(196, 154, 108, .16);
  border-radius: 1px;
}

.card__inner {
  position: relative;
  height: 100%;
  padding: 28px 30px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.card__head, .card__body, .card__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.card__head { margin-bottom: 4px; }
.card__foot { padding-top: 14px; gap: 6px; }

.countdown { margin-top: 12px; }

/* --- шапка --- */

.eyebrow {
  margin: 0;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .42em;
  text-indent: .42em;
  text-transform: uppercase;
  color: var(--gold);
}

.name {
  margin: 2px 0 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: 56px;
  line-height: 1;
  color: var(--wine);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}

.kicker {
  margin: 2px 0 0;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rule {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 13px;
  width: 150px;
}
.rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(196, 154, 108, 0), rgba(196, 154, 108, .8), rgba(196, 154, 108, 0));
}
.rule__heart {
  width: 12px;
  height: 11px;
  fill: rgba(196, 122, 134, .85);
  flex: none;
}

/* --- тело --- */

.portrait {
  position: relative;
  margin: 0 0 20px;
  width: 132px;
  height: 164px;
  border-radius: 66px 66px 8px 8px;
  overflow: hidden;
  background: #f4e3da;
  box-shadow:
    0 10px 22px -12px rgba(112, 68, 60, .5),
    0 0 0 1px rgba(196, 154, 108, .5),
    inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.portrait::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 72px 72px 10px 10px;
  border: 1px solid rgba(196, 154, 108, .45);
  pointer-events: none;
}
.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transform: scale(1.45);
  transform-origin: 50% 34%;
  filter: saturate(.92) contrast(1.05) sepia(.12) brightness(1.02);
}
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 26px rgba(150, 92, 82, .18), inset 0 -32px 44px rgba(150, 88, 80, .16);
  background: linear-gradient(180deg, rgba(250, 214, 204, .32) 0%, rgba(214, 140, 130, .24) 100%);
  mix-blend-mode: multiply;
}

.lead {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.48;
  color: var(--ink-soft);
}

.date { margin-top: 16px; }

.date__main {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
  color: var(--wine);
}
.date__num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 44px;
  line-height: .9;
  letter-spacing: .01em;
}
.date__mon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
}
.date__sub {
  margin: 5px 0 0;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.place {
  margin: 13px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: inherit;
  transition: color .3s ease;
}
.place__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--wine);
  border-bottom: 1px solid rgba(156, 65, 87, .22);
  padding-bottom: 2px;
  transition: border-color .3s ease;
}
.place__pin {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .8;
}
.place__addr {
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--ink-mute);
  transition: color .3s ease;
}
.place:hover .place__name { border-color: rgba(156, 65, 87, .6); }
.place:hover .place__addr { color: var(--ink-soft); }
.place:focus-visible { outline: 2px solid rgba(196, 154, 108, .55); outline-offset: 4px; border-radius: 4px; }

.countdown {
  margin: 9px 0 0;
  font-size: 8.5px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
}

/* --- низ --- */

.actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 15px;
  border: 1px solid rgba(196, 154, 108, .6);
  border-radius: 999px;
  background: rgba(196, 154, 108, .09);
  color: #8a6236;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .3s ease, border-color .3s ease, transform .3s var(--ease-out);
}
.btn:hover { background: rgba(196, 154, 108, .18); border-color: rgba(196, 154, 108, .95); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid rgba(196, 154, 108, .6); outline-offset: 2px; }

.btn--ghost {
  background: transparent;
  border-color: rgba(156, 65, 87, .3);
  color: var(--wine);
}
.btn--ghost:hover { background: rgba(156, 65, 87, .06); border-color: rgba(156, 65, 87, .6); }

/* ---------- появление текста ---------- */

.reveal {
  opacity: 0;
  transform: translateY(9px);
  transition: opacity .75s ease var(--d, 0s), transform .85s var(--ease-out) var(--d, 0s);
  will-change: opacity, transform;
}

body.open .reveal { opacity: 1; transform: none; }

/* ---------- подсказка ---------- */

.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(26px, env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 20;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(140, 100, 100, .9);
  transition: opacity .5s ease, transform .5s ease;
  animation: hint-in 1.2s var(--ease-out) .5s both;
}
.hint__heart {
  width: 14px;
  height: 13px;
  fill: rgba(196, 122, 134, .75);
  animation: heart-beat 2.4s ease-in-out 1.6s infinite;
}
body.open .hint { animation: none; opacity: 0; transform: translateY(8px); pointer-events: none; }

@keyframes hint-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  14%      { transform: scale(1.18); }
  28%      { transform: scale(1); }
  42%      { transform: scale(1.12); }
  56%      { transform: scale(1); }
}

/* ---------- плавающие кнопки ---------- */

.floating {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px) + 10px);
  right: 16px;
  z-index: 40;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .5s ease 1.3s, transform .5s ease 1.3s;
}
body.open .floating { opacity: 1; transform: none; pointer-events: auto; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(196, 154, 108, .38);
  border-radius: 50%;
  background: rgba(255, 251, 246, .78);
  backdrop-filter: blur(6px);
  color: #9a7042;
  cursor: pointer;
  transition: background .3s ease, border-color .3s ease, transform .3s var(--ease-out);
}
.icon-btn:hover { background: rgba(255, 251, 246, .98); border-color: rgba(196, 154, 108, .7); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 2px solid rgba(196, 154, 108, .6); outline-offset: 2px; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .icon-off { display: none; }
.icon-btn[aria-pressed="false"] .icon-on { display: none; }
.icon-btn[aria-pressed="false"] .icon-off { display: block; }

/* ---------- лепестки и сердечки ---------- */

.petals {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
}
.petal {
  position: absolute;
  top: -8vh;
  width: 10px;
  height: 8px;
  border-radius: 62% 38% 58% 42% / 60% 56% 44% 40%;
  background: linear-gradient(140deg, #fbd9d4 0%, #f0bfb7 55%, #e0a396 100%);
  opacity: 0;
  will-change: transform, opacity;
  animation: petal-fall linear forwards;
}
.petal--gold { background: linear-gradient(140deg, #f5e2c0 0%, #e3c69a 60%, #cfa972 100%); }
.petal--heart {
  border-radius: 0;
  background: linear-gradient(160deg, #f6bfc8 0%, #dd8b9c 100%);
  -webkit-mask: var(--heart) center / contain no-repeat;
  mask: var(--heart) center / contain no-repeat;
}

@keyframes petal-fall {
  0%   { opacity: 0; transform: translate3d(0, -8vh, 0) rotate(0deg) rotateX(0deg); }
  10%  { opacity: .8; }
  70%  { opacity: .55; }
  100% { opacity: 0; transform: translate3d(var(--drift, 30px), 112vh, 0) rotate(var(--spin, 260deg)) rotateX(220deg); }
}

/* ---------- открытие ---------- */

body.open .env-flap { transform: rotateX(-177deg); }

body.open .env-flap-layer { opacity: 0; transition: opacity .4s ease .55s; }
body.open .env-back-layer { opacity: 0; transition: opacity .5s ease .58s; }
body.open .env-front-layer { opacity: 0; transition: opacity .5s ease .68s; }

body.open .seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.76) rotate(-16deg);
  animation: none;
  filter: drop-shadow(0 4px 6px rgba(112, 36, 54, .2));
  transition: opacity .3s ease, transform .35s var(--ease-out), filter .3s ease;
}

body.open .env-hit { pointer-events: none; }

body.open .card {
  animation: card-rise 1.25s var(--ease-out) .35s forwards;
}

@keyframes card-rise {
  0% {
    transform: translate(-50%, -50%) scale(var(--card-closed));
    box-shadow: 0 18px 34px -24px rgba(96, 56, 48, .35);
  }
  40% {
    transform: translate(-50%, calc(-50% - 70px)) scale(calc(var(--card-closed) * 1.5));
  }
  100% {
    transform: translate(-50%, -50%) scale(var(--card-fit));
  }
}

/* ---------- адаптив ---------- */

@media (max-width: 480px) {
  .seal { width: 66px; }
  .env-address { top: 80%; gap: 2px; }
  .env-address__to { font-size: 23px; }
  .env-address__note { font-size: 6.5px; letter-spacing: .26em; }
  .env-sticker { width: 9%; right: 3.2%; bottom: 10%; }
  .card__inner { padding: 24px 26px 22px; }
  .name { font-size: 50px; }
  .portrait { width: 116px; height: 154px; margin-bottom: 10px; }
  .lead { font-size: 16px; }
  .branch { opacity: .26; }
}

@media (max-height: 640px) and (orientation: landscape) {
  .hint { display: none; }
}

/* ---------- мгновенный предпросмотр (?open) ---------- */

body.is-instant *,
body.is-instant *::before,
body.is-instant *::after {
  animation: none !important;
  transition: none !important;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
    transition-delay: 0s !important;
  }
  .petals, .bg-heart { display: none; }
  .reveal { opacity: 1; transform: none; }
}
