:root {
  --burgundy: #6e1020;
  --burgundy-deep: #4a0a14;
  --burgundy-ink: #5b0e1b;
  --cream: #f6efe4;
  --cream-2: #efe4d3;
  --ivory: #f5e9d4;
  --sage: #8a9a5b;
  --ink: #4b3431;
  --muted: #8a716b;

  /* Envelope width drives every measurement in the scene */
  --w: min(78vw, 440px, calc((100svh - 330px) / 1.25));
  --h: calc(var(--w) * 0.6);

  --script: "Pinyon Script", cursive;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sc: "Cormorant SC", "Cormorant Garamond", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
p, h2, h3 { text-wrap: balance; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
main { overflow-x: hidden; overflow-x: clip; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100svh;
}
body.is-locked { overflow: hidden; height: 100svh; touch-action: none; }
img { display: block; max-width: 100%; user-select: none; -webkit-user-drag: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ---------- Backgrounds ---------- */
.bg { position: fixed; inset: 0; z-index: -3; pointer-events: none; }
.bg--cream {
  background:
    radial-gradient(120% 70% at 50% 18%, #fbf6ee 0%, rgba(251,246,238,0) 60%),
    linear-gradient(180deg, #f7f0e5 0%, #f3eadc 100%);
}
.bg--burgundy {
  z-index: -2;
  background:
    radial-gradient(90% 60% at 50% 45%, #84182a 0%, #5e0d1a 45%, #3a0710 100%);
}
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Stage ---------- */
.stage {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: visible;
}

.intro {
  position: absolute;
  top: calc(50svh - var(--h) / 2 - 150px);
  left: 0; right: 0;
  text-align: center;
  color: var(--ivory);
  padding: 0 16px;
}
.intro__eyebrow {
  font-family: var(--sc);
  font-size: 15px;
  letter-spacing: .22em;
  opacity: .85;
}
.intro__names {
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(40px, 12vw, 54px);
  line-height: 1.25;
  margin-top: 4px;
}
.intro__names span { font-size: .8em; padding: 0 .06em; }

.scene {
  position: absolute;
  left: calc(50% - var(--w) / 2);
  top: calc(50svh - var(--h) / 2);
  width: var(--w);
  height: var(--h);
  will-change: transform;
}

/* ---------- Envelope ---------- */
.env {
  position: absolute; inset: 0;
  perspective: 1400px;
}
.env > * { position: absolute; }

.env__back {
  inset: 1.6% 1.5% 1.6% 1.2%;
  border-radius: 3px;
  background:
    linear-gradient(180deg, #2c050b 0%, #3f0811 35%, #5a0e19 100%);
  box-shadow:
    0 28px 40px -18px rgba(30, 4, 8, .55),
    0 10px 18px -8px rgba(30, 4, 8, .35);
}

.env__pocket {
  inset: 0; width: 100%; height: 100%;
  z-index: 4;
  filter: drop-shadow(0 -1.5px 2px rgba(35, 5, 10, .35));
  pointer-events: none;
}

.env__seal {
  z-index: 5;
  width: calc(var(--w) * .15);
  left: calc(50% - var(--w) * .075 + var(--w) * .005);
  top: calc(var(--w) * .31);
  filter: drop-shadow(0 3px 4px rgba(40, 6, 12, .45));
  opacity: 0;
}

/* Flap (3D): front shows lace + seal, back shows the damask liner */
.flap {
  inset: 0; width: 100%; height: 100%;
  z-index: 20;
  transform-origin: 50% .94%;
  transform-style: preserve-3d;
  will-change: transform;
}
.flap__face {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.flap__front { filter: drop-shadow(0 4px 5px rgba(30, 4, 8, .35)); }
.flap__back { transform: rotateX(180deg); visibility: hidden; }

/* Items tucked inside the envelope (clipped at the envelope's bottom edge) */
.env__items {
  inset: 0; z-index: 3;
  clip-path: inset(-300% -80% 1.5% -80%);
  visibility: hidden;
}
.item {
  position: absolute;
  will-change: transform, opacity;
}
.item > img { width: 100%; filter: drop-shadow(0 4px 6px rgba(60, 20, 20, .28)); }

.item--card  { left: calc(var(--w) * .36); top: calc(var(--w) * -.31); width: calc(var(--w) * .52); }
.item--frame { left: calc(var(--w) * .07); top: calc(var(--w) * -.26); width: calc(var(--w) * .38); }
.item--peony { left: calc(var(--w) * -.05); top: calc(var(--w) * -.15); width: calc(var(--w) * .22); }
.item--heart { left: calc(var(--w) * .25); top: calc(var(--w) * .035); width: calc(var(--w) * .45); }

.card__text {
  position: absolute;
  left: 12%; right: 12%; top: 13%; bottom: 30%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 8%;
  text-align: center;
  color: var(--burgundy);
}
.card__eyebrow {
  font-family: var(--sc);
  font-size: calc(var(--w) * .028);
  letter-spacing: .18em;
  color: #7d4a45;
  font-weight: 500;
  margin-bottom: calc(var(--w) * .02);
}
.card__name {
  font-family: var(--script);
  font-size: calc(var(--w) * .051);
  line-height: 1.2;
  white-space: nowrap;
  color: #5e0c1a;
  -webkit-text-stroke: .35px #5e0c1a;
}
.card__amp { font-family: var(--script); font-size: calc(var(--w) * .05); line-height: 1; color: #5e0c1a; }
.card__orn { font-size: calc(var(--w) * .03); margin-top: calc(var(--w) * .012); opacity: .8; }

.frame__photo {
  position: absolute;
  left: 23.1%; top: 19.7%; width: 53.8%; height: 61.3%;
  border-radius: 50%;
  overflow: hidden;
  background: #3b2a26;
}
.frame__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; filter: none; }
.item--frame > img:last-child { position: relative; }

.heart__text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-bottom: 12%;
  color: var(--burgundy);
}
.heart__date {
  font-family: var(--serif);
  font-weight: 500;
  font-size: calc(var(--w) * .058);
  letter-spacing: .04em;
}
.heart__orn { font-size: calc(var(--w) * .028); opacity: .75; margin-top: 2px; }

/* Bouquet sits in front of the envelope, like the reference */
.bouquet {
  z-index: 30;
  left: calc(var(--w) * .83);
  top: calc(var(--w) * -.08);
  width: calc(var(--w) * .32);
  transform-origin: 50% 20%;
  opacity: 0;
  pointer-events: none;
}
.bouquet img { width: 100%; filter: drop-shadow(0 6px 8px rgba(40, 30, 10, .3)); }

.seal-hit {
  inset: 0; width: 100%; height: 100%;
  z-index: 40;
  border-radius: 4px;
}
.seal-hit:focus-visible { outline: 1px solid rgba(245, 233, 212, .6); outline-offset: 6px; }

/* Glove hand holding the envelope */
.hand {
  position: absolute;
  z-index: 50;
  width: calc(var(--w) * 1.293);
  max-width: none;
  left: calc(var(--w) * -.07);
  top: calc(var(--w) * .19);
  pointer-events: none;
  filter: drop-shadow(-6px 14px 18px rgba(20, 2, 6, .45));
  -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent 97%);
  mask-image: linear-gradient(90deg, #000 78%, transparent 97%);
  will-change: transform;
}

/* Call to action */
.cta {
  position: absolute;
  left: 0; right: 0;
  top: calc(50svh + var(--h) / 2 + var(--w) * .42);
  display: flex; justify-content: center;
}
.cta__btn {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--ivory);
  padding: 10px 24px;
}
.cta__label {
  font-family: var(--sc);
  font-size: 17px;
  letter-spacing: .28em;
  padding-left: .28em;
  animation: breathe 2.6s ease-in-out infinite;
}
.cta__bar {
  position: relative;
  width: 120px; height: 1px;
  background: rgba(245, 233, 212, .22);
  overflow: hidden;
}
.cta__bar i {
  position: absolute; inset: 0;
  background: rgba(245, 233, 212, .85);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
@keyframes breathe { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }

.scroll-hint {
  position: absolute; bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--sc); font-size: 12px; letter-spacing: .3em; color: var(--muted);
  opacity: 0;
}
.scroll-hint i {
  width: 1px; height: 34px;
  background: linear-gradient(var(--muted), transparent);
  animation: drip 2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Details ---------- */
.details {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 24px 40px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.bismillah { margin-bottom: 30px; color: var(--burgundy); max-width: calc(var(--w) * .74); }
.bismillah__ar { font-family: "Amiri", serif; font-size: 26px; line-height: 1.7; }
.bismillah__en { font-size: 17px; font-style: italic; color: var(--ink); margin-top: 14px; }
.eyebrow {
  font-family: var(--sc);
  font-size: 15px;
  letter-spacing: .24em;
  color: var(--muted);
}
.lead {
  font-size: 19px;
  font-style: italic;
  color: var(--ink);
  margin-top: 10px;
  max-width: 360px;
  line-height: 1.4;
}
.person { margin-top: 30px; display: flex; flex-direction: column; align-items: center; }
.person__name {
  font-family: var(--script);
  font-weight: 400;
  color: var(--burgundy);
  font-size: clamp(40px, 12.5vw, 56px);
  line-height: 1.15;
  white-space: nowrap;
}
.person__rel {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--burgundy-ink);
  margin-top: 10px;
  line-height: 1.45;
  width: 100%;
  max-width: 400px;
}
.person__gp {
  font-size: 15.5px;
  font-style: italic;
  color: var(--ink);
  margin-top: 8px;
  line-height: 1.55;
  width: 100%;
  max-width: 400px;
}
.amp { font-family: var(--script); font-size: 40px; color: var(--sage); margin-top: 22px; line-height: 1; }
.insha { font-family: var(--sc); font-size: 15px; letter-spacing: .3em; color: var(--muted); margin-bottom: 12px; padding-left: .3em; }

.divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--burgundy); margin: 24px 0 30px;
}
.divider i { width: 64px; height: 1px; background: linear-gradient(90deg, transparent, rgba(110, 16, 32, .5)); }
.divider i:last-child { transform: scaleX(-1); }
.divider b { font-weight: 400; font-size: 18px; }

.date {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--burgundy);
}
.date__day { font-family: var(--sc); letter-spacing: .3em; font-size: 15px; padding-left: .3em; }
.date__big { display: flex; align-items: center; gap: 14px; }
.date__big em {
  font-style: normal; font-size: 64px; line-height: 1; font-weight: 500;
  padding: 0 16px;
  border-left: 1px solid rgba(110, 16, 32, .35);
  border-right: 1px solid rgba(110, 16, 32, .35);
}
.date__big small {
  font-family: var(--sc); font-size: 15px; letter-spacing: .22em; width: 96px;
}
.date__time { font-family: var(--sc); font-size: 17px; letter-spacing: .14em; color: var(--burgundy); margin-top: 10px; }

.countdown-wrap { margin-top: 54px; }
.countdown {
  display: flex; align-items: flex-start; justify-content: center; gap: 8px;
  margin: 14px 0 8px;
  color: var(--burgundy);
}
.countdown > div { display: flex; flex-direction: column; align-items: center; min-width: 54px; }
.countdown b {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.countdown span { font-family: var(--sc); font-size: 11px; letter-spacing: .18em; color: var(--muted); margin-top: 4px; }
.countdown em { font-style: normal; font-size: 24px; line-height: 1.3; opacity: .5; }

.venue { margin-top: 40px; display: flex; flex-direction: column; align-items: center; }
.venue__name {
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(36px, 10vw, 46px);
  color: var(--burgundy);
  margin-top: 10px;
  line-height: 1.2;
}
.venue__addr { font-size: 18px; margin-top: 6px; line-height: 1.45; max-width: 300px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 24px;
  padding: 15px 34px;
  border-radius: 999px;
  background: var(--burgundy);
  color: var(--ivory);
  font-family: var(--sc);
  font-size: 15px;
  letter-spacing: .2em;
  text-decoration: none;
  box-shadow: 0 10px 22px -10px rgba(74, 10, 20, .6), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .25s ease, box-shadow .25s ease;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn:active { transform: scale(.97); }
@media (hover: hover) { .btn:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -12px rgba(74, 10, 20, .7); } }
.sharing { margin-top: 48px; }
.sharing__names { font-size: 19px; line-height: 1.6; max-width: 340px; margin-left: auto; margin-right: auto; color: var(--burgundy); margin-top: 8px; font-weight: 500; }

.verse { margin-top: 64px; color: var(--burgundy); }
.verse__ar { font-family: "Amiri", serif; font-size: 30px; line-height: 1.6; }
.verse__en { font-size: 19px; font-style: italic; color: var(--ink); margin-top: 4px; }
.verse__ref { font-family: var(--sc); font-size: 12px; letter-spacing: .2em; color: var(--muted); margin-top: 6px; }

.closing { margin-top: 44px; font-size: 18px; line-height: 1.55; color: var(--ink); }

.footer {
  display: flex; flex-direction: column; align-items: center;
  padding: 30px 24px calc(80px + env(safe-area-inset-bottom));
  text-align: center;
}
.footer__seal { width: 70px; filter: drop-shadow(0 4px 6px rgba(60, 20, 20, .3)); }
.footer__with { font-family: var(--sc); letter-spacing: .28em; color: var(--muted); font-size: 13px; margin-top: 18px; }
.footer__names { font-family: var(--script); font-size: 38px; color: var(--burgundy); margin-top: 2px; }
.footer__group { font-family: var(--sc); font-size: 12px; letter-spacing: .22em; color: var(--muted); margin-top: 6px; }

.details, .footer { visibility: hidden; }
body.is-open .details, body.is-open .footer { visibility: visible; }

/* ---------- Larger screens (laptop / tablet preview) ---------- */
@media (min-width: 768px) {
  .details { max-width: 640px; padding-top: 0; }
  .intro__eyebrow { font-size: 17px; }
  .intro__names { font-size: 64px; }
  .bismillah__ar { font-size: 30px; }
  .bismillah__en, .lead { font-size: 21px; }
  .person__name { font-size: 62px; }
  .person__rel { font-size: 20px; max-width: 520px; }
  .person__gp { font-size: 18px; max-width: 520px; }
  .date__big em { font-size: 76px; }
  .countdown b { font-size: 36px; }
  .countdown > div { min-width: 72px; }
  .venue__name { font-size: 52px; }
  .closing { font-size: 20px; }
}
/* very short screens (landscape phones) */
@media (max-height: 520px) {
  :root { --w: min(60vw, 300px); }
  .intro { top: 14px; }
  .intro__names { font-size: 34px; }
  .cta { top: auto; bottom: 10px; }
}
/* narrow phones (iPhone SE / small Androids) */
@media (max-width: 360px) {
  .person__name { font-size: 40px; }
  .countdown { gap: 4px; }
  .countdown > div { min-width: 46px; }
  .countdown b { font-size: 26px; }
}
