@font-face {
  font-family: "Campaign Serif";
  src: url("serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --cream: #fbf5ec;
  --ink: #392722;
  --muted: #715951;
  --wine: #73394a;
  --gold: #a4773f;
  --rule: #d9c1a1;
  --serif: "Campaign Serif", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(ellipse at 14% 37%, #f7e5dd 0%, transparent 38%),
              radial-gradient(ellipse at 92% 78%, #f7e5dd 0%, transparent 35%), var(--cream);
  color: var(--ink);
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
}

.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.masthead {
  text-align: center;
  padding: 21px 20px 18px;
  border-bottom: 1px solid #dbc6a880;
  background: #fffaf470;
}
.brand-logo { display: block; width: 136px; height: auto; margin-inline: auto; mix-blend-mode: multiply; }

.campaign {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  text-align: center;
  width: min(100% - 36px, 610px);
  margin-inline: auto;
  padding: 29px 0 11px;
}
.ornament {
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 13px;
}
.ornament::before, .ornament::after { content: ""; width: 43px; height: 1px; background: var(--rule); }
.ornament svg { width: 18px; height: 18px; }
h1 {
  margin: 0;
  font: 400 clamp(2.08rem, 5.5vw, 3.85rem)/1.05 var(--serif);
  letter-spacing: -.045em;
  text-wrap: balance;
}
h1 em { display: block; margin-top: 3px; color: var(--wine); font-weight: 400; }
.intro p { margin: 15px 0 22px; color: var(--muted); font-size: 1rem; line-height: 1.4; }
.experience { width: min(100%, 510px); margin-inline: auto; }
.scene {
  position: relative;
  display: grid;
  width: 100%;
  place-items: center;
  min-height: 251px;
  aspect-ratio: 1.66;
  isolation: isolate;
  border: 1px solid #d5b590;
  border-radius: 44% 44% 12px 12px / 12% 12% 12px 12px;
  overflow: hidden;
  background: radial-gradient(ellipse, #fcf3e6, #edd2c4);
  box-shadow: 0 12px 28px #704a3521, 0 2px 4px #704a3514;
}
.scene::after { content: ""; position: absolute; inset: 6px; border: 1px solid #fff7e5ab; border-radius: inherit; pointer-events: none; z-index: 2; }
.envelope { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform .58s, filter .58s, opacity .25s; }
.scene.revealed { aspect-ratio: auto; min-height: clamp(251px, 45vw, 307px); }
.revealed .envelope { transform: scale(1.12); filter: blur(3px); }
.envelope-motion { position: absolute; inset: 0; visibility: hidden; pointer-events: none; perspective: 850px; }
.envelope-back, .envelope-pocket, .envelope-flap { position: absolute; left: 10%; width: 80%; }
.envelope-back { top: 29%; height: 60%; background: #d9ba8e; border: 1px solid #c5a377; border-radius: 4px; }
.envelope-flap {
  top: 29%; height: 39%; z-index: 5;
  background: #f4dfbb;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  backface-visibility: visible;
}
.envelope-pocket {
  top: 29%; height: 60%; z-index: 4;
  background: linear-gradient(32deg, #e7cda6 49.7%, transparent 50%) left / 50.1% 100% no-repeat,
              linear-gradient(-32deg, #ecd5b2 49.7%, transparent 50%) right / 50.1% 100% no-repeat;
  border: 1px solid #c5a377; border-top: 0; border-radius: 0 0 4px 4px;
}
.opening .envelope { filter: blur(8px); opacity: .3; }
.opening .envelope-motion { visibility: visible; animation: envelope-away .34s 1.05s both; }
.opening .envelope-flap { animation: flap-open .5s .08s both; }
.opening .fortune { z-index: 3; animation: letter-out 1.4s cubic-bezier(.16, 1, .3, 1) both; }
.fortune {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 72%;
  width: calc(100% - 40px);
  margin: 18px 0;
  padding: 16px 14px 18px;
  background: #fffbf4;
  border: 1px solid var(--rule);
  box-shadow: 0 6px 30px #64412940, inset 0 0 0 4px #fffbf4, inset 0 0 0 5px #e9d4b9;
  border-radius: 4px;
}
.fortune-star { color: var(--gold); height: 20px; width: 20px; }
.fortune p { font: 400 clamp(1.32rem, 4.8vw, 1.8rem)/1.23 var(--serif); margin: 11px 0 0; overflow-wrap: anywhere; }
@keyframes flap-open {
  from { transform: rotateX(0); }
  to { transform: rotateX(-180deg); }
}
@keyframes envelope-away {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(28%); }
}
@keyframes letter-out {
  0%, 22% { opacity: 0; transform: translateY(66%) scale(.72); }
  30% { opacity: 1; }
  70% { opacity: 1; transform: translateY(-10%) scale(.92); }
  100% { opacity: 1; transform: none; }
}

.actions { display: grid; gap: 9px; max-width: 360px; margin: 19px auto 0; }
.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: 600 .9375rem/1.25 system-ui, -apple-system, sans-serif;
}
.button svg, .footer svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.primary { background: var(--wine); color: #fffaf6; box-shadow: 0 3px 9px #73394a33; }
.primary:hover { background: #592b39; }
.primary:disabled { opacity: .72; cursor: wait; }
.secondary { background: #fff8f3; border-color: #dabbba; color: var(--wine); }
.secondary:hover { background: #f8e8e4; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 4px; }
.notice { color: var(--muted); margin: 8px 0 0; font-size: .875rem; line-height: 1.4; }
.notice:empty { margin: 0; }
.share-text { width: 100%; margin-top: 7px; padding: 10px; border: 1px solid var(--rule); border-radius: 5px; font: inherit; color: var(--ink); background: #fffaf5; }
.footer { text-align: center; padding: 13px 18px 20px; }
.footer a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .9375rem; color: var(--wine); text-underline-offset: 4px; }
.footer svg { color: var(--gold); }

@media (max-width: 360px) {
  .campaign { width: calc(100% - 28px); }
  .intro p { font-size: .9375rem; }
  .fortune { width: calc(100% - 26px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .opening .envelope-motion { display: none; }
  .opening .fortune { animation: none; }
  .revealed .envelope { transform: none; }
}
