@font-face {
  font-family: "Michelle Handwriting";
  src: url("assets/michelle.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --viewport-height: 100vh;
  font-family: Georgia, serif;
  background: #314d62;
  --handwriting: "Michelle Handwriting", "Segoe Print", cursive;
}
@supports (height: 100dvh) {
  :root { --viewport-height: 100dvh; }
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #ffe09e; outline-offset: 8px; }
[hidden] { display: none !important; }
.night {
  height: var(--viewport-height);
  width: 100%;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background: radial-gradient(ellipse at 51% 58%, #45677e 0%, #314e65 78%);
}
.artboard {
  width: clamp(calc(var(--viewport-height) * 1.7769), 100vw, calc(var(--viewport-height) * 1.9));
  aspect-ratio: 1672 / 941;
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  container-type: inline-size;
}
.artboard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/sky.webp") center / 100% 100% no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent);
}
.mobile-sky { display: none; }
.stars { position: absolute; inset: 0; pointer-events: none; }
.star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 9px;
  height: 9px;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff5be 0%, #fbc67b 22%, #fbc67b00 72%);
  opacity: 0.1;
  animation: twinkle var(--duration) ease-in-out var(--delay) infinite;
}
.star.flare {
  width: clamp(20px, 3.5cqw, 60px);
  height: clamp(20px, 3.5cqw, 60px);
  background: radial-gradient(circle, #fff3b47d 0%, #ffd98436 25%, #ffd98400 66%);
}
@keyframes twinkle {
  0%, 100% { opacity: .09; scale: .75; }
  44% { opacity: .75; scale: 1; }
  62% { opacity: .27; scale: .86; }
}
.open-button {
  position: absolute;
  top: 43.68%;
  left: 50%;
  translate: -50% 0;
  width: 23.1%;
  padding: 0;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: #ffe0a9;
  display: grid;
  justify-items: center;
  gap: clamp(8px, 1.2cqw, 20px);
  -webkit-tap-highlight-color: transparent;
}
.envelope {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 386 / 198;
  perspective: 700px;
  transition: transform .35s ease, filter .35s ease;
}
.open-button:is(:hover,:focus-visible) .envelope {
  transform: translateY(-5px);
  filter: drop-shadow(0 8px 17px #18202f8c);
}
.envelope-inside, .envelope-front, .envelope-flap, .peek {
  position: absolute;
  display: block;
}
.envelope-inside {
  inset: 1px;
  border-radius: 8px;
  background: linear-gradient(160deg, #5f3928, #a8744e);
  box-shadow: inset 0 0 20px #492d25;
}
.envelope-front, .envelope-flap {
  inset: 0;
  background: url("assets/envelope.webp") center / 100% 100% no-repeat;
}
.envelope-front { z-index: 3; }
.envelope-flap {
  z-index: 4;
  transform-origin: center top;
  clip-path: polygon(0 0, 100% 0, 98% 12%, 59% 59%, 58% 80%, 51% 83%, 43% 78%, 42% 63%, 2% 12%);
}
.peek {
  inset: 5% 6% 4%;
  border-radius: 3px;
  background: linear-gradient(170deg, #fff1d6, #ead3ab);
  translate: 0 16%;
  opacity: 0;
  box-shadow: 0 0 14px #36282444;
  z-index: 2;
}
.open-label {
  font: 400 clamp(1.35rem, 2.65cqw, 3rem)/1 var(--handwriting);
  white-space: nowrap;
  transition: opacity .2s ease;
  text-shadow: 0 1px 8px #203143;
}
.opening .envelope-front {
  clip-path: polygon(0 0, 50% 69%, 100% 0, 100% 100%, 0 100%);
}
.opening .envelope-flap { animation: unseal .48s ease both; }
.opening .peek { animation: unfold .6s .1s ease both; }
.opening .open-label { opacity: 0; }
.opening .night { animation: night-away .3s .57s ease both; }
@keyframes unseal {
  0% { transform: rotateX(0deg); }
  48% { z-index: 4; }
  49% { z-index: 1; }
  100% { transform: rotateX(180deg); z-index: 1; filter: brightness(.76); }
}
@keyframes unfold {
  8% { opacity: 1; }
  100% { opacity: 1; translate: 0 -63%; }
}
@keyframes night-away { to { opacity: 0; } }
.letter-view {
  background: radial-gradient(ellipse at 54% 28%, #516f84, #2e485f 80%);
  --letter-gutter: clamp(1.5rem, 5vw, 4rem);
  padding:
    max(var(--letter-gutter), env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(var(--letter-gutter), env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  min-height: var(--viewport-height);
  animation: arrive .48s ease both;
}
@keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
.paper {
  position: relative;
  width: min(100%, 42rem);
  min-height: max(29rem, 68svh);
  margin: 1.3rem auto 0;
  padding: clamp(2rem, 8vw, 5rem);
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 40% 25%, #fff5e4, #f2dfbe);
  border-radius: 3px;
  color: #2b3a48;
  box-shadow: 0 14px 48px #18293d63;
}
.letter-copy {
  flex: 1;
  font: 400 clamp(1.85rem, 4.8vw, 2.35rem)/1.48 var(--handwriting);
  overflow-wrap: break-word;
}
.hug { width: clamp(6rem, 15vw, 10rem); align-self: end; margin-top: 1.5rem; }
.back-button {
  display: block;
  margin: 0 auto;
  border: 0;
  padding: .35rem .7rem;
  border-radius: .25rem;
  color: #ffe5b9;
  background: transparent;
  font: 400 1.5rem/1.15 var(--handwriting);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (orientation: portrait) {
  .artboard { width: 100%; height: 100%; aspect-ratio: auto; }
  .artboard::before {
    mask-image: none;
    background: radial-gradient(ellipse at 50% 31%, #4a6580, transparent 60%), linear-gradient(#304960, #456881);
  }
  .mobile-sky { display: block; position: absolute; inset: 0; }
  .mobile-sky::after {
    content: "";
    position: absolute;
    bottom: -17%;
    left: -18%;
    width: 95%;
    height: 36%;
    background: radial-gradient(ellipse, #6c829177 0%, transparent 62%);
  }
  .mobile-moon {
    position: absolute;
    top: max(7%, calc(env(safe-area-inset-top) + 4px));
    left: 50%;
    translate: -50% 0;
    width: min(64vw, calc(var(--viewport-height) * .38), 420px);
  }
  .mobile-friends {
    position: absolute;
    left: max(10%, env(safe-area-inset-left));
    bottom: max(7%, calc(env(safe-area-inset-bottom) + 4px));
    width: min(44vw, calc(var(--viewport-height) * .27), 350px);
    z-index: 1;
  }
  .star { opacity: .75; }
  .star.flare {
    width: 23px;
    height: 23px;
    background: radial-gradient(circle, #fff1ac 0%, #ffce6d91 13%, transparent 66%);
  }
  .open-button { top: 48%; width: min(65vw, 22rem); gap: 13px; }
  .open-label { font-size: clamp(1.55rem, 7cqw, 2.1rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* Separate the sky's grain from the softer light around each subject. */
.artboard {
  --moon-focus: radial-gradient(ellipse 12.4% 22% at 49.85% 21.4%, #000 64%, transparent 100%);
  --friends-focus: radial-gradient(ellipse 14.5% 24% at 24.5% 79%, #000 43%, transparent 96%);
}
.aura-focus, .sky-grain, .artboard::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}
.aura-focus {
  mask-image: var(--moon-focus), var(--friends-focus);
  backdrop-filter: blur(2.2px) saturate(1.08) brightness(1.06);
}
.sky-grain {
  background: url("assets/film-grain.webp") repeat;
  mix-blend-mode: soft-light;
  opacity: .21;
  mask-image: linear-gradient(#000, #000), var(--moon-focus), var(--friends-focus);
  mask-composite: subtract, add;
}
.artboard::after {
  content: "";
  background:
    radial-gradient(ellipse 15.4% 27.4% at 49.85% 21.4%, #ffcc9008 38%, #ffab7759 61%, #ee9aa730 73%, #bb8fdb16 83%, transparent 98%),
    radial-gradient(ellipse 17% 29% at 23.5% 78%, #ffc59235 0%, #eca3b425 36%, #a59fef20 56%, transparent 85%),
    radial-gradient(ellipse 14% 15% at 28% 86%, #ef9ea329, transparent 80%);
  mix-blend-mode: screen;
}
.stars { z-index: 1; }
.star {
  width: 13px;
  height: 13px;
  background: radial-gradient(circle, #fff6d1 0%, #ffda8aa8 23%, #ffcb7200 68%);
}
.star.flare {
  width: clamp(23px, 4cqw, 64px);
  height: clamp(23px, 4cqw, 64px);
  background: radial-gradient(circle, #fff0bbd6 0%, #ffdc7570 20%, #ffc68519 46%, #ffd98400 69%);
}
.star.flare::before, .star.flare::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 58%;
  height: 7%;
  translate: -50% -50%;
  background: radial-gradient(ellipse, #fff7cb 0%, #ffda9399 32%, #ffca6d00 74%);
  filter: blur(.55px);
}
.star.flare::after { rotate: 90deg; }
@keyframes twinkle {
  0%, 100% { opacity: .11; scale: .78; }
  40% { opacity: .94; scale: 1.17; }
  49% { opacity: .8; scale: 1.07; }
  66% { opacity: .29; scale: .89; }
}
.open-button {
  z-index: 3;
  perspective: 900px;
}
.envelope-float {
  width: 100%;
  display: block;
  position: relative;
  transform-style: preserve-3d;
  animation: float-envelope 6.5s ease-in-out infinite;
}
.envelope-float::before {
  content: "";
  position: absolute;
  inset: 8% 4% 5%;
  transform: translate3d(0, 15px, -13px);
  background: #112636;
  border-radius: 28%;
  filter: blur(15px);
  opacity: .52;
}
.envelope {
  isolation: isolate;
  border-radius: 3%;
  transform-style: preserve-3d;
  box-shadow: 0 3px 0 #855b42, 0 5px 0 #6c4634, 0 7px 12px #18273767;
}
.envelope::after {
  content: "";
  pointer-events: none;
  position: absolute;
  z-index: 5;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(145deg, #ffe1a43a, transparent 43%, #23181127 94%);
  box-shadow: inset 1px 1px 1px #ffdc9f81, inset 0 -1px 2px #4e352f77;
}
@keyframes float-envelope {
  0%, 100% { transform: translateY(1px) rotateX(6deg) rotateY(-7deg) rotateZ(-.7deg); }
  50% { transform: translateY(-13px) rotateX(-7deg) rotateY(7deg) rotateZ(.7deg); }
}
.opening .envelope-float { animation-play-state: paused; }
.opening .envelope::after { opacity: 0; }
.open-label {
  display: block;
  width: 48%;
  min-width: 96px;
}
.open-label img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 5px #22374c);
}
@media (orientation: portrait) {
  .aura-focus { display: none; }
  .sky-grain { mask-image: none; }
  .mobile-sky { position: static; }
  .mobile-sky::after { z-index: 0; pointer-events: none; }
  .mobile-moon, .mobile-friends { z-index: 1; }
  .mobile-moon {
    filter: blur(.65px) drop-shadow(0 0 11px #ffb1818c) drop-shadow(0 0 25px #fca2a957);
  }
  .mobile-friends {
    filter: blur(.55px) drop-shadow(-3px -2px 6px #ffc18d91) drop-shadow(4px 3px 14px #aaaaff72);
  }
  .artboard::after {
    background:
      radial-gradient(ellipse 48% 24% at 50% 22%, #ffab775a, #bc92e528 61%, transparent 92%),
      radial-gradient(ellipse 43% 19% at 32% 85%, #f6aaa949, #a1a1e624 59%, transparent 92%);
  }
  .star.flare {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle, #fff1ac 0%, #ffce6d91 13%, transparent 66%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .star { opacity: .66; }
}


.hill-plants {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  filter: blur(.55px);
}
.stem {
  --sway: 9deg;
  position: absolute;
  left: var(--x);
  bottom: calc(10.6% - var(--x) * .105);
  width: clamp(3px, .8cqw, 12px);
  height: calc(var(--height) * .34cqw);
  transform: rotate(var(--lean));
  transform-origin: 0 100%;
  animation: hillside-breeze 5.9s ease-in-out var(--delay) infinite alternate;
}
.stem::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 90% 0 82% 0;
  background: linear-gradient(150deg, #b5bd9e95, #759b8da9 39%, #577c8273 78%, #53798100);
  clip-path: polygon(100% 0, 67% 18%, 41% 43%, 30% 71%, 14% 100%, 29% 100%, 49% 73%, 63% 46%, 81% 19%);
}
.stem:nth-child(3n) { --sway: 14deg; animation-duration: 4.7s; }
.stem:nth-child(4n) { --sway: 7deg; animation-duration: 7.2s; }
@keyframes hillside-breeze {
  from { transform: rotate(calc(var(--lean) - var(--sway) * .55)); }
  to { transform: rotate(calc(var(--lean) + var(--sway))); }
}
.stem.flower {
  --bloom: #e6b599;
  --petal: 2px;
}
.stem.flower.ivory { --bloom: #eddaa9; }
.stem.flower::before {
  clip-path: polygon(100% 0, 82% 1%, 45% 40%, 14% 100%, 28% 100%, 57% 42%);
}
.stem.flower::after {
  content: "";
  position: absolute;
  top: 0;
  left: 93%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff0ba;
  box-shadow: 0 calc(-1 * var(--petal)) 1px var(--bloom),
    calc(-1 * var(--petal)) 0 1px var(--bloom),
    var(--petal) 0 1px var(--bloom),
    0 var(--petal) 1px var(--bloom),
    0 0 8px #ffd5a66b;
  opacity: .78;
}
@media (orientation: portrait) {
  .stem {
    left: var(--mx);
    bottom: calc(max(6.8%, env(safe-area-inset-bottom)) - var(--mx) * .02);
    height: calc(var(--height) * .63cqw);
    width: 6px;
  }
  .stem:nth-child(n+6):nth-child(-n+8) { display: none; }
}

