/* ============================================================
   waqar — «وقار»: قالب دعوة رسمي عام (عربي)
   نسخةٌ عامّة مستقلّة من الـVIP «المجلس» (public/custom/majlis-sdym — لا يُمَسّ):
   قماش يتموّج بخطوط ضوءٍ ذهبية، شعارٌ ذهبيّ بارز وصورته الكبيرة مغبّشة خلف الكرت،
   عباراتٌ ثابتة صورٌ بخط الثلث الكامل، والأسماء بالرقعة، والنصّ بـTajawal رقيق.
   ⚑ القماش يُلوَّن: الأرضية var(--silk) تحت طيّاتٍ محايدة (assets/folds.svg)، وكلّ
   درجةٍ مشتقّة بـcolor-mix — فميزة «ألوان القالب» تبدّل القماش والذهب والحبر كلّها.
   ============================================================ */

:root {
  /* الألوان الأربعة التي تعرضها «ألوان القالب» (hex فقط تُقرأ — color-roles.ts) */
  --silk: #1f3c2c;
  --gold: #d8b86a;
  --gold-hi: #f3dea0;
  --ink: #f8f5ec;
  /* مشتقّاتٌ منها — تتبعها تلقائياً */
  --silk-hi: color-mix(in srgb, var(--silk) 80%, #ffffff);
  --silk-lo: color-mix(in srgb, var(--silk) 60%, #000000);
  --ink-soft: color-mix(in srgb, var(--ink) 84%, transparent);
  --ink-faint: color-mix(in srgb, var(--ink) 60%, transparent);
  --gold-line: color-mix(in srgb, var(--gold) 50%, transparent);
  --gold-faint: color-mix(in srgb, var(--gold) 22%, transparent);
  --glow: color-mix(in srgb, var(--gold-hi) 40%, transparent);
  /* النصّ المتغيّر (اسم العريس، دعاءٌ مخصّص، العناوين) بالرقعة: موثوقة مع أيّ اسم.
     العبارات الثابتة صورٌ بالثلث الكامل، ولا يُضمَّن خطّ ثلث (انظر المولّد). */
  --callig: "Aref Ruqaa", "Amiri", serif;
  --sans: "Tajawal", "Helvetica Neue", sans-serif;
  /* الشعار ذهبٌ مطروق مقتطعٌ من صورة الزبونة المرجعية (scripts/cut-waqar-emblem.mjs) — عموديّ ٥٢١×٧٧٣ */
  --m-emblem: url("/templates/waqar/assets/emblem.webp");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--silk); }
body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.85;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* القماش: طبقة ثابتة خلف كل شيء — لونه var(--silk) وطيّاته محايدة فوقه */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    url("/templates/waqar/assets/folds.svg") center / cover no-repeat,
    linear-gradient(180deg, var(--silk-hi) 0%, var(--silk) 46%, var(--silk-lo) 100%);
  background-color: var(--silk);
}
body.is-locked { overflow: hidden; height: 100vh; height: 100dvh; }
img, svg { display: block; max-width: 100%; }

/* العبارات الثابتة صورٌ بيضاء بخط الثلث تُستعمل **قناعاً** يُصبغ بلون النصّ: فتتبع «ألوان القالب»
   كالأسماء — قماشٌ عاجيّ بحبرٍ داكن لا يُخفيها. ‹img› يبقى للمقاس والنصّ البديل، ومحتواه يُدفع خارج
   صندوقه فلا يُرى إلا اللون. الظلّ على الغلاف .art-shadow لأن القناع يقصّ ظلّ عنصره نفسه. */
.art {
  background: var(--ink); object-position: -99999px 0;
  -webkit-mask: var(--art) center / contain no-repeat; mask: var(--art) center / contain no-repeat;
}
.art--dawa { --art: url("/templates/waqar/assets/dawa.png"); }
.art--dua { --art: url("/templates/waqar/assets/dua.png"); }
.art--closing { --art: url("/templates/waqar/assets/closing.png"); }
.art--welcome { --art: url("/templates/waqar/assets/welcome.png"); }
.art-shadow { display: block; width: fit-content; margin: 0 auto; }
[hidden] { display: none !important; }
a { color: inherit; }

/* الشعار الكبير المغبّش خلف الكرت — كما في المرجع */
.ghost {
  position: absolute; left: 50%; top: 3vh; width: min(66vw, 310px); transform: translateX(-50%);
  opacity: .17; filter: blur(9px) saturate(.85);
  pointer-events: none; user-select: none;
}

/* البريق: شريط ضوء دافئ يعبر الذهب، مقصوصٌ على شكل الشعار */
.sheen {
  position: absolute; inset: 0;
  -webkit-mask: var(--m-emblem) center / 100% 100% no-repeat; mask: var(--m-emblem) center / 100% 100% no-repeat;
  background: linear-gradient(112deg, transparent 40%, rgba(255, 244, 205, .9) 50%, transparent 60%) no-repeat;
  background-size: 260% 100%; background-position: 130% 0;
  opacity: 0; pointer-events: none;
}
@keyframes sheen {
  0% { opacity: 0; background-position: 130% 0; }
  12%, 88% { opacity: 1; }
  100% { opacity: 0; background-position: -30% 0; }
}

/* =========================== البوابة =========================== */
.gate {
  position: fixed; inset: 0; z-index: 60;
  cursor: pointer; outline: none; touch-action: manipulation;
}
.gate.is-gone { display: none; }
.gate > .ghost { position: fixed; transition: opacity .8s ease; }
.gate__stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 24px 6vh;
  pointer-events: none;
}
.gate__emblem { position: relative; width: min(34vw, 136px, 19vh); aspect-ratio: 521 / 773; }
.gate__emblem img { width: 100%; height: 100%; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45)); }
.gate__title { display: block; width: min(66vw, 268px); margin-top: 12px; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .35)); }
.gate__title img { width: 100%; }
.gate__emblem, .gate__title { transform-origin: 50% 50%; transition: transform 1.15s cubic-bezier(.6, .02, .2, 1); }
.gate__title { width: min(42vw, 168px); }
.gate__names {
  margin: 10px 0 0; font-family: var(--callig); font-weight: 700; font-size: clamp(26px, 8vw, 36px); line-height: 1.6;
  color: var(--ink); text-shadow: 0 2px 12px rgba(0, 0, 0, .35); transition: opacity .5s ease;
}
.gate.is-shine .gate__names { opacity: 0; }
.gate__hint {
  position: absolute; left: 0; right: 0; bottom: max(9vh, 62px); margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 400; letter-spacing: .06em; color: var(--ink-soft);
  transition: opacity .4s ease;
}
/* ديمو المعرض: شريط «أعجبك القالب؟» الثابت أسفل الشاشة يغطّي التلميح — يرتفع فوقه ما دام ظاهراً */
body:has(#da3wa-democta) .gate__hint { bottom: calc(max(9vh, 62px) + 80px); }
.gate__ring { position: relative; width: 13px; height: 13px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 14px var(--glow); }
.gate__ring::before, .gate__ring::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px solid var(--gold);
  animation: ring 2.2s ease-out infinite;
}
.gate__ring::after { animation-delay: 1.1s; }
@keyframes ring { from { transform: scale(.5); opacity: .9; } to { transform: scale(2.1); opacity: 0; } }

.gate.is-shine .gate__emblem .sheen { animation: sheen 1.1s cubic-bezier(.45, .05, .3, 1) forwards; }
.gate.is-shine .gate__hint { opacity: 0; }
.gate.is-flying > .ghost { opacity: 0; }

/* =========================== الكرت =========================== */
.card { position: relative; max-width: 560px; margin: 0 auto; padding: 0 20px 26px; text-align: center; }

.inv {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(3vh, 18px) 0 max(2vh, 10px);
}
.inv > .ghost--card { position: absolute; top: 2vh; }
.inv p { margin: 0; }
.inv__title { margin: 0; line-height: 0; }
.inv__title img { width: min(38vw, 150px); }
.inv__title .art-shadow { filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .35)); }
.inv__dua { margin-top: 4px !important; }
.inv__dua img { width: min(88vw, 360px); }
.inv__dua .art-shadow, .inv__closing .art-shadow { filter: drop-shadow(0 0 10px var(--glow)) drop-shadow(0 2px 6px rgba(0, 0, 0, .3)); }
.inv__verse {
  display: block; max-width: 26ch; text-wrap: balance; white-space: pre-line;
  font-family: var(--callig); font-size: clamp(21px, 6vw, 26px); line-height: 1.8;
  color: var(--ink); text-shadow: 0 0 14px var(--glow), 0 2px 8px rgba(0, 0, 0, .3);
}
.inv__body {
  margin-top: 10px !important; max-width: 30ch; text-wrap: balance;
  font-size: clamp(16.5px, 4.6vw, 19px); line-height: 1.85; color: var(--ink-soft);
  white-space: pre-line;
}
.inv__emblem { position: relative; width: clamp(54px, 16vw, 66px); aspect-ratio: 521 / 773; margin: 12px auto 0; }
.inv__emblem img { width: 100%; height: 100%; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45)); }
.inv__emblem .sheen { animation: sheen 1.3s ease-in-out 3s 1 both, sheenLoop 8s ease-in-out 6s infinite; }
@keyframes sheenLoop {
  0%, 82% { opacity: 0; background-position: 130% 0; }
  86%, 96% { opacity: 1; }
  100% { opacity: 0; background-position: -30% 0; }
}
/* الأسماء: العريس & العروس، أو العريس وحده في كرت الرجال */
.inv__names { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 14px; margin-top: 4px; max-width: 100%; }
.inv__name {
  font-family: var(--callig); font-weight: 700; font-size: clamp(30px, 9.2vw, 42px); line-height: 1.6;
  color: var(--ink); text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  overflow-wrap: anywhere;
}
.inv__amp { font-family: var(--callig); font-size: clamp(22px, 6.4vw, 28px); color: var(--gold-hi); text-shadow: 0 0 12px var(--glow); }
/* اسمان طويلان: كلٌّ في سطره و«&» بينهما */
.inv__names.is-stacked { flex-direction: column; align-items: center; gap: 0; }
.inv__names.is-stacked .inv__name { line-height: 1.45; }
.inv__names.is-stacked .inv__amp { line-height: 1; }
.inv__families { margin-top: 2px !important; display: flex; flex-direction: column; font-size: clamp(14.5px, 4vw, 16px); line-height: 1.75; color: var(--ink-soft); }
.inv__will { margin-top: 8px !important; font-size: clamp(16.5px, 4.6vw, 19px); color: var(--ink-soft); }
.inv__icons { display: flex; justify-content: center; gap: 22px; margin: 8px 0 4px; }
.ico { display: grid; place-items: center; width: 34px; height: 34px; color: var(--ink); opacity: .92; }
.ico svg { width: 25px; height: 25px; }
.ico:active { transform: scale(.92); }
.inv__date { font-size: clamp(15px, 4.2vw, 17px); font-weight: 400; letter-spacing: .03em; color: var(--ink); }
.inv__date bdi { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.inv__time, .inv__venue { margin-top: 2px !important; font-size: clamp(15px, 4.2vw, 17px); color: var(--ink-soft); }
.inv__closing { margin-top: 12px !important; }
.inv__closing img { width: min(72vw, 290px); }

/* «مرّر للأسفل» — كبسولةٌ زجاجية بإطارٍ ذهبيّ تطفو أسفل الشاشة: تُقرأ فوق أيّ سطرٍ من الكرت
   يقع تحتها (ظلٌّ متدرّج وحده كان يُركِّب النصّ على اسم القاعة). تظهر بعد أن يُكتب الكرت
   كلّه (body.is-read) وتتنحّى مع أوّل تمرير (body.is-scrolled). نصٌّ ذهبيّ وبجانبه سهمان
   يتتابعان نزولاً، ومركزها على خطّ زرّ الموسيقى (bottom 16px، قطره 50). كلّ لونٍ متغيّر —
   يتبع «ألوان القالب». */
.more {
  position: fixed; left: 0; right: 0; z-index: 20;
  bottom: calc(21px + env(safe-area-inset-bottom, 0px));
  width: max-content; margin: 0 auto;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 20px 8px 16px;
  border: 1px solid var(--gold-line); border-radius: 999px;
  background: color-mix(in srgb, var(--silk-lo) 74%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38), 0 0 18px var(--gold-faint), inset 0 1px 0 rgba(255, 255, 255, .1);
  color: var(--gold-hi); text-decoration: none;
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
  -webkit-tap-highlight-color: transparent;
}
.is-read .more { opacity: 1; transform: none; pointer-events: auto; }
.is-read.is-scrolled .more { opacity: 0; transform: translateY(16px); pointer-events: none; }
/* ديمو المعرض: تطفو فوق شريط «أعجبك القالب؟» الثابت ما دام ظاهراً */
body:has(#da3wa-democta) .more { bottom: calc(21px + 88px + env(safe-area-inset-bottom, 0px)); }
/* وزرّ الموسيقى كذلك — تحت الشريط لا يُرى، فيبدو الديمو بلا أغنية (البُعد المضمّن 16px) */
body:has(#da3wa-democta) #da3wa-music { bottom: calc(16px + 88px + env(safe-area-inset-bottom, 0px)) !important; }
.more__label {
  font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--gold-hi); white-space: nowrap;
  text-shadow: 0 0 10px var(--glow);
}
.more__arrows { display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 0 5px var(--glow)); }
.more__arrows svg { width: 16px; height: 8px; opacity: 0; animation: cascade 1.9s ease-in-out infinite; }
.more__arrows svg + svg { margin-top: 1px; animation-delay: .32s; }
@keyframes cascade {
  0% { opacity: 0; transform: translateY(-4px); }
  35% { opacity: 1; }
  75%, 100% { opacity: 0; transform: translateY(5px); }
}
.more:active { transform: scale(.96); }

/* الكتابة: قبل الفتح أسطر الكرت مخفية، وبعده تظهر واحداً بعد الآخر */
.ln { transition: opacity .9s ease var(--d, 0s), transform 1s cubic-bezier(.2, .7, .2, 1) var(--d, 0s), filter .9s ease var(--d, 0s); }
.is-gated .ln { opacity: 0; transform: translateY(10px); filter: blur(3px); }
/* العنوان والشعار يصلهما نظيراهما الطائران من البوابة فيُكشفان فوراً بلا حركة */
.is-landing .inv__title, .is-landing .inv__emblem { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }

/* =========================== ما بعد الكرت =========================== */
.sec { position: relative; padding: 30px 0 6px; }
.notes { list-style: none; margin: 0 auto; padding: 0; max-width: 32ch; }
.notes li { padding: 3px 0; font-size: clamp(16px, 4.4vw, 18px); color: var(--ink-soft); }

.sec__title {
  margin: 0 0 16px; display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: var(--callig); font-weight: 700; font-size: clamp(23px, 6.6vw, 28px); line-height: 1.5; color: var(--ink);
}
.sec__title::before, .sec__title::after { content: ""; width: 30px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.sec__title::after { transform: scaleX(-1); }

.count__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 380px; margin: 0 auto; }
.count__box {
  padding: 12px 4px 8px; border: 1px solid var(--gold-faint); border-radius: 4px;
  background: rgba(255, 255, 255, .05); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.count__num { display: block; font-size: clamp(25px, 7.6vw, 32px); font-weight: 500; line-height: 1.3; color: var(--ink); font-variant-numeric: tabular-nums; }
.count__lab { display: block; font-size: 13px; color: var(--ink-faint); }

.prog__list { list-style: none; margin: 0 auto; padding: 0; max-width: 380px; }
.prog__list li { display: flex; align-items: baseline; gap: 10px; padding: 9px 2px; }
.prog__title { font-size: clamp(16.5px, 4.6vw, 18px); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.prog__dots { flex: 1; border-bottom: 1px dotted var(--gold-line); transform: translateY(-5px); min-width: 18px; }
.prog__time { font-size: clamp(15px, 4.2vw, 17px); font-weight: 400; color: var(--gold-hi); white-space: nowrap; }

.venue__name { margin: 0; font-family: var(--callig); font-weight: 700; font-size: clamp(26px, 7.8vw, 34px); line-height: 1.6; color: var(--ink); }
.venue__addr { margin: 2px 0 0; font-size: clamp(16px, 4.4vw, 18px); color: var(--ink-soft); white-space: pre-line; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 18px; padding: 11px 26px;
  border: 1px solid var(--gold-line); border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--ink); text-decoration: none;
  font-size: 15px; font-weight: 500; letter-spacing: .02em;
  transition: background .25s ease, transform .15s ease;
}
.btn svg { width: 17px; height: 17px; color: var(--gold-hi); }
.btn:active { transform: scale(.97); background: rgba(255, 255, 255, .12); }

.closing { padding: 40px 0 12px; }
.closing__emblem { width: 48px; height: auto; margin: 0 auto 6px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .4)); }
.closing__welcome { margin: 0; }
.closing__welcome img { width: min(48vw, 190px); }
.closing__welcome .art-shadow { filter: drop-shadow(0 0 10px var(--glow)); }
.closing__families { margin: 8px auto 0; font-size: clamp(16px, 4.4vw, 18px); font-weight: 400; color: var(--ink); }
.closing__note { margin: 8px auto 0; max-width: 32ch; text-wrap: balance; font-size: clamp(16px, 4.4vw, 18px); color: var(--ink-soft); white-space: pre-line; }
.closing__contact { margin-top: 20px; }
.closing__contact span { display: block; font-size: 13px; letter-spacing: .06em; color: var(--ink-faint); }

/* ظهور الأقسام مع التمرير */
.rv { opacity: 0; transform: translateY(20px); transition: opacity 1s ease, transform 1.1s cubic-bezier(.2, .7, .2, 1); }
.rv.is-in { opacity: 1; transform: none; }

/* الأقسام المحقونة (احفظ الموعد، التأكيد) تأخذ مسافة البطاقة */
.card > #da3wa-cal, .card > #da3wa-rsvp { margin-top: 30px; }

@media (prefers-reduced-motion: reduce) {
  .rv, .ln { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
  .inv__emblem .sheen, .gate__ring::before, .gate__ring::after { animation: none; }
  .more__arrows svg { animation: none; opacity: .95; }
  .more { transition: none; }
}
