/* مكنون — الموقع. الرموز أولاً، ثم الأساس، ثم المكوّنات المشتركة. */

:root {
  --ground: #F2ECE1;
  --ground-2: #E9E0CF;
  --paper: #FBF7EF;
  --ink: #14203A;
  --ink-2: #33415C;
  --muted: #4C566B;
  --brand: #152A44;
  --brand-2: #22406A;
  --on-brand: #F4E6CC;
  --gold: #9A7244;
  --sand: #D6B483;
  --quran-ink: #14203A;
  --basmala: #8E6A3E;
  --line: rgba(21, 42, 68, 0.12);
  --glass: rgba(255, 252, 245, 0.56);
  --glass-strong: rgba(255, 252, 246, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-shade: rgba(21, 42, 68, 0.10);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 50px -18px rgba(21, 42, 68, 0.28), 0 2px 8px -2px rgba(21, 42, 68, 0.08);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 30px 70px -22px rgba(21, 42, 68, 0.38), 0 4px 12px -4px rgba(21, 42, 68, 0.12);
  --hl: rgba(214, 180, 131, 0.34);
  --hl-hover: rgba(21, 42, 68, 0.07);
  --good: #2F6B4F;
  --range: #152A44;
  --bg-image: url('../img/bg-light.webp');
  --glow-a: rgba(214, 180, 131, 0.40);
  --glow-b: rgba(34, 64, 106, 0.16);

  --f-display: 'Reem Kufi', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --f-body: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --f-naskh: 'Noto Naskh Arabic', 'Traditional Arabic', serif;
  --f-quran: 'Hafs', 'Noto Naskh Arabic', serif;

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 4vw, 40px);
  --wrap: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #08111E;
    --ground-2: #0C1728;
    --paper: #0D1626;
    --ink: #EDE3CF;
    --ink-2: #C9CFDB;
    --muted: #AEB8CA;
    --brand: #1F3A60;
    --brand-2: #2B4E7E;
    --on-brand: #F4E6CC;
    --gold: #D6B483;
    --sand: #D6B483;
    --quran-ink: #E8DEC9;
    --basmala: #D6B483;
    --line: rgba(214, 180, 131, 0.14);
    --glass: rgba(19, 32, 56, 0.52);
    --glass-strong: rgba(17, 29, 50, 0.84);
    --glass-edge: rgba(214, 180, 131, 0.16);
    --glass-shade: rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 34px 80px -24px rgba(0, 0, 0, 0.8), 0 4px 14px -4px rgba(0, 0, 0, 0.5);
    --hl: rgba(214, 180, 131, 0.22);
    --hl-hover: rgba(214, 180, 131, 0.08);
    --good: #7FC4A0;
    --range: #D6B483;
    --bg-image: url('../img/bg-dark.webp');
    --glow-a: rgba(47, 71, 102, 0.55);
    --glow-b: rgba(214, 180, 131, 0.10);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ground: #08111E;
  --ground-2: #0C1728;
  --paper: #0D1626;
  --ink: #EDE3CF;
  --ink-2: #C9CFDB;
  --muted: #AEB8CA;
  --brand: #1F3A60;
  --brand-2: #2B4E7E;
  --on-brand: #F4E6CC;
  --gold: #D6B483;
  --sand: #D6B483;
  --quran-ink: #E8DEC9;
  --basmala: #D6B483;
  --line: rgba(214, 180, 131, 0.14);
  --glass: rgba(19, 32, 56, 0.52);
  --glass-strong: rgba(17, 29, 50, 0.84);
  --glass-edge: rgba(214, 180, 131, 0.16);
  --glass-shade: rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 34px 80px -24px rgba(0, 0, 0, 0.8), 0 4px 14px -4px rgba(0, 0, 0, 0.5);
  --hl: rgba(214, 180, 131, 0.22);
  --hl-hover: rgba(214, 180, 131, 0.08);
  --good: #7FC4A0;
  --range: #D6B483;
  --bg-image: url('../img/bg-dark.webp');
  --glow-a: rgba(47, 71, 102, 0.55);
  --glow-b: rgba(214, 180, 131, 0.10);
  color-scheme: dark;
}

@font-face {
  font-family: 'Hafs';
  src: url('../fonts/hafs.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'QCF2BSML';
  src: url('../fonts/qcf2-bsml.woff2') format('woff2');
  font-display: block;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.8;
  color: var(--ink);
  background: var(--ground);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* طبقة الجوّ: نسيج خلفية التطبيق نفسه وتدرّجان خفيفان — خلفية لا عناصر. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 700px at 85% -10%, var(--glow-a), transparent 60%),
    radial-gradient(900px 700px at 0% 110%, var(--glow-b), transparent 60%),
    var(--bg-image) center / cover no-repeat,
    var(--ground);
  pointer-events: none;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--hl); }

.wrap { width: min(var(--wrap), 100% - var(--gutter) * 2); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ——— الزجاج ——— */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
}

/* ——— الشريط العلوي: من اليمين — الشعار، ثم الأقسام، والأدوات في الطرف الأيسر ——— */
.nav {
  position: fixed;
  inset-inline: 0;
  top: 12px;
  z-index: 50;
  pointer-events: none;
}
.nav__bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  padding-inline-start: 14px;
  border-radius: 22px;
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), padding 0.4s var(--ease);
}
.nav.is-scrolled .nav__bar { background: var(--glass-strong); box-shadow: var(--shadow-lift); }
.nav__brand { display: flex; align-items: center; gap: 11px; flex: none; }
.nav__brand img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(21, 42, 68, 0.25)); }
.nav__name { display: grid; line-height: 1.1; }
.nav__name b { font-family: var(--f-display); font-size: 26px; font-weight: 600; color: var(--ink); }
.nav__name small { font-size: 17px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.01em; }
.nav__sep { width: 1px; height: 30px; background: var(--line); margin-inline: 10px 6px; flex: none; }
.nav__links { display: flex; gap: 2px; min-width: 0; }
.nav__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 17px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.25s, color 0.25s;
}
.nav__links a svg { width: 19px; height: 19px; color: var(--gold); transition: transform 0.35s var(--ease); }
.nav__links a:hover { background: var(--hl-hover); color: var(--ink); }
.nav__links a:hover svg { transform: translateY(-2px); }
.nav__links a[aria-current="page"] { background: var(--brand); color: var(--on-brand); box-shadow: 0 10px 22px -12px rgba(21, 42, 68, 0.7); }
.nav__links a[aria-current="page"] svg { color: var(--sand); }
.nav__actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; flex: none; }
.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 17px;
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--sand) 55%, transparent);
  white-space: nowrap;
  transition: background 0.25s;
}
.nav__cta:hover { background: var(--hl-hover); }
.nav__cta svg { width: 18px; height: 18px; }
.nav__actions .nav__menu { display: none; }

@media (max-width: 1180px) { .nav__cta { display: none; } }
@media (max-width: 1060px) {
  .nav__links, .nav__sep { display: none; }
  .nav__actions .nav__menu { display: inline-grid; }
}
@media (max-width: 640px) {
  .nav { top: 8px; }
  .nav__bar { padding: 6px; padding-inline-start: 10px; border-radius: 18px; }
  .nav__brand img { width: 34px; height: 34px; }
  .nav__name b { font-size: 23px; }
  .nav__name small { font-size: 14.5px; }
}

/* ——— قائمة الأقسام المنبثقة ——— */
.menu { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.menu__scrim { position: absolute; inset: 0; background: rgba(8, 17, 30, 0.35); opacity: 0; transition: opacity 0.35s; }
.menu__panel {
  position: absolute;
  top: 10px;
  inset-inline: 10px;
  max-width: 460px;
  margin-inline-start: auto;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  padding: 14px;
  transform: translateY(-16px) scale(0.98);
  opacity: 0;
  transition: transform 0.45s var(--ease), opacity 0.3s;
}
.menu-open .menu { pointer-events: auto; }
.menu-open .menu__scrim { opacity: 1; }
.menu-open .menu__panel { transform: none; opacity: 1; }
.menu__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.menu li a { display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; padding: 10px; border-radius: 16px; transition: background 0.2s; }
.menu li a:hover { background: var(--hl-hover); }
.menu li a[aria-current="page"] { background: var(--hl); }
.menu__icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--brand); color: var(--sand); }
.menu__icon svg { width: 23px; height: 23px; }
.menu li b { display: block; font-size: 17.5px; font-weight: 600; line-height: 1.3; }
.menu li small { font-size: 16.5px; color: var(--muted); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s var(--ease);
}
.icon-btn:hover { background: var(--hl-hover); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: block; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}


/* ——— الأزرار ——— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16.5px;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.25s;
}
.btn svg { width: 20px; height: 20px; }
.btn--brand { background: var(--brand); color: var(--on-brand); box-shadow: 0 14px 30px -12px rgba(21, 42, 68, 0.55); }
.btn--brand:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px rgba(21, 42, 68, 0.6); }
.btn--glass { background: var(--glass); border-color: var(--glass-edge); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--ink); }
.btn--glass:hover { transform: translateY(-2px); background: var(--glass-strong); }

/* ——— العناوين ——— */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold);
}
.eyebrow::before { content: ''; width: 26px; height: 1.5px; background: currentColor; border-radius: 2px; }
.h-display { font-family: var(--f-display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; color: var(--ink); }
.lede { color: var(--ink-2); font-size: clamp(18.5px, 1.7vw, 21px); font-weight: 500; max-width: 60ch; margin: 0; text-wrap: pretty; }

/* ——— الظهور بالتمرير: صعودٌ عند الدخول، ونزولٌ عند العودة ——— */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(42px) scale(0.985);
  transition: opacity 0.85s var(--ease), transform 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
  will-change: transform, opacity;
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal].is-above { opacity: 0; transform: translateY(-34px) scale(0.985); transition-delay: 0ms; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal], .js [data-reveal].is-above { opacity: 1; transform: none; transition: none; }
}

/* ——— التذييل ——— */
.footer { margin-top: 110px; padding: 0 0 36px; }
.footer__card { border-radius: var(--r-lg); padding: 34px clamp(20px, 4vw, 44px); display: grid; gap: 26px; grid-template-columns: 1.1fr 1.5fr; }
.footer__brand { display: flex; gap: 14px; align-items: center; }
.footer__brand img { width: 52px; height: 52px; object-fit: contain; }
.footer__brand strong { font-family: var(--f-display); font-size: 30px; font-weight: 600; display: block; line-height: 1.1; }
.footer__brand small { color: var(--muted); font-size: 17.5px; }
.footer__sources { display: grid; gap: 10px; font-size: 16px; color: var(--muted); line-height: 1.7; }
.footer__sources b { color: var(--ink-2); font-weight: 600; }
.footer__base { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 17px; color: var(--muted); padding: 18px 6px 0; }
@media (max-width: 760px) { .footer__card { grid-template-columns: 1fr; } }

/* ——— الشعار المتوهّج (باب مكنون) ——— */
.door { position: relative; display: grid; place-items: center; }
.door__glow { position: absolute; inset: -30%; background: url('../img/door-glow.webp') center / contain no-repeat; opacity: 0.9; animation: breathe 6s ease-in-out infinite; }
.door__mark { position: relative; width: 100%; height: auto; }
@keyframes breathe { 0%, 100% { opacity: 0.65; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .door__glow { animation: none; } }

/* ——— هيكل التحميل ——— */
.skeleton { background: linear-gradient(90deg, var(--line), transparent 40%, var(--line) 80%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* ——— تنبيهٌ عائم ——— */
.toast {
  position: fixed;
  left: 50%;
  top: 75%;
  z-index: 80;
  transform: translate(-50%, 16px);
  opacity: 0;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  font-size: 17.5px;
  white-space: nowrap;
  box-shadow: 0 16px 40px -12px rgba(8, 17, 30, 0.6);
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast .q { color: var(--sand); margin-inline-end: 8px; font-family: var(--f-quran); }

/* حاوية الأيقونة تأخذ مقاس رسمها. */
[data-icon] { display: inline-grid; place-items: center; }
