:root {
  --night: #04061a;
  --ink: #f6efe4;
  --muted: #b2b5d3;
  --dim: #8083a9;
  --gold: #ecca8e;
  --rose: #f2b6c8;
  --line: rgba(236, 202, 142, .26);
  --f-body: "El Messiri", "Segoe UI", Tahoma, sans-serif;
  --f-cal: "Aref Ruqaa", "Amiri", "Times New Roman", serif;
  --f-verse: "Amiri", "Times New Roman", serif;
  --f-lat: "Cormorant Garamond", Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--night); -webkit-text-size-adjust: 100%; }
html.locked, html.locked body { overflow: hidden; height: 100%; overscroll-behavior: none; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--night);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; color: inherit; }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ───────── السما ───────── */
.nebula {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, #191c50 0%, rgba(14, 16, 52, .55) 38%, transparent 72%),
    radial-gradient(90% 60% at 50% 115%, #1b0f35 0%, transparent 62%),
    linear-gradient(#060822, #02030c);
}
.nebula i {
  position: absolute; border-radius: 50%;
  animation: drift 40s ease-in-out infinite alternate;
}
.nebula i:nth-child(1) { width: 90vmax; height: 60vmax; left: -30vmax; top: 12vh; background: radial-gradient(closest-side, rgba(120, 80, 190, .2), transparent); }
.nebula i:nth-child(2) { width: 80vmax; height: 55vmax; right: -35vmax; top: 48vh; background: radial-gradient(closest-side, rgba(236, 150, 175, .12), transparent); animation-duration: 48s; }
.nebula i:nth-child(3) { width: 70vmax; height: 42vmax; left: 12vw; top: -16vh; background: radial-gradient(closest-side, rgba(236, 202, 142, .09), transparent); animation-duration: 56s; }
@keyframes drift { to { transform: translate3d(6vmax, -4vmax, 0) scale(1.12); } }

#sky { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 1; display: block; pointer-events: none; transform: translateZ(0); }
html.intro #sky { pointer-events: auto; touch-action: none; cursor: grab; }
html.intro #sky:active { cursor: grabbing; }

main { position: relative; z-index: 2; }
html.intro main { pointer-events: none; }

/* ───────── أزرار ───────── */
.btn-star {
  position: relative;
  display: inline-flex; align-items: center; gap: .6em;
  padding: .85em 2.1em;
  border-radius: 999px;
  border: 1px solid rgba(236, 202, 142, .55);
  background: linear-gradient(180deg, rgba(236, 202, 142, .16), rgba(236, 202, 142, .04));
  color: var(--ink);
  font-size: 1.08rem; font-weight: 500; line-height: 1.5;
  text-decoration: none; cursor: pointer;
  box-shadow: inset 0 0 18px rgba(236, 202, 142, .08);
  transition: box-shadow .5s var(--ease), transform .3s var(--ease), border-color .3s;
}
.btn-star::before { content: "✦"; color: var(--gold); font-size: .8em; }
.btn-star:hover { border-color: var(--gold); box-shadow: 0 0 38px rgba(236, 202, 142, .28), inset 0 0 22px rgba(236, 202, 142, .14); }
.btn-star:active { transform: scale(.97); }

.btn-ghost {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .7em 1.4em; cursor: pointer; font-size: .98rem;
  transition: border-color .3s, background .3s;
}
.btn-ghost:hover { border-color: var(--gold); background: rgba(236, 202, 142, .08); }

.link-btn {
  background: none; border: 0; padding: .5em; cursor: pointer;
  color: var(--muted); font-size: .92rem;
  text-decoration: underline; text-decoration-color: rgba(178, 181, 211, .35); text-underline-offset: 6px;
}
.link-btn:hover { color: var(--ink); }

.btn-star:focus-visible, .btn-ghost:focus-visible, .link-btn:focus-visible, .sound:focus-visible, .stepper button:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 4px;
}

/* ───────── البوابة ───────── */
.gate {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-content: center; justify-items: center; gap: .3rem;
  padding: 24px; text-align: center;
  background: radial-gradient(70% 55% at 50% 50%, rgba(4, 6, 26, .1), rgba(4, 6, 26, .6));
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}
.gate.out { opacity: 0; visibility: hidden; }
.gate-to { font-family: var(--f-cal); color: var(--gold); font-size: clamp(1.9rem, 8vw, 2.6rem); margin-bottom: .2rem; opacity: 0; transform: translateY(12px); animation: rise-in 1.4s var(--ease) .1s forwards; }
html.wait .gate * { animation-play-state: paused !important; }

.loader {
  position: fixed; z-index: 25; top: 50%; left: 50%;
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  background: radial-gradient(circle, #fff6e6 0 12%, rgba(236, 202, 142, .55) 22%, transparent 62%);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: 0; pointer-events: none;
  transition: opacity .5s;
}
html.wait .loader { opacity: 1; animation: loader 1.4s ease-in-out infinite; }
@keyframes loader { 50% { transform: scale(.6) rotate(45deg); opacity: .5; } }
.gate-line { opacity: 0; transform: translateY(12px); animation: rise-in 1.4s var(--ease) forwards; }
.gate-line.l1 { color: var(--muted); font-size: clamp(1.05rem, 4.2vw, 1.3rem); animation-delay: .4s; }
.gate-line.l2 {
  font-family: var(--f-cal); font-weight: 700;
  font-size: clamp(2.2rem, 9.5vw, 3.8rem); line-height: 1.4;
  text-shadow: 0 0 30px rgba(236, 202, 142, .35);
  margin-bottom: 2.2rem; animation-delay: 1.1s;
}
@keyframes rise-in { to { opacity: 1; transform: none; } }

.hint {
  position: fixed; z-index: 15; inset-inline: 0;
  bottom: calc(8svh + env(safe-area-inset-bottom));
  padding-inline: 24px; text-align: center; pointer-events: none;
  opacity: 0; transform: translateY(10px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.hint.show { opacity: 1; transform: none; }
.hint p { color: var(--muted); font-size: 1.02rem; }
.hint .link-btn { pointer-events: auto; margin-top: .3rem; }

.sound {
  position: fixed; z-index: 30;
  top: calc(14px + env(safe-area-inset-top)); inset-inline-end: 14px;
  width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  border-radius: 50%; border: 1px solid var(--line);
  background: rgba(6, 8, 30, .72);
  cursor: pointer;
}
.sound i { display: block; width: 2px; height: 14px; border-radius: 2px; background: var(--gold); transform-origin: bottom; animation: eq 1.1s ease-in-out infinite; }
.sound i:nth-child(2) { animation-delay: -.35s; }
.sound i:nth-child(3) { animation-delay: -.7s; }
.sound[aria-pressed="false"] i { animation: none; transform: scaleY(.18); }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* ───────── الفصل الأول ───────── */
.hero { position: relative; height: 100svh; min-height: 520px; }
.hero-caption { position: absolute; inset-inline: 0; bottom: calc(4svh + env(safe-area-inset-bottom)); padding-inline: 20px; text-align: center; }
.hero-in { opacity: 0; transform: translateY(18px); transition: opacity 1.8s var(--ease), transform 1.8s var(--ease); }
.hero-caption.show .hero-in { opacity: 1; transform: none; }
.hero-sub { font-size: clamp(1.02rem, 4vw, 1.2rem); }
.hero-date { color: var(--gold); font-size: clamp(1rem, 3.8vw, 1.15rem); margin: .1rem 0 1rem; }
.scroll-cue { display: inline-flex; flex-direction: column; align-items: center; gap: .25rem; color: var(--dim); font-size: .8rem; }
.scroll-cue i { position: relative; width: 1px; height: 36px; overflow: hidden; background: linear-gradient(var(--line), transparent); }
.scroll-cue i::after { content: ""; position: absolute; left: -1.5px; top: -8px; width: 4px; height: 8px; border-radius: 2px; background: var(--gold); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { to { transform: translateY(46px); } }

/* ───────── الفصول ───────── */
.chapter { position: relative; max-width: 720px; margin: 0 auto; padding: clamp(90px, 16svh, 160px) 20px; text-align: center; }
.chapter-wide { position: relative; overflow: hidden; }

.chapter-tag { display: flex; align-items: center; justify-content: center; gap: .8em; margin-bottom: .5rem; color: var(--gold); font-size: .86rem; font-weight: 500; }
.chapter-tag::before, .chapter-tag::after { content: ""; width: clamp(24px, 8vw, 56px); height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.chapter-tag::after { transform: scaleX(-1); }

.ch-title { font-family: var(--f-cal); font-weight: 700; font-size: clamp(2.1rem, 8.6vw, 3.3rem); line-height: 1.4; margin: .1rem 0 1rem; text-shadow: 0 0 28px rgba(236, 202, 142, .25); }
.ch-sub { color: var(--muted); max-width: 30em; margin: -.4rem auto 2.4rem; }

[data-r] { opacity: 0; transform: translateY(26px); transition: opacity 1.3s var(--ease), transform 1.3s var(--ease); transition-delay: calc(var(--i, 0) * 130ms); }
.in [data-r] { opacity: 1; transform: none; }

/* الدعوة */
.ornament { color: var(--gold); letter-spacing: .6em; font-size: .9rem; margin-bottom: 1.4rem; opacity: .85; }
.verse { font-family: var(--f-verse); font-size: clamp(1.3rem, 5vw, 1.65rem); line-height: 2.15; color: #efe3cb; max-width: 24em; margin: 0 auto .3rem; }
.verse-ref { color: var(--dim); font-size: .85rem; margin-bottom: 3.4rem; }
.to { font-family: var(--f-cal); color: var(--gold); font-size: clamp(1.6rem, 6.5vw, 2.1rem); line-height: 1.5; margin-bottom: .4rem; }
.hosts { color: var(--muted); margin-bottom: 1.2rem; }
.lead { font-size: clamp(1.15rem, 4.5vw, 1.4rem); }
.body { color: var(--muted); max-width: 26em; margin: 0 auto; }
.names {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 .3em;
  margin: 1.4rem 0 .6rem;
  font-family: var(--f-cal); font-weight: 700;
  font-size: clamp(3.4rem, 16vw, 6.4rem); line-height: 1.3;
  background: linear-gradient(to left, #f7d9a6 15%, #fff4e4 50%, #f4b9cb 85%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.names em { font-family: var(--f-lat); font-style: italic; font-weight: 300; font-size: .55em; }
.whisper { color: var(--dim); font-size: .98rem; margin-top: 1rem; }

/* القمر */
.moon-wrap { width: min(66vw, 280px); aspect-ratio: 1; margin: 1.4rem auto 1.2rem; }
.moon-wrap svg { width: 100%; height: 100%; overflow: visible; display: block; }
.moon-note { color: var(--muted); max-width: 24em; margin: 0 auto .3rem; }
.moon-pct { color: var(--gold); font-size: .9rem; margin-bottom: 2.4rem; }
.big-date { font-family: var(--f-cal); font-size: clamp(1.8rem, 7.4vw, 2.5rem); line-height: 1.5; }
.big-time { color: var(--muted); margin-bottom: 1.8rem; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 3vw, 20px); max-width: 460px; margin: 0 auto; }
.countdown div { position: relative; padding: 1rem .2rem .4rem; border-top: 1px solid var(--line); }
.countdown div::before { content: ""; position: absolute; top: -2.5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.countdown b { display: block; font-weight: 600; font-size: clamp(1.7rem, 8vw, 2.6rem); line-height: 1.2; font-variant-numeric: tabular-nums; }
.countdown span { color: var(--dim); font-size: .82rem; }
.cd-done { font-family: var(--f-cal); color: var(--gold); font-size: 2rem; }

/* المكان */
.pin { display: block; width: 40px; height: auto; margin: .3rem auto 1.4rem; }
.venue {
  max-width: 460px; margin: 0 auto 1.8rem; padding: 1.6rem 1.2rem;
  border: 1px solid var(--line); border-radius: 28px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(236, 202, 142, .08), rgba(8, 10, 34, .35));
}
.venue h3 { font-family: var(--f-cal); font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.45; margin: 0; }
.venue p { color: var(--muted); margin-top: .3rem; }
.timeline { list-style: none; max-width: 380px; margin: 0 auto 2.4rem; padding: 0; }
.timeline li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .75rem .2rem; border-bottom: 1px dashed rgba(236, 202, 142, .18); }
.timeline li:last-child { border-bottom: 0; }
.timeline b { font-weight: 500; }
.timeline time { color: var(--gold); font-size: .95rem; white-space: nowrap; }

/* الختام */
.finale { min-height: 92svh; display: flex; flex-direction: column; justify-content: center; }
.finale-title { font-family: var(--f-cal); font-weight: 700; font-size: clamp(3rem, 14vw, 5.6rem); line-height: 1.35; margin: .1rem 0 .3rem; text-shadow: 0 0 40px rgba(236, 202, 142, .35); }
.finale-sub { color: var(--muted); margin-bottom: 2.6rem; }
.monogram { direction: ltr; font-family: var(--f-lat); font-weight: 300; font-size: clamp(2.4rem, 10vw, 3.4rem); letter-spacing: .12em; margin-bottom: 2.2rem; }
.monogram em { color: var(--gold); font-style: italic; letter-spacing: 0; margin: 0 .18em; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; }
.foot { margin-top: 4rem; color: var(--dim); font-size: .8rem; }

/* ───────── خيط التقدّم + فهرس الفصول + رسالة ───────── */
.thread { position: fixed; z-index: 31; top: 0; inset-inline: 0; height: 2px; pointer-events: none; opacity: 0; transition: opacity .8s; }
.thread i { display: block; height: 100%; background: linear-gradient(to left, var(--gold), var(--rose)); box-shadow: 0 0 10px rgba(236, 202, 142, .7); transform: scaleX(0); transform-origin: right; }
html:not(.intro) .thread { opacity: 1; }

.chapters { display: none; }
@media (min-width: 960px) {
  .chapters {
    position: fixed; z-index: 30; top: 50%; inset-inline-start: 22px; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 6px;
    opacity: 0; pointer-events: none; transition: opacity .8s;
  }
  .chapters::before { content: ""; position: absolute; inset-block: 14px; inset-inline-start: 13px; width: 1px; background: linear-gradient(transparent, var(--line), transparent); }
  html:not(.intro) .chapters { opacity: 1; pointer-events: auto; }
  .chapters button { position: relative; display: flex; align-items: center; gap: .7rem; padding: 6px; background: none; border: 0; cursor: pointer; color: var(--dim); font-size: .82rem; }
  .chapters i { width: 15px; height: 15px; flex: none; background: currentColor; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); transform: scale(.55); transition: transform .4s var(--ease), color .4s; }
  .chapters span { opacity: 0; transform: translateX(8px); transition: opacity .35s, transform .35s var(--ease); white-space: nowrap; }
  .chapters button:hover span, .chapters button:focus-visible span, .chapters button.on span { opacity: 1; transform: none; }
  .chapters button.on { color: var(--gold); }
  .chapters button.on i { transform: scale(1); filter: drop-shadow(0 0 6px var(--gold)); }
  .chapters button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
}

.toast {
  position: fixed; z-index: 45; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px); margin: 0; padding: .7rem 1.4rem;
  border: 1px solid rgba(236, 202, 142, .5); border-radius: 999px;
  background: rgba(8, 10, 34, .92);
  color: var(--ink); text-align: center; box-shadow: 0 0 40px rgba(236, 202, 142, .25);
  opacity: 0; visibility: hidden; transform: translate(-50%, 14px);
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility .5s;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ───────── حكايتنا ───────── */
.story { position: relative; max-width: 560px; margin: 1rem auto 0; padding-inline-start: 46px; text-align: start; }
.story-line { position: absolute; top: 8px; bottom: 8px; inset-inline-start: 15px; width: 1px; background: rgba(236, 202, 142, .14); }
.story-line i { position: absolute; inset: 0; background: linear-gradient(var(--gold), var(--rose)); box-shadow: 0 0 10px rgba(236, 202, 142, .6); transform: scaleY(0); transform-origin: top; }
.story-list { list-style: none; margin: 0; padding: 0; }
.moment { position: relative; padding-bottom: 3.4rem; opacity: .32; transform: translateY(10px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.moment:last-child { padding-bottom: 0; }
.moment.lit { opacity: 1; transform: none; }
.moment-star {
  position: absolute; top: 5px; inset-inline-start: -39px; width: 18px; height: 18px;
  background: #5c5f86;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  transform: scale(.6); transition: transform .7s var(--ease), background .7s;
}
.moment.lit .moment-star { background: #fff3d6; transform: scale(1.15); filter: drop-shadow(0 0 8px var(--gold)); }
.moment-when { color: var(--gold); font-size: .88rem; }
.moment-title { font-family: var(--f-cal); font-weight: 700; font-size: clamp(1.7rem, 6.5vw, 2.2rem); line-height: 1.45; margin: 0; }
.moment-text { color: var(--muted); max-width: 28em; }
.moment-note { color: var(--dim); font-size: .9rem; max-width: 28em; }
.moment-map { display: inline-block; margin-top: .35rem; color: var(--gold); font-size: .9rem; text-decoration: underline; text-decoration-color: rgba(236, 202, 142, .4); text-underline-offset: 5px; }
.moment-map:hover { text-decoration-color: var(--gold); }
.moment.main .moment-title { font-size: clamp(2rem, 8vw, 2.6rem); color: #f8dfae; }
.moment.main .moment-star { width: 22px; height: 22px; top: 7px; inset-inline-start: -41px; }
.moment.main.lit .moment-star { background: #ffe7b8; transform: scale(1.25); filter: drop-shadow(0 0 10px var(--gold)); }
.moment.past .moment-title, .moment.past .moment-text { color: var(--dim); }

@media (min-width: 820px) {
  .story { max-width: 820px; padding-inline-start: 0; }
  .story-line { inset-inline-start: 50%; }
  .moment { width: 50%; }
  .moment:nth-child(odd) { padding-inline-end: 52px; text-align: end; }
  .moment:nth-child(odd) .moment-star { inset-inline-start: auto; inset-inline-end: -9px; }
  .moment:nth-child(odd) .moment-text, .moment:nth-child(odd) .moment-note { margin-inline-start: auto; }
  .moment.main:nth-child(odd) .moment-star { inset-inline-end: -11px; }
  .moment.main:nth-child(even) .moment-star { inset-inline-start: -11px; }
  .moment:nth-child(even) { margin-inline-start: 50%; padding-inline-start: 52px; }
  .moment:nth-child(even) .moment-star { inset-inline-start: -9px; }
}

/* تفاعلات صغيرة */
.moon-wrap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.moon-wrap.pulse svg { animation: moon-pulse 1.3s var(--ease); }
@keyframes moon-pulse { 30% { transform: scale(1.05); } }
.countdown b.tick { animation: tick .55s var(--ease); }
@keyframes tick { from { opacity: .15; transform: translateY(-10px); } }

/* ───────── كارت الدعوة ───────── */
.keepsake {
  display: flex; align-items: center; justify-content: center; gap: clamp(1.2rem, 5vw, 2.6rem);
  flex-wrap: wrap; margin: 0 auto 2.6rem; max-width: 560px;
}
.card-preview {
  position: relative; width: min(40vw, 190px); aspect-ratio: 9 / 16; padding: 0;
  border: 1px solid rgba(236, 202, 142, .45); border-radius: 18px; overflow: hidden; cursor: pointer;
  background: linear-gradient(160deg, #15195a, #05061a);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 50px rgba(236, 202, 142, .16);
  transform: rotate(-5deg); animation: card-float 6s ease-in-out infinite;
  transition: box-shadow .4s;
}
.card-preview:hover { box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 70px rgba(236, 202, 142, .32); }
.card-preview::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 60%; background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .14) 50%, transparent); transform: translateX(-120%); animation: shimmer 2.8s linear infinite; }
.card-preview.ready::after { animation-duration: 5.5s; opacity: .5; }
.card-preview img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s; }
.card-preview.ready img { opacity: 1; }
.card-preview:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
@keyframes card-float { 50% { transform: rotate(-3deg) translateY(-8px); } }
@keyframes shimmer { to { transform: translateX(260%); } }
.keepsake-text { flex: 1 1 200px; max-width: 260px; text-align: start; }
.keepsake-title { font-family: var(--f-cal); font-weight: 700; font-size: 1.9rem; line-height: 1.4; }
.keepsake-sub { color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }
@media (max-width: 480px) {
  .keepsake-text { text-align: center; max-width: none; }
}


/* ───────── المجرّة: طبقة التصميم ───────── */
#galaxy { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 0; display: block; pointer-events: none; transform: translateZ(0); }
html.gl .nebula { display: none; }
html.gl, html.gl body { background: #02030b; }

.gate { background: radial-gradient(55% 42% at 50% 50%, rgba(2, 3, 12, .6), rgba(2, 3, 12, .12) 72%, rgba(2, 3, 12, .38)); }

/* الكلام يفضل مقروء فوق السُدُم */
main p, main li, main h3, .hero-caption, .hint p, .gate-line.l1, .gate-to, .touch-label {
  text-shadow: 0 1px 7px rgba(2, 3, 12, .85);
}

/* عناوين بلمعة ضوء نجوم */
/* (لون ثابت + ظل نص بدل الفلاتر: بيترسم مرة واحدة ومش بيتقل السكرول) */
.ch-title, .finale-title, .gate-line.l2, .keepsake-title, .moment-title, .venue h3 {
  color: #f7e5c1;
  text-shadow: 0 0 16px rgba(236, 202, 142, .3), 0 1px 6px rgba(2, 3, 12, .75);
}
.ch-title { margin-block: -.1rem .8rem; }
.names { padding-block: .1em; }

/* زجاج مُعتم فوق المجرّة */
.venue, .countdown div {
  position: relative;
  background: linear-gradient(155deg, rgba(40, 44, 108, .6), rgba(12, 14, 42, .66) 58%, rgba(48, 22, 70, .58));
  border: 1px solid rgba(236, 202, 142, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 12px 30px rgba(0, 0, 0, .35);
}
.venue::before {
  content: ""; position: absolute; inset: 0; padding: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 236, 200, .6), rgba(255, 236, 200, 0) 34%, rgba(160, 150, 255, 0) 64%, rgba(244, 178, 200, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.venue { border-radius: 30px; }
.countdown div { border-radius: 18px; padding: .95rem .2rem .55rem; }
.countdown div::before { top: -2.5px; }
.timeline { padding: .4rem 1.2rem; border-radius: 22px; background: linear-gradient(180deg, rgba(10, 12, 38, .35), rgba(10, 12, 38, .15)); }

.btn-star {
  background: linear-gradient(180deg, rgba(236, 202, 142, .24), rgba(40, 34, 90, .5));
}
.btn-ghost { background: rgba(20, 22, 60, .6); }


.card-preview { box-shadow: 0 16px 38px rgba(0, 0, 0, .5), 0 0 40px rgba(236, 202, 142, .18); }


/* ───────── الحركة ───────── */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); }

/* البوابة: الكلام بيظهر كلمة كلمة من الضباب، والخروج كأنك داخل جوه السما */
.gate { transition: opacity .7s ease .55s, visibility 0s linear 1.3s; }
.gate.out { opacity: 0; visibility: hidden; }
/* الكلام بيطير لبرّه كأنك معدّي جنبه بسرعة الضوء */
.gate.out .split .w { animation: word-out .9s cubic-bezier(.5, 0, .9, .4) forwards; animation-delay: calc(var(--w) * 30ms); }
@keyframes word-out {
  from { opacity: 1; filter: blur(0); transform: none; }
  to { opacity: 0; filter: blur(7px); transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(1.9); }
}
.gate-to, .gate-line { opacity: 1; transform: none; animation: none; }
.gate-to { --base: .15s; }
.gate-line.l1 { --base: .55s; }
.gate-line.l2 { --base: 1.1s; }
.split .w { display: inline-block; }
.gate .split .w { opacity: 0; animation: word-in 1.4s var(--ease-out) forwards; animation-delay: calc(var(--base, 0s) + var(--w) * 130ms); }
@keyframes word-in {
  from { opacity: 0; filter: blur(14px); transform: translateY(.45em) scale(.92); }
  to { opacity: 1; filter: blur(0); transform: none; }
}
.gate-actions { display: grid; justify-items: center; opacity: 0; transform: translateY(20px) scale(.9); animation: rise-in 1.6s var(--ease-out) 2.2s forwards; }

/* عناوين متقسمة: اللمعة على كل كلمة */
.names.split { background: none; color: inherit; }
.names [data-groom] { color: #f5d29b; text-shadow: 0 0 18px rgba(236, 202, 142, .35), 0 1px 6px rgba(2, 3, 12, .7); }
.names [data-bride] { color: #f3b8cb; text-shadow: 0 0 18px rgba(244, 178, 200, .35), 0 1px 6px rgba(2, 3, 12, .7); }
.names em.w { color: var(--gold); text-shadow: none; }

/* زرار «المس السما»: نجمة بتنبض وحواليها مدارات */
.touch {
  position: relative; display: grid; justify-items: center; gap: 1.2rem;
  padding: .4rem 1.2rem; background: none; border: 0; cursor: pointer; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.touch-orb { position: relative; display: block; width: 124px; height: 124px; perspective: 420px; transition: transform .6s var(--ease-out); }
.touch-orb i { position: absolute; inset: 0; margin: auto; display: block; border-radius: 50%; }
.touch:hover .touch-orb { transform: scale(1.08); }
.touch:active .touch-orb { transform: scale(.94); }
.touch:focus-visible { outline: none; }
.touch:focus-visible .touch-orb { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 50%; }

.touch .core {
  width: 30px; height: 30px;
  background: radial-gradient(closest-side, #fff 0 30%, #ffecc9 52%, rgba(236, 202, 142, .55) 76%, rgba(236, 202, 142, 0));
  box-shadow: 0 0 26px 6px rgba(255, 226, 180, .45), 0 0 70px 18px rgba(160, 130, 255, .2);
  animation: core-breathe 3.2s ease-in-out infinite;
}
.touch .halo { width: 120px; height: 120px; background: radial-gradient(closest-side, rgba(255, 232, 196, .32), rgba(190, 160, 255, .12) 45%, rgba(190, 160, 255, 0)); animation: halo-pulse 3.2s ease-in-out infinite; }
@keyframes halo-pulse { 50% { transform: scale(1.18); opacity: .7; } }
@keyframes core-breathe { 50% { opacity: .75; box-shadow: 0 0 40px 12px rgba(255, 226, 180, .55), 0 0 100px 26px rgba(160, 130, 255, .26); } }

.touch .spark { width: 108px; height: 108px; border-radius: 0; transform: rotate(90deg); -webkit-mask: radial-gradient(circle, #000 8%, transparent 66%); mask: radial-gradient(circle, #000 8%, transparent 66%); animation: spark-twinkle 3.2s ease-in-out infinite; }
.touch .spark, .touch .spark::before, .touch .spark::after { background: linear-gradient(90deg, transparent, rgba(255, 250, 238, .95) 50%, transparent) center / 100% 1.5px no-repeat; }
.touch .spark::before, .touch .spark::after { content: ""; position: absolute; inset: 0; }
.touch .spark::before { transform: rotate(60deg); }
.touch .spark::after { transform: rotate(120deg); }
@keyframes spark-twinkle { 0%, 100% { transform: rotate(90deg) scale(.9); opacity: .8; } 50% { transform: rotate(96deg) scale(1.12); opacity: 1; } }

.touch .orbit { border: 1px solid rgba(236, 202, 142, .3); animation: orbit-a 9s linear infinite; }
.touch .orbit.o2 { width: 88px; height: 88px; border-color: rgba(244, 178, 200, .3); animation: orbit-b 6.5s linear infinite; }
.touch .orbit b { position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #fff6e4; box-shadow: 0 0 10px 3px rgba(236, 202, 142, .85); }
.touch .orbit.o2 b { background: #ffe6ef; box-shadow: 0 0 10px 3px rgba(244, 178, 200, .85); }
@keyframes orbit-a { from { transform: rotateZ(-18deg) rotateX(72deg) rotateZ(0); } to { transform: rotateZ(-18deg) rotateX(72deg) rotateZ(360deg); } }
@keyframes orbit-b { from { transform: rotateZ(32deg) rotateX(66deg) rotateZ(360deg); } to { transform: rotateZ(32deg) rotateX(66deg) rotateZ(0); } }

.touch .ripple { width: 36px; height: 36px; border: 1px solid rgba(255, 230, 190, .6); opacity: 0; animation: ripple 3.6s cubic-bezier(.25, .6, .4, 1) infinite; }
.touch .ripple.r2 { animation-delay: 1.2s; }
.touch .ripple.r3 { animation-delay: 2.4s; }
@keyframes ripple { 0% { transform: scale(.7); opacity: 0; } 8% { opacity: .8; } 62% { opacity: 0; } 100% { transform: scale(4.2); opacity: 0; } }

.touch-label {
  font-size: 1.18rem; font-weight: 500;
  background: linear-gradient(100deg, rgba(246, 239, 228, .7) 35%, #fffaf0 50%, rgba(246, 239, 228, .7) 65%) 0 0 / 260% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: label-shine 4s linear infinite;
  transition: opacity .5s, transform .6s var(--ease-out);
}
@keyframes label-shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }

.touch.pressed .touch-orb { animation: orb-collapse .7s cubic-bezier(.5, 0, .8, .3) forwards; }
.touch.pressed .ripple, .touch.pressed .orbit { animation: none; opacity: 0; transition: opacity .25s; }
.touch.pressed .touch-label { opacity: 0; transform: translateY(10px); }
/* النجمة بتنفخ لحظة وبعدين بتتجمع في نقطة… ومنها القفزة */
@keyframes orb-collapse {
  0% { transform: scale(1); }
  30% { transform: scale(1.28); filter: brightness(2); }
  100% { transform: scale(.06); filter: brightness(2.6); opacity: 0; }
}

/* ظهور الفصول: من الضباب للوضوح */
[data-r] { transform: translateY(38px); transition: opacity 1.4s var(--ease-out), transform 1.6s var(--ease-out); transition-delay: calc(var(--i, 0) * 120ms); }
.split[data-r], .in .split[data-r] { opacity: 1; transform: none; }
main .split .w {
  opacity: 0; transform: translateY(.4em) scale(.95);
  transition: opacity 1.2s var(--ease-out), transform 1.4s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 120ms + var(--w) * 90ms);
}
main .names .w { transform: translateY(.25em) scale(.8); transition-duration: 1.4s, 1.8s; transition-delay: calc(.5s + var(--w) * 220ms); }
main .in .split .w, .hero-caption.show .split .w { opacity: 1; transform: none; }

.hint .split .w { opacity: 0; transform: translateY(.3em); transition: opacity .9s var(--ease-out), transform 1s var(--ease-out); transition-delay: calc(var(--w) * 90ms); }
.hint.show .split .w { opacity: 1; transform: none; }

/* الافتتاحية تحت الأسامي بتظهر سطر ورا سطر */
.hero-in { opacity: 1; transform: none; }
.hero-in > * { opacity: 0; transform: translateY(16px); transition: opacity 1.4s var(--ease-out), transform 1.6s var(--ease-out); }
.hero-in > :nth-child(2) { transition-delay: .25s; }
.hero-in > :nth-child(3) { transition-delay: .6s; }
.hero-in > :nth-child(4) { transition-delay: 1s; }
.hero-caption.show .hero-in > * { opacity: 1; transform: none; }

/* خطوط عناوين الفصول بتترسم */
.chapter-tag::before, .chapter-tag::after { transition: transform 1.5s var(--ease-out) .2s, opacity 1s .2s; }
.reveal:not(.in) .chapter-tag::before, .reveal:not(.in) .chapter-tag::after,
.hero-caption:not(.show) .chapter-tag::before, .hero-caption:not(.show) .chapter-tag::after { transform: scaleX(0); opacity: 0; }

/* الحروف M & N بيقربوا من بعض */
.monogram span, .monogram em { display: inline-block; transition: transform 1.8s var(--ease-out) .5s, opacity 1.3s var(--ease-out) .5s; }
#end:not(.in) #mono1 { transform: translateX(-.9em); opacity: 0; }
#end:not(.in) #mono2 { transform: translateX(.9em); opacity: 0; }
#end:not(.in) .monogram em { transform: scale(0) rotate(-120deg); opacity: 0; }

/* لمعة بتعدي على الزراير */
.btn-star { overflow: hidden; }
.btn-star::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, .24) 50%, transparent 62%) -160% 0 / 220% 100% no-repeat;
  transition: background-position 1s var(--ease-out);
}
.btn-star:hover::after { background-position: 160% 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
