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

@font-face {
  font-family: 'Aves do Paraiso';
  src: url('AvesdoParaiso.ttf.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --cream: #f5f0e8;
  --parchment: #ede6d6;
  --gold: #b08d57;
  --gold-dark: #8a6c3a;
  --gold-light: #d4b483;
  --brown: #000000;
  --text: #000000;
  --text-light: #222222;
}

html, body {
  height: 100%;
  background: var(--cream);
  font-family: 'EB Garamond', serif;
  overflow-x: hidden;
}

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

.petal {
  position: absolute;
  width: 10px;
  height: 14px;
  background: radial-gradient(ellipse at 40% 30%, #e8d5b7, #c9a96e44);
  border-radius: 50% 0 50% 0;
  opacity: 0;
  animation: petalFall linear infinite;
}

@keyframes petalFall {
  0% { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 0; }
  10% { opacity: .6; }
  90% { opacity: .3; }
  100% { transform: translateY(110vh) rotate(720deg) scale(.6); opacity: 0; }
}

#stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 40px 16px;
}

#envelope-wrap {
  position: relative;
  width: 360px;
  height: 520px;
  cursor: pointer;
  user-select: none;
}

.envelope {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #f7f2ea;
  border-radius: 4px 4px 12px 12px;
  box-shadow: 0 20px 60px #00000022, 0 4px 12px #00000018;
  overflow: hidden;
}

.env-body {
  height: 100%;
  background: #fdfaf5;
  position: relative;
}

.env-bottom {
  width: 0;
  height: 0;
  border-left: 180px solid transparent;
  border-right: 180px solid transparent;
  border-bottom: 240px solid #f2ead8;
  position: absolute;
  bottom: 0;
  left: 0;
}

.env-left {
  width: 0;
  height: 0;
  border-top: 260px solid transparent;
  border-bottom: 260px solid transparent;
  border-left: 180px solid #f9f4e9;
  position: absolute;
  top: 0;
  left: 0;
}

.env-right {
  width: 0;
  height: 0;
  border-top: 260px solid transparent;
  border-bottom: 260px solid transparent;
  border-right: 180px solid #f4ecdc;
  position: absolute;
  top: 0;
  right: 0;
}

.env-flap-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: top center;
  transform-style: preserve-3d;
  z-index: 10;
  transition: transform 1.1s cubic-bezier(.4,0,.2,1);
}

.env-flap {
  width: 0;
  height: 0;
  border-left: 180px solid transparent;
  border-right: 180px solid transparent;
  border-top: 320px solid #fdfbf7;
  position: absolute;
  top: 0;
  left: 0;
  filter: drop-shadow(0 8px 12px #00000015);
}

#envelope-wrap.open .env-flap-wrap {
  transform: rotateX(-180deg);
}

.wax-seal {
  position: absolute;
  top: 290px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 76px;
  height: 76px;
  transition: transform .3s ease, opacity .5s ease;
}

#envelope-wrap.open .wax-seal {
  transform: translateX(-50%) scale(0);
  opacity: 0;
}

.wax-seal:hover {
  transform: translateX(-50%) scale(1.08);
}

.seal-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 10px #7a521888);
}

.hint {
  text-align: center;
  position: absolute;
  bottom: -30px;
  left: 0; width: 100%;
  color: var(--text-light);
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .7; }
  50% { opacity: 1; }
}

.cover-names {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 5;
  pointer-events: none;
  width: 100%;
}

.cover-names .name {
  font-family: 'Aves do Paraiso', cursive;
  font-size: 56px;
  color: #000000;
  line-height: 1.15;
  text-transform: none;
  letter-spacing: normal;
}

.cover-names .amp {
  font-family: 'Great Vibes', cursive;
  font-size: 64px;
  color: #000000;
  line-height: 0.7;
  display: block;
  margin: 12px 0;
  font-weight: normal;
}

#card {
  display: none;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(170deg, #f7f2ea 0%, #ede5d2 100%);
  border-radius: 16px;
  box-shadow: 0 30px 80px #00000028, 0 6px 20px #00000018;
  padding: 44px 36px 48px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(40px) scale(.96);
  transition: opacity .8s ease, transform .8s ease;
}

#card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#card::before, #card::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  border-color: var(--gold-light);
  border-style: solid;
  opacity: .5;
}

#card::before {
  top: 14px;
  left: 14px;
  border-width: 1px 0 0 1px;
}

#card::after {
  bottom: 14px;
  right: 14px;
  border-width: 0 1px 1px 0;
}

.card-quote {
  text-align: center;
  font-style: italic;
  font-size: 13.5px;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 6px;
  letter-spacing: .02em;
}

.card-quote span {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  font-style: normal;
  letter-spacing: .08em;
  color: #000000;
}

.card-sub {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  letter-spacing: .08em;
  margin-bottom: 24px;
  font-family: 'Lato', sans-serif;
  font-weight: 300;
}

.divider {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 14px auto;
}

.card-names {
  text-align: center;
  margin: 16px 0 10px;
}

.card-names .n {
  font-family: 'Aves do Paraiso', cursive;
  font-size: 52px;
  color: var(--brown);
  line-height: 1.1;
  display: block;
  text-transform: none;
  letter-spacing: normal;
}

.card-names .a {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 46px;
  color: #000000;
  line-height: .9;
  display: block;
}

.card-invite-text {
  text-align: center;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.7;
  margin: 18px auto 26px;
  max-width: 300px;
}

.date-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 4px auto 6px;
  font-family: 'Cormorant Garamond', serif;
}

.date-pill {
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-radius: 30px;
  padding: 6px 18px;
  font-style: italic;
  font-size: 17px;
  color: var(--brown);
  letter-spacing: .05em;
}

.date-num {
  font-size: 42px;
  font-weight: 600;
  color: var(--brown);
  margin: 0 8px;
  line-height: 1;
}

.date-year {
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-radius: 30px;
  padding: 6px 18px;
  font-size: 17px;
  color: var(--brown);
  letter-spacing: .04em;
}

.date-day {
  text-align: center;
  font-family: 'Lato', sans-serif;
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 28px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 auto 28px;
  max-width: 280px;
}

.btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #b08d57, #8a6c3a);
  color: #fdf8ef;
  border: none;
  border-radius: 50px;
  padding: 13px 22px;
  font-family: 'Lato', sans-serif;
  font-size: 13.5px;
  letter-spacing: .1em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 4px 14px #b08d5744;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 22px #b08d5766;
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(.98);
}

.btn-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: .9;
}

.card-seal {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.card-seal img {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 3px 8px #7a521855);
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 22px 0 10px;
}

.cd-unit {
  text-align: center;
}

.cd-num {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--brown);
  font-weight: 600;
  line-height: 1;
  display: block;
}

.cd-label {
  font-family: 'Lato', sans-serif;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-top: 3px;
}

.cd-sep {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--gold-light);
  align-self: flex-start;
  margin-top: 2px;
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0) rotate(0); }
  50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

.sparkle {
  position: absolute;
  font-size: 14px;
  pointer-events: none;
  animation: sparkle 3s ease-in-out infinite;
}

#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #00000055;
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#modal-overlay.open {
  display: flex;
}

.modal {
  background: linear-gradient(160deg, #f7f2ea, #ede5d2);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 30px 80px #00000044;
  position: relative;
  animation: modalIn .4s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.88) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  transition: color .2s;
}

.modal-close:hover {
  color: var(--gold);
}

.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  color: var(--brown);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: .08em;
}

.modal p {
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 28px;
  font-family: 'Lato', sans-serif;
  font-weight: 300;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
  font-family: 'Lato', sans-serif;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid #d4b48388;
  border-radius: 10px;
  background: #fdf9f2;
  font-family: 'EB Garamond', serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px #b08d5722;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #b08d57, #8a6c3a);
  color: #fdf8ef;
  border: none;
  border-radius: 50px;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 8px;
  transition: transform .2s, box-shadow .2s, filter .2s;
  box-shadow: 0 4px 14px #b08d5744;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px #b08d5766;
  filter: brightness(1.08);
}

.btn-submit:active {
  transform: scale(.98);
}
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.success-msg {
  display: none;
  text-align: center;
  padding: 20px 0;
}

.success-msg .tick {
  font-size: 48px;
  margin-bottom: 14px;
  display: block;
}

.success-msg h3 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--brown);
  margin-bottom: 8px;
}

.success-msg p {
  font-size: 14px;
  color: var(--text-light);
  font-family: 'Lato', sans-serif;
}

.err {
  display: none;
  text-align: center;
  font-size: .85rem;
  color: #9B4A3A;
  margin-top: .6rem;
  font-family: 'Lato', sans-serif;
}

footer {
  text-align: center;
  font-size: .8rem;
  color: var(--text-light);
  padding: 2.5rem 0 1rem;
}

@media(max-width: 440px) {
  #card { padding: 36px 22px 40px; }
  .card-names .n { font-size: 28px; }
  .card-names .a { font-size: 38px; }
  .date-num { font-size: 34px; }
}
