:root {
  color-scheme: dark;
  --wine-950: #1d0308;
  --wine-900: #31060d;
  --wine-800: #500914;
  --wine-700: #6f0d1d;
  --cream: #f6ead8;
  --paper: #f3e7d4;
  --gold: #c69b56;
  --ink: #65101d;
  --shadow: 0 30px 90px rgba(8, 0, 2, 0.7);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--wine-950); scroll-behavior: smooth; }

body {
  min-height: 100%;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 10%, rgba(145, 31, 51, 0.28), transparent 38rem),
    var(--wine-950);
  font-family: Georgia, "Times New Roman", serif;
}

body.is-locked { overflow: hidden; }

button, a { -webkit-tap-highlight-color: transparent; }

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

.opening {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: end center;
  min-height: 100svh;
  overflow: hidden;
  background: var(--wine-950);
  transition: opacity 0.95s ease, visibility 0.95s ease;
}

.opening__image {
  position: absolute;
  inset: -3%;
  background: url("assets/envelope-bg.webp") center / cover no-repeat;
  filter: saturate(0.93) contrast(1.03);
  transform: scale(1.035);
  transition: transform 1.4s cubic-bezier(.22,.75,.2,1), filter 1.2s ease;
}

.opening__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(21, 1, 5, 0.02) 45%, rgba(20, 1, 5, 0.35) 70%, rgba(17, 1, 4, 0.94) 100%),
    radial-gradient(ellipse at center, transparent 40%, rgba(13, 0, 3, 0.42) 100%);
}

.opening__content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  width: min(92vw, 560px);
  padding: 0 1rem max(5svh, 1.75rem);
  text-align: center;
}

.opening__eyebrow {
  margin: 0 0 0.65rem;
  color: rgba(246, 234, 216, 0.7);
  font-size: clamp(0.65rem, 2.3vw, 0.78rem);
  letter-spacing: 0.38em;
  text-transform: uppercase;
}

.open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.55rem, 2vw, 0.85rem);
  min-height: 52px;
  padding: 0.9rem 1.3rem;
  border: 1px solid rgba(221, 185, 128, 0.48);
  border-radius: 999px;
  color: #f7e8d2;
  background: rgba(50, 5, 14, 0.64);
  box-shadow: 0 12px 34px rgba(0,0,0,.34), inset 0 0 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(10px);
  font: 500 clamp(0.74rem, 2.8vw, 0.95rem)/1.2 Georgia, serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .25s ease, background .25s ease, border-color .25s ease;
  animation: invitation-pulse 2.5s ease-in-out infinite;
}

.open-button:hover { transform: translateY(-2px); background: rgba(75, 8, 20, .78); border-color: rgba(232, 202, 153, .78); }
.open-button:focus-visible, .rsvp-button:focus-visible { outline: 3px solid #f7d596; outline-offset: 4px; }
.open-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.open-button__sparkle { color: #d5aa6a; font-size: 0.95rem; }

.opening.is-opening .opening__image { transform: scale(1.12); filter: saturate(.7) brightness(1.28) blur(2px); }
.opening.is-opening .opening__content { animation: content-away .65s ease forwards; }
.opening.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }

.invitation-stage {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  gap: 0.9rem;
  overflow: hidden;
  padding: clamp(0.75rem, 3vw, 2rem) 0.6rem calc(1.5rem + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 16% 22%, rgba(142, 28, 48, .32), transparent 25rem),
    radial-gradient(circle at 85% 75%, rgba(118, 20, 37, .25), transparent 25rem),
    linear-gradient(145deg, #190207, #3a0710 55%, #170105);
}

.invitation-stage[hidden] { display: none; }

.ambient {
  position: absolute;
  width: 28rem;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .16;
  pointer-events: none;
  background: #af3b4e;
}
.ambient--one { top: -14rem; left: -12rem; }
.ambient--two { right: -13rem; bottom: -14rem; }

.invitation-card {
  position: relative;
  width: min(94vw, 720px);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #efe2cf url("assets/invitation-bg.webp") center / cover no-repeat;
  box-shadow: var(--shadow), 0 0 0 1px rgba(210, 168, 101, .2);
  animation: card-arrive 1.1s cubic-bezier(.16,.84,.26,1) both;
}

.invitation-card__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 29% 14% 7%;
  color: var(--ink);
  text-align: center;
}

.invitation-card__header { width: 100%; }

.overline {
  margin: 0 0 1.2%;
  font-size: clamp(0.63rem, 2.2vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.31em;
  line-height: 1.25;
  text-transform: uppercase;
}

.invitation-card h2 {
  margin: 0;
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(2.9rem, 13.2vw, 5.8rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.07em;
}

.ornament, .closing-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 1.3% auto 2.4%;
}

.ornament span, .closing-ornament span { width: 16%; height: 1px; background: currentColor; opacity: .6; }
.ornament b { font: 400 clamp(0.8rem, 3vw, 1.25rem)/1 serif; }

.message {
  margin: 0;
  font-size: clamp(0.6rem, 2.15vw, 1.12rem);
  font-weight: 600;
  letter-spacing: 0.23em;
  line-height: 1.65;
  text-transform: uppercase;
}

.event-details {
  display: grid;
  gap: clamp(0.55rem, 2.7vw, 1.4rem);
  width: 76%;
  margin: 5.5% 0 2%;
}

.event-detail { display: grid; grid-template-columns: 2.6rem 1fr; column-gap: clamp(0.45rem, 2vw, 1rem); text-align: left; }
.event-detail dt { display: contents; }
.event-detail dt svg { grid-row: span 2; align-self: center; width: clamp(1.75rem, 6vw, 3.2rem); fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.event-detail dt span { align-self: end; font-size: clamp(0.55rem, 2vw, 1rem); font-weight: 700; letter-spacing: .24em; line-height: 1.1; text-transform: uppercase; }
.event-detail dd { align-self: start; margin: .15em 0 0; font-size: clamp(0.98rem, 4.2vw, 2rem); font-style: italic; line-height: 1.1; white-space: nowrap; }

.closing-ornament { width: 66%; margin: 2.2% auto 2.6%; }
.closing-ornament span { width: 36%; }
.closing-ornament b { color: #a26d2e; font-size: clamp(.75rem, 3vw, 1.35rem); }

.rsvp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 44px;
  padding: clamp(.65rem, 2vw, .9rem) clamp(1rem, 4vw, 1.75rem);
  border: 1px solid rgba(110, 14, 28, .45);
  border-radius: 999px;
  color: #f9ecdb;
  background: linear-gradient(135deg, #5f0b19, #85192a);
  box-shadow: 0 10px 24px rgba(75, 7, 17, .24), inset 0 1px rgba(255,255,255,.14);
  font-size: clamp(.68rem, 2.15vw, 1.02rem);
  font-weight: 700;
  letter-spacing: .15em;
  line-height: 1.15;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .25s ease, box-shadow .25s ease;
}
.rsvp-button:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(75, 7, 17, .3); }
.rsvp-button svg { width: clamp(1.1rem, 4vw, 1.45rem); fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }

.whatsapp-note { position: relative; margin: 0; color: rgba(245, 226, 204, .62); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }

@keyframes invitation-pulse { 0%,100% { box-shadow: 0 12px 34px rgba(0,0,0,.34), 0 0 0 0 rgba(212, 167, 99, .2); } 50% { box-shadow: 0 12px 34px rgba(0,0,0,.34), 0 0 0 9px rgba(212, 167, 99, 0); } }
@keyframes content-away { to { opacity: 0; transform: translateY(18px); } }
@keyframes card-arrive { from { opacity: 0; transform: translateY(38px) scale(.965); filter: blur(4px); } to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }

@media (max-aspect-ratio: 3/4) {
  .opening__image { inset: 0; background-size: auto 100%; background-position: 51% center; }
}

@media (min-width: 580px) {
  .event-detail { grid-template-columns: 3.5rem 1fr; }
}

@media (max-width: 380px) {
  .invitation-card__content { padding-inline: 12.5%; }
  .event-details { width: 82%; gap: .5rem; }
  .event-detail { grid-template-columns: 2.25rem 1fr; }
  .rsvp-button { letter-spacing: .11em; }
}

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