/* ==========================================================================
   دعوة زفاف رقمية — التصميم
   الألوان: عاجي #FAF6EF | ذهبي شامباني #C5A46D | أخضر غابات #263B32
            بيج #E9DFD0 | نص داكن #292621
   ملاحظة: الذهبي الفاتح للزخارف والحدود؛ والنصوص على الخلفيات الفاتحة تستخدم ذهبيًا أغمق لتباين مقروء.
   ========================================================================== */

:root {
  --ivory: #FAF6EF;
  --gold: #C5A46D;
  --gold-deep: #7F6330;
  --green: #263B32;
  --green-soft: #34503f;
  --beige: #E9DFD0;
  --text: #292621;
  --text-soft: #4a453d;
  --error: #9b2c2c;
  --radius: 14px;
  --font-display: "Amiri", "Traditional Arabic", serif;
  --font-body: "Cairo", "Segoe UI", Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 12px;
}
html.no-scroll { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--text);
  background: var(--ivory);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }

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

:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 4px; }
.cover :focus-visible, .section--green :focus-visible, .footer :focus-visible, .lb :focus-visible {
  outline-color: var(--gold);
}

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 10px 30px;
  font: 600 1.0625rem/1.4 var(--font-body);
  border: 1.5px solid transparent; border-radius: 999px;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .25s ease, background-color .25s ease, color .25s ease, border-color .25s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--gold { background: var(--gold); color: var(--text); border-color: var(--gold); }
.btn--gold:hover { background: #d3b680; }
.btn--green { background: var(--green); color: var(--ivory); border-color: var(--green); }
.btn--green:hover { background: var(--green-soft); }
.btn--outline { background: transparent; color: var(--green); border-color: var(--gold); }
.btn--outline:hover { background: rgba(197,164,109,.16); }
.btn--block { width: 100%; }
.btn[aria-disabled="true"] { opacity: .6; }

.actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 28px; }
.actions .btn { flex: 1 1 240px; max-width: 340px; }

/* ---------- زخرفة فاصلة ---------- */
.ornament { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px auto; color: var(--gold); }
.ornament span { width: clamp(40px, 16vw, 90px); height: 1px; background: currentColor; opacity: .8; }
.ornament i { width: 9px; height: 9px; border: 1px solid currentColor; transform: rotate(45deg); flex: none; }
.ornament--dark { color: var(--gold-deep); }

/* ---------- الغلاف ---------- */
.cover {
  position: relative; isolation: isolate;
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  padding: 44px 30px;
  color: var(--ivory); text-align: center;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(197,164,109,.16), transparent 60%),
    radial-gradient(90% 70% at 50% 100%, rgba(52,80,63,.9), transparent 70%),
    var(--green);
  overflow: clip;
}
.cover::before, .cover::after { content: ""; position: absolute; pointer-events: none; z-index: -1; }
.cover::before { inset: 12px; border: 1px solid var(--gold); opacity: .85; }
.cover::after { inset: 19px; border: 1px solid rgba(197,164,109,.4); }

.cover__inner { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cover__eyebrow { color: var(--gold); font-weight: 600; font-size: .95rem; }
.cover__kicker { color: rgba(250,246,239,.85); font-size: 1rem; }
.cover__names {
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.5rem, min(14vw, 9.5vh), 5.2rem);
  margin: 4px 0;
}
.cover__amp { color: var(--gold); font-size: .6em; font-weight: 400; line-height: 1.2; }
.cover__date { font-family: var(--font-display); font-size: clamp(1.15rem, 4.6vw, 1.6rem); color: var(--gold); }
.cover__msg { max-width: 34ch; color: rgba(250,246,239,.9); font-size: 1rem; margin-bottom: 14px; }
.cover .btn { min-width: 240px; margin-top: 6px; }
.cover__cue {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  color: var(--gold); text-decoration: none; font-weight: 600; padding: 8px 12px;
}
.cover__cue svg { width: 20px; height: 20px; transform: rotate(90deg); animation: bob 1.8s ease-in-out infinite; }

.sprig { position: absolute; z-index: -1; width: clamp(70px, 22vw, 150px); height: clamp(116px, 36vw, 250px); color: var(--gold); opacity: .55; pointer-events: none; }
.sprig--tl { top: 26px; left: 26px; transform: rotate(-24deg); }
.sprig--tr { top: 26px; right: 26px; transform: scaleX(-1) rotate(-24deg); }
.sprig--bl { bottom: 26px; left: 26px; transform: scaleY(-1) rotate(-24deg); }
.sprig--br { bottom: 26px; right: 26px; transform: scale(-1, -1) rotate(-24deg); }

/* حركة الدخول */
.js .cover__inner > * { opacity: 0; transform: translateY(18px); animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; }
.js .cover__inner > :nth-child(1) { animation-delay: .15s; }
.js .cover__inner > :nth-child(2) { animation-delay: .3s; }
.js .cover__inner > :nth-child(3) { animation-delay: .5s; }
.js .cover__inner > :nth-child(4) { animation-delay: .7s; }
.js .cover__inner > :nth-child(5) { animation-delay: .85s; }
.js .cover__inner > :nth-child(6) { animation-delay: 1s; }
.js .cover__inner > :nth-child(7) { animation-delay: 1.15s; }
.js .sprig { opacity: 0; animation: fadeSprig 1.6s ease .2s forwards; }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fadeSprig { to { opacity: .55; } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 5px; } }

/* ---------- أقسام عامة ---------- */
.section { padding: 76px 20px; }
.section--ivory { background: var(--ivory); }
.section--beige { background: var(--beige); }
.section--green { background: var(--green); color: var(--ivory); }
.container { max-width: 960px; margin-inline: auto; }
.container--narrow { max-width: 600px; }
.center { text-align: center; }

.eyebrow { color: var(--gold-deep); font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.eyebrow--gold { color: var(--gold); }
.title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.9rem, 6.5vw, 2.8rem); line-height: 1.4; color: var(--green); }
.title--light { color: var(--ivory); }
.title:focus { outline: none; }
.lead { color: var(--text-soft); font-size: 1.1rem; max-width: 52ch; }
.lead--narrow { margin-inline: auto; }
.lead--light { color: rgba(250,246,239,.9); }
.center .lead { margin-inline: auto; }

/* حركة الظهور عند التمرير */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-visible { opacity: 1; transform: none; }
#content.is-open { animation: fadeIn .8s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- تعريف العروسين ---------- */
.intro { display: grid; gap: 44px; align-items: center; text-align: center; }
.intro .ornament { justify-content: center; }
.intro .lead { margin-inline: auto; }
.intro__names { font-family: var(--font-display); font-size: 1.7rem; color: var(--gold-deep); margin-top: 14px; }

.arch {
  position: relative; width: min(78%, 320px); aspect-ratio: 4 / 5; margin-inline: auto;
  border-radius: 999px 999px 18px 18px;
  border: 1.5px solid var(--gold); padding: 10px;
  background: var(--beige);
}
.arch::before { content: ""; position: absolute; inset: 5px; border-radius: inherit; border: 1px solid rgba(197,164,109,.45); pointer-events: none; }
.arch img, .arch__monogram { width: 100%; height: 100%; border-radius: 999px 999px 10px 10px; object-fit: cover; }
.arch__monogram {
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: clamp(3rem, 14vw, 4.6rem); color: var(--gold);
  background: radial-gradient(circle at 50% 30%, var(--green-soft), var(--green));
}

/* ---------- العد التنازلي ---------- */
.cd { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 32px auto 0; }
.cd__box { border: 1px solid var(--gold); border-radius: var(--radius); padding: 14px 4px 10px; background: rgba(250,246,239,.04); display: flex; flex-direction: column; align-items: center; }
.cd__num { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 9vw, 3rem); line-height: 1.3; color: var(--gold); min-width: 2ch; }
.cd__label { font-size: .9rem; color: rgba(250,246,239,.88); }
.cd__msg { margin: 32px auto 0; max-width: 34ch; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.7; color: var(--gold); }

/* ---------- بطاقة التفاصيل ---------- */
.card {
  position: relative; margin-top: 34px; padding: 34px 24px;
  background: var(--ivory); border: 1.5px solid var(--gold); border-radius: 6px;
}
.card::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(197,164,109,.45); border-radius: 3px; pointer-events: none; }
.facts { display: grid; gap: 26px; position: relative; }
.fact { display: flex; gap: 16px; align-items: flex-start; }
.fact[hidden] { display: none; }
.fact__icon { width: 34px; height: 34px; flex: none; color: var(--gold-deep); margin-top: 4px; }
.fact h3 { font-size: .95rem; font-weight: 600; color: var(--gold-deep); line-height: 1.6; }
.fact p { font-size: 1.15rem; font-weight: 600; color: var(--text); line-height: 1.7; overflow-wrap: anywhere; }
.fact .fact__sub { font-size: 1rem; font-weight: 400; color: var(--text-soft); }

/* ---------- المعرض ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 34px; }
.gallery__item {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0;
  border: 1px solid var(--gold); border-radius: 6px; overflow: hidden; cursor: zoom-in;
  background: linear-gradient(135deg, var(--green-soft), var(--green));
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.gallery__item:hover img { transform: scale(1.04); }
.gallery__fallback { display: none; position: absolute; inset: 0; place-items: center; color: var(--gold); font-family: var(--font-display); font-size: 1.1rem; padding: 10px; text-align: center; }
.gallery__item.is-broken .gallery__fallback { display: grid; }

/* ---------- النموذج ---------- */
.card--form { display: grid; gap: 22px; padding: 30px 22px; }
.card--form > * { position: relative; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 8px; padding: 0; color: var(--green); }
.field input[type="text"], .field select {
  width: 100%; min-height: 52px; padding: 10px 14px;
  font: 400 1rem/1.5 var(--font-body); color: var(--text);
  background: #fff; border: 1.5px solid #cfc3ae; border-radius: 10px;
}
.field input[type="text"]:focus, .field select:focus { outline: 3px solid rgba(38,59,50,.35); outline-offset: 1px; border-color: var(--green); }
.field.has-error input[type="text"] { border-color: var(--error); }
.field__error { min-height: 0; margin-top: 6px; font-size: .92rem; color: var(--error); line-height: 1.6; }
.field__error:empty { display: none; }

.choices { display: grid; gap: 10px; }
.choice { position: relative; display: block; margin: 0 !important; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px;
  border: 1.5px solid #cfc3ae; border-radius: 10px; background: #fff; font-weight: 600; color: var(--text);
  transition: border-color .2s, background-color .2s;
}
.choice span::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--gold-deep); background: #fff; transition: box-shadow .2s, background-color .2s; }
.choice input:checked + span { border-color: var(--green); background: rgba(38,59,50,.06); }
.choice input:checked + span::before { background: var(--green); box-shadow: inset 0 0 0 3px #fff; border-color: var(--green); }
.choice input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }

.form__hint { font-size: .9rem; color: var(--text-soft); text-align: center; line-height: 1.7; }
.status { margin-top: 14px; font-size: 1rem; line-height: 1.8; text-align: center; color: var(--text-soft); }
.status:empty { display: none; }
.status--light { color: rgba(250,246,239,.92); }
.card--form .status { margin-top: 0; padding: 14px 16px; border-radius: 10px; background: var(--beige); text-align: right; }
.card--form .status.is-error { background: #f6e3e3; color: var(--error); }
.status a { color: var(--green); font-weight: 700; }
.status pre { margin: 10px 0 0; padding: 12px; white-space: pre-wrap; font: 400 .95rem/1.8 var(--font-body); background: #fff; border-radius: 8px; color: var(--text); text-align: right; }
.section--green .status a { color: var(--gold); }

/* ---------- التذييل ---------- */
.footer { background: var(--green); color: var(--gold); text-align: center; padding: 34px 20px calc(34px + env(safe-area-inset-bottom)); }
.footer__msg { font-family: var(--font-display); font-size: 1.35rem; }

/* ---------- نافذة الصور ---------- */
.lb { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100vh; height: 100dvh; margin: 0; color: var(--ivory); }
.lb[open] { display: block; }
.lb::backdrop { background: rgba(14,22,18,.94); }
.lb__stage { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 64px 8px 24px; }
.lb__figure { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.lb__figure img { max-width: 100%; max-height: calc(100dvh - 160px); width: auto; height: auto; object-fit: contain; border: 1px solid rgba(197,164,109,.6); }
.lb__figure img[hidden] { display: none; }
.lb__error { padding: 40px 20px; color: var(--gold); }
.lb__figure figcaption { font-size: .95rem; color: rgba(250,246,239,.9); }
.lb__btn { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--gold); background: rgba(38,59,50,.9); color: var(--gold); cursor: pointer; }
.lb__btn svg { width: 24px; height: 24px; }
.lb__btn:hover { background: var(--green-soft); }
.lb__btn--close { position: absolute; top: 12px; left: 12px; }
.lb__btn--prev svg { transform: none; }          /* RTL: السابق على اليمين ويشير لليمين */
.lb__btn--next svg { transform: scaleX(-1); }    /* التالي على اليسار ويشير لليسار */
.lb__btn[hidden] { display: none; }

/* ---------- الشاشات الأكبر ---------- */
@media (min-width: 640px) {
  .section { padding: 96px 32px; }
  .facts { grid-template-columns: 1fr 1fr; gap: 32px 40px; }
  .card { padding: 46px 44px; }
  .card--form { padding: 36px 40px; }
  .choices { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .cd { gap: 18px; }
  .lb__btn { width: 56px; height: 56px; }
  .lb__stage { gap: 24px; padding-inline: 24px; }
}
@media (min-width: 900px) {
  .intro { grid-template-columns: 1.2fr 1fr; text-align: right; gap: 70px; }
  .intro .ornament { justify-content: flex-start; }
  .intro .lead { margin-inline: 0; }
  .cover__names { flex-direction: row; gap: .35em; }
  .cover__inner { max-width: 760px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .cover { padding-block: 34px; }
  .cover__names { flex-direction: row; gap: .35em; font-size: clamp(2rem, 9vh, 3rem); }
  .sprig { display: none; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .cover__inner > * { opacity: 1; transform: none; }
  .js .sprig { opacity: .55; }
  .btn:hover, .gallery__item:hover img { transform: none; }
}
