:root {
  --emerald: #0d3328;
  --emerald-2: #144536;
  --emerald-deep: #071f18;
  --ivory: #f7f1e5;
  --ivory-2: #efe6d3;
  --ink: #2c3a33;
  --muted: #6b7a70;
  --gold: #b8924a;
  --gold-2: #d8bb7c;
  --sage: #8ea58c;
  --f-script: "Aref Ruqaa", "Amiri", serif;
  --f-body: "Amiri", serif;
  --f-ui: "El Messiri", "Amiri", sans-serif;
  --ease: cubic-bezier(.65, 0, .35, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--emerald-deep);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.is-closed, body.is-opening { overflow: hidden; height: 100svh; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ================= INTRO / ENVELOPE ================= */
.intro {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  padding: 24px 16px;
  background:
    radial-gradient(120% 80% at 50% 40%, rgba(40, 110, 85, .35), transparent 60%),
    linear-gradient(180deg, #0b2a21, var(--emerald-deep));
  transition: opacity .7s ease, transform .9s var(--ease), visibility 0s linear .9s;
}
.intro__glow {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 187, 124, .18), transparent 65%);
  pointer-events: none; animation: breathe 5s ease-in-out infinite;
}
.intro__kicker, .intro__hint {
  margin: 0; font-family: var(--f-ui); color: var(--gold-2); letter-spacing: .02em;
  transition: opacity .4s ease;
}
.intro__kicker { font-size: 15px; opacity: .8; }
.intro__hint { font-size: 16px; animation: pulse 2.2s ease-in-out infinite; }

.envelope {
  --w: min(88vw, 380px);
  position: relative; width: var(--w); height: calc(var(--w) * .7);
  cursor: pointer; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .45));
  animation: float 6s ease-in-out infinite;
}
.envelope > div { position: absolute; inset: 0; border-radius: 6px; }
.envelope__back {
  z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.1)), url(assets/emerald.webp) center/420px, var(--emerald);
}
.envelope__card {
  z-index: 2;
  inset: 7% 6% 6% 6% !important;
  border-radius: 4px !important;
  background: url(assets/ivory.webp) center/360px, var(--ivory);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 9%; gap: 4px; text-align: center;
}
.card__small { font-family: var(--f-ui); color: var(--muted); font-size: 13px; }
.card__names { font-family: var(--f-script); font-size: clamp(30px, 9vw, 40px); color: var(--emerald); line-height: 1.5; }
.card__names em { font-style: normal; color: var(--gold); font-size: .7em; padding: 0 .15em; }
.envelope__pocket {
  z-index: 3;
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpolyline points='0,100 50,52 100,100' fill='none' stroke='%23000' stroke-opacity='.35' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0/100% 100% no-repeat,
    linear-gradient(155deg, rgba(255,255,255,.07), transparent 40%),
    linear-gradient(205deg, rgba(0,0,0,.18), transparent 45%),
    url(assets/emerald.webp) center/420px, var(--emerald-2);
}
.envelope__flap {
  z-index: 4;
  height: 64%; bottom: auto !important;
  transform-origin: 50% 0;
  transform: perspective(1100px) rotateX(0deg);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpolyline points='0,0 50,100 100,0' fill='none' stroke='%23d8bb7c' stroke-opacity='.55' stroke-width='1.2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0/100% 100% no-repeat,
    linear-gradient(180deg, rgba(255,255,255,.1), rgba(0,0,0,.05) 70%, rgba(0,0,0,.25)),
    url(assets/emerald.webp) center/420px, var(--emerald-2);
  border-radius: 6px 6px 0 0 !important;
}
.seal {
  position: absolute; z-index: 5;
  left: 50%; top: 64%; width: 30%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.45));
  transition: transform .25s ease;
}
.seal img { width: 100%; height: 100%; }
.seal:hover { transform: translate(-50%, -50%) scale(1.05); }
.seal:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 6px; border-radius: 50%; }
.seal::after {
  content: ""; position: absolute; inset: -14%; border-radius: 50%;
  border: 1px solid rgba(216, 187, 124, .55);
  animation: ring 2.2s ease-out infinite;
}

/* opening sequence */
.is-opening .envelope { animation: none; }
.is-opening .intro__hint, .is-opening .intro__kicker { opacity: 0; animation: none; }
.is-opening .seal { animation: sealOff .6s var(--ease) forwards; }
.is-opening .seal::after { display: none; }
.is-opening .envelope__flap { animation: flapOpen 1s var(--ease) .35s forwards; }
.is-opening .envelope__card { animation: cardUp 1.1s var(--ease) 1.25s forwards; }
.is-opening .intro { animation: introOut .8s var(--ease) 2.2s forwards; }

@keyframes sealOff {
  30% { transform: translate(-50%, -50%) scale(1.15); }
  100% { transform: translate(-50%, -30%) scale(.6) rotate(-25deg); opacity: 0; }
}
@keyframes flapOpen {
  0% { transform: perspective(1100px) rotateX(0); z-index: 4; }
  49% { z-index: 4; }
  50% { z-index: 1; }
  100% { transform: perspective(1100px) rotateX(180deg); z-index: 1; filter: brightness(.7); }
}
@keyframes cardUp {
  0% { transform: translateY(0); }
  60% { z-index: 2; }
  100% { transform: translateY(-58%); z-index: 2; }
}
@keyframes introOut { to { opacity: 0; transform: scale(1.12); visibility: hidden; } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .7; } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }

.is-open .intro { opacity: 0; visibility: hidden; pointer-events: none; }

/* ================= PAGE ================= */
.page {
  min-height: 100svh;
  background: url(assets/ivory.webp) center top/480px repeat, var(--ivory);
  opacity: 0;
  text-align: center;
  padding-bottom: 40px;
}
.is-open .page { opacity: 1; animation: pageIn 1.2s ease both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

.hero {
  position: relative; padding: 0 20px 48px; overflow: hidden;
  max-width: 560px; margin: 0 auto;
}
.hero__garland {
  width: 135%; max-width: none; margin: -2% -17.5% 0; pointer-events: none;
  transform-origin: 50% 0;
}
.is-open .hero__garland { animation: sway 1.6s var(--ease) both; }
@keyframes sway { from { opacity: 0; transform: translateY(-30px) scale(1.04); } }

.verse {
  font-family: var(--f-body); font-size: 15px; line-height: 2; color: var(--muted);
  max-width: 34ch; margin: 8px auto 22px;
}
.hero__intro { font-family: var(--f-ui); color: var(--gold); font-size: 17px; margin: 0 0 4px; }
.names {
  font-family: var(--f-script); font-weight: 400; color: var(--emerald);
  font-size: clamp(64px, 20vw, 104px); line-height: 1.25; margin: 0;
  display: flex; flex-direction: column; align-items: center;
}
.names__amp { font-family: var(--f-body); color: var(--gold); font-size: .45em; line-height: 1; margin: -4px 0; }
.is-open .names > span { animation: rise 1.1s var(--ease) both; }
.is-open .names > span:nth-child(2) { animation-delay: .15s; }
.is-open .names > span:nth-child(3) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } }

.hero__invite { font-size: 19px; margin: 18px 0 0; }
.hero__invite strong { color: var(--emerald); font-weight: 700; }
.divider { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px auto; max-width: 260px; }
.divider span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
.divider img { width: 54px; }
.hero__date { font-family: var(--f-ui); font-size: 21px; color: var(--emerald); margin: 0; }
.hero__hijri { font-size: 15px; color: var(--muted); margin: 4px 0 0; }

.label {
  font-family: var(--f-ui); font-size: 14px; letter-spacing: .04em;
  color: var(--gold); margin: 0 0 12px;
}
.label::before, .label::after { content: "—"; margin: 0 8px; opacity: .6; }

/* countdown arch */
.arch {
  margin: 8px auto 40px; width: min(100% - 32px, 440px);
  padding: 80px 20px 40px; color: var(--ivory);
  border-radius: 999px 999px 18px 18px;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(216,187,124,.18), transparent 70%),
    url(assets/emerald.webp) center/420px, var(--emerald);
  box-shadow: 0 20px 40px -18px rgba(13, 51, 40, .55), inset 0 0 0 1px rgba(216,187,124,.35);
  position: relative;
}
.arch::before {
  content: ""; position: absolute; inset: 8px; border-radius: inherit;
  border: 1px solid rgba(216,187,124,.4); pointer-events: none;
}
.arch .label { color: var(--gold-2); }
.countdown { display: flex; justify-content: center; gap: 6px; direction: rtl; }
.countdown div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.countdown b { font-family: var(--f-ui); font-weight: 500; font-size: clamp(30px, 10vw, 44px); line-height: 1.2; color: #fff; font-variant-numeric: tabular-nums; }
.countdown small { font-family: var(--f-ui); font-size: 13px; color: var(--gold-2); }
.countdown__done { font-family: var(--f-script); font-size: 30px; margin: 0; }

/* blocks */
.block {
  width: min(100% - 32px, 440px); margin: 0 auto 28px; padding: 30px 22px;
  background: rgba(255, 255, 255, .45);
  border: 1px solid rgba(184, 146, 74, .35);
  border-radius: 18px;
  box-shadow: 0 10px 30px -20px rgba(44, 58, 51, .4);
  backdrop-filter: blur(2px);
}
.block__big { font-family: var(--f-script); font-size: 38px; color: var(--emerald); margin: 0; line-height: 1.4; }
.block__mid { font-size: 19px; margin: 4px 0 0; }
.gold { color: var(--gold); font-family: var(--f-ui); }
.soon { font-family: var(--f-ui); color: var(--muted); font-size: 17px; margin: 6px 0 0; }

.btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.btn {
  font-family: var(--f-ui); font-size: 15px; text-decoration: none;
  padding: 11px 20px; border-radius: 999px; min-height: 44px;
  display: inline-flex; align-items: center;
  background: var(--emerald); color: var(--ivory);
  border: 1px solid var(--emerald);
  transition: transform .2s ease, background .2s ease;
}
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--emerald); }

.map {
  margin: 18px 0 0; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(184, 146, 74, .35); aspect-ratio: 4 / 3; background: var(--ivory-2);
}
.map iframe { width: 100%; height: 100%; border: 0; filter: saturate(.75) sepia(.12); }

.schedule { list-style: none; padding: 0; margin: 0; text-align: right; }
.schedule li { display: flex; gap: 16px; align-items: baseline; padding: 12px 4px; border-bottom: 1px dashed rgba(184,146,74,.4); }
.schedule li:last-child { border-bottom: 0; }
.schedule time { font-family: var(--f-ui); color: var(--gold); min-width: 96px; font-size: 15px; }
.schedule span { font-size: 18px; }

.closing { padding: 30px 20px 20px; }
.closing__seal { width: 84px; margin: 0 auto 10px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.closing__text { font-family: var(--f-script); font-size: 30px; color: var(--emerald); margin: 0; }
.closing__names { font-family: var(--f-ui); color: var(--gold); margin: 6px 0 0; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.music {
  position: fixed; bottom: 18px; left: 18px; z-index: 20;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(184,146,74,.5); background: rgba(13, 51, 40, .9); color: var(--gold-2);
  font-size: 20px; cursor: pointer;
}
.music.on { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

.credit { font-family: var(--f-ui); font-size: 11px; color: var(--muted); opacity: .7; margin: 18px 0 0; }
