/* ---------- tokens ---------- */
:root {
  --paper: #f4f1ea;
  --paper-2: #ebe6da;
  --card: rgba(252, 250, 246, 0.9);
  --ink: #1f1d1a;
  --ink-soft: #5f5a52;
  --muted: #8a847a;
  --gold: #b3975b;
  --gold-soft: #d9cba3;
  --gold-tint: #faf6ea;
  --line: #dcd5c5;
  --ok: #2f6b4f;
  --ok-tint: #e8f2ec;
  --bad: #9a3b3b;
  --bad-tint: #f7e9e9;
  --shadow: 0 24px 60px rgba(60, 45, 20, 0.10);
  --radius: 28px;
  --font-body: 'Tajawal', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Amiri', 'Noto Naskh Arabic', 'Geeza Pro', serif;
}
html[lang="en"] {
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--paper) url('/img/bg.jpg') center / cover no-repeat;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(244, 241, 234, 0.35) 0%, rgba(244, 241, 234, 0.1) 40%, rgba(244, 241, 234, 0.55) 100%);
}
.hidden { display: none !important; }
:empty.auto-hide { display: none; }
button, input { font-family: inherit; font-size: inherit; }
a { color: inherit; }

/* ---------- layout ---------- */
.lang-toggle {
  position: fixed;
  top: 14px;
  inset-inline-end: 16px;
  z-index: 20;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(252, 250, 246, 0.92);
  color: var(--ink-soft);
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(60, 45, 20, 0.08);
}
.lang-toggle:hover { color: var(--ink); border-color: var(--gold); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: 100vh;
}

/* generic page container (admin, verify, 404) */
.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 64px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
  text-align: center;
  backdrop-filter: blur(4px);
}

/* ---------- invitation panel ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
  text-align: center;
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(246, 243, 236, 0.97) 0%,
    rgba(246, 243, 236, 0.93) 36%,
    rgba(246, 243, 236, 0.6) 54%,
    rgba(246, 243, 236, 0) 74%);
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 56px 36px 40px;
}
@media (min-width: 900px) {
  .hero { position: sticky; top: 0; height: 100vh; }
  .hero-content { padding-top: clamp(40px, 8vh, 90px); }
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
html[lang="ar"] .eyebrow { letter-spacing: 0.04em; font-size: 15px; }
.hosts {
  max-width: 420px;
  margin: 0 auto 8px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--ink-soft);
}

.couple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 0 12px;
}
.person { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.person-title { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.person-name {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 1.15;
  font-weight: 700;
}
html[lang="en"] .person-name { font-size: 38px; font-weight: 600; }
.person-family { font-size: 15px; font-weight: 500; }
.on {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--gold);
  font-style: italic;
}
html[lang="ar"] .on { font-style: normal; }

.details {
  list-style: none;
  margin: 0 auto 14px;
  padding: 14px 0 0;
  max-width: 420px;
  border-top: 1px solid var(--gold-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.details li { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; line-height: 1.4; }
.details svg { flex: none; width: 20px; height: 20px; color: var(--gold); stroke-width: 1.6; }

.actions-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}
.actions-row .chip {
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-height: 74px;
  height: auto;
  padding: 10px 8px;
  text-align: center;
  font-size: 14px;
  line-height: 1.3;
  border-radius: 14px;
}
.actions-row .chip svg { flex: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip svg { width: 15px; height: 15px; color: var(--gold); }
.chip.chip-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(31, 29, 26, 0.22);
}
.chip.chip-primary svg { color: var(--gold-soft); }
.chip.chip-primary:hover { background: #000; border-color: #000; color: #fff; }
@media (max-width: 420px) { .actions-row { gap: 6px; } .actions-row .chip { font-size: 13px; padding: 10px 6px; } }

/* ---------- RSVP panel ---------- */
.rsvp-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 48px 28px 36px;
}
.card.rsvp {
  width: 100%;
  max-width: 560px;
  padding: 40px 36px 34px;
  box-shadow: 0 30px 70px rgba(60, 45, 20, 0.16);
}

@media (max-width: 899px) {
  .layout { grid-template-columns: 1fr; min-height: 0; }
  .hero::after {
    background: linear-gradient(180deg,
      rgba(246, 243, 236, 0.97) 0%,
      rgba(246, 243, 236, 0.95) 55%,
      rgba(246, 243, 236, 0.7) 75%,
      rgba(246, 243, 236, 0.15) 100%);
  }
  .person-name { font-size: 42px; }
  html[lang="en"] .person-name { font-size: 34px; }
  .rsvp-panel { order: -1; padding: 60px 14px 18px; margin-top: 0; gap: 12px; }
  .hero-content { padding: 36px 20px 150px; }
  .card.rsvp { padding: 30px 20px 26px; border-radius: 24px; }
}

/* ---------- RSVP ---------- */
.rsvp h2 {
  margin: 0 0 6px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
}
html[lang="en"] .rsvp h2 { font-weight: 600; }
.hint { margin: 0 0 18px; text-align: center; color: var(--ink-soft); font-size: 15px; }
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  background: var(--gold-tint);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: start;
}
.notice svg { flex: none; width: 24px; height: 24px; color: var(--gold); }
.hint.small { font-size: 14px; margin: 12px 0 0; }
#result .pass-wrap .hint.small { margin-top: 20px; }
.step { animation: fade .35s ease; text-align: start; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 8px; font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.field input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(179, 151, 91, 0.15); }
.field input[type="tel"] { direction: ltr; text-align: left; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
html[lang="ar"] .field input[type="tel"]::placeholder { text-align: left; }

.phone-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--gold-tint);
  border: 1px solid var(--gold-soft);
  font-size: 15px;
}
.phone-chip b { direction: ltr; unicode-bidi: isolate; font-weight: 700; letter-spacing: 0.04em; }

.choice { display: grid; gap: 12px; margin: 6px 0 18px; }
.choice-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-weight: 500;
}
.choice-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--gold); flex: none; }
.choice-opt.selected, .choice-opt:has(input:checked) { border-color: var(--gold); background: var(--gold-tint); }
.choice-opt.no.selected, .choice-opt.no:has(input:checked) { border-color: var(--muted); background: #f5f3ef; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .1s, opacity .15s, background .15s;
}
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #000; }
.btn.ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: rgba(31, 29, 26, 0.05); }

.btn.busy > span { visibility: hidden; }
.btn.busy::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bad-tint);
  color: var(--bad);
  font-size: 14px;
}
.note { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- result ---------- */
#result { text-align: center; }
.result-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-tint);
  color: var(--ok);
}
.result-icon svg { width: 30px; height: 30px; }
#result.declined .result-icon { background: #f1efea; color: var(--ink-soft); }
#result h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.3;
}
html[lang="en"] #result h3 { font-weight: 600; }
#result p { margin: 0 auto 14px; max-width: 440px; color: var(--ink-soft); }
.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.bad { background: var(--bad-tint); color: var(--bad); }

.pass-wrap { margin-top: 22px; }
.pass-frame {
  position: relative;
  width: min(100%, 320px);
  margin: 0 auto 14px;
  aspect-ratio: 1080 / 1610;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(60, 45, 20, 0.16);
  overflow: hidden;
}
.pass-frame img { width: 100%; height: 100%; display: block; }
.pass-wrap.rendering .pass-frame img { opacity: 0; }
.pass-wrap.rendering .pass-frame::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid var(--gold-soft);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.pass-status { min-height: 1.4em; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.pass-code { margin: 0 0 14px; font-size: 14px; color: var(--ink-soft); }
.pass-code b { direction: ltr; unicode-bidi: isolate; letter-spacing: 0.08em; }
.btn-row { display: grid; gap: 10px; }
.wallet-row { display: grid; gap: 10px; margin-top: 10px; }
.wallet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  padding: 0 20px;
  border: 1.5px solid #000;
  border-radius: 14px;
  background: #000;
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}
.wallet-btn:hover { background: #1a1a1a; }

.result-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.result-links .link-btn {
  padding: 11px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}
.result-links .link-btn:hover { background: var(--gold-tint); border-color: var(--gold); }
.link-btn {
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--ink-soft);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

/* ---------- footer ---------- */
.footer { text-align: center; padding: 2px 0 8px; }
.personal-line { margin: 6px 0 0; font-size: 12px; color: var(--gold); letter-spacing: 0.04em; }
.blessing { margin: 8px auto 0; max-width: 420px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.calligraphy {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--gold);
}
html[lang="en"] .calligraphy { font-style: italic; font-size: 24px; }

/* ---------- verify page ---------- */
.verify-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-tint); color: var(--ok);
}
.verify-icon.bad { background: var(--bad-tint); color: var(--bad); }
.verify-icon svg { width: 34px; height: 34px; }
.verify-name { font-family: var(--font-display); font-size: 34px; margin: 10px 0 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* One icon system for all buttons: same box, same stroke, same gap, centred on the text. */
.actions-row .chip svg, .btn svg, .wallet-btn svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
  stroke-width: 1.8;
}
.actions-row .chip svg { width: 24px; height: 24px; }
.btn, .wallet-btn { gap: 10px; }
.btn > span, .wallet-btn > span { display: block; line-height: 1.2; }
html[lang="en"] .btn svg, html[lang="en"] .wallet-btn svg { transform: translateY(1px); }
