:root {
  --wine: #2b0718;
  --wine-light: #55142f;
  --cream: #f6eedf;
  --cream-deep: #e5d5bc;
  --gold: #bb8a47;
  --ink: #27141b;
  --muted: #6f5d61;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wine);
  font-family: "Montserrat", sans-serif;
}

a {
  color: inherit;
}

.hero {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  padding: 64px 20px 80px;
  background:
    radial-gradient(circle at 50% 20%, rgba(145, 55, 91, 0.42), transparent 35%),
    linear-gradient(145deg, #1c0611 0%, var(--wine) 52%, #19050f 100%);
}

.glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.18;
  background: #d6ab6a;
}

.glow-one {
  top: -100px;
  left: -90px;
}

.glow-two {
  right: -120px;
  bottom: -80px;
}

.envelope-experience {
  position: relative;
  z-index: 2;
  width: min(94vw, 760px);
  height: min(920px, 92svh);
  min-height: 700px;
  perspective: 1800px;
}

.envelope {
  position: absolute;
  right: 0;
  bottom: 42px;
  left: 0;
  z-index: 3;
  aspect-ratio: 1.55;
  filter: drop-shadow(0 34px 34px rgba(0, 0, 0, 0.42));
  transform-style: preserve-3d;
}

.envelope-back,
.envelope-lining,
.envelope-front,
.envelope-flap {
  position: absolute;
  inset: 0;
}

.envelope-back {
  z-index: 1;
  overflow: hidden;
  border: 2px solid #b98a46;
  border-radius: 8px 8px 22px 8px;
  background:
    radial-gradient(rgba(255, 255, 255, 0.035) 0.8px, transparent 0.8px),
    linear-gradient(145deg, #70482f, #4b2b1e 68%, #382016);
  background-size: 5px 5px, auto;
}

.envelope-back::after {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(224, 178, 98, 0.75);
  border-radius: 4px 4px 16px 4px;
  content: "";
}

.envelope-lining {
  z-index: 2;
  height: 59%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    repeating-linear-gradient(45deg, rgba(220, 172, 96, 0.2) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, #342017, #6d442c);
}

.envelope-front {
  z-index: 4;
  clip-path: polygon(0 10%, 50% 59%, 100% 10%, 100% 100%, 0 100%);
  border-radius: 0 0 22px 8px;
  background:
    linear-gradient(148deg, transparent 49.5%, rgba(232, 190, 116, 0.48) 50%, transparent 50.5%),
    linear-gradient(32deg, transparent 49.5%, rgba(232, 190, 116, 0.48) 50%, transparent 50.5%),
    radial-gradient(rgba(255, 255, 255, 0.04) 0.8px, transparent 0.8px),
    linear-gradient(150deg, #6f472f, #4a2b1e 72%);
  background-size: auto, auto, 5px 5px, auto;
  box-shadow: inset 0 -1px 0 rgba(235, 194, 121, 0.68);
}

.envelope-flap {
  z-index: 6;
  height: 59%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    radial-gradient(rgba(255, 255, 255, 0.035) 0.8px, transparent 0.8px),
    linear-gradient(165deg, #805239, #4b2b1e 76%);
  background-size: 5px 5px, auto;
  transform: rotateX(0deg);
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  backface-visibility: visible;
}

.envelope-flap::after {
  position: absolute;
  top: 15px;
  right: 18px;
  left: 18px;
  height: calc(100% - 30px);
  border-top: 1px solid rgba(232, 190, 116, 0.72);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  content: "";
}

.invitation-visual.invitation-card {
  position: absolute;
  right: auto;
  bottom: 70px;
  left: 50%;
  z-index: 2;
  width: min(58vw, 480px);
  opacity: 0.99;
  filter: drop-shadow(0 30px 30px rgba(0, 0, 0, 0.38));
  pointer-events: none;
  transform: translateX(-50%) translateY(58%) scale(0.72);
  transform-origin: 50% 100%;
  will-change: transform;
}

.open-envelope {
  position: absolute;
  bottom: clamp(215px, 30vw, 270px);
  left: 50%;
  z-index: 8;
  display: grid;
  width: 106px;
  height: 106px;
  min-height: 0;
  margin: 0;
  padding: 0;
  place-content: center;
  border: 2px solid #d2a557;
  border-radius: 50%;
  color: #f5dba8;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(145deg, #5c1530, #2b0718);
  box-shadow:
    0 15px 28px rgba(25, 10, 8, 0.35),
    inset 0 0 0 5px rgba(210, 165, 87, 0.16);
  font: 600 0.76rem/1 "Montserrat", sans-serif;
  letter-spacing: 0.13em;
  text-align: center;
  transform: translate(-50%, 0);
  transition: transform 220ms ease, box-shadow 220ms ease, opacity 300ms ease;
}

.open-envelope span,
.open-envelope small {
  display: block;
}

.open-envelope small {
  margin-top: 8px;
  color: rgba(245, 219, 168, 0.72);
  font-size: 0.48rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.open-envelope:hover {
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(145deg, #76203e, #35091e);
  box-shadow:
    0 18px 34px rgba(25, 10, 8, 0.42),
    0 0 0 6px rgba(210, 165, 87, 0.12),
    inset 0 0 0 5px rgba(210, 165, 87, 0.2);
  transform: translate(-50%, -3px) rotate(-2deg);
}

.envelope-hint {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  margin: 0;
  color: rgba(246, 238, 223, 0.78);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 300ms ease;
}

.envelope-experience.is-open .envelope-flap {
  animation: open-flap 900ms cubic-bezier(0.65, 0, 0.22, 1) forwards;
}

.envelope-experience.is-open .open-envelope {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -55px) scale(0.8);
}

.envelope-experience.is-open .invitation-card {
  animation: reveal-card 1.45s 500ms cubic-bezier(0.22, 0.8, 0.2, 1) forwards;
}

.envelope-experience.is-revealed .invitation-card {
  z-index: 7;
  pointer-events: auto;
}

.envelope-experience.is-revealed .envelope-hint {
  opacity: 0;
}

@keyframes open-flap {
  0% {
    z-index: 6;
    transform: rotateX(0deg);
  }
  49% {
    z-index: 6;
  }
  50%,
  100% {
    z-index: 1;
  }
  100% {
    transform: rotateX(180deg);
  }
}

@keyframes reveal-card {
  0% {
    z-index: 2;
    transform: translateX(-50%) translateY(58%) scale(0.72);
  }
  58% {
    z-index: 5;
    transform: translateX(-50%) translateY(-25%) scale(0.84);
  }
  100% {
    z-index: 7;
    transform: translateX(-50%) translateY(-18%) scale(1);
  }
}

.invitation-visual {
  position: relative;
  z-index: 2;
  width: min(92vw, 640px);
  filter: drop-shadow(0 36px 42px rgba(0, 0, 0, 0.42));
}

.invitation-visual img {
  display: block;
  width: 100%;
  height: auto;
}

.address-hotspot,
.rsvp-hotspot {
  position: absolute;
  z-index: 5;
  display: block;
  border-radius: 14px;
}

.address-hotspot {
  top: 57.5%;
  right: 27%;
  bottom: 35.8%;
  left: 27%;
}

.rsvp-hotspot {
  right: 20.5%;
  bottom: 4.5%;
  left: 20.5%;
  height: 7.4%;
  border-radius: 999px;
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.address-hotspot:hover {
  background: rgba(187, 138, 71, 0.08);
}

.rsvp-hotspot:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.address-hotspot:focus-visible,
.rsvp-hotspot:focus-visible {
  outline: 3px solid #f1c77f;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.invitation-shell {
  position: relative;
  width: min(92vw, 620px);
  min-height: 760px;
  perspective: 1600px;
}

.paper {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(187, 138, 71, 0.55);
  border-radius: 4px 4px 30px 4px;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(74, 46, 40, 0.055) 0.7px, transparent 0.7px);
  background-size: 5px 5px;
}

.paper-back {
  transform: rotate(-4deg) translate(-22px, 13px);
  box-shadow: 0 34px 70px rgba(0, 0, 0, 0.42);
  background-color: #d8c5a9;
}

.paper-middle {
  transform: rotate(2deg) translate(17px, 8px);
  background-color: #eee0ca;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.3);
}

.paper-front {
  position: relative;
  z-index: 3;
  display: flex;
  min-height: 760px;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  padding: 68px 46px 0;
  text-align: center;
  transform: rotateX(1.5deg) translateZ(30px);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.32);
}

.paper-front::before {
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(187, 138, 71, 0.55);
  border-radius: 2px 2px 20px 2px;
  content: "";
  pointer-events: none;
}

.eyebrow {
  position: relative;
  z-index: 2;
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
}

h1,
h2 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}

.paper-front h1 {
  position: relative;
  z-index: 2;
  margin: 0;
  color: var(--wine);
  font-size: clamp(3rem, 10vw, 5.3rem);
  line-height: 0.82;
  letter-spacing: -0.03em;
}

.paper-front h1 span {
  display: block;
  margin-bottom: 16px;
  color: var(--muted);
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.occasion {
  position: relative;
  z-index: 2;
  margin: 24px 0 22px;
  color: var(--gold);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.75rem;
  font-weight: 600;
}

.details {
  position: relative;
  z-index: 2;
  padding: 16px 0;
  border-top: 1px solid rgba(187, 138, 71, 0.55);
  border-bottom: 1px solid rgba(187, 138, 71, 0.55);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.details p {
  margin: 0;
}

.details .time {
  margin: 6px 0 14px;
  color: var(--wine);
  font-size: 1.28rem;
  font-weight: 600;
}

.address {
  color: var(--muted);
  line-height: 1.55;
  text-decoration-color: rgba(187, 138, 71, 0.7);
  text-underline-offset: 4px;
}

.primary-button,
button {
  position: relative;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 54px;
  padding: 0 26px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: #fff8e9;
  background: var(--wine);
  box-shadow: 0 10px 26px rgba(43, 7, 24, 0.22);
  font: 600 0.76rem/1 "Montserrat", sans-serif;
  letter-spacing: 0.11em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.paper-front .primary-button {
  margin-top: 24px;
}

.primary-button:hover,
button:hover {
  background: var(--wine-light);
  box-shadow: 0 13px 30px rgba(43, 7, 24, 0.3);
  transform: translateY(-2px);
}

.primary-button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #d7a760;
  outline-offset: 4px;
}

.sushi-crop {
  position: absolute;
  z-index: 4;
  right: -6%;
  bottom: -80px;
  left: -6%;
  height: 320px;
  background-image:
    linear-gradient(to bottom, transparent 40%, rgba(43, 7, 24, 0.14)),
    url("/assets/convite-aniversario-vivi.png");
  background-position: center 82%;
  background-size: 112% auto;
  clip-path: ellipse(48% 31% at 50% 58%);
  filter: drop-shadow(0 24px 20px rgba(24, 8, 13, 0.36));
  pointer-events: none;
}

.rsvp-section {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 80px 20px;
  scroll-margin-top: 10px;
  background:
    linear-gradient(rgba(246, 238, 223, 0.94), rgba(246, 238, 223, 0.97)),
    radial-gradient(circle at 15% 10%, var(--gold), transparent 22%);
}

.form-card {
  width: min(100%, 640px);
  padding: clamp(30px, 7vw, 64px);
  border: 1px solid rgba(187, 138, 71, 0.5);
  border-radius: 28px;
  background: rgba(255, 252, 246, 0.84);
  box-shadow: 0 28px 70px rgba(43, 7, 24, 0.14);
}

.form-card h2 {
  margin: 0 0 12px;
  color: var(--wine);
  font-size: clamp(2.5rem, 7vw, 4.2rem);
  line-height: 0.98;
}

.form-intro {
  margin: 0 0 34px;
  color: var(--muted);
  line-height: 1.7;
}

form {
  display: grid;
  gap: 12px;
}

form > label,
legend {
  margin-top: 10px;
  color: var(--wine);
  font-size: 0.77rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid #cdbfae;
  border-radius: 12px;
  color: var(--ink);
  background: #fffdfa;
  font: inherit;
}

input[type="text"],
select {
  min-height: 52px;
  padding: 0 14px;
}

textarea {
  min-height: 112px;
  padding: 14px;
  resize: vertical;
}

fieldset {
  display: grid;
  gap: 9px;
  margin: 10px 0 4px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 12px;
}

.radio-option {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #d7ccbd;
  border-radius: 12px;
  background: #fffdfa;
  cursor: pointer;
}

.radio-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--wine);
}

button {
  width: 100%;
  margin-top: 20px;
  cursor: pointer;
}

.hidden-field {
  position: absolute;
  left: -9999px;
}

.thank-you-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(148, 60, 96, 0.42), transparent 42%),
    var(--wine);
}

.thank-you-card {
  width: min(100%, 590px);
  padding: clamp(44px, 9vw, 82px);
  border: 1px solid var(--gold);
  border-radius: 30px;
  text-align: center;
  background: var(--cream);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

.thank-you-card h1 {
  margin: 0;
  color: var(--wine);
  font-size: clamp(4rem, 14vw, 7rem);
}

.thank-you-card p:not(.eyebrow) {
  margin: 12px auto 32px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 640px) {
  .hero {
    padding: 22px 10px 34px;
  }

  .envelope-experience {
    height: min(780px, 94svh);
    min-height: 650px;
  }

  .envelope {
    bottom: 34px;
  }

  .invitation-visual.invitation-card {
    bottom: 50px;
    width: min(82vw, 390px);
  }

  .open-envelope {
    bottom: clamp(145px, 39vw, 188px);
    width: 84px;
    height: 84px;
    font-size: 0.62rem;
  }

  .open-envelope small {
    margin-top: 6px;
    font-size: 0.4rem;
  }

  .invitation-shell,
  .paper-front {
    min-height: 700px;
  }

  .paper-front {
    padding: 54px 24px 0;
  }

  .paper-front::before {
    inset: 12px;
  }

  .paper-back {
    transform: rotate(-2deg) translate(-7px, 10px);
  }

  .paper-middle {
    transform: rotate(1.4deg) translate(7px, 8px);
  }

  .paper-front h1 {
    font-size: clamp(3.2rem, 16vw, 4.6rem);
  }

  .occasion {
    margin: 18px 0;
  }

  .sushi-crop {
    bottom: -100px;
    height: 290px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .envelope-experience.is-open .envelope-flap {
    animation: none;
    z-index: 1;
    transform: rotateX(180deg);
  }

  .envelope-experience.is-open .invitation-card {
    animation: none;
    z-index: 7;
    pointer-events: auto;
    transform: translateX(-50%) translateY(-18%) scale(1);
  }
}

.envelope-experience.is-closing .invitation-card {
  animation: return-vertical-card 850ms cubic-bezier(0.65, 0, 0.3, 1) forwards;
  pointer-events: none;
}

.envelope-experience.is-sealing .envelope-flap {
  animation: close-vertical-flap 750ms cubic-bezier(0.65, 0, 0.22, 1) forwards;
}

.envelope-experience.is-confirmed .open-envelope {
  opacity: 1;
  pointer-events: none;
  transform: translate(-50%, 0) scale(0.9);
}

.envelope-experience.is-confirmed .envelope-hint {
  opacity: 1;
}

button:disabled {
  cursor: default;
}

@keyframes return-vertical-card {
  0% {
    z-index: 3;
    transform: translateX(-50%) translateY(-47%) scale(0.96);
  }
  100% {
    z-index: 2;
    transform: translateX(-50%) translateY(22%) scale(0.82);
  }
}

@keyframes close-vertical-flap {
  0% {
    z-index: 1;
    transform: rotateX(180deg);
  }
  50% {
    z-index: 6;
  }
  100% {
    z-index: 6;
    transform: rotateX(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .envelope-experience.is-closing .invitation-card {
    animation: none;
    z-index: 2;
    transform: translateX(-50%) translateY(22%) scale(0.82);
  }

  .envelope-experience.is-sealing .envelope-flap {
    animation: none;
    z-index: 6;
    transform: rotateX(0deg);
  }
}

/* Fully sealed state: the flap covers the card and carries the button */
.envelope-lining,
.envelope-flap {
  height: 62%;
}

.envelope-flap {
  filter: drop-shadow(0 13px 10px rgba(83, 34, 38, 0.2));
}

.open-envelope {
  top: 54%;
  transform: translate(-50%, -50%);
}

.open-envelope:hover {
  transform: translate(-50%, -54%) rotate(-2deg);
}

.envelope-experience:not(.is-open):not(.is-closing) .invitation-card {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(70%) scale(0.8);
}

.envelope-experience.is-open .invitation-card {
  opacity: 1;
}

.envelope-experience.is-confirmed .open-envelope {
  transform: translate(-50%, -50%) scale(0.9);
}

@keyframes reveal-vertical-card {
  0% {
    z-index: 2;
    opacity: 0;
    transform: translateX(-50%) translateY(70%) scale(0.8);
  }
  22% {
    opacity: 1;
  }
  100% {
    z-index: 3;
    opacity: 1;
    transform: translateX(-50%) translateY(-47%) scale(0.96);
  }
}

@keyframes return-vertical-card {
  0% {
    z-index: 3;
    opacity: 1;
    transform: translateX(-50%) translateY(-47%) scale(0.96);
  }
  78% {
    opacity: 1;
  }
  100% {
    z-index: 2;
    opacity: 0;
    transform: translateX(-50%) translateY(70%) scale(0.8);
  }
}

@media (max-width: 640px) {
  .open-envelope {
    top: 54%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .envelope-experience.is-open .invitation-card {
    opacity: 1;
    transform: translateX(-50%) translateY(-47%) scale(0.96);
  }

  .envelope-experience.is-closing .invitation-card {
    opacity: 0;
    transform: translateX(-50%) translateY(70%) scale(0.8);
  }
}

/* Vertical envelope experience */
.envelope-experience {
  width: min(94vw, 620px);
  height: min(940px, 94svh);
  min-height: 720px;
}

.envelope {
  right: auto;
  bottom: 34px;
  left: 50%;
  width: min(80vw, 460px);
  height: min(108vw, 620px);
  min-height: 500px;
  aspect-ratio: auto;
  transform: translateX(-50%);
}

.envelope-back {
  border-color: #c99a4d;
  border-radius: 18px 18px 32px 18px;
  background:
    radial-gradient(rgba(255, 255, 255, 0.045) 0.8px, transparent 0.8px),
    linear-gradient(150deg, #e6a08e, #cb7466 55%, #9b4b44);
  background-size: 5px 5px, auto;
}

.envelope-back::after {
  border-color: rgba(235, 192, 111, 0.82);
  border-radius: 10px 10px 22px 10px;
}

.envelope-lining {
  height: 46%;
  background:
    repeating-linear-gradient(45deg, rgba(230, 185, 103, 0.24) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, #3b0a20, #6b1e38);
}

.envelope-front {
  clip-path: polygon(0 29%, 50% 54%, 100% 29%, 100% 100%, 0 100%);
  border-radius: 0 0 32px 18px;
  background:
    linear-gradient(153deg, transparent 49.5%, rgba(239, 197, 119, 0.56) 50%, transparent 50.5%),
    linear-gradient(27deg, transparent 49.5%, rgba(239, 197, 119, 0.56) 50%, transparent 50.5%),
    radial-gradient(rgba(255, 255, 255, 0.045) 0.8px, transparent 0.8px),
    linear-gradient(155deg, #e29a89, #c86f62 55%, #93463f);
  background-size: auto, auto, 5px 5px, auto;
}

.envelope-flap {
  height: 46%;
  background:
    radial-gradient(rgba(255, 255, 255, 0.045) 0.8px, transparent 0.8px),
    linear-gradient(165deg, #e8a895, #c96f62 58%, #964940);
  background-size: 5px 5px, auto;
}

.envelope-flap::after {
  border-top-color: rgba(239, 197, 119, 0.86);
}

.invitation-visual.invitation-card {
  bottom: 68px;
  width: min(58vw, 340px);
  pointer-events: none;
  transform: translateX(-50%) translateY(22%) scale(0.82);
  transform-origin: 50% 100%;
}

.open-envelope {
  top: 38%;
  bottom: auto;
  width: 92px;
  height: 92px;
}

.address-hotspot,
.rsvp-hotspot {
  touch-action: manipulation;
}

.rsvp-hotspot {
  z-index: 20;
  -webkit-tap-highlight-color: rgba(210, 165, 87, 0.28);
}

.envelope-experience.is-open .envelope-flap {
  animation: open-vertical-flap 850ms cubic-bezier(0.65, 0, 0.22, 1) forwards;
}

.envelope-experience.is-open .invitation-card {
  animation: reveal-vertical-card 1.25s 420ms cubic-bezier(0.22, 0.8, 0.2, 1) forwards;
  pointer-events: auto;
}

.envelope-experience.is-revealed .invitation-card {
  z-index: 3;
  pointer-events: auto;
}

@keyframes open-vertical-flap {
  0% {
    z-index: 6;
    transform: rotateX(0deg);
  }
  49% {
    z-index: 6;
  }
  50%,
  100% {
    z-index: 1;
  }
  100% {
    transform: rotateX(180deg);
  }
}

@keyframes reveal-vertical-card {
  0% {
    z-index: 2;
    transform: translateX(-50%) translateY(22%) scale(0.82);
  }
  100% {
    z-index: 3;
    transform: translateX(-50%) translateY(-47%) scale(0.96);
  }
}

@media (max-width: 640px) {
  .envelope-experience {
    height: min(820px, 95svh);
    min-height: 680px;
  }

  .envelope {
    bottom: 30px;
    width: min(88vw, 390px);
    height: min(119vw, 530px);
    min-height: 460px;
  }

  .invitation-visual.invitation-card {
    bottom: 54px;
    width: min(68vw, 290px);
  }

  .open-envelope {
    top: 37%;
    bottom: auto;
    width: 78px;
    height: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .envelope-experience.is-open .envelope-flap {
    animation: none;
    z-index: 1;
    transform: rotateX(180deg);
  }

  .envelope-experience.is-open .invitation-card {
    animation: none;
    z-index: 3;
    pointer-events: auto;
    transform: translateX(-50%) translateY(-47%) scale(0.96);
  }
}

/* Final palette: chocolate brown paper, gold folds, seal on the flap junction */
.envelope-back {
  border-color: #c99a4d;
  background:
    radial-gradient(rgba(255, 255, 255, 0.035) 0.8px, transparent 0.8px),
    linear-gradient(150deg, #76503a, #503123 58%, #321c15);
  background-size: 5px 5px, auto;
}

.envelope-back::after {
  border-color: rgba(221, 173, 89, 0.9);
}

.envelope-front {
  background:
    linear-gradient(153deg, transparent 49.5%, rgba(226, 177, 91, 0.72) 50%, transparent 50.5%),
    linear-gradient(27deg, transparent 49.5%, rgba(226, 177, 91, 0.72) 50%, transparent 50.5%),
    radial-gradient(rgba(255, 255, 255, 0.035) 0.8px, transparent 0.8px),
    linear-gradient(155deg, #79523c, #563526 56%, #382018);
  background-size: auto, auto, 5px 5px, auto;
}

.envelope-flap {
  background:
    radial-gradient(rgba(255, 255, 255, 0.035) 0.8px, transparent 0.8px),
    linear-gradient(165deg, #7c543d, #513022 60%, #331d16);
  background-size: 5px 5px, auto;
}

.envelope-flap::after {
  border-top-color: rgba(226, 177, 91, 0.94);
}

.open-envelope {
  top: 62%;
}

.envelope-experience:not(.is-open) .open-envelope {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 640px) {
  .open-envelope {
    top: 62%;
  }
}

/* One-piece envelope geometry: all folds meet at the seal */
.envelope-front {
  background:
    radial-gradient(rgba(255, 255, 255, 0.035) 0.8px, transparent 0.8px),
    linear-gradient(155deg, #79523c, #563526 56%, #382018);
  background-size: 5px 5px, auto;
}

.envelope-seams {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: 0 0 32px 18px;
  pointer-events: none;
}

.envelope-seams::before,
.envelope-seams::after {
  position: absolute;
  bottom: 0;
  width: 72%;
  height: 2px;
  background: linear-gradient(90deg, rgba(198, 145, 67, 0.45), #ddb05f 62%, #edc77f);
  box-shadow: 0 1px 0 rgba(42, 21, 15, 0.34);
  content: "";
}

.envelope-seams::before {
  left: 0;
  transform: rotate(-46deg);
  transform-origin: left bottom;
}

.envelope-seams::after {
  right: 0;
  transform: rotate(46deg);
  transform-origin: right bottom;
}

.envelope-flap {
  height: 62%;
  filter:
    drop-shadow(0 2px 0 rgba(226, 177, 91, 0.9))
    drop-shadow(0 13px 10px rgba(18, 8, 6, 0.24));
}

.open-envelope {
  top: 62%;
  z-index: 8;
}

/* Hand-poured burgundy wax seal */
.open-envelope {
  isolation: isolate;
  overflow: visible;
  border: 0;
  border-radius: 48% 52% 45% 55% / 53% 46% 54% 47%;
  color: #edca83;
  background:
    radial-gradient(circle at 22% 23%, rgba(255, 210, 191, 0.3) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 31%, rgba(255, 196, 167, 0.22) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 30% 78%, rgba(255, 190, 164, 0.2) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 42% 34%, #9a334d 0, #731b37 39%, #4a0e25 72%, #2b0718 100%);
  box-shadow:
    0 4px 0 #310817,
    0 11px 13px rgba(16, 5, 8, 0.48),
    inset 5px 7px 8px rgba(255, 151, 147, 0.2),
    inset -7px -9px 10px rgba(25, 2, 12, 0.48),
    0 0 0 2px rgba(111, 20, 45, 0.8);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.92rem;
  line-height: 0.86;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 1px #2b0718, 0 0 4px rgba(238, 196, 119, 0.18);
}

.open-envelope::before {
  position: absolute;
  inset: 9px;
  z-index: -1;
  border: 2px solid rgba(188, 77, 91, 0.76);
  border-radius: 53% 47% 51% 49% / 47% 54% 46% 53%;
  box-shadow:
    0 0 0 2px rgba(48, 5, 21, 0.52),
    inset 1px 2px 3px rgba(255, 182, 166, 0.18),
    1px 2px 3px rgba(24, 2, 10, 0.45);
  content: "";
}

.open-envelope::after {
  position: absolute;
  inset: -3px;
  z-index: -2;
  border-radius: 51% 49% 46% 54% / 48% 54% 46% 52%;
  background:
    radial-gradient(circle at 18% 58%, #8c2945 0 3px, transparent 4px),
    radial-gradient(circle at 64% 7%, #7b203b 0 4px, transparent 5px),
    radial-gradient(circle at 91% 61%, #56112b 0 4px, transparent 5px),
    radial-gradient(circle at 45% 95%, #64132f 0 5px, transparent 6px);
  content: "";
}

.open-envelope span {
  position: relative;
  z-index: 2;
}

.open-envelope small {
  display: none;
}

.open-envelope:hover {
  background:
    radial-gradient(circle at 22% 23%, rgba(255, 210, 191, 0.34) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 31%, rgba(255, 196, 167, 0.25) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 30% 78%, rgba(255, 190, 164, 0.22) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 42% 34%, #a83b55 0, #7d203d 39%, #510f29 72%, #30081c 100%);
}

/* Matched square invitation and square envelope */
.envelope-experience {
  width: min(96vw, 700px);
  height: min(850px, 94svh);
  min-height: 650px;
}

.envelope {
  right: auto;
  bottom: 42px;
  left: 50%;
  width: min(82vw, 520px);
  height: min(82vw, 520px);
  min-height: 0;
  aspect-ratio: 1;
  transform: translateX(-50%);
}

.envelope-front {
  clip-path: polygon(0 30%, 50% 62%, 100% 30%, 100% 100%, 0 100%);
}

.envelope-seams::before,
.envelope-seams::after {
  width: 63%;
}

.envelope-seams::before {
  transform: rotate(-37deg);
}

.envelope-seams::after {
  transform: rotate(37deg);
}

.invitation-visual.invitation-card {
  bottom: 46px;
  width: min(68vw, 420px);
  aspect-ratio: 1;
}

.invitation-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.address-hotspot {
  top: 43%;
  right: 23%;
  bottom: auto;
  left: 23%;
  height: 10%;
}

.rsvp-hotspot {
  right: 23%;
  bottom: 4.2%;
  left: 23%;
  height: 7.5%;
}

@media (max-width: 640px) {
  .envelope-experience {
    height: min(700px, 92svh);
    min-height: 580px;
  }

  .envelope {
    bottom: 48px;
    width: min(90vw, 400px);
    height: min(90vw, 400px);
    min-height: 0;
  }

  .invitation-visual.invitation-card {
    bottom: 38px;
    width: min(76vw, 340px);
  }
}

/* Photoreal closed cover; the transparent hotspot keeps the wax seal interactive */
.closed-envelope-art {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 1;
  filter: none;
  pointer-events: none;
  transform: scale(1.18);
  user-select: none;
  transition: opacity 320ms ease, transform 520ms ease;
}

.envelope-experience.is-open .closed-envelope-art,
.envelope-experience.is-closing .closed-envelope-art,
.envelope-experience.is-sealing .closed-envelope-art {
  opacity: 0;
  transform: scale(1.12);
}

.envelope-experience:not(.is-open) .envelope {
  filter: none;
}

.envelope-experience:not(.is-open) .open-envelope {
  top: 55%;
  width: 28%;
  max-width: 132px;
  height: 28%;
  max-height: 132px;
  border: 0;
  color: transparent;
  background: transparent;
  box-shadow: none;
  text-shadow: none;
}

.envelope-experience:not(.is-open) .open-envelope::before,
.envelope-experience:not(.is-open) .open-envelope::after {
  display: none;
}

.envelope-experience:not(.is-open) .open-envelope:hover {
  background: rgba(255, 255, 255, 0.025);
  box-shadow: 0 0 0 4px rgba(224, 177, 91, 0.15);
}

/* Lucas palette, preserving the original invitation geometry. */
:root{--wine:#19392c;--wine-light:#31513d;--cream:#f3e9d5;--cream-deep:#e0ceab;--gold:#bb9452;--ink:#19392c;--muted:#566154}
.hero,.thank-you-page{background:radial-gradient(circle at 50% 20%,#45654b66,transparent 35%),linear-gradient(145deg,#10291e,var(--wine) 52%,#10251b)}
.envelope-back,.envelope-front,.envelope-flap{background:radial-gradient(#705e3b18 .8px,transparent .8px),linear-gradient(150deg,#f3e8d1,#d8c4a1 58%,#c2aa82);background-size:5px 5px,auto}
.envelope-lining{background:repeating-linear-gradient(45deg,#cba76233 0 1px,transparent 1px 12px),linear-gradient(#173428,#36533e)}
.open-envelope,.open-envelope:hover{background:radial-gradient(circle at 42% 34%,#517251,#31543e 39%,#183b2b 72%,#10281d);color:#edca83}
.open-envelope::before{border-color:#bb9452aa}
.open-envelope::after{background:none}
.rsvp-section{background:#f3e9d5}.form-card{background:#fbf6e9}
.envelope-hint{font-size:12px}.form-intro{font-size:16px}form>label,legend{font-size:14px}

.address-hotspot{top:48%;height:13%;left:23%;right:23%}

/* Fine stationery texture and revised button position. */
.envelope-back,.envelope-front,.envelope-flap{background:radial-gradient(#705e3b0c .5px,transparent .5px),linear-gradient(150deg,#f3e8d1,#e4d4b8 58%,#d4c09b);background-size:3px 3px,auto}
.rsvp-hotspot{bottom:7%;height:7.5%}

.rsvp-hotspot{bottom:12%;height:7.5%}

/* Keep the cover hidden until the closing folds finish. */
.envelope-experience.is-closing .closed-envelope-art,.envelope-experience.is-sealing .closed-envelope-art{opacity:0;transform:scale(1.12)}
.envelope-experience.is-closing .open-envelope,.envelope-experience.is-sealing .open-envelope{opacity:0;visibility:hidden;pointer-events:none}

/* Transparent click area must never draw a second button outside the artwork. */
.invitation-card a.rsvp-hotspot,
.invitation-card a.rsvp-hotspot:hover,
.invitation-card a.rsvp-hotspot:active,
.invitation-card a.rsvp-hotspot:focus{background:transparent!important;border:0!important;outline:0!important;outline-offset:0!important;box-shadow:none!important;transform:none!important;transition:none!important}
.invitation-card a.rsvp-hotspot:focus-visible{background:rgba(255,255,255,.14)!important;box-shadow:none!important;outline:0!important}

/* Compact handmade-paper RSVP card. */
.rsvp-section{min-height:auto;padding:44px 18px 64px;background:var(--wine)}
.form-card{position:relative;isolation:isolate;width:min(100%,470px);padding:30px 28px;border-radius:5px;border:1px solid #bb9452;box-shadow:0 16px 40px #071b1640;background-color:#f2e8d5;background-image:radial-gradient(ellipse at 20% 25%,#ad956225 0 .8px,transparent 1.6px),radial-gradient(ellipse at 65% 70%,#8f795025 0 .7px,transparent 1.7px),repeating-linear-gradient(23deg,transparent 0 18px,#baa67d09 18px 19px,transparent 19px 31px);background-size:27px 31px,39px 43px,auto}
.form-card:before{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:.28;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='.3'/%3E%3C/svg%3E")}
.form-card .eyebrow{margin-bottom:12px;color:var(--wine)}
.form-card h2{font-size:clamp(1.85rem,6vw,2.4rem);line-height:1.1;margin-bottom:12px}
.form-intro{font-size:14px;line-height:1.6;margin-bottom:20px;color:var(--wine)}
.form-card form{gap:9px;color:var(--wine)}
.form-card form>label,.form-card legend{font-size:14px;letter-spacing:.02em;text-transform:none;margin-top:8px}
.form-card input[type=text],.form-card select,.form-card textarea{font-size:16px;color:var(--wine);border-color:#bcaa85;background:#fffbef99;border-radius:5px}
.form-card input[type=text],.form-card select{min-height:42px;padding:9px 11px}
.form-card textarea{padding:11px;resize:vertical}
.form-card .radio-option{font-size:14px;min-height:43px;padding:8px 11px;border-radius:5px;border-color:#bcaa85;background:#fffbef66}
.form-card fieldset{display:grid;gap:8px}
.form-card legend{margin-bottom:8px}
.form-card button[type=submit]{margin-top:14px;min-height:46px;font-size:12px}
@media(max-width:480px){.form-card{padding:25px 21px}.rsvp-section{padding:30px 14px 45px}}

/* Off-white RSVP and teal lettering. */
:root{--wine:#0c351b;--wine-light:#246e70;--cream:#faf9f4;--cream-deep:#eeeae0;--ink:#0c351b;--muted:#49686a}
.hero{background:radial-gradient(circle at 50% 20%,#31797b66,transparent 35%),linear-gradient(145deg,#0c3d42,#0c351b 52%,#0a3539)}
.form-card{background-color:#faf9f4}
.form-card input[type=text],.form-card select,.form-card textarea,.form-card .radio-option{background:#fdfdfb;color:#0c351b}
.envelope-back,.envelope-front,.envelope-flap{background-color:#faf9f4;background-image:radial-gradient(#705e3b0c .5px,transparent .5px),linear-gradient(150deg,#fdfcf8,#f4f2ea 58%,#e9e5d9);background-size:3px 3px,auto}
.envelope-lining{background:linear-gradient(#0c351b,#246e70)}

/* Edge-to-edge invitation presentation: no decorative surround. */
html,body,main{margin:0;padding:0;background:transparent}
.hero{padding:0;min-height:100svh;background:transparent;overflow:hidden}
.glow,.envelope-hint{display:none}
.envelope-experience{width:100vw;height:100svh;min-height:0;perspective:1800px}
.envelope{inset:0;width:100%;height:100%;min-height:0;aspect-ratio:auto;transform:none;filter:none}
.closed-envelope-art{transform:none;object-fit:cover;object-position:center;width:100%;height:100%}
.envelope-experience.is-open .closed-envelope-art{transform:none}
.envelope-back,.envelope-front,.envelope-lining,.envelope-seams,.envelope-flap{border-radius:0}
.envelope-experience:not(.is-open) .open-envelope{top:55%;width:120px;height:120px}
.invitation-visual.invitation-card{position:absolute;top:50%;bottom:auto;left:50%;width:min(94vw,82svh,680px);aspect-ratio:1}
.envelope-experience.is-open .invitation-card{animation:reveal-full-card 1.25s 420ms cubic-bezier(.22,.8,.2,1) forwards}
.envelope-experience.is-revealed .invitation-card{z-index:9}
@keyframes reveal-full-card{0%{opacity:0;transform:translate(-50%,70%) scale(.8)}100%{opacity:1;transform:translate(-50%,-50%) scale(1)}}
.envelope-experience.is-closing .invitation-card{animation:return-full-card 850ms ease forwards}
@keyframes return-full-card{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}100%{opacity:0;transform:translate(-50%,70%) scale(.8)}}
@media(prefers-reduced-motion:reduce){.envelope-experience.is-open .invitation-card{animation:none;transform:translate(-50%,-50%)}.envelope-experience.is-closing .invitation-card{animation:none;opacity:0}}

.rsvp-section{background:transparent}.invitation-visual.invitation-card{filter:none}

.rsvp-hotspot{left:28%;right:28%;bottom:17.5%;height:6.5%}.address-hotspot{left:28%;right:28%;top:50%;height:11%}

/* Teal envelope paper throughout its opening animation. */
.envelope-back,.envelope-front,.envelope-flap{background-color:#0c351b;background-image:radial-gradient(#ffffff14 .5px,transparent .5px),linear-gradient(150deg,#1a492b,#0c351b 58%,#072311);background-size:3px 3px,auto}

/* Original invitation proportions selected by Lucas. */
.rsvp-hotspot{left:24%;right:24%;bottom:12%;height:7.5%}
.address-hotspot{left:23%;right:23%;top:48%;height:13%}

/* Match every opening fold and the RSVP stationery to the green cover. */
:root{--wine:#0c351b;--wine-light:#214c32;--ink:#0c351b;--muted:#47644f}
.envelope-lining{background:linear-gradient(150deg,#214c32,#0c351b)}
.form-card{background-color:#214c32;color:#eed49b;border-color:#bb9452}
.form-card .eyebrow,.form-card h2,.form-intro,.form-card form,.form-card form>label,.form-card legend,.form-card .radio-option{color:#eed49b}
.form-card input[type=text],.form-card select,.form-card textarea{background:#faf9f4;color:#0c351b;border-color:#bb9452}
.form-card .radio-option{background:#173e27;border-color:#bb9452}
.form-card form button[type=submit],.form-card form button[type=submit]:hover,.form-card form button[type=submit]:focus{background:#0c351b;color:#eed49b;border:1px solid #bb9452;transform:none}

.studio-credit{margin:0;padding:14px 18px 26px;text-align:center;color:#b99a62;font-family:Montserrat,sans-serif;font-size:10px;letter-spacing:.12em}

/* Once opened, show only the invitation until the envelope closes again. */
.envelope-experience.is-revealed .envelope-back,
.envelope-experience.is-revealed .envelope-lining,
.envelope-experience.is-revealed .envelope-front,
.envelope-experience.is-revealed .envelope-seams,
.envelope-experience.is-revealed .envelope-flap{opacity:0;visibility:hidden;pointer-events:none}

/* Compact sealed start, then reveal the invitation on an explicit seal tap. */
.hero{display:grid;place-items:center;min-height:100svh}
.envelope-experience{width:min(90vw,520px,76svh);height:min(90vw,520px,76svh);min-height:0}
.envelope{width:100%;height:100%;inset:0}
.closed-envelope-art{object-fit:fill}
.invitation-visual.invitation-card{width:100%;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%,-50%) scale(.85)}
.envelope-experience.is-open .invitation-card{visibility:visible;pointer-events:auto}
.envelope-experience.is-revealed .invitation-card{opacity:1;visibility:visible;transform:translate(-50%,-50%) scale(1)}
.envelope-experience:not(.is-open) .open-envelope{top:54%;left:50%;transform:translate(-50%,-50%);width:31%;height:31%;max-width:none;max-height:none}
.envelope-experience.is-open .closed-envelope-art{transform:perspective(1000px) rotateX(65deg);transform-origin:top;transition:transform 650ms ease,opacity 650ms ease}
.rsvp-section{display:none}
.rsvp-section.is-visible{display:block}
.studio-credit{display:none}
body.rsvp-visible .studio-credit{display:block}

/* The card rises from inside the envelope before settling in place. */
@keyframes reveal-full-card{0%{opacity:0;transform:translate(-50%,0%) scale(.78)}35%{opacity:1;transform:translate(-50%,-82%) scale(.88)}100%{opacity:1;transform:translate(-50%,-50%) scale(1)}}
.envelope-experience.is-open .invitation-card{animation:reveal-full-card 1.7s 650ms cubic-bezier(.22,.8,.2,1) forwards}
.music-section{max-width:360px;margin:0 auto 24px;text-align:center;color:#846322;font:12px Montserrat,sans-serif}.music-section[hidden]{display:none}.music-section iframe{width:100%;height:203px;border:1px solid #bb9452;border-radius:6px}.music-section a{color:#846322}

.studio-credit a{color:inherit;text-decoration:underline;text-underline-offset:3px}
