/* ===== Base / shared across all styles ===== */
:root {
  --ink: #1c1a17;
  --muted: #6d675f;
  --paper: #fffdf9;
  --gold: #b9924f;
  --radius: 18px;
  --maxw: 720px;
  --font-ar: "Cairo", system-ui, "Segoe UI", sans-serif;
  --font-display-ar: "Aref Ruqaa", "Amiri", serif;
  --font-en: "Cormorant Garamond", Georgia, serif;
  --font-script: "Great Vibes", cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ar);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

section { position: relative; }

.sec { padding: 64px 0; }

.sec-title {
  font-family: var(--font-display-ar);
  font-size: clamp(1.4rem, 5vw, 2rem);
  text-align: center;
  margin: 0 0 8px;
}

.sec-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 32px;
  font-family: var(--font-en);
}

/* ——— names ——— */
.names {
  font-family: var(--font-display-ar);
  font-size: clamp(2.4rem, 12vw, 4.6rem);
  line-height: 1.15;
  margin: 0;
  text-align: center;
}
.names .amp {
  display: block;
  font-family: var(--font-script);
  font-size: 0.55em;
  opacity: 0.8;
  margin: 4px 0;
}
.names-en {
  font-family: var(--font-en);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
  margin-top: 14px;
}

/* ——— countdown ——— */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 460px;
  margin: 28px auto 0;
  direction: ltr;
}
.cd-box {
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.cd-num { font-size: clamp(1.2rem, 6vw, 1.9rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.cd-lbl { font-size: 0.68rem; letter-spacing: 0.1em; opacity: 0.75; }

/* ——— cards / grid ——— */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
  padding: 26px 20px 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
}
.card h4 {
  margin: 18px 0 10px;
  /* الخط العرضي (Aref Ruqaa) يظهر أصغر من نص الجسم فيبدو العنوان لاصقًا بالرسم */
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}
/* فاصل صغير يفصل الرسم عن العنوان بصريًا */
.card h4::before {
  content: "";
  display: block;
  width: 26px;
  height: 1px;
  margin: 0 auto 14px;
  background: currentColor;
  opacity: 0.4;
}
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.9; }
.card p bdi { display: block; }

/* ——— رسم توضيحي ثلاثي الأبعاد داخل الكرت (مولَّد بالذكاء الاصطناعي) ——— */
.card .art {
  width: 92px;
  height: 92px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  position: relative;
}
.card .art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* PNG بخلفية شفافة (تُقصّ بـ tools/cutout-bg.ps1) */
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.18));
}
[data-mode="dark"] .card .art img { filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5)); }
/* البديل عند عدم وجود الصورة: أيقونة SVG */
.card .art .art-ic { width: 34px; height: 34px; display: none; color: var(--gold); }
.card .art.art-fallback .art-ic { display: block; }

/* ——— أيقونات SVG ——— */
.ic {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  vertical-align: -3px;
}

/* ——— buttons ——— */
.btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid currentColor;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: inherit;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-solid:hover { filter: brightness(1.07); }

/* ——— map ——— */
.map-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  aspect-ratio: 16 / 10;
  background: #eee;
}
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ——— timeline ——— */
.tl { list-style: none; margin: 0; padding: 0; max-width: 460px; margin-inline: auto; }
.tl li {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.12);
}
.tl li:last-child { border-bottom: 0; }
.tl .t { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.tl .n { font-family: var(--font-display-ar); }
.tl .n small { display: block; font-family: var(--font-en); letter-spacing: 0.2em; font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }

/* ——— QR ——— */
.qr-card {
  max-width: 320px;
  margin-inline: auto;
  text-align: center;
  padding: 22px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 50px -30px rgba(0, 0, 0, 0.5);
}
.qr-card canvas, .qr-card img { margin-inline: auto; border-radius: 8px; }
.qr-card .lnk { font-size: 0.72rem; color: var(--muted); word-break: break-all; direction: ltr; margin-top: 12px; }

/* ——— verse ——— */
.verse { text-align: center; max-width: 560px; margin-inline: auto; }
.verse p { font-family: "Amiri", var(--font-display-ar); font-size: clamp(1.05rem, 4.4vw, 1.5rem); line-height: 2.1; margin: 0; }
.verse cite { display: block; margin-top: 12px; font-size: 0.8rem; color: var(--muted); font-style: normal; }

/* ——— فاصل زخرفي بصورة مولَّدة ——— */
.orn { margin: 20px auto; max-width: 240px; display: grid; place-items: center; }
.orn img { width: 100%; height: auto; object-fit: contain; }
/* بديل بـ CSS لو الصورة ناقصة */
.orn-fallback { position: relative; }
.orn-fallback::before {
  content: "";
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0.5;
}

/* ——— نصوص مساعدة ——— */
.lead { margin: 0; font-size: 0.95rem; }
.date-line { margin: 6px 0 0; color: var(--gold); }
.deadline { color: var(--muted); margin: 0 0 6px; }
.dua { font-family: var(--font-display-ar); font-size: 1.05rem; margin: 0; }
.qr-note { margin: 12px 0 0; font-size: 0.85rem; }
.cd-done { grid-column: 1 / -1; font-family: var(--font-display-ar); }

/* ——— gallery ——— */
.gal { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.gal figure {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 3 / 4;
  background: rgba(0, 0, 0, 0.06);
}
.gal img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.gal figure:hover img { transform: scale(1.06); }
.gal figcaption {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  padding: 26px 14px 12px;
  color: #fff;
  font-size: 0.85rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
}
.gal figcaption small {
  display: block;
  font-family: var(--font-en);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.6rem;
  opacity: 0.8;
}

/* ——— footer ——— */
footer { text-align: center; padding: 40px 20px 60px; font-size: 0.8rem; color: var(--muted); }

/* ——— reveal on scroll ——— */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ——— style switcher (hidden in ?clean=1) ——— */
.switcher {
  position: fixed;
  inset-block-end: 16px;
  inset-inline-start: 16px;
  z-index: 50;
  display: flex;
  gap: 6px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}
.switcher a {
  font-size: 0.72rem;
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0.75;
}
.switcher a[aria-current="true"] { background: #fff; color: #111; opacity: 1; font-weight: 700; }
.switcher .to-3d {
  background: #cfa96b;
  color: #16130f;
  font-weight: 700;
  opacity: 1;
}

/* ——— audio toggle ——— */
.audio-btn {
  position: fixed;
  inset-block-start: 16px;
  inset-inline-end: 16px;
  z-index: 50;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(20, 20, 20, 0.6);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}
