:root {
  color-scheme: light;
  --bg: #EBDFD2;
  --paper: #F4EFDE;
  --ink: #34402E;
  --ink-soft: #59604B;
  --gold: #B59A58;
  --gold-soft: #D9C49A;
  --line: rgba(181, 154, 88, 0.45);

  --f-display: "Aref Ruqaa", "Amiri", serif;
  --f-formal: "Amiri", serif;
  --f-ui: "Cairo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-formal);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; height: 100dvh; }

.svg-ico { width: 1em; height: 1em; display: inline-block; vertical-align: middle; }

/* ---------- Opening ---------- */
.opening {
  position: fixed; inset: 0; z-index: 50;
  min-height: 100dvh; overflow: hidden;
  background: #000;
  transition: opacity .5s ease;
}
.opening.is-done { opacity: 0; pointer-events: none; }
.opening__video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  /* Crops the video's outer margin on phones. */
  transform: translateY(-2%) scale(1.29);
}
@media (min-width: 640px) { .opening__video { transform: translateY(-2%) scale(1.12); } }
@media (min-width: 768px) { .opening__video { transform: translateY(-2%) scale(1.10); } }
.opening__shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.4), transparent 50%, rgba(0,0,0,.1));
}

.tap {
  position: absolute; left: 0; right: 0; z-index: 2;
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex; justify-content: center;
  padding: 0 20px; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: tapIn 1.3s cubic-bezier(.2,.7,.2,1) .4s both;
  transition: opacity .3s ease;
}
.opening.is-playing .tap { opacity: 0; pointer-events: none; }
@media (min-width: 640px) { .tap { bottom: 40px; } }
@media (min-width: 768px) { .tap { bottom: 48px; } }
.tap__glow {
  position: absolute; top: 50%; left: 50%; width: 192px; height: 96px;
  margin: -48px 0 0 -96px; border-radius: 50%;
  background: rgba(255,255,255,.2); filter: blur(40px);
  animation: tapGlow 3s ease-in-out infinite;
}
.tap__float { position: relative; animation: tapFloat 3.2s ease-in-out infinite; }
.tap__ring {
  position: absolute; inset: -7px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.4);
  animation: tapRing 2.6s ease-in-out infinite;
}
.tap__ring--outer { inset: -14px; border-color: rgba(255,255,255,.2); animation: tapRingOuter 2.8s ease-out infinite; }
.tap__pill {
  position: relative; display: block; overflow: hidden;
  min-width: 165px; padding: 14px 32px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.7);
  background: rgba(0,0,0,.25);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: 0 8px 35px rgba(0,0,0,.3);
  color: #fff; font-family: var(--f-ui); font-size: 11px; font-weight: 500;
  letter-spacing: .32em; text-align: center; white-space: nowrap;
  transition: transform .3s ease;
}
.tap:hover .tap__pill { transform: scale(1.04); }
.tap:active .tap__pill { transform: scale(.97); }
@media (min-width: 640px) { .tap__pill { min-width: 180px; padding: 16px 40px; font-size: 12px; } }
@media (min-width: 768px) { .tap__pill { min-width: 200px; padding: 18px 44px; font-size: 14px; } }
.tap__pill.is-ar { letter-spacing: 0; font-size: 15px; font-weight: 600; padding-top: 12px; padding-bottom: 12px; }
@media (min-width: 640px) { .tap__pill.is-ar { font-size: 16px; } }
@media (min-width: 768px) { .tap__pill.is-ar { font-size: 17px; } }
.tap__label { position: relative; z-index: 1; }
.tap__shine {
  position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  animation: tapShine 3.2s ease-in-out infinite;
}

@keyframes tapIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes tapFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
@keyframes tapRing { 0%,100% { transform: scale(1); opacity: .45 } 50% { transform: scale(1.08); opacity: .12 } }
@keyframes tapRingOuter { 0% { transform: scale(1); opacity: .25 } 50% { transform: scale(1.14); opacity: 0 } 100% { transform: scale(1); opacity: .25 } }
@keyframes tapGlow { 0%,100% { opacity: .15; transform: scale(1) } 50% { opacity: .3; transform: scale(1.18) } }
@keyframes tapShine { 0% { left: -60% } 35%,100% { left: 140% } }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }

/* ---------- Layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 0 16px; }
section { padding: 56px 0; text-align: center; }

.frame {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 56px 28px;
  box-shadow: 0 20px 50px -30px rgba(46,58,42,.35);
}
.frame::before {
  content: ""; position: absolute; inset: 8px;
  border: 1px solid var(--line); border-radius: 2px; pointer-events: none;
}
.corner { position: absolute; width: 64px; height: 64px; color: var(--gold); }
.corner--tr { top: 4px; right: 4px; transform: scaleX(-1); }
.corner--tl { top: 4px; left: 4px; }
.corner--br { bottom: 4px; right: 4px; transform: scale(-1,-1); }
.corner--bl { bottom: 4px; left: 4px; transform: scaleY(-1); }

.divider {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--gold); margin: 18px auto;
}
.divider::before, .divider::after {
  content: ""; height: 1px; width: 72px;
  background: linear-gradient(to left, var(--gold), transparent);
}
.divider::after { background: linear-gradient(to right, var(--gold), transparent); }
.divider .svg-ico { width: 18px; height: 18px; }

.eyebrow { font-family: var(--f-ui); font-size: 13px; letter-spacing: .08em; color: var(--gold); margin: 0; }
.h-display { font-family: var(--f-display); font-weight: 400; color: var(--ink); margin: 6px 0 0; line-height: 1.35; font-size: clamp(38px, 10vw, 54px); }
.lead { font-size: 19px; color: var(--ink-soft); margin: 0; }

/* Image-backed card: a 9:16 background with the text laid over its empty middle. */
.panel {
  position: relative; margin: 0 -16px;
  aspect-ratio: 9 / 20; background-size: cover; background-position: center;
  display: grid; place-items: center;
}
.panel--tall { aspect-ratio: 3 / 8; }
.panel__body { width: 80%; }
.cover:has(.panel), section:has(> .panel) { padding: 0; min-height: 0; }

/* ---------- Cover ---------- */
.cover { min-height: 100dvh; display: grid; align-content: center; padding: 32px 0; }
.cover .frame { padding: 72px 24px 64px; }
.cover .occasion { font-family: var(--f-display); color: var(--gold); font-size: 24px; margin: 0 0 6px; }
.mono { display: block; width: min(46%, 200px); height: auto; margin: 10px auto 4px; }
.latin {
  font-family: "Cormorant Garamond", serif; font-weight: 600;
  font-size: clamp(20px, 5.6vw, 26px); letter-spacing: .22em; color: var(--ink-soft);
  margin: 20px 0 0; direction: ltr;
}
.latin i { font-style: normal; font-weight: 500; padding: 0 .6em; letter-spacing: 0; }
.cover .date { font-family: var(--f-formal); font-size: clamp(22px, 6vw, 28px); color: var(--ink-soft); margin: 2px 0 0; }

/* ---------- Invitation ---------- */
.inv p { margin: 0; }
.inv__intro { font-size: clamp(17px, 4.6vw, 20px); color: var(--ink-soft); }
.inv__lead { font-size: clamp(18px, 5vw, 21px); color: var(--ink-soft); margin-top: 10px !important; }
.inv__pair { display: flex; justify-content: space-around; align-items: center; gap: 12px; margin: 18px 0; }
.inv__pair div { display: grid; justify-items: center; text-align: center; }
.inv__pair small { font-size: 15px; color: var(--ink-soft); line-height: 1.4; }
.inv__hosts b { font-size: clamp(21px, 6vw, 27px); font-weight: 700; color: var(--ink); line-height: 1.4; }
.inv__invite { font-size: clamp(18px, 5vw, 21px); color: var(--ink-soft); }
.inv__names { margin: 14px 0 22px; justify-content: center; gap: 22px; }
.inv__names b {
  font-family: var(--f-formal); font-weight: 700; line-height: 1.25;
  font-size: clamp(48px, 14vw, 64px); color: #6E5A35;
  text-shadow: 0 3px 6px rgba(110, 90, 53, .25);
}
.inv__names small { font-size: 16px; }
.inv__sep { display: grid; place-items: center; align-self: stretch; color: #6E5A35; position: relative; }
.inv__sep::before { content: ""; position: absolute; top: 8%; bottom: 8%; width: 1px; background: currentColor; opacity: .6; }
.inv__sep .svg-ico { position: relative; width: 18px; height: 18px; background: var(--paper); }
.panel .inv__sep .svg-ico { background: none; }
.flourish { display: block; width: min(86%, 300px); height: 18px; margin: 6px auto; color: #7A6438; }
.inv__when { font-family: var(--f-formal); font-weight: 700; font-size: clamp(22px, 6.4vw, 28px); color: var(--ink); letter-spacing: .02em; }

/* ---------- Countdown ---------- */
.count { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 26px; direction: rtl; }
.count div {
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px;
  padding: 16px 4px 12px;
}
.count b { display: block; font-family: var(--f-ui); font-weight: 600; font-size: clamp(28px, 8vw, 38px); line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.count span { font-family: var(--f-ui); font-size: 13px; color: var(--ink-soft); }
.count-done { font-family: var(--f-display); font-size: 28px; color: var(--gold); margin-top: 22px; }

/* ---------- Venue ---------- */
.venue-name { font-size: 28px; font-weight: 700; margin: 18px 0 0; }
.venue-area { font-family: var(--f-ui); color: var(--ink-soft); margin: 0; }
.map {
  margin-top: 22px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
  background: var(--paper); padding: 6px;
}
.map iframe { display: block; width: 100%; height: 280px; border: 0; border-radius: 2px; filter: sepia(.15) saturate(.9); }
.actions { display: grid; gap: 10px; margin-top: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 12px 22px;
  font-family: var(--f-ui); font-size: 15px; font-weight: 600;
  border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  text-decoration: none; cursor: pointer;
  transition: transform .2s ease, background-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn .svg-ico { width: 18px; height: 18px; }

/* ---------- Footer ---------- */
footer { text-align: center; padding: 20px 0 72px; }
footer p { font-family: var(--f-display); font-size: 24px; color: var(--gold); margin: 0; }

/* ---------- Music toggle ---------- */
.music-toggle {
  position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; z-index: 40;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(46,58,42,.88); color: var(--gold-soft); border: 1px solid rgba(217,196,154,.4);
  cursor: pointer; backdrop-filter: blur(6px);
}
.music-toggle[hidden] { display: none; }
.music-toggle svg { width: 20px; height: 20px; }
.music-toggle.is-muted { opacity: .55; }
.music-toggle:not(.is-muted) svg { animation: float 2.4s ease-in-out infinite; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

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

/* ---------- Image-backed cards: everything scales with the card ----------
   Sizes use cqw (1% of the card's width), so the text keeps its place against the
   artwork at any screen size. The body is confined to the empty band between ornaments. */
.panel { container-type: inline-size; }
.panel__body {
  position: absolute; left: 9%; right: 9%; width: auto;
  top: var(--free-top, 25%); bottom: var(--free-bottom, 25%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.cover .panel { --free-top: 30%; --free-bottom: 30%; }
.panel--tall { --free-top: 24.5%; --free-bottom: 24.5%; }

.panel .occasion { font-size: 6.4cqw; margin: 0 0 1cqw; }
.panel .mono { width: 34cqw; margin: 1cqw auto 0; }
.panel .latin { font-size: 5.4cqw; margin: 4cqw 0 0; }
.panel .date { font-size: 6.4cqw; margin: 1cqw 0 0; }

.panel .inv__intro { font-size: 4.5cqw; }
.panel .inv__lead { font-size: 4.9cqw; margin-top: 2cqw !important; }
.panel .inv__pair { margin: 4cqw 0; gap: 3cqw; width: 100%; }
.panel .inv__pair small { font-size: 3.7cqw; }
.panel .inv__hosts b { font-size: 6cqw; }
.panel .inv__invite { font-size: 4.8cqw; }
.panel .inv__names { margin: 3cqw 0 5cqw; gap: 5cqw; }
.panel .inv__names b { font-size: 13.5cqw; }
.panel .inv__names small { font-size: 4cqw; }
.panel .inv__sep .svg-ico { width: 4.4cqw; height: 4.4cqw; }
.panel .flourish { width: 70cqw; height: 4.4cqw; margin: 1.5cqw auto; }
.panel .inv__when { font-size: 6.4cqw; }
