:root {
  --paper: #fdfaf3;
  --cream: #f6efe0;
  --gold-light: #d9c08a;
  --gold-deep: #a8823a;
  --gold: #c9a24d;
  --emerald: #2f7d64;
  --emerald-deep: #0f5c46;
  --emerald-ink: #0b3d30;
  --night: #072a21;
  --ink: #2b2a26;
  --muted: #776f60;
  --line: #e7dcc4;
  --script: 'Great Vibes', cursive;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --arabic: 'Amiri', 'Traditional Arabic', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  /* deep emerald with a fine gold eight-pointed-star pattern */
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(201, 162, 77, 0.22), transparent 65%),
    url(/img/pattern.svg) center top / 80px 80px,
    linear-gradient(180deg, var(--emerald-deep), var(--night));
  background-color: var(--emerald-deep);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--emerald-deep); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.page { max-width: 640px; margin: 0 auto; padding: 28px 16px 56px; }

/* ---------- the invitation card ---------- */
/* an arched (mihrab-shaped) ivory card with a gold double frame */
.card {
  --arch: 50% 50% 8px 8px / 150px 150px 8px 8px;
  position: relative;
  background: var(--paper);
  border-radius: var(--arch);
  padding: 120px 28px 96px;
  text-align: center;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 6px rgba(201, 162, 77, 0.18), 0 30px 70px -20px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.card::before { /* inner gold line following the arch */
  content: ''; position: absolute; inset: 10px;
  border: 1px solid rgba(201, 162, 77, 0.6);
  border-radius: 50% 50% 4px 4px / 142px 142px 4px 4px;
  pointer-events: none;
}
.ornament { position: absolute; left: 50%; width: min(240px, 66%); transform: translateX(-50%); pointer-events: none; }
.ornament.top { top: 46px; }
.ornament.bottom { bottom: 30px; transform: translateX(-50%) rotate(180deg); }

.opening { font-family: var(--arabic); font-size: 22px; color: var(--emerald-deep); margin: 0 0 18px; direction: rtl; }
.dear { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold-deep); margin: 0 0 10px; }
.hosts { font-family: var(--serif); font-size: 17px; font-style: italic; color: var(--muted); margin: 0 auto 18px; max-width: 30ch; }
.names { font-family: var(--script); font-weight: 400; color: var(--emerald-ink); line-height: 1.05; margin: 6px 0 14px; }
.names .who { display: block; font-size: clamp(46px, 13vw, 68px); }
.names .amp { display: block; font-family: var(--serif); font-style: italic; font-size: 30px; color: var(--gold-deep); margin: 2px 0; }
.invite-line { font-family: var(--serif); font-size: 18px; margin: 0 auto 6px; max-width: 32ch; }
.event-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 8vw, 40px);
  letter-spacing: 0.32em; text-transform: uppercase; margin: 2px 0 0 0.32em; color: var(--gold-deep);
}

.verse { margin: 0 auto 20px; max-width: 34ch; }
.verse .ar { font-family: var(--arabic); font-size: 20px; line-height: 1.9; color: var(--emerald-deep); margin: 0; direction: rtl; }
.verse .en { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted); margin: 6px 0 2px; }
.verse .ref { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-deep); margin: 0; }

.divider { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 22px auto; color: var(--gold); }
.divider::before, .divider::after { content: ''; height: 1px; width: 70px; background: linear-gradient(90deg, transparent, var(--gold)); }
.divider::after { transform: scaleX(-1); }
.divider svg { width: 26px; height: 26px; }

.when { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; max-width: 380px; margin: 0 auto; font-family: var(--serif); }
.when .side { font-size: 15px; letter-spacing: 0.22em; text-transform: uppercase; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.when .day { font-size: 58px; font-weight: 600; line-height: 1; color: var(--emerald-ink); }
.year { font-family: var(--serif); letter-spacing: 0.4em; margin: 10px 0 0 0.4em; font-size: 16px; }
.time { font-family: var(--serif); font-size: 20px; margin-top: 8px; color: var(--gold-deep); font-style: italic; }

.venue { margin-top: 26px; }
.venue .label { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
.venue .name { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--emerald-ink); margin: 2px 0 0; }
.venue .addr { font-family: var(--serif); font-size: 18px; }
.note { font-family: var(--serif); font-style: italic; margin: 18px auto 0; max-width: 34ch; color: var(--muted); white-space: pre-line; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 15px var(--sans); letter-spacing: 0.04em;
  padding: 11px 18px; border-radius: 999px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--emerald); background: transparent; color: var(--emerald-deep);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.05s;
}
.btn:hover { background: var(--emerald); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.solid { background: var(--emerald-deep); border-color: var(--emerald-deep); color: #fff; }
.btn.solid:hover { background: var(--emerald-ink); }
.btn.gold { border-color: var(--gold-deep); color: var(--gold-deep); }
.btn.gold:hover { background: var(--gold-deep); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* countdown */
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.countdown div { min-width: 64px; padding: 10px 6px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.countdown b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; color: var(--emerald-ink); }
.countdown span { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.countdown-done { font-family: var(--serif); font-style: italic; font-size: 20px; margin-top: 24px; color: var(--gold-deep); }

/* ---------- RSVP and extras ---------- */
.panel {
  margin-top: 22px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 6px; padding: 28px 22px; box-shadow: 0 12px 40px -24px rgba(95, 115, 85, 0.35);
}
.panel h2 { font-family: var(--serif); font-weight: 600; font-size: 28px; text-align: center; margin: 0; color: var(--emerald-ink); }
.panel .sub { text-align: center; margin: 4px 0 20px; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 17px; }

form .field { margin-bottom: 16px; }
form .lbl { display: block; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; font: 16px var(--sans); color: var(--ink);
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(156, 175, 136, 0.5); outline-offset: 1px; border-color: var(--emerald); }
textarea { min-height: 84px; resize: vertical; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; min-height: 54px;
  padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-family: var(--serif); font-size: 18px; transition: all 0.15s;
}
.choice input:checked + label { border-color: var(--emerald-deep); background: var(--emerald-deep); color: #fff; box-shadow: 0 6px 18px -8px var(--emerald-deep); }
.choice input[value=no]:checked + label { border-color: var(--gold-deep); background: var(--gold-deep); box-shadow: 0 6px 18px -8px var(--gold-deep); }
.choice input:focus-visible + label { outline: 2px solid var(--emerald); outline-offset: 2px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--emerald); background: #fff; color: var(--emerald-deep); font-size: 22px; cursor: pointer; }
.stepper input { width: 80px; text-align: center; font-size: 20px; font-family: var(--serif); font-weight: 600; }
.form-error { color: #b0404c; text-align: center; margin: 0 0 12px; }
.submit { width: 100%; padding: 14px; font-size: 16px; }

.thanks { text-align: center; }
.thanks .big { font-family: var(--script); font-size: 46px; color: var(--emerald-ink); line-height: 1.2; }
.thanks p { font-family: var(--serif); font-size: 18px; margin: 6px 0 16px; }

.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.extras a {
  display: block; text-decoration: none; text-align: center; padding: 18px 12px; border-radius: 6px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
}
.extras a:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -18px rgba(95, 115, 85, 0.6); }
.extras b { display: block; font-family: var(--serif); font-size: 20px; color: var(--emerald-ink); }
.extras span { display: block; font-size: 14px; color: var(--muted); }
.extras.single { grid-template-columns: 1fr; }
.extras .cta {
  display: inline-block; margin-top: 12px; padding: 8px 18px; border-radius: 999px;
  font: 500 14px var(--sans); font-style: normal; letter-spacing: 0.04em;
  background: var(--emerald-deep); color: #fff; transition: background 0.2s;
}
.extras a:hover .cta { background: var(--emerald-ink); }

/* event code shown on its own above the Wishes / Photos buttons */
.event-code {
  margin-top: 22px; text-align: center; padding: 18px 16px;
  background: var(--paper); border: 1px dashed var(--gold-light); border-radius: 6px;
}
.event-code .label { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
.event-code .code-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 4px; flex-wrap: wrap; }
.event-code strong { font-family: var(--serif); font-weight: 600; font-size: 34px; letter-spacing: 0.28em; margin-right: -0.28em; color: var(--gold-deep); }
.event-code .copy { padding: 7px 14px; font-size: 14px; }
.event-code p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.event-code + .extras { margin-top: 12px; }
.extras svg { width: 26px; height: 26px; fill: none; stroke: var(--gold-deep); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

footer { text-align: center; margin-top: 30px; font-family: var(--serif); color: rgba(241, 217, 143, 0.75); }
footer .sig { font-family: var(--script); font-size: 34px; color: #f1d98f; display: block; }

/* ---------- envelope intro ---------- */
.envelope {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; cursor: pointer; overflow: hidden;
}
.envelope.open { pointer-events: none; }

/* the two halves: each paints the full-screen background so they meet without a visible join */
.door { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; will-change: transform;
  transition: transform 1.25s cubic-bezier(.77, 0, .18, 1) 0.35s; }
.door.left { left: 0; }
.door.right { right: 0; }
.door::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 100vw;
  background:
    radial-gradient(700px 500px at 50% 45%, rgba(201, 162, 77, 0.28), transparent 70%),
    url(/img/pattern.svg) center top / 80px 80px,
    linear-gradient(180deg, var(--emerald-deep), var(--night));
}
.door.left::before { left: 0; }
.door.right::before { right: 0; }
.door::after { /* a gold arch outline drawn across both halves */
  content: ''; position: absolute; top: 7vh; bottom: 7vh; width: min(78vw, 460px);
  border: 1.5px solid rgba(217, 180, 95, 0.75);
  border-radius: 50% 50% 6px 6px / 160px 160px 6px 6px;
}
.door.left::after { left: calc(100% - min(39vw, 230px)); }
.door.right::after { right: calc(100% - min(39vw, 230px)); }
/* the edges that meet in the middle: a gold line and a soft shadow */
.door.left { box-shadow: inset -1px 0 0 rgba(217, 180, 95, 0.8); }
.door.right { box-shadow: inset 1px 0 0 rgba(217, 180, 95, 0.8); }
.envelope.open .door.left { transform: translateX(-101%); box-shadow: inset -1px 0 0 rgba(217, 180, 95, 0.8), 18px 0 40px -10px rgba(0, 0, 0, 0.5); }
.envelope.open .door.right { transform: translateX(101%); box-shadow: inset 1px 0 0 rgba(217, 180, 95, 0.8), -18px 0 40px -10px rgba(0, 0, 0, 0.5); }

.env-content { position: relative; z-index: 1; transition: opacity 0.45s ease, transform 0.6s ease; }
.envelope.open .env-content { opacity: 0; transform: scale(0.94); }
.envelope.open .seal { animation: sealPop 0.5s ease-out forwards; }
@keyframes sealPop { 40% { transform: scale(1.18); } 100% { transform: scale(0.6); opacity: 0; } }

/* falling rose petals */
.petals { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }
.envelope .small { letter-spacing: 0.35em; text-transform: uppercase; font-size: 12px; color: rgba(241, 217, 143, 0.8); }
.envelope .bismillah { font-family: var(--arabic); font-size: 22px; color: #f1d98f; margin-bottom: 14px; direction: rtl; }
.envelope .to { font-family: var(--serif); font-style: italic; font-size: 22px; color: #f1d98f; margin-top: 6px; min-height: 1.4em; }
/* gold seal shaped as an eight-pointed star */
.envelope .seal {
  position: relative; z-index: 0; width: 112px; height: 112px; margin: 26px auto;
  display: flex; align-items: center; justify-content: center;
  color: var(--emerald-ink); font-family: var(--script); font-size: 30px; padding-right: 4px;
  animation: breathe 2.4s ease-in-out infinite;
}
.envelope .seal::before, .envelope .seal::after {
  content: ''; position: absolute; inset: 14px; z-index: -1;
  background: linear-gradient(145deg, #f6e3a4, #c9a24d 55%, #9c7a2e);
  box-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.55);
}
.envelope .seal::after { transform: rotate(45deg); }
.env-content { isolation: isolate; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.envelope .names-sm { font-family: var(--script); font-size: clamp(34px, 9vw, 52px); color: #f6e3a4; line-height: 1.1; }
.envelope .tap { margin-top: 26px; border-color: #d9b45f; color: #f1d98f; }
.envelope .tap:hover { background: #d9b45f; color: var(--emerald-ink); }

/* reveal on scroll */
.rise { opacity: 0; transform: translateY(16px); transition: opacity 0.8s ease, transform 0.8s ease; }
.rise.in { opacity: 1; transform: none; }

/* ---------- landing ---------- */
.choose { display: grid; gap: 16px; margin-top: 26px; }
.choose a {
  display: block; position: relative; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 24px 22px; text-align: center;
  box-shadow: 0 16px 40px -26px rgba(95, 115, 85, 0.55); transition: transform 0.15s;
}
.choose a:hover { transform: translateY(-3px); }
.choose .t { font-family: var(--serif); font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; font-size: 24px; color: var(--gold-deep); }
.choose .d { font-family: var(--serif); font-size: 18px; margin-top: 4px; }
.choose .v { color: var(--muted); }

/* mute / unmute button for the background music */
.music-btn {
  position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 55;
  width: 48px; height: 48px; border-radius: 50%; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--emerald-deep); border: 1.5px solid var(--gold); color: #f1d98f;
  box-shadow: 0 8px 22px -8px rgba(0, 0, 0, 0.6);
}
.music-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.music-btn svg path:first-child { fill: currentColor; }
.music-btn .off, .music-btn.muted .on { display: none; }
.music-btn.muted .off { display: block; }
.music-btn:not(.muted) .on { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

/* light background for the admin page */
body.light { background: var(--cream); }

@media (max-width: 420px) {
  .card { --arch: 50% 50% 8px 8px / 120px 120px 8px 8px; padding: 108px 18px 90px; }
  .card::before { border-radius: 50% 50% 4px 4px / 112px 112px 4px 4px; }
  .ornament.top { top: 40px; }
  .when .day { font-size: 50px; }
  .when .side { font-size: 13px; letter-spacing: 0.16em; }
  .countdown div { min-width: 56px; }
  .extras { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rise { opacity: 1; transform: none; }
  .envelope.open { opacity: 0; }
}
