:root {
  --sky: #8ac7ea;
  --sky-deep: #4c94c0;
  --sky-dark: #396b8c;
  --blue-ink: #354e60;
  --soft-blue: #e8f4fa;
  --cream: #fffdf9;
  --muted: #6b7e89;
  --border: #cde4ef;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  padding: 58px 18px 48px;
  color: var(--blue-ink);
  background: #e8f3fa;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }
.page-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 12% 18%, rgba(255,255,255,.92), transparent 35%), radial-gradient(ellipse at 87% 76%, rgba(162,208,233,.36), transparent 40%), linear-gradient(155deg, #ebf6fb 4%, #d6eaf5 100%);
  z-index: -1;
}
/* The envelope has four true layers: back, tucked-in letter, front pocket, and closing flap. */
.envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(235, 246, 252, .97);
  transition: opacity .65s ease, visibility .65s ease;
}
.envelope-stage { width: min(100%, 440px); text-align: center; }
.envelope {
  position: relative;
  display: block;
  appearance: none;
  border: 0;
  background: transparent;
  width: min(88vw, 420px);
  aspect-ratio: 1.31 / 1;
  margin: 0 auto 4px;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 20px 27px rgba(61, 108, 140, .17));
  perspective: 1000px;
  transform-style: preserve-3d;
  isolation: isolate;
}
.envelope-back, .envelope-letter, .envelope-front, .envelope-flap, .wax-seal { position: absolute; display: block; }
.envelope-back {
  z-index: 1;
  left: 0;
  top: 21%;
  width: 100%;
  height: 72%;
  border: 1px solid #d9e8f2;
  border-radius: 16px;
  background: linear-gradient(150deg, #fff 10%, #e6f2f9 100%);
}
.envelope-letter {
  z-index: 2;
  left: 8%;
  top: 28%;
  width: 84%;
  height: 61%;
  padding: 22px 16px;
  border: 1px solid #d7e7f0;
  border-radius: 12px;
  background: #fffefb;
  box-shadow: 0 3px 12px rgba(71, 125, 156, .06);
  color: var(--sky-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: transform 1.05s cubic-bezier(.23,.7,.29,1);
}
.mini-letter-copy { display: block; color: var(--sky-dark); font: 16px/1.45 var(--serif); }
.mini-letter-copy strong { display: block; margin-top: 5px; color: var(--sky-deep); font-size: 18px; font-weight: normal; }
.mini-floral { width: 67%; height: 18px; opacity: .83; background: url('assets/watercolor-floral-border.webp') center / contain no-repeat; }
.mini-floral--bottom { transform: rotate(180deg); }
.envelope-front {
  z-index: 4;
  left: 0;
  top: 47%;
  width: 100%;
  height: 46%;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(160deg, #eaf6fd, #f8fcff 52%, #dfedf7);
  clip-path: polygon(0 0, 50% 63%, 100% 0, 100% 100%, 0 100%);
}
.envelope-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(117,170,208,.15), transparent 22%, transparent 78%, rgba(117,170,208,.15));
}
.envelope-flap {
  z-index: 6;
  left: 0;
  top: 21%;
  width: 100%;
  height: 43%;
  background: linear-gradient(180deg, #fafdff 0%, #dfeff9 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  backface-visibility: hidden;
  transition: transform .72s cubic-bezier(.22,.61,.36,1), opacity .18s linear .52s;
}
.wax-seal {
  z-index: 7;
  left: 50%;
  top: 59%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255,255,255,.84);
  background: radial-gradient(circle at 30% 25%, #bedff1, #76b5d9 65%, #4f95bf);
  box-shadow: 0 5px 15px rgba(67, 120, 162, .22);
  color: white;
  font: 25px var(--serif);
  transition: transform .35s ease, opacity .35s ease;
}
.open-copy { margin: 0; color: var(--sky-dark); font: 700 12px/1.6 var(--sans); letter-spacing: .09em; text-transform: uppercase; }
body.is-opening .envelope-flap { transform: rotateX(-128deg) translateY(-4px); opacity: 0; z-index: 1; }
body.is-opening .envelope-letter { z-index: 5; transform: translateY(-24%); }
body.is-opening .wax-seal { transform: translate(-50%, -50%) scale(.5); opacity: 0; }
body.invitation-open .envelope-overlay, body.no-envelope .envelope-overlay { opacity: 0; visibility: hidden; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .envelope-flap, .envelope-letter, .wax-seal, .invitation, .envelope-overlay { transition-duration: .01ms !important; }
}
.invitation {
  position: relative;
  isolation: isolate;
  width: min(100%, 770px);
  margin: auto;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 36px;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 0 24px 75px rgba(62,115,151,.16), 0 6px 18px rgba(62,115,151,.06);
  transition: opacity .8s ease, transform .8s cubic-bezier(.22,.61,.36,1), filter .8s ease;
}
.invitation--hidden { opacity: 0; transform: translateY(42px) scale(.98); filter: blur(6px); pointer-events: none; }
.invitation::before { content: ''; position: absolute; inset: 13px; border: 1px solid var(--border); border-radius: 26px; pointer-events: none; z-index: 3; }
.invitation::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 0, rgba(224,241,249,.5), transparent 40%); }
.floral-top, .floral-bottom { position: relative; overflow: hidden; background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0)); }
.floral-top { min-height: 175px; padding: 8px 22px 0; }
.floral-bottom { min-height: 125px; padding: 0 22px 8px; }
.floral-top img, .floral-bottom img { display: block; width: 100%; max-width: 760px; height: auto; margin: 0 auto; object-fit: contain; }
.floral-top img { object-position: center top; }
.floral-bottom img { object-position: center bottom; transform: rotate(180deg); opacity: .88; }
.card-content { position: relative; z-index: 1; padding: 0 66px; text-align: center; }
.card-header { margin-top: -2px; }
.brand-mark { display: inline-flex; align-items: center; gap: 16px; font: 27px var(--serif); font-style: italic; letter-spacing: .045em; color: var(--sky-dark); }
.brand-mark span { font: 24px var(--sans); color: var(--sky-deep); }
.eyebrow { text-transform: uppercase; font-size: 10px; line-height: 1.8; letter-spacing: .28em; font-weight: 700; color: #80939e; margin: 14px 0 0; }
.eyebrow--blue { color: var(--sky-deep); }
.fine-rule { margin: 19px auto 17px; width: 145px; color: var(--sky); display: flex; align-items: center; gap: 14px; font-size: 16px; }
.fine-rule::before, .fine-rule::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.hero h1 { font: normal clamp(36px, 6.2vw, 58px)/1.13 var(--serif); letter-spacing: -.035em; margin: 16px 0 28px; color: var(--blue-ink); }
.hero h1 em { color: var(--sky-deep); font-weight: normal; }
.salutation { font: italic 27px/1.3 var(--serif); color: var(--sky-dark); margin: 0 0 17px; overflow-wrap: anywhere; }
.intro-text { font: 16px/1.9 var(--serif); max-width: 530px; margin: 0 auto 8px; color: #60727c; }
.intro-text--small { font-size: 15px; color: #7a8c96; }
.proposal { margin: 32px auto 0; border-top: 1px solid var(--border); padding: 29px 0 4px; }
.proposal-illustration { width: min(100%, 300px); height: 112px; margin: 0 auto 8px; position: relative; display: flex; align-items: center; justify-content: center; }
.proposal-illustration img { max-width: 100%; max-height: 100%; object-fit: contain; }
.proposal-illustration .bridesmaid-florals { width: 225px; max-height: 110px; mix-blend-mode: multiply; filter: saturate(.78); }
.proposal-illustration .groomsman-people { display: none; width: 118px; height: 118px; object-fit: contain; }
body[data-party="groom"] .bridesmaid-florals { display: none; }
body[data-party="groom"] .groomsman-people { display: block; }
.proposal .eyebrow { margin: 5px 0 10px; }
.proposal h2 { color: var(--blue-ink); font: normal clamp(28px, 5vw, 40px)/1.22 var(--serif); letter-spacing: -.03em; margin: 0 auto 12px; max-width: 560px; }
.proposal h2 span { color: var(--sky-deep); font-style: italic; }
.proposal-note { max-width: 430px; margin: 0 auto 27px; font: italic 15px/1.7 var(--serif); color: #71838d; }
.actions, .reply-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }
.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-align: center; min-height: 47px; padding: 13px 25px; font: 700 12px/1.3 var(--sans); letter-spacing: .035em; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:focus-visible, .envelope:focus-visible { outline: 3px solid #295e80; outline-offset: 3px; }
.button--primary { background: var(--sky-deep); color: white; box-shadow: 0 5px 14px rgba(60,129,173,.18); }
.button--primary:hover { background: var(--sky-dark); }
.button--primary span { font-size: 17px; font-weight: 400; }
.button--quiet { color: var(--sky-dark); background: #edf6fa; border-color: #dcecf5; }
.button--quiet:hover { background: #e2f1f8; }
.button--outline { color: var(--sky-dark); border-color: #bbd9e8; background: white; }
.button--outline:hover { background: #f6fbfe; }
.response-note { margin: 17px auto 0; max-width: 470px; font-size: 13px; line-height: 1.7; color: #758791; }
.reply-panel { margin: 28px auto 0; padding: 25px 25px 4px; border: 1px solid var(--border); border-radius: 22px; background: linear-gradient(180deg, rgba(236,247,252,.55), rgba(255,255,255,.95)); }
.reply-symbol { color: var(--sky-deep); font-size: 24px; margin-bottom: 7px; }
.reply-panel h3 { margin: 0 0 7px; font: normal 28px/1.25 var(--serif); color: var(--blue-ink); }
.reply-panel p { margin: 0 auto 14px; max-width: 470px; }
.reply-message { white-space: pre-wrap; word-break: break-word; padding: 18px; margin: 0 auto 17px; max-width: 570px; background: white; border: 1px solid #d7e9f1; border-radius: 20px; text-align: left; font: 15px/1.7 var(--serif); color: #5e6f7a; box-shadow: inset 0 1px 0 rgba(255,255,255,.85); }
.card-footer { padding: 31px 0 34px; }
.footer-ornament { color: var(--sky); margin-bottom: 10px; letter-spacing: .2em; }
.card-footer p { margin: 4px 0; color: #6c808d; font: 14px/1.8 var(--sans); letter-spacing: .02em; }
.card-footer p span { color: var(--sky-dark); font-weight: 700; }
.card-footer .date { letter-spacing: .25em; font-size: 11px; text-transform: uppercase; color: #8ca1ad; }
.preview-banner { text-align: center; margin: 16px auto 0; color: #6b7e89; font-size: 12px; }
@media (max-width: 720px) {
  body { padding: 24px 12px 32px; }
  .invitation { border-radius: 26px; }
  .invitation::before { inset: 10px; border-radius: 20px; }
  .card-content { padding: 0 24px; }
  .floral-top { min-height: 132px; padding-top: 10px; }
  .floral-bottom { min-height: 96px; }
  .proposal { margin-top: 28px; padding-top: 24px; }
  .proposal-illustration { height: 92px; }
  .reply-panel { padding: 20px 16px 2px; }
  .reply-panel h3 { font-size: 24px; }
  .envelope { width: min(92vw, 360px); }
}
@media (max-width: 420px) {
  .hero h1 { font-size: 31px; }
  .salutation { font-size: 24px; }
  .proposal h2 { font-size: 29px; }
  .button { width: 100%; }
}
