:root {
  --wine: #681b2c;
  --wine-dark: #3c0b16;
  --rose: #b76776;
  --blush: #ecd0ca;
  --blush-light: #f8e9e3;
  --ivory: #fff8ef;
  --paper: #f5e6dc;
  --gold: #ad7f4a;
  --gold-light: #e3c497;
  --sage: #74806b;
  --ink: #522a30;
  --shadow: rgba(70, 17, 28, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.story { position: relative; overflow: clip; }
.scene {
  min-height: 100svh;
  padding: max(68px, env(safe-area-inset-top)) 22px max(62px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.content {
  width: min(760px, 90vw);
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.content.narrow { width: min(630px, 88vw); }

.hero-scene,
.final-scene {
  color: var(--wine);
  background: var(--blush-light) url("/assets/hero-arch.webp") center/cover no-repeat;
}
.hero-shade,
.final-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,248,239,.42), rgba(255,248,239,.08) 52%, rgba(70,17,28,.05));
}
.hero-content { transform: translateY(-4vh); }
.bismillah {
  margin: 0 0 22px;
  color: var(--gold);
  font-size: clamp(18px, 4.4vw, 31px);
  font-style: italic;
  text-shadow: 0 1px rgba(255,255,255,.75);
}
.eyebrow {
  margin: 0 0 20px;
  color: var(--wine);
  letter-spacing: .27em;
  font: 700 clamp(10px, 2.6vw, 14px)/1.4 Arial, sans-serif;
}
.names {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--wine);
  font-family: "Segoe Script", "Brush Script MT", "URW Chancery L", cursive;
  font-size: clamp(52px, 14vw, 100px);
  font-weight: 400;
  line-height: .95;
  text-shadow: 0 2px 22px rgba(255,248,239,.7);
}
.names i { margin: 10px 0; color: var(--gold); font-size: .48em; }
.ornament { width: min(390px, 74vw); display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--gold); }
.ornament i { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament i:last-child { transform: rotate(180deg); }
.ornament b { font-size: 13px; }
.date-card {
  min-width: min(440px, 84vw);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--wine);
  background: rgba(255,248,239,.79);
  border: 1px solid rgba(104,27,44,.38);
  border-radius: 24px 5px;
  box-shadow: inset 0 0 0 5px rgba(173,127,74,.08), 0 16px 45px var(--shadow);
  backdrop-filter: blur(7px);
}
.date-card strong { font: 700 clamp(16px, 4vw, 25px) Arial, sans-serif; letter-spacing: .07em; }
.date-card span { font-size: clamp(27px, 6vw, 41px); }

.paper-scene {
  background:
    linear-gradient(rgba(255,248,239,.78), rgba(255,248,239,.82)),
    url("/assets/hero-arch.webp") center/cover fixed;
}
.paper-scene::before,
.blush-scene::before {
  content: "";
  position: absolute;
  inset: 19px;
  border: 1px solid rgba(173,127,74,.45);
  border-radius: 34px 8px;
  pointer-events: none;
}
.paper-scene::after,
.blush-scene::after {
  content: "✦";
  position: absolute;
  top: 34px;
  left: 50%;
  color: var(--gold);
  transform: translateX(-50%);
  font-size: 13px;
}
.script-heading {
  margin: 0;
  color: var(--wine);
  font-family: "Segoe Script", "Brush Script MT", "URW Chancery L", cursive;
  font-size: clamp(39px, 10vw, 72px);
  font-weight: 400;
  line-height: 1.08;
}
.script-heading.small { font-size: clamp(31px, 7vw, 49px); }
.invitation-card {
  padding: clamp(24px, 5vw, 38px);
  color: #5c373b;
  background: rgba(255,250,245,.8);
  border: 1px solid rgba(104,27,44,.2);
  border-radius: 34px 8px;
  box-shadow: 0 18px 50px rgba(85,33,42,.12), inset 0 0 0 6px rgba(173,127,74,.06);
  backdrop-filter: blur(8px);
  font-size: clamp(17px, 4.1vw, 23px);
  line-height: 1.68;
}
.invitation-card p { margin: 0; }
.invitation-card .salaam { margin-bottom: 18px; color: var(--wine); font-size: 1.08em; font-weight: 700; letter-spacing: .04em; }
.invitation-card strong, .invitation-card b { color: var(--wine); }
.family-sign { margin: 28px 0 0; padding-top: 23px; width: min(480px, 82vw); border-top: 1px solid rgba(104,27,44,.25); color: #765158; font-size: clamp(15px, 3.7vw, 20px); line-height: 1.65; }
.family-sign strong { color: var(--wine); }

.blush-scene {
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.6), transparent 35%),
    radial-gradient(circle at 82% 82%, rgba(183,103,118,.15), transparent 34%),
    linear-gradient(145deg, #f8e7e1, #efd5d1 55%, #f8ebe4);
}
.blush-scene h2,
.location-scene h2,
.final-scene h2 {
  margin: 0;
  color: var(--wine);
  font-size: clamp(35px, 7.5vw, 62px);
  font-weight: 400;
  line-height: 1.15;
}
.countdown {
  width: min(620px, 90vw);
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,248,239,.72);
  border: 1px solid rgba(104,27,44,.25);
  border-radius: 28px 7px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(85,33,42,.12);
}
.countdown div { padding: 19px 7px; border-right: 1px solid rgba(104,27,44,.16); }
.countdown div:last-child { border: 0; }
.countdown strong { display: block; color: var(--wine); font-size: clamp(27px, 7vw, 45px); font-weight: 400; }
.countdown span { display: block; margin-top: 7px; color: var(--sage); font: 700 9px Arial, sans-serif; letter-spacing: .12em; }
.event-card {
  width: min(580px, 88vw);
  margin-top: 34px;
  padding: 25px 28px 30px;
  background: rgba(255,248,239,.64);
  border: 1px solid rgba(173,127,74,.44);
  border-radius: 8px 32px;
}
.event-line { margin-top: 24px; display: grid; grid-template-columns: 90px 36px 1fr; align-items: center; text-align: left; }
.event-line time { color: var(--wine); font-size: clamp(27px, 6vw, 38px); }
.event-line > span { width: 11px; height: 11px; justify-self: center; background: var(--rose); border-radius: 50% 50% 50% 8px; transform: rotate(-45deg); box-shadow: 0 0 0 7px rgba(183,103,118,.13); }
.event-line strong { color: var(--wine); font-size: clamp(20px, 4.5vw, 28px); font-weight: 400; }
.event-line small { color: #7f6265; font-size: .67em; font-weight: 400; }

.location-scene h2 span { font-family: "Segoe Script", "Brush Script MT", cursive; font-size: .78em; }
.pin { width: 105px; height: 105px; margin-bottom: 24px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; background: rgba(255,248,239,.78); box-shadow: 0 0 0 9px rgba(173,127,74,.08); }
.pin i { width: 43px; height: 54px; position: relative; background: var(--wine); border-radius: 50% 50% 50% 7px; transform: rotate(-45deg); }
.pin i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 12px; top: 12px; background: var(--ivory); border-radius: 50%; }
.address { margin: 22px 0 0; color: #75545a; font-size: clamp(20px, 4.7vw, 29px); }
.primary-button {
  min-width: 260px;
  min-height: 56px;
  margin-top: 28px;
  padding: 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ivory);
  background: linear-gradient(135deg, var(--rose), var(--wine-dark));
  border: 1px solid rgba(255,248,239,.35);
  border-radius: 999px;
  box-shadow: 0 14px 35px rgba(73,12,25,.28);
  letter-spacing: .1em;
  font: 700 11px Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.primary-button span { font-size: 18px; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(73,12,25,.34); }
.qr-card { margin-top: 25px; padding: 15px 17px 11px; background: rgba(255,255,255,.77); border: 1px solid rgba(173,127,74,.48); border-radius: 26px 7px; box-shadow: 0 12px 30px rgba(85,33,42,.1); }
.qr-card img { display: block; width: 168px; height: 168px; }
.qr-card p { margin: 6px 0 0; color: #75545a; font: 700 9px Arial, sans-serif; letter-spacing: .05em; }

.final-scene .content { transform: translateY(-1vh); }
.final-scene h2 { font-size: clamp(30px, 6.6vw, 49px); line-height: 1.32; }
.final-date { margin: 28px 0 0; color: #74535a; font: 700 11px Arial, sans-serif; letter-spacing: .11em; }
.share-button { margin-top: 28px; }
.monogram { margin: 30px 0 0; color: var(--wine); font-size: clamp(46px, 10vw, 72px); font-style: italic; }
.monogram i { color: var(--gold); font-size: .62em; }
.brand-note { margin: 17px 0 0; color: var(--gold); font: 700 9px Arial, sans-serif; letter-spacing: .18em; }

.down-arrow {
  width: 47px;
  height: 47px;
  margin-top: 28px;
  display: grid;
  place-items: center;
  color: var(--wine);
  border: 1px solid rgba(104,27,44,.48);
  border-radius: 50%;
  font-size: 25px;
  text-decoration: none;
  animation: bob 1.8s ease-in-out infinite;
}
.music-button {
  position: fixed;
  z-index: 30;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  min-width: 82px;
  height: 41px;
  padding: 0 13px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ivory);
  background: rgba(73,12,25,.82);
  border: 1px solid rgba(255,248,239,.35);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(57,8,18,.23);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.music-button.show { display: flex; }
.music-button span { font-size: 19px; }
.music-button b { font: 700 9px Arial, sans-serif; letter-spacing: .06em; }
.music-button.playing span { animation: note 1.5s ease-in-out infinite; }
.section-nav { position: fixed; z-index: 25; right: 15px; top: 50%; display: none; flex-direction: column; gap: 10px; transform: translateY(-50%); }
.section-nav.show { display: flex; }
.section-nav a { width: 9px; height: 9px; background: rgba(104,27,44,.3); border: 1px solid rgba(255,248,239,.76); border-radius: 50%; box-shadow: 0 2px 8px rgba(65,10,21,.22); }
.section-nav a.active { background: var(--wine); transform: scale(1.35); }

.gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #e7c8c3;
  perspective: 1600px;
}
.gate-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--wine);
  text-align: center;
  background: linear-gradient(rgba(255,248,239,.39), rgba(255,248,239,.24)), url("/assets/hero-arch.webp") center/cover;
}
.gate-reveal span { font: 700 11px Arial, sans-serif; letter-spacing: .27em; }
.gate-reveal strong { width: min(500px, 84vw); font-family: "Segoe Script", "Brush Script MT", cursive; font-size: clamp(44px, 11vw, 82px); font-weight: 400; line-height: 1.08; }
.gate-reveal small { padding: 12px 18px; background: rgba(255,248,239,.7); border: 1px solid rgba(104,27,44,.28); font: 700 12px Arial, sans-serif; letter-spacing: .12em; }
.envelope-panel {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 50.2%;
  background-image: url("/assets/envelope.webp");
  background-size: 200% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 22px rgba(62,16,25,.26));
  transition: transform 3.6s cubic-bezier(.72,.02,.25,1);
}
.envelope-left { left: 0; background-position: left center; transform-origin: left center; }
.envelope-right { right: 0; background-position: right center; transform-origin: right center; }
.gate.opening .envelope-left { transform: rotateY(-84deg) translateX(-18%); }
.gate.opening .envelope-right { transform: rotateY(84deg) translateX(18%); }
.gate-vignette { position: absolute; z-index: 4; inset: 0; background: radial-gradient(circle at 50% 55%, transparent 0 13%, rgba(64,12,24,.13) 70%, rgba(50,7,16,.3)); transition: opacity 1.4s 1s; pointer-events: none; }
.gate.opening .gate-vignette { opacity: 0; }
.seal-button {
  position: absolute;
  z-index: 7;
  top: 58%;
  left: 50%;
  width: 195px;
  height: 205px;
  padding: 0;
  color: var(--ivory);
  background: transparent;
  border: 0;
  transform: translate(-50%, -50%);
  transition: opacity .55s, transform .8s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}
.wax-seal {
  width: 154px;
  height: 154px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--gold-light);
  background: radial-gradient(circle at 37% 31%, #a54355, var(--wine) 48%, var(--wine-dark) 82%);
  border: 8px ridge #8f3043;
  border-radius: 45% 52% 48% 55%;
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 7px var(--wine-dark), 0 17px 28px rgba(59,6,17,.43);
  animation: sealPulse 2.3s ease-in-out infinite;
}
.wax-seal b { font-size: 42px; font-weight: 400; font-style: italic; }
.wax-seal i { color: var(--ivory); font-size: 25px; }
.open-label { display: block; margin-top: 10px; color: var(--ivory); text-shadow: 0 2px 10px var(--wine-dark); font: 700 10px Arial, sans-serif; letter-spacing: .16em; }
.gate.unsealed .seal-button { opacity: 0; pointer-events: none; transform: translate(-50%, -43%) scale(.58) rotate(7deg); }
.gate-hint { position: absolute; z-index: 7; bottom: max(28px, env(safe-area-inset-bottom)); margin: 0; color: var(--wine); font: 700 9px Arial, sans-serif; letter-spacing: .2em; text-transform: uppercase; transition: opacity .35s; }
.gate.unsealed .gate-hint { opacity: 0; }
.gate.done { display: none; }

.petals { position: fixed; z-index: 12; inset: 0; pointer-events: none; overflow: hidden; }
.petal { position: absolute; top: -8vh; width: 10px; height: 15px; opacity: .48; background: linear-gradient(145deg, #f9d9d8, #b76776); border-radius: 70% 30% 65% 35%; animation: petalFall linear infinite; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: 86vw; padding: 13px 21px; color: var(--ivory); background: rgba(73,12,25,.92); border: 1px solid rgba(255,248,239,.36); border-radius: 999px; box-shadow: 0 14px 38px rgba(0,0,0,.25); font: 700 11px Arial, sans-serif; text-align: center; transform: translate(-50%, 130%); transition: transform .35s ease; }
.toast.show { transform: translate(-50%, 0); }

.reveal .content,
.content.reveal { opacity: 0; transform: translateY(42px); transition: opacity 1s ease, transform 1s cubic-bezier(.2,.8,.2,1); }
.reveal.visible .content,
.content.reveal.visible { opacity: 1; transform: none; }

@keyframes bob { 50% { transform: translateY(7px); } }
@keyframes note { 50% { color: #fff; transform: scale(1.2); } }
@keyframes sealPulse { 50% { transform: scale(1.045) rotate(-1deg); box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 7px var(--wine-dark), 0 20px 33px rgba(59,6,17,.52); } }
@keyframes petalFall { to { transform: translate3d(var(--drift), 112vh, 0) rotate(560deg); } }

@media (max-width: 520px) {
  .scene { padding-inline: 18px; }
  .hero-content { transform: translateY(-2vh); }
  .countdown { grid-template-columns: repeat(2, 1fr); }
  .countdown div:nth-child(2) { border-right: 0; }
  .countdown div:nth-child(-n + 2) { border-bottom: 1px solid rgba(104,27,44,.16); }
  .section-nav { display: none !important; }
  .qr-card img { width: 145px; height: 145px; }
  .event-line { grid-template-columns: 77px 28px 1fr; }
  .seal-button { top: 59%; }
}

@media (min-width: 900px) {
  .scene { min-height: 930px; }
  .gate { background: #e8cec8; }
  .envelope-panel { max-width: 500px; }
  .envelope-left { left: calc(50% - 500px); }
  .envelope-right { right: calc(50% - 500px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .gate.opening .envelope-left { transform: translateX(-110%); }
  .gate.opening .envelope-right { transform: translateX(110%); }
}
