/* «محلاها» — ستارة مخملية تُفتح على ليلة الحنّة: مخمل عنّابي وورد أحمر وذهب النحاس على عاجٍ
   مدمشق، من مشهد الحنّة نفسه. الألوان متغيّرات :root فتصلها «ألوان القالب» */
:root {
  --velvet: #5a0a15;
  --velvet-deep: #3a050d;
  --crimson: #7d0f1f;
  --rose: #a3162b;
  --gold: #b0843e;
  --gold-soft: #d8b77a;
  --ivory: #fbf7f3;
  --ivory-2: #f4ece5;
  --ink: #4a1d1d;
  --ink-soft: #87635a;
  --col: 520px;
  --ruqaa: "Aref Ruqaa", "Amiri", serif;
  --naskh: "Amiri", serif;
  --ui: "El Messiri", "Amiri", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--naskh);
  /* على الشاشات العريضة: عمود الدعوة على مخملٍ عنّابي */
  background: radial-gradient(120% 80% at 50% 0%, #7a1020 0%, var(--velvet) 45%, var(--velvet-deep) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
}

#page {
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  background: var(--ivory);
  box-shadow: 0 0 60px rgba(0, 0, 0, .45);
  overflow: hidden;
}

/* ═══ قبل فتح الستارة: الواجهة وحدها، ولا تمرير ═══ */
body.is-gate { overflow: hidden; height: 100%; }
body.is-gate #page > :not(.hero) { display: none !important; }
body.is-gate #da3wa-music,
body.is-gate .da3wa-footer,
body.is-gate #da3wa-credit { opacity: 0 !important; pointer-events: none !important; }

/* ═══ المسرح ═══ */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: var(--velvet-deep);
}
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  aspect-ratio: 9 / 16;
  /* يغطّي العمود كـcover، بنسبة الفيلم ثابتة فتبقى الأسطر فوق الجدار نفسه */
  width: max(100%, calc(100svh * 9 / 16));
  transform: translate(-50%, -50%);
  container-type: inline-size;
}
@supports not (height: 100svh) {
  .stage { width: max(100%, calc(100vh * 9 / 16)); }
}
.stage-still,
.stage-loop,
.stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.stage-still,
.stage-loop { opacity: 0; }
.stage-video { background: var(--velvet-deep) center / cover no-repeat url("/templates/mahlaha/assets/gate-poster.jpg"); }
body.is-open .stage-still,
body.is-open .stage-loop { opacity: 1; }
body.is-open .stage-video { visibility: hidden; }

/* أسطر «عروستنا محلاها» فوق جدار المشهد — تُكتب من اليمين واحداً تلو الآخر */
.lines {
  position: absolute;
  top: var(--lines-top, 15%);
  left: 50%;
  width: 66%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .05em;
  font-family: var(--ruqaa);
  font-weight: 700;
  font-size: 8.4cqw;
  line-height: 1.55;
  color: var(--crimson);
  text-align: center;
  pointer-events: none;
}
.line {
  display: block;
  white-space: nowrap;
  text-shadow: 0 0 .35em rgba(255, 253, 250, .95), 0 0 .9em rgba(255, 253, 250, .8), 0 1px 0 rgba(255, 255, 255, .7);
  clip-path: inset(0 0 0 100%);
  opacity: 0;
  filter: blur(3px);
}
.line.on {
  animation: write 1.15s cubic-bezier(.3, .1, .2, 1) forwards;
}
body.is-open .line { clip-path: inset(0 0 0 0); opacity: 1; filter: none; animation: none; }
@keyframes write {
  0% { clip-path: inset(0 0 0 100%); opacity: 0; filter: blur(3px); }
  25% { opacity: 1; }
  100% { clip-path: inset(0 0 0 0); opacity: 1; filter: blur(0); }
}

/* زرّ «اضغط على الستارة» — المسرح كلّه يُلمس، والزرّ دليلٌ عليه */
.tap-hint {
  position: absolute;
  left: 50%;
  bottom: calc(16% + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 12px 18px;
  border: 1px solid rgba(var(--gold-soft-rgb, 216, 183, 122), 0.75);
  border-radius: 999px;
  background: rgba(40, 3, 9, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff7ea;
  font-family: var(--ui);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .06);
  cursor: pointer;
  animation: hint-in .9s .4s both ease-out;
  transition: opacity .45s ease, transform .45s ease;
  z-index: 3;
}
.tap-hand { width: 24px; height: 24px; color: var(--gold-soft); animation: tap 1.6s infinite ease-in-out; }
.tap-ring {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(var(--gold-soft-rgb, 216, 183, 122), 0.8);
  animation: ring 1.9s infinite ease-out;
  pointer-events: none;
}
.hero.is-starting .tap-hint,
body.is-open .tap-hint { opacity: 0; transform: translateX(-50%) translateY(10px); pointer-events: none; }
.hero.is-loading .tap-text::after { content: " …"; }
@keyframes hint-in { from { opacity: 0; transform: translateX(-50%) translateY(14px); } }
@keyframes tap { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-3px) scale(.96); } }
@keyframes ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.18, 1.5); } }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 18px 6px;
  border-radius: 999px;
  background: rgba(40, 3, 9, .5);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  color: #fff3e3;
  font-family: var(--ui);
  font-size: 14px;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s .6s ease;
  z-index: 3;
}
.scroll-cue svg { width: 20px; height: 20px; animation: bob 1.6s infinite ease-in-out; }
body.is-open .scroll-cue { opacity: 1; pointer-events: auto; }
body.is-open.scrolled .scroll-cue { opacity: 0; pointer-events: none; transition-delay: 0s; }
@keyframes bob { 50% { transform: translateY(4px); } }

/* ═══ صفحة الدعوة: عاجٌ مدمشق تحت إكليل الستارة ═══ */
.invite {
  position: relative;
  padding: 0 22px 44px;
  text-align: center;
  background-color: var(--ivory);
  background-image:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='160' viewBox='0 0 120 160'%3E%3Cg fill='none' stroke='%23d9c3b6' stroke-width='1' opacity='.55'%3E%3Cpath d='M60 0C60 40 120 40 120 80S60 120 60 160M60 0C60 40 0 40 0 80S60 120 60 160'/%3E%3Cpath d='M60 64c-6 6-6 26 0 32 6-6 6-26 0-32zM44 80c6-6 26-6 32 0-6 6-26 6-32 0z'/%3E%3C/g%3E%3Cg fill='%23d9c3b6' opacity='.5'%3E%3Ccircle cx='60' cy='80' r='2.2'/%3E%3Ccircle cx='0' cy='0' r='1.6'/%3E%3Ccircle cx='120' cy='0' r='1.6'/%3E%3Ccircle cx='0' cy='160' r='1.6'/%3E%3Ccircle cx='120' cy='160' r='1.6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 520px, 120px 160px;
  background-repeat: no-repeat, repeat;
}
.garland {
  display: block;
  width: calc(100% + 44px);
  height: auto;
  margin: 0 -22px 10px;
  pointer-events: none;
  /* جدار المشهد الأبيض يذوب في العاجي، ويبقى الورد والقماش */
  mix-blend-mode: multiply;
}

[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
[data-reveal].in { opacity: 1; transform: none; }

.poem {
  margin: 6px 0 4px;
  font-family: var(--ruqaa);
  font-weight: 700;
  font-size: clamp(32px, 9.6vw, 46px);
  line-height: 1.5;
  color: var(--crimson);
  white-space: pre-line;
}
.divider { display: block; width: min(240px, 66%); height: auto; margin: 10px auto 14px; color: var(--gold); }
.welcome {
  margin: 0 0 26px;
  font-family: var(--ruqaa);
  font-size: clamp(25px, 7.4vw, 34px);
  line-height: 1.6;
  color: var(--gold);
}
.honour .lead {
  white-space: pre-line;
  margin: 0;
  font-size: clamp(19px, 5.4vw, 23px);
  line-height: 1.9;
  color: var(--ink);
}
.host {
  margin: 2px 0 6px;
  font-family: var(--ruqaa);
  font-weight: 700;
  font-size: clamp(32px, 9.6vw, 44px);
  line-height: 1.45;
  color: var(--crimson);
}
.bride {
  margin: 4px 0 0;
  font-family: var(--ruqaa);
  font-weight: 700;
  font-size: clamp(64px, 21vw, 96px);
  line-height: 1.25;
  color: var(--rose);
  text-shadow: 0 2px 0 rgba(255, 255, 255, .8), 0 10px 26px rgba(var(--crimson-rgb, 125, 15, 31), 0.18);
}
.bride.is-long { font-size: clamp(44px, 13vw, 64px); line-height: 1.35; }
.flourish { display: block; width: min(260px, 72%); height: auto; margin: 0 auto 14px; color: var(--gold); }
.flourish { margin-bottom: 22px; }

/* ═══ الموعد والمكان ═══ */
.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 18px;
}
.tile {
  position: relative;
  padding: 16px 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(var(--gold-rgb, 176, 132, 62), 0.38);
  box-shadow: 0 8px 22px rgba(var(--velvet-rgb, 90, 10, 21), 0.07), inset 0 0 0 4px rgba(255, 255, 255, .55);
}
.tile-wide { grid-column: 1 / -1; padding-bottom: 18px; }
.ico {
  width: 30px;
  height: 30px;
  margin: 0 auto 6px;
  display: block;
  fill: none;
  stroke: var(--crimson);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile .k { margin: 0; font-family: var(--ui); font-size: 14px; color: var(--ink-soft); }
.tile .v {
  margin: 2px 0 0;
  font-family: var(--ui);
  font-weight: 600;
  font-size: clamp(19px, 5.6vw, 23px);
  color: var(--crimson);
  font-variant-numeric: lining-nums;
}
.tile .addr { margin: 2px 0 0; font-size: 16px; color: var(--ink-soft); }
.tile .addr:empty { display: none; }
.map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8f1424, var(--crimson));
  color: #fff6ea;
  font-family: var(--ui);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(var(--crimson-rgb, 125, 15, 31), 0.25);
}
.map-btn[hidden] { display: none; }

/* ═══ العدّ التنازلي ═══ */
.countdown {
  margin: 0 0 18px;
  padding: 16px 12px 18px;
  border-radius: 20px;
  color: #fff4e6;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #7a1020, var(--velvet));
  box-shadow: 0 12px 28px rgba(var(--velvet-rgb, 90, 10, 21), 0.28), inset 0 0 0 1px rgba(var(--gold-soft-rgb, 216, 183, 122), 0.45);
}
.countdown[hidden] { display: none; }
.cd-title { margin: 0 0 10px; font-family: var(--ruqaa); font-size: 26px; color: var(--gold-soft); }
.cd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; direction: rtl; }
.cd-grid div { display: flex; flex-direction: column; align-items: center; }
.cd-grid b { font-family: var(--ui); font-size: clamp(26px, 8vw, 34px); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd-grid span { font-family: var(--ui); font-size: 13px; opacity: .8; }

/* ═══ التنويهات (من المحرّر) والختام ═══ */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notes:empty { display: none; }
.note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(var(--crimson-rgb, 125, 15, 31), 0.4);
  background: rgba(var(--rose-rgb, 163, 22, 43), 0.05);
}
.note .ico { width: 26px; height: 26px; margin: 0; flex: none; }
.note p { margin: 0; font-family: var(--ui); font-weight: 600; font-size: clamp(16px, 4.6vw, 19px); color: var(--crimson); }
.closing {
  margin: 20px 0 4px;
  font-family: var(--ruqaa);
  font-weight: 700;
  font-size: clamp(26px, 7.8vw, 34px);
  line-height: 1.5;
  color: var(--gold);
}
.closing[hidden] { display: none; }

/* أقسام المنصّة المنقولة إلى مكانها داخل البطاقة */
.invite #da3wa-cal,
.invite #da3wa-rsvp { text-align: initial; }
.invite #da3wa-cal { margin: 0 -6px 18px; }
.invite #da3wa-rsvp { margin: 22px -6px 0; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .tap-hand, .tap-ring, .scroll-cue svg { animation: none; }
}
