/* ==========================================================================
   مَدار — الأساس: المتغيّرات، التصفير، الخطوط، التنسيق العام
   المصدر الوحيد للألوان. لا لون ثابت داخل المكوّنات.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #f6f8fd;
  --surface: #ffffff;
  --surface-2: #f1f5fc;
  --surface-3: #e8eef9;
  --border: #e2e9f5;
  --border-strong: #cdd8ea;

  --text: #0b1425;
  --text-2: #3a4964;
  --text-muted: #6c7c96;
  --text-inverse: #ffffff;

  --primary: #2454f0;
  --primary-2: #6c8cff;
  --primary-soft: #e9f0ff;
  --accent: #f59e0b;
  --accent-soft: #fff3d9;
  --success: #0c9a74;
  --success-soft: #e1f7ef;
  --danger: #dc3f3a;
  --danger-soft: #fdeceb;
  --violet: #7a55f2;
  --violet-soft: #f1ecff;

  --shadow-xs: 0 1px 2px rgba(11, 20, 37, .05);
  --shadow-sm: 0 2px 6px -1px rgba(11, 20, 37, .07), 0 1px 2px rgba(11, 20, 37, .04);
  --shadow-md: 0 14px 30px -18px rgba(11, 20, 37, .35), 0 2px 8px rgba(11, 20, 37, .05);
  --shadow-lg: 0 34px 70px -40px rgba(11, 20, 37, .45), 0 8px 22px -14px rgba(11, 20, 37, .2);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  --font-body: "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-head: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cairo Mono", Menlo, monospace;

  --wrap: 1180px;
  --nav-h: 68px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #070d18;
  --surface: #0d1626;
  --surface-2: #121d31;
  --surface-3: #18253d;
  --border: #1d2b45;
  --border-strong: #2b3d5c;

  --text: #e9f0fb;
  --text-2: #c3d0e5;
  --text-muted: #8b9cb7;
  --text-inverse: #070d18;

  --primary: #7fa2ff;
  --primary-2: #a9c1ff;
  --primary-soft: #152340;
  --accent: #f7ba57;
  --accent-soft: #2a2214;
  --success: #35cba1;
  --success-soft: #0f2a24;
  --danger: #f4746f;
  --danger-soft: #2b1414;
  --violet: #a98bfb;
  --violet-soft: #1b1934;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 16px 34px -20px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lg: 0 40px 80px -44px rgba(0, 0, 0, .9), 0 10px 26px -16px rgba(0, 0, 0, .5);
}

/* ---------- تصفير ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* هالة لونية خفيفة خلف الصفحة */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46% 60% at 18% 0%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
    radial-gradient(40% 55% at 82% 6%, color-mix(in srgb, var(--violet) 13%, transparent), transparent 72%),
    radial-gradient(34% 46% at 55% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
  filter: blur(6px);
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
code, kbd, pre { font-family: var(--font-mono); }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -.012em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.35rem); line-height: 1.16; letter-spacing: -.028em; }
h2 { font-size: clamp(1.5rem, 2.7vw, 2.05rem); letter-spacing: -.02em; }
h3 { font-size: clamp(1.1rem, 1.7vw, 1.28rem); }
p { text-wrap: pretty; }

::selection { background: color-mix(in srgb, var(--primary) 26%, transparent); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.ico {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  inset-inline-start: 50%;
  top: -100px;
  transform: translateX(50%);
  z-index: 200;
  padding: .6rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- تنسيقات مساعدة ---------- */
.wrap {
  width: min(100% - 2.75rem, var(--wrap));
  margin-inline: auto;
}

.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;
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.muted { color: var(--text-muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.num { font-family: var(--font-head); font-variant-numeric: tabular-nums; }

/* ظهور تدريجي عند التمرير */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* أقسام الصفحة */
.section { padding-block: clamp(2.6rem, 6vw, 4.5rem); }
.section--tight { padding-block: clamp(1.8rem, 4vw, 2.8rem); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.9rem;
}
.section-head p {
  color: var(--text-muted);
  max-width: 62ch;
  margin-top: .45rem;
  font-size: .97rem;
}
.section-head h2 { position: relative; }
.section-head .link-more {
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 600; font-size: .92rem; color: var(--primary);
  white-space: nowrap; padding-bottom: .3rem;
}
.section-head .link-more .ico { transition: transform .25s var(--ease); }
.section-head .link-more:hover .ico { transform: translateX(-4px); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .34rem .8rem .34rem .68rem;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  font-size: .8rem; font-weight: 600; color: var(--text-2);
}
.eyebrow .ico { color: var(--primary); }

@media (max-width: 720px) {
  .wrap { width: min(100% - 1.75rem, var(--wrap)); }
  .section-head { flex-direction: column; align-items: flex-start; gap: .6rem; }
}
