/* ==========================================================================
   لمّة — صفحة الدعوة
   الألوان والخطوط تأتي من متغيرات القالب المحقونة على .inv
   (--bg --surface --ink --muted --accent --accent-strong --line --btn-bg --btn-ink
    --cover-bg --cover-bg-2 --cover-ink --seal --seal-ink --font-display --font-body)
   ========================================================================== */

.inv-body { background: #14110d; }
html.inv-locked, html.inv-locked body { overflow: hidden; height: 100%; }

.inv {
  --ease: cubic-bezier(.22, .8, .24, 1);
  position: relative;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  overflow-x: clip;
}
.inv--dark { color-scheme: dark; }
/* الدعوات الإنجليزية تستخدم خط Cormorant للعناوين (يُحقن في style من القالب) */
.inv[data-lang='en'] .inv-names { font-weight: 600; letter-spacing: .01em; }

/* على الشاشات العريضة تبقى الدعوة بعرض الهاتف في المنتصف */
.inv-page {
  position: relative; z-index: 1;
  width: min(100%, 480px);
  margin-inline: auto;
  padding-bottom: 96px;
}
@media (min-width: 640px) {
  .inv { background: color-mix(in srgb, var(--bg) 82%, #000); }
  .inv-page { background: var(--bg); box-shadow: 0 0 80px rgba(0, 0, 0, .28); min-height: 100dvh; }
}

/* ------------------------------ الخلفية الزخرفية ------------------------------ */

.inv-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
@media (min-width: 640px) { .inv-bg { inset-inline: calc(50% - 240px); } }
.inv-bg::before, .inv-bg::after { content: ''; position: absolute; inset: 0; }

/* نقش مكرر يُلوَّن بلون القالب عبر mask */
.inv[data-motif='girih'] .inv-bg::before,
.inv[data-motif='damask'] .inv-bg::before {
  background: var(--accent);
  opacity: .09;
  -webkit-mask-size: 84px 84px; mask-size: 84px 84px;
}
.inv[data-motif='girih'] .inv-bg::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 3L45 24L24 45L3 24ZM9.2 9.200H38.800V38.800H9.200Z' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 3L45 24L24 45L3 24ZM9.2 9.200H38.800V38.800H9.200Z' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");
}
.inv[data-motif='damask'] .inv-bg::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 4c7 7 7 13 0 20c-7-7-7-13 0-20zM24 24c7 7 7 13 0 20c-7-7-7-13 0-20zM4 24c7-7 13-7 20 0c-7 7-13 7-20 0zM24 24c7-7 13-7 20 0c-7 7-13 7-20 0z' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 4c7 7 7 13 0 20c-7-7-7-13 0-20zM24 24c7 7 7 13 0 20c-7-7-7-13 0-20zM4 24c7-7 13-7 20 0c-7 7-13 7-20 0zM24 24c7-7 13-7 20 0c-7 7-13 7-20 0z' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");
}

/* نجوم تتلألأ */
.inv[data-motif='stars'] .inv-bg::before,
.inv[data-motif='stars'] .inv-bg::after {
  background-image:
    radial-gradient(1.4px 1.4px at 12% 8%, var(--accent) 50%, transparent 52%),
    radial-gradient(1px 1px at 78% 14%, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 34% 26%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 88% 38%, var(--accent) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 8% 52%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 62% 60%, var(--accent) 50%, transparent 52%),
    radial-gradient(1px 1px at 26% 74%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 92% 82%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 48% 92%, var(--accent) 50%, transparent 52%);
  opacity: .7;
  animation: inv-twinkle 4.5s ease-in-out infinite alternate;
}
.inv[data-motif='stars'] .inv-bg::after { transform: scale(-1, 1) translateY(6%); animation-delay: -2.2s; opacity: .45; }
@keyframes inv-twinkle { from { opacity: .25; } to { opacity: .8; } }

/* هالات لونية ناعمة */
.inv[data-motif='palm'] .inv-bg::before,
.inv[data-motif='floral'] .inv-bg::before,
.inv[data-motif='clouds'] .inv-bg::before,
.inv[data-motif='laurel'] .inv-bg::before {
  background:
    radial-gradient(60% 34% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(56% 30% at 0% 46%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(60% 34% at 100% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.inv[data-motif='laurel'] .inv-bg::after {
  background-image:
    radial-gradient(3px 3px at 14% 12%, var(--accent) 50%, transparent 52%),
    radial-gradient(2px 2px at 82% 9%, var(--ink) 50%, transparent 52%),
    radial-gradient(3px 3px at 90% 30%, var(--accent) 50%, transparent 52%),
    radial-gradient(2px 2px at 6% 40%, var(--ink) 50%, transparent 52%),
    radial-gradient(3px 3px at 20% 70%, var(--accent) 50%, transparent 52%),
    radial-gradient(2px 2px at 86% 64%, var(--accent) 50%, transparent 52%),
    radial-gradient(3px 3px at 70% 90%, var(--ink) 50%, transparent 52%);
  opacity: .35;
}
.inv[data-motif='lines'] .inv-bg::before {
  background: linear-gradient(90deg, transparent 23px, var(--line) 23px, var(--line) 24px, transparent 24px) left / 100% 100% no-repeat,
    linear-gradient(270deg, transparent 23px, var(--line) 23px, var(--line) 24px, transparent 24px) right / 100% 100% no-repeat;
  opacity: .8;
}

/* ------------------------------ الزخارف داخل الدعوة ------------------------------ */

.inv .orn-crest { color: var(--accent); width: 172px; margin-inline: auto; }
.inv .orn-glyph { color: var(--accent); }
.inv .orn-divider { margin-block: 14px 22px; }
.inv .orn-divider span { background: var(--accent); opacity: .45; }

/* ------------------------------ الواجهة ------------------------------ */

.inv-hero {
  position: relative;
  min-height: 100svh;
  display: grid; align-content: center; justify-items: center;
  padding: 40px 22px 76px;
  text-align: center;
}
.inv-frame { width: 100%; padding: 30px 18px 34px; position: relative; }
.inv-frame--arch {
  border: 1px solid var(--accent);
  border-radius: 999px 999px 20px 20px;
  padding: 64px 22px 38px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.inv-frame--arch::before {
  content: ''; position: absolute; inset: 7px; pointer-events: none;
  border: 1px solid var(--accent); opacity: .4;
  border-radius: 999px 999px 14px 14px;
}
.inv-frame--double {
  border: 1px solid var(--accent);
  padding: 40px 20px 40px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.inv-frame--double::before {
  content: ''; position: absolute; inset: 7px; pointer-events: none;
  border: 1px solid var(--accent); opacity: .4;
}

.inv-basmala { font-family: 'Amiri', serif; font-size: 1.15rem; color: var(--muted); margin-bottom: 10px; }
.inv-crest { margin-bottom: 6px; }
.inv-kicker {
  font-family: var(--font-display);
  font-size: 1.25rem; letter-spacing: .02em;
  color: var(--accent-strong);
}
.inv-hosts { margin: 10px auto 0; max-width: 30ch; color: var(--muted); font-size: .98rem; line-height: 1.9; }

.inv-names {
  margin-top: 18px;
  display: grid; justify-items: center; gap: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.1rem, 16vw, 4.5rem);
  line-height: 1.32;
  color: var(--ink);
}
.inv-names--long { font-size: clamp(2.2rem, 10.5vw, 3.1rem); line-height: 1.5; }
.inv-name { display: block; padding-inline: 8px; }
.inv-amp {
  display: block;
  font-size: .42em; line-height: 1.5; font-weight: 400;
  color: var(--accent);
}

.inv-dateline {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
  margin-top: 6px;
  font-size: .98rem; color: var(--ink);
}
.inv-dateline__side { padding-block: 6px; border-block: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.inv-dateline__day {
  display: grid; justify-items: center; gap: 4px;
  font-family: var(--font-display); font-size: 2.6rem; line-height: 1; font-weight: 700;
  color: var(--accent-strong); min-width: 1.6ch;
}
.inv-dateline__day small {
  font-family: var(--font-body); font-size: .8rem; font-weight: 500; letter-spacing: .12em;
  color: var(--muted);
}
.inv-venueline { margin-top: 14px; color: var(--muted); font-size: .98rem; }
.inv-guest {
  display: inline-block; margin-top: 18px; padding: 6px 18px;
  border: 1px solid var(--accent); border-radius: 999px;
  font-size: .95rem; color: var(--ink);
}
.inv-guest strong { font-weight: 600; color: var(--accent-strong); }

.inv-scroll {
  position: absolute; bottom: 22px; left: 50%; margin-left: -22px;
  width: 44px; height: 44px; display: grid; place-items: center;
  color: var(--accent); border-radius: 50%;
}
.inv[data-open='true'] .inv-scroll .icon { animation: inv-bob 1.8s ease-in-out 2.4s infinite; }
@keyframes inv-bob { 50% { transform: translateY(6px); } }

/* دخول عناصر الواجهة بالتتابع بعد فتح الدعوة */
.h-in { opacity: 0; transform: translateY(18px); }
.inv[data-open='true'] .h-in {
  animation: inv-rise .95s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 120ms + 80ms);
}
@keyframes inv-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ظهور الأقسام عند التمرير */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ------------------------------ الأقسام ------------------------------ */

.inv-sec { padding: 44px 24px; text-align: center; }
.inv-h2 {
  font-family: var(--font-display);
  font-size: 1.9rem; line-height: 1.5; font-weight: 700;
  color: var(--ink);
}
.inv-lead { color: var(--muted); margin-bottom: 20px; }
.inv-prose { max-width: 34ch; margin-inline: auto; color: var(--ink); line-height: 2.05; }

/* العدّاد */
.inv-count__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 20px;
}
.inv-count__cell {
  padding: 16px 4px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid; gap: 4px;
}
.inv-count__num {
  font-family: var(--font-display); font-size: 2rem; line-height: 1.1; font-weight: 700;
  color: var(--accent-strong); font-variant-numeric: tabular-nums;
}
.inv-count__lbl { font-size: .8rem; color: var(--muted); }
.inv-count__done { margin-top: 18px; font-family: var(--font-display); font-size: 1.35rem; color: var(--accent-strong); }

/* الموعد والمكان */
.inv-facts { display: grid; gap: 12px; text-align: start; }
.inv-fact {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.inv-fact__icon {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.inv-fact p { display: grid; min-width: 0; }
.inv-fact__label { font-size: .8rem; color: var(--muted); }
.inv-fact strong { font-weight: 600; line-height: 1.6; }
.inv-fact small { font-size: .88rem; color: var(--muted); }

.inv-actions { display: grid; gap: 10px; margin-top: 18px; justify-items: stretch; }

/* الأزرار */
.inv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 50px; padding: 10px 22px;
  border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), opacity .2s var(--ease), background-color .2s var(--ease);
}
.inv-btn:active { transform: translateY(1px); }
.inv-btn--primary { background: var(--btn-bg); color: var(--btn-ink); }
.inv-btn--primary:hover { opacity: .92; }
.inv-btn--outline { border-color: var(--accent); color: var(--ink); background: transparent; }
.inv-btn--outline:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.inv-btn--block { display: flex; width: 100%; }
.inv-btn[disabled] { opacity: .6; cursor: progress; }
.inv-link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: 12px;
  background: none; border: 0; cursor: pointer; font: inherit; font-size: .93rem;
  color: var(--accent-strong); text-decoration: underline; text-underline-offset: 5px;
}
.inv :focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

/* البرنامج */
.inv-timeline { display: grid; gap: 0; text-align: start; max-width: 340px; margin-inline: auto; }
.inv-timeline__item {
  display: grid; grid-template-columns: 5.4em 20px 1fr; align-items: center; column-gap: 10px;
  padding-block: 12px; position: relative;
}
.inv-timeline__time { font-size: .9rem; color: var(--accent-strong); font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; }
.inv-timeline__dot {
  width: 11px; height: 11px; justify-self: center;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); position: relative; z-index: 1;
}
.inv-timeline__item::before {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: calc(5.4em + 10px + 9.5px);
  width: 1px; background: color-mix(in srgb, var(--accent) 45%, transparent);
}
.inv-timeline__item:first-child::before { inset-block-start: 50%; }
.inv-timeline__item:last-child::before { inset-block-end: 50%; }
.inv-timeline__title { font-weight: 500; }

/* العائلتان */
.inv-families { display: grid; gap: 12px; }
.inv-family { padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.inv-family__name { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.5; color: var(--accent-strong); }
.inv-family__line { color: var(--muted); font-size: .95rem; }

/* الألبوم */
.inv-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-gallery li:first-child { grid-column: 1 / -1; }
/* إن بقيت صورة وحيدة في الصف الأخير تمتد على العرض كله */
.inv-gallery li:last-child:nth-child(even) { grid-column: 1 / -1; }
.inv-gallery li:last-child:nth-child(even) .inv-gallery__item { aspect-ratio: 16 / 10; }
.inv-gallery__item {
  display: block; width: 100%; padding: 0; border: 0; background: var(--surface);
  border-radius: 14px; overflow: hidden; cursor: zoom-in; aspect-ratio: 1;
}
.inv-gallery li:first-child .inv-gallery__item { aspect-ratio: 16 / 10; }
.inv-gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.inv-gallery__item:hover img { transform: scale(1.04); }

.inv-lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(10, 10, 10, .94); color: #fff;
}
.inv-lightbox[open] { display: grid; grid-template-rows: 1fr auto; place-items: center; }
.inv-lightbox::backdrop { background: rgba(10, 10, 10, .94); }
.inv-lightbox img { max-width: 100vw; max-height: calc(100dvh - 90px); object-fit: contain; }
.inv-lightbox button {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
}
.inv-lightbox__close { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2; }
.inv-lightbox__nav { display: flex; align-items: center; gap: 22px; padding: 14px; font-variant-numeric: tabular-nums; }

/* الاقتباس */
.inv-quote { padding-block: 34px; }
.inv-quote__mark { width: 30px; height: 30px; margin: 0 auto 12px; }
.inv-quote blockquote { max-width: 30ch; margin-inline: auto; }
.inv-quote blockquote p { font-family: 'Amiri', var(--font-display); font-size: 1.32rem; line-height: 2.1; color: var(--ink); }
.inv-quote blockquote footer { margin-top: 10px; font-size: .88rem; color: var(--muted); }

/* المعلومات */
.inv-notes { display: grid; gap: 10px; text-align: start; max-width: 340px; margin-inline: auto; }
.inv-notes li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.inv-notes .orn-glyph { width: 16px; height: 16px; margin-top: 8px; }

/* ------------------------------ نموذج الحضور ------------------------------ */

.inv-form { display: grid; gap: 16px; text-align: start; }
.inv-hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.inv-choice { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-choice__opt { position: relative; cursor: pointer; }
.inv-choice__opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.inv-choice__opt span {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  font-weight: 600; text-align: center;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.inv-choice__opt input:checked + span { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.inv-choice__opt input:focus-visible + span { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

.inv-field { display: grid; gap: 6px; }
.inv-field label, .inv-stepper__label { font-size: .9rem; font-weight: 600; color: var(--ink); }
.inv-opt { font-weight: 400; color: var(--muted); }
.inv-field input, .inv-field textarea {
  width: 100%; min-height: 50px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color .2s var(--ease);
}
.inv-field textarea { resize: vertical; line-height: 1.8; }
.inv-field input:focus, .inv-field textarea:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.inv-field input[aria-invalid='true'] { border-color: #c0392b; }

.inv-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.inv-stepper {
  display: grid; gap: 8px; justify-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.inv-stepper__ctrl { display: flex; align-items: center; gap: 12px; }
.inv-stepper__ctrl button {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--accent); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
}
.inv-stepper__ctrl button[disabled] { opacity: .35; cursor: default; }
.inv-stepper__ctrl output {
  min-width: 2ch; text-align: center;
  font-family: var(--font-display); font-size: 1.7rem; line-height: 1; font-weight: 700; color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.inv-form__error {
  padding: 10px 14px; border-radius: 12px; font-size: .93rem; font-weight: 500;
  background: #fdecea; color: #8c1d17; border: 1px solid #f3c7c2;
}
.inv-form__note { font-size: .85rem; color: var(--muted); text-align: center; }

.inv-thanks { display: grid; justify-items: center; gap: 12px; padding: 26px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.inv-thanks__icon {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%;
  background: var(--btn-bg); color: var(--btn-ink);
}
.inv-thanks:not([hidden]) .inv-thanks__icon { animation: inv-pop .6s var(--ease) both; }
@keyframes inv-pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.inv-thanks__text { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.8; max-width: 24ch; }
.inv-rsvp__wa { margin-top: 12px; }

/* ------------------------------ الختام ------------------------------ */

.inv-closing { padding: 30px 24px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.inv .inv-closing__crest { width: 120px; opacity: .9; }
.inv-closing__text { max-width: 28ch; color: var(--muted); }
.inv-closing__names { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.6; color: var(--accent-strong); }
.inv-brand { margin-top: 22px; font-size: .8rem; color: var(--muted); }
.inv-brand a { color: inherit; font-weight: 600; text-underline-offset: 4px; }

.inv-state { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 6px; padding: 40px 24px; text-align: center; }

/* ------------------------------ عناصر عائمة ------------------------------ */

.inv-banner {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; background: #3b2f08; color: #fbe9b0; font-size: .88rem; text-align: center;
}

.inv-fab {
  position: fixed; z-index: 40; bottom: calc(18px + env(safe-area-inset-bottom)); inset-inline-start: 18px;
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid var(--accent); border-radius: 50%;
  background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.inv-fab[aria-pressed='true'] { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.inv-fab__on, .inv-fab[aria-pressed='true'] .inv-fab__off { display: none; }
.inv-fab[aria-pressed='true'] .inv-fab__on { display: block; animation: inv-beat 1.6s ease-in-out infinite; }
@keyframes inv-beat { 50% { transform: scale(1.14); } }
@media (min-width: 640px) { .inv-fab { inset-inline-start: calc(50% - 222px); } }
/* في العرض التجريبي يرتفع الزر فوق شريط «اطلبوا هذا القالب» */
.inv--demo .inv-fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
.inv--demo .inv-page { padding-bottom: 150px; }

.inv-demo {
  position: fixed; z-index: 40; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px;
  width: max-content; max-width: calc(100vw - 24px);
  background: #17302B; color: #F6EFDF; border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .3);
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-size: .86rem;
}
[dir='rtl'] .inv-demo { padding: 6px 16px 6px 6px; }
.inv-demo__tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-demo__cta {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px;
  background: #E3C583; color: #17302B; border-radius: 999px; font-weight: 700; text-decoration: none; white-space: nowrap;
}

/* ==========================================================================
   المشهد الافتتاحي
   ========================================================================== */

.cv {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  overflow: hidden;
  color: var(--cover-ink);
  background: var(--cover-bg);
  perspective: 1500px;
}
.cv[hidden] { display: none; }

.cv-pattern {
  position: absolute; inset: 0;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 255, 255, .12), transparent 62%),
    linear-gradient(180deg, var(--cover-bg), var(--cover-bg-2));
}

.cv-body {
  position: relative; z-index: 3;
  display: grid; justify-items: center; gap: 12px;
  width: 100%; padding: 24px 22px; text-align: center;
}
.cv-body > * { transition: opacity .4s ease, transform .5s var(--ease); }

.cv-kicker {
  font-size: .88rem; letter-spacing: .14em; opacity: .85;
  padding-inline: 14px; border-inline: 1px solid currentColor;
}
.inv[data-lang='en'] .cv-kicker { text-transform: uppercase; }
.cv-guest { font-size: 1.02rem; }
.cv-guest strong { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.cv-title { font-family: var(--font-display); font-size: 1.25rem; opacity: .9; margin-top: 8px; }
.cv-names { font-family: var(--font-display); font-size: clamp(2.3rem, 11vw, 3.1rem); line-height: 1.5; font-weight: 700; margin-bottom: 14px; }
.cv-hint { margin-top: 16px; font-size: .92rem; opacity: .85; animation: cv-breathe 2.6s ease-in-out infinite; }
@keyframes cv-breathe { 50% { opacity: .45; } }

/* الختم */
.cv-seal {
  position: relative;
  width: 104px; height: 104px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  color: var(--seal-ink);
  background: var(--seal);
  background: radial-gradient(circle at 32% 26%, color-mix(in srgb, var(--seal) 72%, #fff), var(--seal) 52%, color-mix(in srgb, var(--seal) 74%, #000));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 255, 255, .16), inset 0 0 0 9px rgba(0, 0, 0, .07);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .45s var(--ease), opacity .4s ease;
}
.cv-seal::before {
  content: ''; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px solid var(--seal); opacity: .7;
  animation: cv-ring 2.4s ease-out infinite;
}
@keyframes cv-ring { from { transform: scale(.94); opacity: .8; } to { transform: scale(1.26); opacity: 0; } }
.cv-seal:hover { transform: scale(1.04); }
.cv-seal:focus-visible { outline: 3px solid var(--cover-ink); outline-offset: 6px; }
.cv-seal__mono {
  display: flex; align-items: center; gap: 7px; direction: inherit;
  font-family: var(--font-display); font-size: 2rem; line-height: 1; font-weight: 700;
  padding-bottom: .12em;
}
.cv-seal__mono i { width: 1px; height: 1.1em; background: currentColor; opacity: .5; }

/* لحظة الفتح: يختفي النص والختم */
.cv[data-state='opening'] .cv-kicker,
.cv[data-state='opening'] .cv-guest,
.cv[data-state='opening'] .cv-title,
.cv[data-state='opening'] .cv-names,
.cv[data-state='opening'] .cv-hint { opacity: 0; animation: none; }
.cv[data-state='opening'] .cv-seal { transform: scale(1.25); opacity: 0; pointer-events: none; }
.cv[data-state='opening'] .cv-seal::before { animation: none; opacity: 0; }

/* ---------- الظرف ---------- */
.cv--envelope { transition: opacity .7s ease 1.55s, transform .9s var(--ease) 1.55s; }
.cv--envelope[data-state='opening'] { opacity: 0; transform: scale(1.06); }

.cv-env {
  position: relative;
  width: min(84vw, 340px); aspect-ratio: 1.42;
  margin-block: 38px 6px;
  perspective: 1100px;
}
.cv-env__back {
  position: absolute; inset: 0; border-radius: 6px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 84%, #000);
  box-shadow: 0 22px 44px rgba(0, 0, 0, .3);
}
.cv-env__letter {
  position: absolute; inset: 6% 5%; z-index: 1;
  display: grid; align-content: center; justify-items: center; gap: 2px;
  background: var(--bg); color: var(--ink);
  border-radius: 4px; box-shadow: 0 1px 5px rgba(0, 0, 0, .18);
  transition: transform .75s var(--ease) .95s;
}
.cv-env__letter .orn-crest { width: 46%; }
.cv-env__title { font-family: var(--font-display); font-size: .9rem; color: var(--accent-strong); }
.cv-env__names { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.5; font-weight: 700; }
.cv-env__pocket {
  position: absolute; inset: 0; z-index: 2; border-radius: 0 0 6px 6px;
  -webkit-clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  background: var(--surface);
  background: conic-gradient(from 0deg at 50% 56%,
    transparent 0 52deg,
    color-mix(in srgb, var(--surface) 93%, #000) 52deg 121deg,
    var(--surface) 121deg 239deg,
    color-mix(in srgb, var(--surface) 93%, #000) 239deg 308deg,
    transparent 308deg);
}
.cv-env__flap {
  position: absolute; left: 0; right: 0; top: 0; height: 58%; z-index: 3;
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: var(--surface);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, #000), color-mix(in srgb, var(--surface) 88%, #000));
  transform-origin: top center;
  transition: transform .7s var(--ease) .3s, z-index 0s linear .62s;
}
.cv-env .cv-seal {
  position: absolute; left: 50%; top: 58%; z-index: 4;
  width: 86px; height: 86px; margin: -43px 0 0 -43px;
}
.cv-env .cv-seal__mono { font-size: 1.65rem; }
.cv[data-state='opening'] .cv-env__flap { transform: rotateX(180deg); z-index: 0; }
.cv[data-state='opening'] .cv-env__letter { transform: translateY(-54%); }

/* ---------- البوّابتان ---------- */
.cv--gates, .cv--curtain { background: none; }
.cv--gates .cv-pattern, .cv--curtain .cv-pattern { display: none; }

.cv-gate {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: linear-gradient(180deg, var(--cover-bg-2), var(--cover-bg));
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transition: transform 1.35s cubic-bezier(.62, .04, .22, 1) .28s;
}
.cv-gate--a { left: 0; transform-origin: left center; box-shadow: inset -1px 0 0 var(--seal); }
.cv-gate--b { right: 0; transform-origin: right center; box-shadow: inset 1px 0 0 var(--seal); }
.cv-gate__panel {
  position: absolute; inset: 26px 16px 26px 20px;
  border: 1px solid var(--seal);
  border-radius: 100% 0 0 0 / 30% 0 0 0;
  opacity: .85; overflow: hidden;
}
.cv-gate--b .cv-gate__panel { inset: 26px 20px 26px 16px; border-radius: 0 100% 0 0 / 0 30% 0 0; }
.cv-gate__panel::before {
  content: ''; position: absolute; inset: 0;
  background: var(--seal); opacity: .2;
  -webkit-mask-size: 72px 72px; mask-size: 72px 72px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 3L45 24L24 45L3 24ZM9.2 9.200H38.800V38.800H9.200Z' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 3L45 24L24 45L3 24ZM9.2 9.200H38.800V38.800H9.200Z' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E");
}
.inv[data-motif='stars'] .cv-gate__panel::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 14Q24 24 34 24Q24 24 24 34Q24 24 14 24Q24 24 24 14ZM6 4Q6 7 9 7Q6 7 6 10Q6 7 3 7Q6 7 6 4ZM42 38Q42 41 45 41Q42 41 42 44Q42 41 39 41Q42 41 42 38Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M24 14Q24 24 34 24Q24 24 24 34Q24 24 14 24Q24 24 24 14ZM6 4Q6 7 9 7Q6 7 6 10Q6 7 3 7Q6 7 6 4ZM42 38Q42 41 45 41Q42 41 42 44Q42 41 39 41Q42 41 42 38Z'/%3E%3C/svg%3E");
  opacity: .34;
}
.cv[data-state='opening'] .cv-gate--a { transform: rotateY(100deg); }
.cv[data-state='opening'] .cv-gate--b { transform: rotateY(-100deg); }

/* ---------- الستارة ---------- */
.cv-drape {
  position: absolute; top: 0; bottom: 0; width: 51%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .34) 0, rgba(255, 255, 255, .08) 5%, rgba(0, 0, 0, .1) 9%, rgba(0, 0, 0, .34) 13%),
    linear-gradient(180deg, var(--cover-bg), var(--cover-bg-2));
  transition: transform 1.55s cubic-bezier(.66, 0, .2, 1) .3s;
}
.cv-drape::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background: repeating-linear-gradient(90deg, var(--seal) 0 3px, transparent 3px 7px);
  opacity: .9;
}
.cv-drape--a { left: 0; transform-origin: left center; }
.cv-drape--b { right: 0; transform-origin: right center; }
.cv-valance {
  position: absolute; top: 0; left: 0; right: 0; height: 64px; z-index: 2;
  background: linear-gradient(180deg, var(--cover-bg-2), var(--cover-bg));
  border-bottom: 3px solid var(--seal);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .3);
  -webkit-mask-image: radial-gradient(22px 16px at 50% 100%, transparent 98%, #000 100%);
  mask-image: radial-gradient(22px 16px at 50% 100%, transparent 98%, #000 100%);
  -webkit-mask-size: 44px 100%; mask-size: 44px 100%;
  -webkit-mask-position: center bottom; mask-position: center bottom;
  transition: transform 1.1s var(--ease) .5s;
}
.cv[data-state='opening'] .cv-drape { transform: scaleX(.05); }
.cv[data-state='opening'] .cv-valance { transform: translateY(-110%); }

/* ---------- الحجاب الدائري ---------- */
@property --iris {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}
.cv--veil {
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent var(--iris), #000 calc(var(--iris) + 1%));
  mask-image: radial-gradient(circle at 50% 50%, transparent var(--iris), #000 calc(var(--iris) + 1%));
  transition: --iris 1.35s cubic-bezier(.6, 0, .3, 1) .2s;
}
.cv--veil[data-state='opening'] { --iris: 100%; }
.cv--veil .cv-seal { margin-top: 6px; }
.cv--veil .cv-body::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: min(120vw, 620px); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%; z-index: -1;
  border: 1px solid var(--seal); opacity: .28;
  box-shadow: 0 0 0 26px color-mix(in srgb, var(--seal) 7%, transparent), 0 0 0 27px color-mix(in srgb, var(--seal) 30%, transparent);
}

/* ------------------------------ تقليل الحركة ------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .h-in, [data-reveal] { opacity: 1; transform: none; }
  .inv[data-open='true'] .h-in { animation: none; }
  .cv, .cv * { transition-delay: 0s !important; }
  .cv-hint, .cv-seal::before, .inv[data-motif='stars'] .inv-bg::before, .inv[data-motif='stars'] .inv-bg::after { animation: none; }
}

@media print {
  .cv, .inv-fab, .inv-demo, .inv-scroll { display: none !important; }
  .h-in, [data-reveal] { opacity: 1 !important; transform: none !important; }
}
