/* ============================================================
   Amna & Adil — Nikkah Invitation
   Palette
   ------------------------------------------------------------ */
:root {
  --cream:      #f7f1e6;
  --cream-deep: #efe6d3;
  --paper:      #f6efe1;
  --gold:       #a98c54;        /* muted antique gold */
  --gold-soft:  #bda473;
  --gold-deep:  #8a6c34;
  --ink:        #5a503e;
  --ink-soft:   #7a6f59;
  --sage:       #9aa07a;
  --shadow:     rgba(74, 64, 40, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* keep the hidden attribute authoritative */

html, body { height: 100%; }

body {
  min-height: 100%;
  font-family: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% -10%, #fbf7ef 0%, #efe6d3 55%, #e3d7bf 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;          /* envelope + card stack in the same cell */
  perspective: 1600px;
  padding: 24px 14px;
}
.envelope-scene,
.card { grid-area: 1 / 1; }

/* ============================================================
   ENVELOPE SCENE
   ------------------------------------------------------------ */
.envelope-scene {
  position: relative;
  width: min(86vw, 380px);
  aspect-ratio: 5 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.open-hint {
  position: absolute;
  bottom: -42px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--gold-deep);
  white-space: nowrap;
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 0%,100%{opacity:.55} 50%{opacity:1} }

.envelope {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border-radius: 10px;
  box-shadow: 0 24px 60px -18px var(--shadow), 0 4px 14px rgba(0,0,0,.08);
  transform-style: preserve-3d;
  outline: none;
}
.envelope:focus-visible { box-shadow: 0 0 0 3px var(--gold-soft), 0 24px 60px -18px var(--shadow); }

/* the two doors */
.door {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(180deg, #f8f2e6 0%, #f1e8d6 100%);
  overflow: hidden;
  backface-visibility: hidden;
  transition: transform 1.25s cubic-bezier(.66,.01,.2,1), box-shadow 1.25s ease;
  z-index: 3;
}
.door-left  { left: 0;  transform-origin: left center;  border-radius: 10px 0 0 10px; box-shadow: inset -16px 0 26px -16px rgba(110,90,50,.35); }
.door-right { right: 0; transform-origin: right center; border-radius: 0 10px 10px 0; box-shadow: inset 16px 0 26px -16px rgba(110,90,50,.35); }

/* scattered leaf field inside each door */
.leaf-field {
  position: absolute;
  inset: 0;
  background-image: url('assets/petals.svg');
  background-size: 130px 130px;
  background-repeat: repeat;
  opacity: 0.92;
}
.door-right .leaf-field { background-position: 34px 66px; }

/* center seam */
.seam {
  position: absolute;
  top: 4%;
  left: 50%;
  width: 1px;
  height: 92%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(138,106,47,.35), transparent);
  z-index: 4;
}

/* wax seal */
.seal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26%;
  transform: translate(-50%, -50%);
  z-index: 6;
  filter: drop-shadow(0 6px 10px rgba(90,60,20,.4));
  transition: transform .7s ease, opacity .6s ease;
}
.seal-svg { width: 100%; height: auto; display: block; }
.seal-blob { filter: drop-shadow(0 1px 0 rgba(255,255,255,.25)); }

/* ---- opened state ---- */
.envelope.is-open .door-left  { transform: rotateY(-118deg); box-shadow: inset -16px 0 40px -10px rgba(110,90,50,.5); }
.envelope.is-open .door-right { transform: rotateY(118deg);  box-shadow: inset 16px 0 40px -10px rgba(110,90,50,.5); }
.envelope.is-open .seal { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
.envelope.is-open .seam { opacity: 0; transition: opacity .3s ease; }

.envelope-scene.gone { opacity: 0; transform: scale(.92); pointer-events: none; }

/* ============================================================
   INVITATION CARD
   ------------------------------------------------------------ */
.card {
  position: relative;
  width: min(93vw, 480px);
  aspect-ratio: 400 / 520;       /* match the arch artwork (wider & shorter) */
  max-width: calc(100vw - 18px);
  display: none;                 /* toggled by JS */
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 90px -28px var(--shadow), 0 8px 22px rgba(0,0,0,.1);
  opacity: 0;
  transform: translateY(60px) scale(.9);
  will-change: opacity, transform, filter;
}
.card.show {
  display: block;
  animation: cardRise 1.5s cubic-bezier(.16,.84,.3,1) both;
}
@keyframes cardRise {
  0%   { opacity: 0; transform: translateY(70px) scale(.9);  filter: blur(7px); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0)    scale(1);  filter: blur(0); }
}

.card-bg {
  position: absolute;
  inset: 0;
  background:
    /* warm watercolour clouds */
    radial-gradient(38% 30% at 18% 12%, rgba(206,184,150,.30), transparent 70%),
    radial-gradient(40% 34% at 84% 18%, rgba(200,176,148,.26), transparent 72%),
    radial-gradient(46% 30% at 50% 96%, rgba(196,170,140,.30), transparent 72%),
    radial-gradient(130% 90% at 50% 0%, #fcf8ef 0%, #f5ecdb 55%, #ece0c9 100%);
  background-color: var(--paper);
}
/* faint gold speckle */
.card-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(150,120,60,.5) 0.7px, transparent 1px),
    radial-gradient(circle, rgba(150,120,60,.35) 0.6px, transparent 1px);
  background-size: 46px 46px, 73px 67px;
  background-position: 0 0, 23px 31px;
  opacity: 0.5;
  mask-image: radial-gradient(120% 95% at 50% 5%, #000 0%, transparent 62%);
  -webkit-mask-image: radial-gradient(120% 95% at 50% 5%, #000 0%, transparent 62%);
}

/* thin inner card border */
.card-frame {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(168,140,84,.45);
  border-radius: 9px;
  pointer-events: none;
  z-index: 1;
}

/* intricate gold arch */
.arch {
  position: absolute;
  inset: 0;
  background: url('assets/arch.svg') no-repeat center top / 100% 100%;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 6px 10px rgba(120,95,45,.16));
}

/* faint mosque silhouette behind the bottom florals */
.mosque {
  position: absolute;
  left: 50%;
  bottom: 5%;
  width: 42%;
  aspect-ratio: 300/180;
  transform: translateX(-50%);
  background: url('assets/mosque.svg') no-repeat center bottom / contain;
  opacity: 0.55;
  pointer-events: none;
  z-index: 3;
}

/* bottom floral garland — spans the full width */
.florals-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background: url('assets/florals-bottom.svg') no-repeat center bottom;
  background-size: 100% auto;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 5px 7px rgba(120,100,60,.14));
}

/* ---- content (sits inside the arch opening) ---- */
.card-content {
  position: absolute;
  z-index: 5;
  left: 18%;
  right: 18%;
  top: 23%;
  bottom: 31%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: flex-start;
  gap: 0.34em;
}

.bismillah {
  font-family: 'Amiri', serif;
  font-size: clamp(.82rem, 3.4vw, 1.15rem);
  color: var(--gold-deep);
  line-height: 1.5;
  padding-top: 0.15em;
  direction: rtl;
}

.blessing {
  font-size: clamp(.72rem, 2.5vw, .9rem);
  color: var(--ink-soft);
  line-height: 1.4;
  letter-spacing: .01em;
  margin-top: .15em;
}

.names {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.0;
  margin: .12em 0 .05em;
}
.name {
  font-family: 'Pinyon Script', cursive;
  font-size: clamp(1.55rem, 7vw, 2.4rem);
  font-weight: 400;
  color: var(--gold-deep);
  background: linear-gradient(180deg, #b69a63 0%, #9c7f44 55%, #856830 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.02;
  white-space: nowrap;
}
.amp {
  font-family: 'Pinyon Script', cursive;
  font-size: clamp(.95rem, 4vw, 1.4rem);
  color: var(--gold);
  margin: -.14em 0;
}

.when {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  margin-top: .35em;
  color: var(--ink);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.w-month, .w-year {
  font-size: clamp(.68rem, 2.5vw, .88rem);
  font-weight: 600;
  color: var(--ink-soft);
}
.w-day {
  font-family: 'Cormorant', 'Cormorant Garamond', serif;
  font-size: clamp(1.25rem, 5vw, 1.7rem);
  font-weight: 600;
  color: var(--gold-deep);
  letter-spacing: 0;
  padding: 0 .42em;
  border-left: 1px solid var(--gold-soft);
  border-right: 1px solid var(--gold-soft);
  line-height: 1;
}
.when-sub {
  font-size: clamp(.68rem, 2.4vw, .85rem);
  color: var(--ink-soft);
  letter-spacing: .04em;
  margin-top: .12em;
}
.venue {
  font-size: clamp(.72rem, 2.5vw, .9rem);
  color: var(--ink);
  line-height: 1.38;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: .45em;
}

.rsvp-btn {
  margin-top: .7em;
  display: inline-block;
  padding: .4em 1.8em;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(.72rem, 2.5vw, .88rem);
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold-deep);
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(247,240,228,.35));
  transition: all .35s ease;
}
.rsvp-btn:hover {
  color: #fff;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  border-color: var(--gold-deep);
  box-shadow: 0 8px 20px -8px rgba(138,106,47,.5);
}

/* close / reset */
.reset-btn {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: .95rem;
  letter-spacing: .1em;
  color: var(--gold-deep);
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: .7;
  transition: opacity .3s ease;
  z-index: 20;
}
.reset-btn:hover { opacity: 1; }

/* ============================================================
   Personalised addressee on the envelope
   ------------------------------------------------------------ */
.env-to {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  text-align: center;
  width: 80%;
  pointer-events: none;
}
.env-to-label {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: .8rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-deep);
  opacity: .8;
}
.env-to-name {
  display: block;
  font-family: 'Pinyon Script', cursive;
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  line-height: 1.1;
  color: var(--gold-deep);
}

/* ============================================================
   RSVP modal
   ------------------------------------------------------------ */
.rsvp-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}
.rsvp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 46, 26, 0.5);
  backdrop-filter: blur(3px);
  animation: fadeIn .3s ease;
}
.rsvp-box {
  position: relative;
  width: min(92vw, 400px);
  background:
    radial-gradient(120% 90% at 50% 0%, #fdfaf3 0%, #f6efe1 70%, #efe5d1 100%);
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  box-shadow: 0 30px 70px -20px var(--shadow);
  padding: 30px 26px 26px;
  text-align: center;
  animation: popIn .4s cubic-bezier(.2,.8,.3,1);
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.rsvp-close {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  opacity: .6;
}
.rsvp-close:hover { opacity: 1; }

.rsvp-eyebrow {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: .82rem;
  color: var(--gold-deep);
}
.rsvp-name {
  font-family: 'Pinyon Script', cursive;
  font-weight: 400;
  font-size: clamp(1.9rem, 9vw, 2.6rem);
  line-height: 1.05;
  color: var(--gold-deep);
  margin: .1em 0 .15em;
}
.rsvp-invited {
  font-size: .95rem;
  color: var(--ink-soft);
  margin-bottom: 1.1em;
}

.rsvp-choice {
  display: flex;
  gap: 10px;
  margin-bottom: 1em;
}
.choice-btn {
  flex: 1;
  padding: .7em .5em;
  font-family: 'Cormorant Garamond', serif;
  font-size: .95rem;
  letter-spacing: .04em;
  color: var(--ink);
  background: rgba(255,255,255,.5);
  border: 1px solid var(--gold-soft);
  border-radius: 8px;
  cursor: pointer;
  transition: all .25s ease;
}
.choice-btn:hover { border-color: var(--gold-deep); }
.choice-btn.selected {
  color: #fff;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  border-color: var(--gold-deep);
}

.rsvp-seats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1em;
  padding: .35em .2em;
}
.rsvp-seats label {
  font-size: .95rem;
  color: var(--ink-soft);
}
.seat-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
}
.seat-stepper button {
  width: 32px; height: 32px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--gold-deep);
  background: rgba(255,255,255,.6);
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  cursor: pointer;
}
.seat-stepper button:disabled { opacity: .35; cursor: default; }
#seatCount { font-size: 1.25rem; min-width: 1.2em; color: var(--ink); }

.rsvp-note {
  width: 100%;
  font-family: 'Cormorant Garamond', serif;
  font-size: .95rem;
  color: var(--ink);
  padding: .6em .7em;
  border: 1px solid var(--gold-soft);
  border-radius: 8px;
  background: rgba(255,255,255,.5);
  resize: vertical;
  margin-bottom: 1em;
}
.rsvp-note:focus { outline: none; border-color: var(--gold-deep); }

.rsvp-submit {
  width: 100%;
  padding: .7em;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity .25s ease;
}
.rsvp-submit:disabled { opacity: .45; cursor: default; }
.rsvp-feedback { min-height: 1.2em; margin-top: .7em; font-size: .92rem; color: var(--ink-soft); }
.rsvp-feedback.success { color: #4f7a4a; }
.rsvp-feedback.error { color: #a8453f; }

/* ============================================================
   Responsive
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .door, .seal, .card.show, .open-hint { animation: none !important; transition: opacity .4s ease !important; }
}
