*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3, p {
  margin: 0;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  gap: 2.5rem;
  padding: 2rem;
  background: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  transition: opacity 1s var(--ease), visibility 1s;
}

.intro.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro__hint {
  font-size: .78rem;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  animation: breathe 2.6s ease-in-out infinite;
  text-align: center;
}

.intro.is-opening .intro__hint {
  opacity: 0;
  transition: opacity .4s;
  animation: none;
}

@keyframes breathe {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

.envelope {
  position: relative;
  width: min(380px, 85vw);
  aspect-ratio: 380 / 260;
  perspective: 1400px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 25px 35px rgba(74, 85, 52, 0.25));
  transition: transform .5s var(--ease);
  z-index: 10;
}

.envelope:hover {
  transform: translateY(-4px);
}

.envelope__back {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--envelope-dark);
  overflow: hidden;
}

.envelope__back::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.1'/%3E%3C/svg%3E");
  opacity: 0.5;
}

.envelope__letter {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 6%;
  bottom: 6%;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: .45rem;
  text-align: center;
  padding: 1.5rem;
  border-radius: 2px;
  background: var(--cream);
  box-shadow: 0 4px 15px rgba(0,0,0,.08);
  transition: transform 1.05s var(--ease), z-index 0s;
}

.envelope__letter .mono {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  letter-spacing: .15em;
  color: var(--envelope-dark);
  text-transform: uppercase;
}

.envelope__letter .small {
  font-family: var(--serif);
  font-style: italic;
  font-size: .85rem;
  letter-spacing: .1em;
  color: var(--gold);
}

.envelope__front {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 4px;
  overflow: hidden;
  background: var(--envelope-light);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.envelope__front::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.08);
  clip-path: polygon(0 0, 50% 50%, 0 100%, 100% 100%, 50% 50%, 100% 0);
}

.envelope__front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.05);
  clip-path: polygon(0 100%, 50% 50%, 100% 100%);
}

.envelope__flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 55%;
  z-index: 4;
  border-radius: 4px 4px 0 0;
  background: var(--envelope-light);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform .85s cubic-bezier(.65,0,.35,1);
  backface-visibility: hidden;
  box-shadow: inset 0 -2px 8px rgba(0,0,0,.15);
}

.envelope__floral {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
  transition: opacity .5s;
}

.envelope__floral--tr {
  top: -25px;
  right: -25px;
  width: 120px;
}

.envelope__floral--bl {
  bottom: -25px;
  left: -25px;
  width: 120px;
}

.intro.is-opening .envelope__floral {
  opacity: 0;
}

.envelope__seal {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%,-50%) scale(1);
  z-index: 6;
  width: 68px;
  height: 68px;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 35% 25%, var(--seal-light), var(--seal-dark) 60%, #3a0a08 100%);
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,.2),
    inset 0 -4px 10px rgba(0,0,0,.6),
    0 10px 20px rgba(40, 15, 10, 0.4);
  display: grid;
  place-items: center;
  transition: transform .35s var(--ease), opacity .35s;
}

.envelope__seal::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
}

.envelope__seal-inner {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: rgba(255, 240, 240, 0.7);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8), -1px -1px 2px rgba(255,255,255,0.1);
  transform: rotate(-10deg);
}

.envelope:hover .envelope__seal {
  transform: translate(-50%,-50%) scale(1.05);
}

.intro.is-opening .envelope__seal {
  opacity: 0;
  transform: translate(-50%,-50%) scale(.45) rotate(-20deg);
}

.intro.is-opening .envelope__flap {
  transform: rotateX(-180deg);
}

.intro.is-opening .envelope__letter {
  z-index: 7;
  transform: translateY(-60%) scale(1.02);
}

.invite {
  position: relative;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.1s ease .15s;
}

body.is-ready .invite {
  opacity: 1;
  pointer-events: auto;
}

.petals {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.petals span {
  position: absolute;
  top: -8vh;
  width: 10px;
  height: 10px;
  border-radius: 50% 0 50% 0;
  background: var(--purple);
  opacity: 0.6;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes fall {
  0%   { transform: translate3d(0, -12vh, 0) rotate(0deg); }
  100% { transform: translate3d(40px, 112vh, 0) rotate(720deg); }
}

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  text-align: center;
}

.hero__illustration {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin-top: 0;
  display: flex;
  justify-content: center;
}

.hero__illustration img {
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
}

.hero__fade {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 180px;
  background: linear-gradient(to bottom, rgba(252, 250, 245, 0) 0%, rgba(252, 250, 245, 1) 100%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  padding: 0 1.5rem 4rem;
  margin-top: -40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: .2em;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.hero__names {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.8rem, 12vw, 5rem);
  line-height: 1;
  letter-spacing: .1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink);
  margin-bottom: 1.2rem;
}

.hero__and {
  font-style: italic;
  font-size: .4em;
  color: var(--gold);
  margin: .2em 0;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.hero__and::before,
.hero__and::after {
  content: '';
  display: block;
  width: 50px;
  height: 1px;
  background: var(--line);
}

.divider-leaf {
  display: block;
  width: 24px;
  height: 24px;
  margin: 1.5rem auto;
  color: var(--sage-dark);
}

.divider-leaf svg {
  width: 100%;
  height: 100%;
}

.hero__date {
  font-size: .9rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.hero__time {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: .1em;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.hero__place {
  font-family: var(--serif);
  font-size: 1.6rem;
  letter-spacing: .15em;
  color: var(--envelope-dark);
  margin-bottom: .6rem;
}

.hero__address {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.section {
  padding: clamp(3.5rem, 9vw, 6rem) 1.5rem;
  max-width: 680px;
  margin-inline: auto;
  text-align: center;
}

.section__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  letter-spacing: .05em;
  margin-bottom: .8rem;
  color: var(--envelope-dark);
}

.section__sub {
  font-size: .95rem;
  color: var(--ink-soft);
  max-width: 45ch;
  margin: 0 auto;
  line-height: 1.8;
}

.clock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  max-width: 440px;
  margin: 2.5rem auto 0;
}

.clock__item {
  padding: 1.2rem .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.4);
}

.clock__num {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--envelope-dark);
}

.clock__label {
  display: block;
  margin-top: .5rem;
  font-size: .6rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cards {
  display: grid;
  gap: 1.2rem;
  margin-top: 2.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

.card {
  padding: 2.2rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
}

.card__icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
}

.card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: .05em;
  margin-bottom: .6rem;
  color: var(--envelope-dark);
}

.card p {
  font-size: .92rem;
  line-height: 1.8;
  color: var(--ink-soft);
}

.card p strong {
  color: var(--ink);
  font-weight: 500;
}

.btn {
  --bg: var(--envelope-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: 1rem 2.4rem;
  border: 1px solid var(--bg);
  border-radius: 4px;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .3s var(--ease), background .3s, color .3s, box-shadow .3s;
}

.btn:hover {
  transform: translateY(-2px);
  background: var(--envelope-light);
  border-color: var(--envelope-light);
  box-shadow: 0 10px 20px -10px rgba(74, 85, 52, 0.6);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--envelope-dark);
}

.btn--ghost:hover {
  background: rgba(85, 97, 61, 0.05);
  color: var(--envelope-dark);
  border-color: var(--envelope-dark);
}

.btn--sm {
  padding: .7rem 1.6rem;
  font-size: .85rem;
}

.btn[disabled] {
  opacity: .55;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.rsvp {
  max-width: 600px;
  margin-inline: auto;
}

.form {
  margin-top: 2.5rem;
  display: grid;
  gap: 1.6rem;
  text-align: left;
}

.field {
  display: grid;
  gap: .6rem;
}

.field > label,
.field > legend {
  font-size: .8rem;
  letter-spacing: .1em;
  color: var(--ink-soft);
  padding: 0;
}

fieldset.field {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: .9rem 1rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: border-color .25s, box-shadow .25s, background .25s;
  appearance: none;
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236e7261' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.4rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--sage);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(85, 97, 61, 0.1);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.choice span {
  display: block;
  padding: .7rem 1.4rem;
  font-size: .9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  transition: all .25s var(--ease);
  color: var(--ink-soft);
}

.choice input:checked + span {
  background: var(--envelope-dark);
  border-color: var(--envelope-dark);
  color: var(--cream);
}

.choice input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(85, 97, 61, 0.2);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  font-size: .95rem;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.6;
}

.check input {
  appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: .15rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  transition: all .2s;
}

.check input:checked {
  background: var(--envelope-dark);
  border-color: var(--envelope-dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='%23fcfaf5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.only-if-yes {
  display: grid;
  gap: 1.6rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
  animation: fadeUp .5s var(--ease);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.error {
  font-size: .8rem;
  color: var(--seal-light);
  min-height: 0;
  display: none;
}

.error.is-visible {
  display: block;
}

.is-invalid {
  border-color: var(--seal-light) !important;
  background: #fdf5f2 !important;
}

.success {
  margin-top: 2rem;
  padding: 3rem 2rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
  animation: fadeUp .6s var(--ease);
}

.success__icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--envelope-dark);
  color: var(--cream);
  font-size: 1.5rem;
}

.success h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.8rem;
  margin-bottom: .8rem;
  color: var(--envelope-dark);
}

.success p {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 40ch;
  margin: 0 auto;
}

.success .btn {
  margin-top: 2rem;
}

.footer {
  padding: 4rem 1.5rem 5rem;
  text-align: center;
  border-top: 1px solid var(--line);
}

.footer .mono {
  font-family: var(--serif);
  font-size: 1.8rem;
  letter-spacing: .15em;
  color: var(--envelope-dark);
}

.footer small {
  display: block;
  margin-top: 1rem;
  font-size: .75rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.music {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 50;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(252, 250, 245, 0.9);
  backdrop-filter: blur(8px);
  color: var(--envelope-dark);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s, transform .3s;
}

body.is-ready .music {
  opacity: 1;
  pointer-events: auto;
}

.music:hover {
  transform: scale(1.08);
}

.music.is-playing span {
  display: inline-block;
  animation: spin 6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .petals { display: none; }
  .reveal { opacity: 1; transform: none; }
}