:root {
  --ink: #2f261f;
  --muted: #76695e;
  --cream: #fff8ec;
  --paper: rgba(255, 250, 241, .82);
  --rose: #b76476;
  --wine: #693244;
  --gold: #d9b467;
  --gold-deep: #a87325;
  --gold-light: #f7d98d;
  --sage: #758b78;
  --sky: #dce8e7;
  --shadow: 0 28px 90px rgba(60, 42, 28, .18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(217,180,103,.28), transparent 26%),
    radial-gradient(circle at 95% 20%, rgba(183,100,118,.16), transparent 26%),
    linear-gradient(145deg, #fff8ec 0%, #eef3ef 44%, #fbefe8 100%);
  font-family: Georgia, "Times New Roman", serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(105,50,68,.035) 1px, transparent 1px),
    linear-gradient(rgba(105,50,68,.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 78%);
}

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

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

.floating-petals span {
  position: absolute;
  top: -12vh;
  width: 10px;
  height: 16px;
  border-radius: 999px 999px 999px 0;
  background: rgba(255,255,255,.72);
  box-shadow: 0 0 18px rgba(255,255,255,.38);
  animation: petalRain 14s linear infinite;
}

.floating-petals span:nth-child(1) { left: 4%; animation-delay: 0s; animation-duration: 13s; }
.floating-petals span:nth-child(2) { left: 13%; animation-delay: 2.2s; animation-duration: 16s; }
.floating-petals span:nth-child(3) { left: 23%; animation-delay: 4.1s; animation-duration: 12s; }
.floating-petals span:nth-child(4) { left: 35%; animation-delay: 1.4s; animation-duration: 17s; }
.floating-petals span:nth-child(5) { left: 46%; animation-delay: 5.2s; animation-duration: 14s; }
.floating-petals span:nth-child(6) { left: 56%; animation-delay: 3s; animation-duration: 18s; }
.floating-petals span:nth-child(7) { left: 66%; animation-delay: .8s; animation-duration: 13.5s; }
.floating-petals span:nth-child(8) { left: 74%; animation-delay: 6s; animation-duration: 16.5s; }
.floating-petals span:nth-child(9) { left: 82%; animation-delay: 2.8s; animation-duration: 12.8s; }
.floating-petals span:nth-child(10) { left: 91%; animation-delay: 4.8s; animation-duration: 15s; }
.floating-petals span:nth-child(11) { left: 97%; animation-delay: 7s; animation-duration: 18s; }
.floating-petals span:nth-child(12) { left: 29%; animation-delay: 8.2s; animation-duration: 19s; }

.open-stage {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fff7eb, #eadbc6 58%, #d7b982);
  overflow: hidden;
  transition: opacity .75s ease, visibility .75s ease;
}

.open-stage.is-finished {
  opacity: 0;
  visibility: hidden;
}

.open-stage::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transform: scale(.72);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,252,244,.98), rgba(248,235,216,.96) 62%, rgba(255,248,236,.9));
  box-shadow: inset 0 0 110px rgba(217,180,103,.22);
}

.petal-field span {
  position: absolute;
  width: 12px;
  height: 18px;
  border-radius: 999px 999px 999px 0;
  background: rgba(255,255,255,.76);
  animation: petalFloat 3.5s ease-in-out infinite;
}

.petal-field span:nth-child(1) { left: 12%; top: 28%; animation-delay: .1s; }
.petal-field span:nth-child(2) { left: 24%; top: 64%; animation-delay: .6s; }
.petal-field span:nth-child(3) { right: 18%; top: 22%; animation-delay: .25s; }
.petal-field span:nth-child(4) { right: 12%; bottom: 20%; animation-delay: .9s; }
.petal-field span:nth-child(5) { left: 48%; top: 12%; animation-delay: 1.1s; }

.envelope-opener {
  width: min(430px, 86vw);
  aspect-ratio: 1.22;
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 1400px;
  filter: drop-shadow(0 30px 70px rgba(75,44,21,.26));
}

.envelope-wrap,
.letter-sheet,
.envelope-back,
.envelope-front,
.envelope-flap,
.envelope-letter-shadow {
  position: absolute;
  inset: 0;
  border-radius: 18px;
}

.envelope-wrap {
  z-index: 3;
  transform-style: preserve-3d;
  transition: transform .45s ease;
}

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

.envelope-back {
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.52), transparent 30%),
    linear-gradient(145deg, #e8c998, #c89f62);
  border: 1px solid rgba(255,255,255,.56);
}

.envelope-front {
  z-index: 5;
  clip-path: polygon(0 34%, 50% 72%, 100% 34%, 100% 100%, 0 100%);
  background:
    linear-gradient(160deg, rgba(255,255,255,.28), transparent 38%),
    linear-gradient(145deg, #dab982, #f0d3a7 48%, #c79a58);
}

.envelope-flap {
  z-index: 6;
  clip-path: polygon(0 0, 50% 58%, 100% 0);
  background:
    linear-gradient(180deg, rgba(255,255,255,.34), transparent 34%),
    linear-gradient(145deg, #f1d6aa, #c79a58);
  transform-origin: top center;
}

.envelope-letter-shadow {
  z-index: 2;
  inset: 18% 9% 20%;
  background: rgba(80, 50, 28, .16);
  filter: blur(18px);
}

.envelope-seal {
  position: absolute;
  left: 50%;
  top: 47%;
  z-index: 8;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  color: var(--cream);
  background: radial-gradient(circle, #b76476, #693244);
  font-weight: 700;
  box-shadow: 0 16px 42px rgba(105,50,68,.28);
}

.letter-sheet {
  z-index: 4;
  width: 76%;
  height: 78%;
  inset: auto 12% 15%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--wine);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.78), transparent 32%),
    linear-gradient(180deg, #fffaf0, #f7ebd8);
  border: 1px solid rgba(105,50,68,.12);
  box-shadow: 0 18px 52px rgba(75,44,21,.18);
  transform: translateY(30%) scale(.82);
  opacity: 0;
}

.letter-sheet span {
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 700;
}

.letter-sheet small {
  color: var(--muted);
  letter-spacing: .12em;
}

.open-hint {
  position: absolute;
  left: 50%;
  bottom: -64px;
  z-index: 8;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  transform: translateX(-50%);
  padding: 0 18px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(255,255,255,.52);
  border: 1px solid rgba(255,255,255,.56);
  backdrop-filter: blur(16px) saturate(1.24);
  white-space: nowrap;
  font-weight: 700;
}

.open-stage.is-opening .envelope-flap {
  animation: envelopeFlapOpen .8s cubic-bezier(.2,.7,.2,1) forwards;
}

.open-stage.is-opening .envelope-seal {
  animation: sealBreak .42s ease forwards;
}

.open-stage.is-opening .letter-sheet {
  animation: letterRiseClean 1.8s cubic-bezier(.18,.82,.2,1) .38s forwards;
}

.open-stage.is-opening .envelope-wrap {
  animation: envelopeDrop .9s ease 1.45s forwards;
}

.open-stage.is-opening .open-hint {
  opacity: 0;
}

.open-stage.is-opening::after {
  animation: pageWash 1.25s ease 1.85s forwards;
}

.wed-page {
  width: min(1180px, calc(100% - 22px));
  margin: 0 auto;
  padding: 14px 0 64px;
  opacity: 0;
  transform: translateY(18px);
}

body.invitation-open .wed-page {
  animation: pageIn .8s ease forwards;
}

.hero {
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 16px;
  align-items: stretch;
}

.hero-media,
.hero-card,
.countdown-card,
.quick-info article,
.schedule,
.rsvp-card,
.final-card {
  border: 1px solid rgba(255,255,255,.58);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.72), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.66), rgba(255,248,236,.34));
  backdrop-filter: blur(18px) saturate(1.24);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.countdown-card {
  margin: 18px 0;
  padding: clamp(24px, 5vw, 52px);
  text-align: center;
  position: relative;
}

.countdown-card::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(217,180,103,.30);
  border-radius: 18px;
  pointer-events: none;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.countdown div {
  min-height: 112px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 0%, rgba(255,255,255,.72), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,.54), rgba(255,248,236,.28));
  border: 1px solid rgba(255,255,255,.48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 16px 38px rgba(60,42,28,.1);
}

.countdown strong {
  color: var(--wine);
  font-size: clamp(2rem, 7vw, 3.8rem);
  line-height: .9;
}

.countdown span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: .72rem;
}

.hero-media img {
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  object-position: center;
}

.hero-card {
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: clamp(26px, 5vw, 58px);
  position: relative;
}

.hero-card::after,
.schedule::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(217,180,103,.34);
  border-radius: 18px;
  pointer-events: none;
}

.overline,
.script {
  color: var(--rose);
  margin: 0 0 10px;
  font-style: italic;
}

.overline {
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .84rem;
  font-style: normal;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin: 0 0 14px;
  color: var(--gold-deep);
  font-size: clamp(3.2rem, 11vw, 8.3rem);
  line-height: .86;
}

h1 span { color: var(--gold); }

.gold-name,
.gold-text,
.wedding-timeline .primary span {
  background: linear-gradient(135deg, var(--gold-deep), var(--gold-light) 46%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  text-shadow: 0 10px 34px rgba(168,115,37,.18);
}

.hero-card h1 {
  filter: drop-shadow(0 14px 30px rgba(168,115,37,.16));
}

h2 {
  margin-bottom: 14px;
  color: var(--wine);
  font-size: clamp(2.1rem, 6vw, 4.8rem);
  line-height: .94;
}

.date-pill {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(217,180,103,.22);
  border: 1px solid rgba(217,180,103,.38);
  font-weight: 700;
  letter-spacing: .08em;
}

.lead,
.story-text p,
.final-card p {
  color: var(--muted);
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  line-height: 1.65;
}

.quick-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.quick-info article {
  min-height: 180px;
  padding: 22px;
  display: grid;
  align-content: center;
  text-align: center;
}

.quick-info .accent {
  background: linear-gradient(145deg, rgba(105,50,68,.92), rgba(183,100,118,.76));
  color: var(--cream);
}

.quick-info span {
  color: var(--rose);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .78rem;
}

.quick-info .accent span,
.quick-info .accent p { color: rgba(255,248,236,.84); }

.quick-info strong {
  margin: 8px 0;
  color: var(--wine);
  font-size: 2.4rem;
}

.quick-info .accent strong { color: var(--cream); }

.quick-info p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.map-link,
.inline-link,
.phone-actions a {
  text-decoration: none;
}

.map-link {
  width: fit-content;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  margin: 14px auto 0;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(217,180,103,.22);
  border: 1px solid rgba(217,180,103,.38);
  font-weight: 700;
}

.accent .map-link {
  color: var(--cream);
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.28);
}

.split-story {
  display: grid;
  grid-template-columns: minmax(290px, .85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: center;
  margin: 24px 0;
}

.story-text {
  padding: clamp(18px, 4vw, 42px);
}

.stacked-photos {
  min-height: 560px;
  position: relative;
}

.stacked-photos img {
  position: absolute;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.photo-a {
  width: 72%;
  height: 62%;
  left: 0;
  top: 0;
  transform: rotate(-2deg);
}

.photo-b {
  width: 68%;
  height: 62%;
  right: 0;
  bottom: 0;
  transform: rotate(2deg);
}

.schedule {
  margin: 18px 0;
  padding: clamp(24px, 5vw, 54px);
  text-align: center;
  position: relative;
}

.wedding-timeline {
  width: min(860px, 100%);
  display: grid;
  gap: 18px;
  margin: 28px auto 0;
  position: relative;
}

.wedding-timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, transparent, rgba(217,180,103,.72), rgba(183,100,118,.55), transparent);
}

.wedding-timeline article {
  width: calc(50% + 1px);
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,.74), transparent 38%),
    linear-gradient(145deg, rgba(255,255,255,.62), rgba(255,248,236,.34));
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 18px 48px rgba(60,42,28,.12);
  text-align: left;
  position: relative;
}

.wedding-timeline article:nth-child(odd) {
  justify-self: start;
}

.wedding-timeline article:nth-child(even) {
  justify-self: end;
}

.wedding-timeline article::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(217,180,103,.16);
}

.wedding-timeline article:nth-child(odd)::after {
  right: -8px;
}

.wedding-timeline article:nth-child(even)::after {
  left: -8px;
}

.wedding-timeline .primary {
  background: linear-gradient(145deg, rgba(105,50,68,.94), rgba(183,100,118,.78));
  color: var(--cream);
}

.wedding-timeline time {
  color: var(--rose);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
}

.wedding-timeline .primary time,
.wedding-timeline .primary span,
.wedding-timeline .primary p {
  color: var(--cream);
}

.wedding-timeline span {
  display: block;
  color: var(--wine);
  font-weight: 700;
  font-size: 1.1rem;
}

.wedding-timeline p {
  margin: 6px 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.inline-link {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(217,180,103,.2);
  border: 1px solid rgba(217,180,103,.34);
  font-weight: 700;
  white-space: nowrap;
}

.rsvp-card {
  margin: 24px 0;
  padding: clamp(24px, 5vw, 52px);
  text-align: center;
}

.phone-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.phone-actions a {
  min-height: 118px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 20px;
  color: var(--cream);
  background: linear-gradient(145deg, rgba(105,50,68,.94), rgba(183,100,118,.78));
  box-shadow: 0 18px 48px rgba(105,50,68,.18);
}

.phone-actions span {
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .78rem;
  opacity: .86;
}

.phone-actions strong {
  font-size: clamp(1.25rem, 4vw, 1.7rem);
}

.moments {
  display: grid;
  grid-template-columns: .8fr 1.15fr .8fr;
  gap: 14px;
  margin: 24px 0;
  align-items: center;
}

.moments img {
  height: clamp(220px, 34vw, 420px);
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.moments img:nth-child(2) {
  height: clamp(280px, 42vw, 560px);
}

.final-card {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(0, 1.18fr);
  gap: 16px;
  align-items: center;
  padding: 18px;
}

.final-card div {
  padding: clamp(16px, 4vw, 36px);
}

.final-card img {
  height: min(58vw, 560px);
  min-height: 320px;
  object-fit: cover;
  border-radius: 18px;
}

.reveal {
  opacity: 0;
  transform: translateY(28px) scale(.985);
  transition: opacity .8s ease, transform .8s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.delay-1 { transition-delay: .12s; }
.delay-2 { transition-delay: .22s; }

@keyframes envelopeFlapOpen {
  0% { transform: rotateX(0); }
  100% { transform: rotateX(178deg); z-index: 1; }
}

@keyframes sealBreak {
  to { opacity: 0; transform: translate(-50%, -50%) scale(.38); }
}

@keyframes letterRiseClean {
  0% {
    opacity: 0;
    transform: translateY(30%) scale(.82);
    border-radius: 18px;
  }
  24% {
    opacity: 1;
    transform: translateY(-34%) scale(.92);
  }
  70% {
    opacity: 1;
    transform: translateY(-64%) scale(1.02);
    border-radius: 18px;
  }
  100% {
    opacity: 0;
    transform: translateY(-78%) scale(1.08);
    border-radius: 18px;
  }
}

@keyframes pageWash {
  0% {
    opacity: 0;
    transform: scale(.72);
    border-radius: 34px;
  }
  42% {
    opacity: 1;
    transform: scale(1);
    border-radius: 0;
  }
  100% {
    opacity: 0;
    transform: scale(1.05);
    border-radius: 0;
  }
}

@keyframes envelopeDrop {
  to { opacity: 0; transform: translateY(38%) scale(.72); }
}

@keyframes stageGone {
  to { opacity: 0; visibility: hidden; }
}

@keyframes pageIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes captionFade {
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes petalFloat {
  50% { transform: translate3d(22px, -26px, 0) rotate(28deg); }
}

@keyframes petalRain {
  0% { transform: translate3d(-10px, -10vh, 0) rotate(0deg); opacity: 0; }
  10% { opacity: .9; }
  50% { transform: translate3d(36px, 52vh, 0) rotate(130deg); }
  90% { opacity: .75; }
  100% { transform: translate3d(-24px, 112vh, 0) rotate(280deg); opacity: 0; }
}

@media (max-width: 860px) {
  .wed-page {
    width: min(100% - 12px, 1180px);
    padding-top: 6px;
  }

  .hero,
  .quick-info,
  .split-story,
  .moments,
  .final-card {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-media {
    border-radius: 24px 24px 14px 14px;
  }

  .hero-media img {
    min-height: 0;
    height: min(72vh, 560px);
  }

  .hero-card {
    padding: 28px 18px 34px;
  }

  .quick-info article {
    min-height: 136px;
    padding: 18px;
  }

  .stacked-photos {
    min-height: 0;
    display: grid;
    gap: 12px;
  }

  .stacked-photos img {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: 1.42;
    transform: none;
  }

  .phone-actions {
    grid-template-columns: 1fr;
  }

  .countdown {
    grid-template-columns: repeat(2, 1fr);
  }

  .countdown div {
    min-height: 94px;
  }

  .wedding-timeline::before {
    left: 18px;
  }

  .wedding-timeline article,
  .wedding-timeline article:nth-child(odd),
  .wedding-timeline article:nth-child(even) {
    width: 100%;
    justify-self: stretch;
    grid-template-columns: 82px 1fr;
    padding-left: 38px;
  }

  .wedding-timeline article::after,
  .wedding-timeline article:nth-child(odd)::after,
  .wedding-timeline article:nth-child(even)::after {
    left: 11px;
    right: auto;
  }

  .moments img,
  .moments img:nth-child(2),
  .final-card img {
    height: auto;
    min-height: 0;
    aspect-ratio: 1.28;
  }

@media (max-width: 420px) {
  h1 { font-size: clamp(3rem, 18vw, 5rem); }
  .lead, .story-text p, .final-card p { font-size: 1rem; }
}

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

  .open-stage { display: none; }
  .wed-page, .reveal { opacity: 1; transform: none; }
}
