:root {
  --ivory: #f7f1e6;
  --ivory-deep: #efe6d4;
  --cream: #fbf8f2;
  --paper: #f3ece0;
  --gold: #c4a35a;
  --gold-deep: #8d6e32;
  --gold-soft: #e0cc96;
  --gold-line: rgba(184, 148, 74, 0.55);
  --green: #2f4a36;
  --green-deep: #1e3326;
  --ink: #3d3428;
  --ink-soft: #6a5d4d;
  --muted: #8a7d6c;
  --shadow: 0 18px 40px rgba(62, 48, 28, 0.1);
  --font-serif: "Cormorant Garamond", "Times New Roman", serif;
  --font-sc: "Cormorant SC", "Cormorant Garamond", serif;
  --font-ar: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif;
  --safe-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.55;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(255, 250, 240, 0.9), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(196, 163, 90, 0.08), transparent 50%),
    radial-gradient(900px 600px at 0% 100%, rgba(47, 74, 54, 0.06), transparent 50%),
    var(--ivory);
}

img { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--green); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

/* Subtle geometric pattern overlay */
.pattern {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath fill='none' stroke='%238d6e32' stroke-width='1' d='M40 4 L76 40 L40 76 L4 40 Z M40 16 L64 40 L40 64 L16 40 Z'/%3E%3C/svg%3E");
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* ---------- Envelope ---------- */
.envelope {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 600px at 50% 40%, #fffaf2 0%, var(--ivory) 55%, #e9dfcc 100%);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

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

.envelope-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 24.5rem);
  text-align: center;
  padding: 4.4rem 1.55rem 2.6rem;
}

.arch-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.envelope .bismillah {
  font-family: var(--font-ar);
  font-size: clamp(1.35rem, 5.4vw, 1.85rem);
  color: var(--green);
  margin: 0 0 1.1rem;
  line-height: 1.7;
  font-weight: 600;
}

.kicker {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--gold-deep);
  letter-spacing: 0.08em;
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.names {
  font-family: var(--font-sc);
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.08em;
  line-height: 1.15;
  margin: 0;
  text-transform: uppercase;
}

.envelope .names {
  font-size: clamp(2rem, 9vw, 2.7rem);
}

.amp {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--gold-deep);
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.55em;
  line-height: 1;
  margin: 0.15em 0;
}

.date-line {
  margin: 1rem 0 0;
  font-family: var(--font-sc);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.date-line span { display: block; }
.date-line span + span {
  margin-top: 0.28rem;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.open-btn {
  margin-top: 1.7rem;
  appearance: none;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--green);
  font-family: var(--font-sc);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.9rem 1.7rem;
  border-radius: 999px;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.open-btn:hover,
.open-btn:focus-visible {
  background: var(--green);
  border-color: var(--green);
  color: var(--cream);
  box-shadow: 0 10px 24px rgba(30, 51, 38, 0.2);
  outline: none;
}

.open-btn:active { transform: translateY(1px); }

/* ---------- Mute ---------- */
.mute-btn {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: var(--safe-bottom);
  z-index: 30;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(247, 241, 230, 0.92);
  color: var(--green);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(62, 48, 28, 0.12);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

body.is-open .mute-btn { display: flex; }

.mute-btn:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

.mute-btn svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.mute-btn.is-muted .icon-wave { display: none; }
.mute-btn:not(.is-muted) .icon-slash { display: none; }

/* ---------- Main invitation ---------- */
.invitation {
  position: relative;
  z-index: 1;
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 2.4rem 1.3rem calc(4.5rem + env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

body.is-open .invitation,
body.no-js .invitation {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 1s ease 0.25s, transform 1s ease 0.25s;
}

body.no-js .envelope { display: none !important; }
body.no-js .mute-btn { display: none !important; }

.section {
  text-align: center;
  margin: 0 0 2.4rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.85s ease, transform 0.85s ease;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

.bismillah {
  font-family: var(--font-ar);
  font-size: clamp(1.4rem, 5.6vw, 1.95rem);
  color: var(--green);
  margin: 0.4rem 0 0.9rem;
  line-height: 1.7;
  font-weight: 600;
}

.title-script {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.7rem, 7vw, 2.35rem);
  color: var(--gold-deep);
  margin: 0.15rem 0 0.2rem;
  line-height: 1.15;
}

.invitation .names {
  font-size: clamp(2.05rem, 8.6vw, 3rem);
  margin: 0.15rem 0 0.85rem;
}

.dua-ar {
  font-family: var(--font-ar);
  font-size: clamp(1.05rem, 4vw, 1.3rem);
  color: var(--green);
  margin: 0.6rem 0 0.35rem;
  line-height: 1.85;
  font-weight: 600;
}

.dua {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 22rem;
  margin: 0 auto;
  line-height: 1.55;
}

/* Ornaments */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 0.85rem auto 1.05rem;
  color: var(--gold);
  width: min(16rem, 70%);
}

.ornament .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

.ornament .jewel {
  width: 7px;
  height: 7px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
  flex: 0 0 auto;
}

/* Countdown */
.countdown h2,
.parents h2,
.events-head,
.card-title,
.rsvp h2 {
  font-family: var(--font-sc);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--gold-deep);
  margin: 0 0 1rem;
}

.ticks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.tick {
  background: rgba(255, 251, 244, 0.7);
  border: 1px solid rgba(184, 148, 74, 0.35);
  border-radius: 0.7rem;
  padding: 0.85rem 0.2rem 0.7rem;
  box-shadow: 0 6px 16px rgba(62, 48, 28, 0.04);
}

.tick span {
  display: block;
  font-family: var(--font-sc);
  font-size: clamp(1.45rem, 6vw, 1.9rem);
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.04em;
  line-height: 1;
}

.tick small {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-sc);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.celebration {
  font-style: italic;
  font-size: 1.25rem;
  color: var(--green);
  margin: 0.4rem 0 0;
}

/* Parents */
.parents-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
}

@media (min-width: 520px) {
  .parents-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

.parent-card {
  padding: 0.2rem 0.4rem;
}

.parent-label {
  display: inline-block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--gold-deep);
  border: 1px solid rgba(184, 148, 74, 0.4);
  border-radius: 999px;
  padding: 0.15rem 0.8rem 0.2rem;
  margin-bottom: 0.55rem;
  background: rgba(255, 251, 244, 0.65);
}

.parent-names {
  font-family: var(--font-sc);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.02rem;
  color: var(--green-deep);
  margin: 0;
  line-height: 1.45;
}

/* Events */
.events {
  display: grid;
  gap: 1rem;
}

.event-card {
  background: rgba(255, 251, 244, 0.72);
  border: 1px solid rgba(184, 148, 74, 0.38);
  border-radius: 1.1rem;
  padding: 1.45rem 1.15rem 1.3rem;
  box-shadow: var(--shadow);
}

.event-icon {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.45rem;
  color: var(--gold-deep);
}

.event-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.event-card h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.85rem;
  color: var(--gold-deep);
  margin: 0 0 0.55rem;
}

.event-date {
  font-family: var(--font-sc);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  color: var(--green);
  margin: 0 0 0.2rem;
}

.event-time {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 0.7rem;
}

.event-venue-label {
  font-family: var(--font-sc);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.2rem;
}

.event-venue {
  font-family: var(--font-sc);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-deep);
  margin: 0;
  font-size: 1.05rem;
}

.event-place {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0.15rem 0 1rem;
  font-size: 0.98rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  font-family: var(--font-sc);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid rgba(184, 148, 74, 0.55);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--green);
  border-color: var(--green);
  color: var(--cream);
  outline: none;
}

/* Invitation image */
.invite-link {
  display: block;
  border-radius: 0.8rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(184, 148, 74, 0.3);
  background: var(--paper);
}

.invite-link img {
  width: 100%;
}

.hint {
  margin: 0.65rem 0 0;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--muted);
}

.closing {
  font-style: italic;
  font-size: 1.12rem;
  color: var(--ink);
  max-width: 24rem;
  margin: 0 auto 1.1rem;
  line-height: 1.55;
}

.look-forward {
  font-family: var(--font-sc);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0.4rem 0 0;
}

footer {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 24, 16, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.is-on {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 100%;
  max-height: 94vh;
  width: auto;
  height: auto;
  border-radius: 0.4rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

.lightbox-close {
  position: absolute;
  top: max(0.7rem, env(safe-area-inset-top));
  right: max(0.7rem, env(safe-area-inset-right));
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(247, 241, 230, 0.15);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
  #particles { display: none; }
  body.is-open .invitation { opacity: 1; transform: none; }
}
