/* The envelope at the bottom of the main page (js/letter.js) and the letter that comes out of it. */
.envelope { margin: 170px 0 30px; text-align: center; }
.envelope[hidden] { display: none; }
.envelope .hand { margin: 22px 0 0; font-size: 32px; font-weight: 700; color: var(--ink); }

/* the envelope, seen from the back: the pocket, the flap folded down over it, a wax seal on the point */
.env { position: relative; display: block; width: min(340px, 82vw); aspect-ratio: 34 / 22; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer;
  transform: rotate(-2deg); transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); filter: drop-shadow(0 16px 16px rgba(var(--shadow), .28)); }
.env:hover, .env:focus-visible { transform: rotate(0) translateY(-4px); }
.env:focus-visible { outline: 2px dashed var(--ink); outline-offset: 10px; }
.env span { position: absolute; inset: 0; display: block; }
.env-back { z-index: 0; } .env-paper { z-index: 2; } .env-pocket { z-index: 3; } .env-flap { z-index: 4; } .env-seal { z-index: 5; } .env.open .env-flap { z-index: 1; }
.env-back { background: #f0cdb4; border-radius: 6px; }
.env-paper { inset: 8% 7% 6% !important; background: var(--card); border-radius: 3px; transition: transform .8s cubic-bezier(.3, .9, .4, 1) .45s;
  background-image: repeating-linear-gradient(transparent 0 15px, rgba(var(--shadow), .12) 15px 16px); background-position: 0 14px; }
.env-pocket { background: #f9e2d0; border-radius: 6px; clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  background-image: linear-gradient(to top right, transparent 49.6%, rgba(var(--shadow), .13) 50%, transparent 50.6%), linear-gradient(to top left, transparent 49.6%, rgba(var(--shadow), .13) 50%, transparent 50.6%); }
.env-flap { background: #f4c7ae; border-radius: 6px 6px 0 0; clip-path: polygon(0 0, 100% 0, 50% 60%); transform-origin: 50% 0; transition: transform .6s ease, background .6s; }
.env-seal { inset: auto !important; left: 50% !important; top: 58%; width: 15%; aspect-ratio: 1; margin: -7.5% 0 0 -7.5%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f08a9c, #d9566e 70%); box-shadow: inset 0 -2px 0 rgba(120, 30, 50, .3), 0 2px 3px rgba(var(--shadow), .35); transition: opacity .3s; }
.env-seal::after { content: ''; position: absolute; inset: 27% 24% 22%; background: #ffe9ec;
  clip-path: polygon(50% 100%, 6% 52%, 0 30%, 8% 10%, 26% 0, 42% 8%, 50% 24%, 58% 8%, 74% 0, 92% 10%, 100% 30%, 94% 52%); }
/* opened: the seal goes, the flap swings up behind, the paper slides out of the pocket */
.env.open .env-seal { opacity: 0; }
.env.open .env-flap { transform: rotateX(180deg); background: #efc0a4; }
.env.open .env-paper { transform: translateY(-46%); }

/* the letter: handwriting on ruled paper */
#letter { width: min(96vw, 700px); padding: 22px 22px 30px; }
#letter .page { padding: 4px clamp(8px, 4vw, 34px) 10px; font-family: 'Caveat', cursive; font-size: clamp(24px, 3.4vw, 29px); line-height: 44px;
  background-image: repeating-linear-gradient(transparent 0 43px, rgba(var(--shadow), .13) 43px 44px); background-position: 0 -10px; }
#letter .page p { margin: 0 0 44px; }
#letter .page .hi { font-weight: 700; font-size: 1.2em; }
#letter .page .bye { text-align: right; margin-bottom: 0; }
