/* A full title screen, followed by the introduction's envelope reveal. */
.title-hero { min-height: calc(100svh - var(--nav-height, 58px)); display: grid; place-items: center; padding: 32px 0; }
.hero-envelope-heading { position: relative; padding-inline: 20px; text-align: center; }
.title-hero h1 { font-size: clamp(4.6rem, 9vw, 7.7rem); line-height: 1; }
.title-hero-art { width: min(460px, 76vw, 48svh); height: auto; margin: 20px auto 0; }
.title-hero .sub { max-width: 38ch; margin: 18px auto 0; font-size: clamp(1rem, 1.65vw, 1.2rem); }
.envelope-hero {
  --mail-width: min(1040px, 92vw);
  --letter-width: min(700px, 78vw);
  --pocket-height: 320px;
  --paper-y: 0px;
  --pocket-y: 0px;
  --nav-height: 58px;
  padding: 0;
  isolation: isolate;
}
.hero-envelope-stage { position: relative; padding: 60px 0 240px; }
.hero-letter-invite { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 44px; margin-top: 22px; font-size: .83rem; letter-spacing: .015em; color: var(--postman-green); text-decoration: none; }
.hero-letter-invite span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #a4ae9b; border-radius: 50%; font-size: 1rem; }
.hero-letter-invite:hover span { background: #e4e9dc; }
.hero-letter {
  position: relative; z-index: 3; width: var(--letter-width); margin: 0 auto;
  padding: 32px 52px 36px; border: 1px solid #e8e0d1; border-radius: 3px;
  background: #fffdf7 url('../img/paper-grain.svg') 0 0 / 160px 160px;
  box-shadow: 0 4px 8px #4a412010, 0 18px 44px #4a412018;
  color: var(--ink); text-align: left; transform-origin: center bottom;
}
.hero-letter p { margin: 0 0 17px; font-size: 1rem; line-height: 1.6; }
.hero-letter .hero-letter-greeting { font-family: var(--hand); font-size: 1.9rem; line-height: 1; color: var(--chestnut); margin-bottom: 15px; }
.hero-letter .hero-letter-lead { font-family: var(--serif); font-size: clamp(1.7rem, 2.45vw, 2.15rem); font-style: italic; font-weight: 600; line-height: 1.12; margin-bottom: 20px; }
.hero-letter .hero-letter-quiet { color: var(--ink-soft); font-size: .92rem; }
.hero-envelope-back, .hero-envelope-pocket { position: absolute; width: var(--mail-width); left: 50%; bottom: 0; height: var(--pocket-height); transform: translateX(-50%); pointer-events: none; }
.hero-envelope-back { z-index: 1; border-radius: 5px; box-shadow: 0 18px 55px #9d5b3d14; }
.hero-envelope-back::before { content: ''; position: absolute; bottom: calc(100% - 1px); left: 0; width: 100%; height: 46%; clip-path: polygon(0 100%, 50% 0, 100% 100%); }
.hero-envelope-pocket { z-index: 4; filter: drop-shadow(0 -3px 3px #9d5b3d10); }
.hero-pocket-face { position: absolute; inset: 0; overflow: hidden; border-radius: 0 0 5px 5px; clip-path: polygon(0 0, 50% 36%, 100% 0, 100% 100%, 0 100%); }
/* Shared warm taupe paper for the opening and assignment envelopes. */
.hero-envelope-back, .hero-envelope-back::before, .hero-pocket-face { background: var(--taupe) url('../img/paper-grain.svg') 0 0 / 160px 160px; }
.hero-pocket-seams { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-pocket-seams path { fill: none; stroke: var(--ink-soft); stroke-opacity: .2; stroke-width: 1; vector-effect: non-scaling-stroke; }

/* JS enhances the readable static letter only when there is room to reveal it. */
.is-scroll-envelope { height: calc(var(--stage-height) + var(--reveal-distance)); }
.is-scroll-envelope .hero-envelope-stage { position: sticky; top: var(--nav-height); height: var(--stage-height); padding: 0; overflow: hidden; }
.is-scroll-envelope .hero-letter { position: absolute; top: var(--paper-top); left: 50%; margin: 0; transform: translate(-50%, var(--paper-y)); will-change: transform; }
.is-scroll-envelope .hero-envelope-back, .is-scroll-envelope .hero-envelope-pocket { top: var(--pocket-top); bottom: auto; height: max(var(--pocket-height), calc(var(--stage-height) - var(--pocket-top) + 40px)); transform: translate(-50%, var(--pocket-y)); will-change: transform; }
.is-scroll-envelope .hero-envelope-back { box-shadow: none; }

@media (max-width: 620px) {
  .title-hero { --nav-height: 98px; padding-block: 28px; }
  .envelope-hero { --mail-width: 96vw; --letter-width: 86vw; --pocket-height: 250px; }
  .hero-envelope-stage { padding-top: 36px; padding-bottom: 205px; }
  .title-hero h1 { font-size: clamp(3.5rem, 15vw, 5rem); }
  .title-hero-art { margin-top: 18px; }
  .title-hero .sub { max-width: 30ch; font-size: .95rem; margin-top: 14px; }
  .hero-letter { padding: 26px 24px 28px; }
  .hero-letter p { font-size: .91rem; line-height: 1.5; margin-bottom: 14px; }
  .hero-letter .hero-letter-lead { font-size: 1.7rem; margin-bottom: 16px; }
  .hero-letter .hero-letter-quiet { font-size: .85rem; }
  .hero-letter-invite { margin-top: 17px; font-size: .78rem; }
}
