:root {
  --bg: #09090B;
  --bg-2: #111114;
  --card: #131317;
  --ink: #F5F1E8;
  --muted: #8E8A82;
  --line: #24242A;
  --accent: #F59E0B;
  --accent-2: #FB7185;
  --ok: #34D399;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Rubik", system-ui, sans-serif;
  line-height: 1.8;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #000; }
.mono { font-family: var(--mono); }
.dim { opacity: .4; }

/* ================= الواجهة الأولى ================= */
.hero {
  position: relative;
  min-height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

.hero-grid {
  position: absolute; inset: 0; z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 70%);
          mask-image: radial-gradient(ellipse at 50% 45%, #000 20%, transparent 70%);
  animation: grid-move 20s linear infinite;
}
@keyframes grid-move { to { background-position: 64px 64px; } }

/* بقعة ضوء تتبع الماوس */
.hero-glow {
  position: absolute; z-index: -1;
  width: 620px; height: 620px;
  left: var(--mx, 50%); top: var(--my, 45%);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(245,158,11,.22), rgba(251,113,133,.08) 40%, transparent 68%);
  pointer-events: none;
  transition: left .25s ease-out, top .25s ease-out;
}

.nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px clamp(20px, 5vw, 56px);
}
/* الشعار المصغّر في الزاوية العليا */
.nav-mark { display: block; line-height: 0; text-decoration: none; transition: transform .2s; }
.nav-mark svg { height: 33px; width: auto; overflow: visible; direction: ltr; }
.nav-mark .logo-en { animation: none; }
.nav-mark:hover { transform: scale(1.06); }
.nav-link {
  color: var(--ink); text-decoration: none; font-weight: 500;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 18px; display: flex; gap: 10px; align-items: center;
  background: rgba(255,255,255,.02); backdrop-filter: blur(6px);
  transition: border-color .2s;
}
.nav-link:hover { border-color: var(--accent); }
.nav-count { font-family: var(--mono); font-size: .75rem; color: var(--accent); }

.hero-inner {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  text-align: center;
  padding: 0 20px 24px;
}

.logo {
  width: min(880px, 94vw);
  height: auto;
  overflow: visible;
  direction: ltr;
}
.logo-en {
  font-family: "Bungee", Impact, sans-serif;
  font-size: 66px;
  letter-spacing: 1px;
  fill: var(--ink);
  animation: rise 1.1s cubic-bezier(.2,.8,.2,1) both;
}
.logo-ar { font-family: "Reem Kufi Fun", sans-serif; font-weight: 700; font-size: 62px; }
/* حدّ بلون الخلفية يفصل «دماحا» عن الحروف التي تتكئ عليها */
.logo-ar-fill { fill: var(--accent); stroke: var(--bg); stroke-width: 7px; stroke-linejoin: round; paint-order: stroke; }
.anim-ar {
  transform-box: fill-box; transform-origin: center;
  animation: drop 1s cubic-bezier(.3,1.5,.5,1) .55s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-40px) scale(1.5) rotate(-6deg); } to { opacity: 1; transform: none; } }

.hero-line {
  margin-top: clamp(16px, 3vw, 32px);
  font-size: clamp(1.6rem, 4.2vw, 2.8rem);
  font-weight: 700;
  line-height: 1.4;
  animation: rise .9s ease 1s both;
}
.rotator {
  display: inline-block;
  color: transparent;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  min-width: 4ch;
  transition: opacity .3s, transform .3s;
}
.rotator.out { opacity: 0; transform: translateY(-12px); }

.hero-sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  max-width: 560px;
  animation: rise .9s ease 1.15s both;
}
.hero-sub .mono { color: var(--ink); }

.cta {
  margin-top: 40px;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: var(--ink); color: #0A0A0A;
  border-radius: 999px;
  font-weight: 600; text-decoration: none;
  animation: rise .9s ease 1.3s both;
  transition: transform .2s, box-shadow .2s;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 10px 40px -10px rgba(245,158,11,.6); }
.cta-arrow { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

/* ================= التطبيقات ================= */
.apps-section {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.section-head { text-align: center; margin-bottom: 40px; }
.eyebrow { color: var(--accent); font-size: .85rem; }
.section-head h2 {
  font-family: "Reem Kufi Fun", sans-serif;
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  line-height: 1.2; font-weight: 700;
  margin: 6px 0 8px;
}
.dots-title { position: relative; }
/* خط Reem Kufi Fun ملوّن: القلوب حمراء من داخل الخط، فنغيّر ألوانه هنا إلى لون «دماحا» */
@font-palette-values --domaha-hearts {
  font-family: "Reem Kufi Fun";
  override-colors: 0 #F59E0B, 1 #F59E0B, 2 #F59E0B, 3 #F59E0B, 4 #F59E0B, 5 #F59E0B;
}
.dt-base { color: var(--accent); font-palette: --domaha-hearts; }
.dt-top { position: absolute; inset: 0; color: var(--ink); pointer-events: none; }
.section-head p { color: var(--muted); }

/* شجرة النطاقات */
.tree {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 0;
}
.tree-root {
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 16px; border-radius: 8px;
  font-size: .9rem;
  background: rgba(245,158,11,.06);
}
.tree::after {
  content: ""; width: 1px; height: 36px;
  background: linear-gradient(var(--accent), var(--line));
}

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
  position: relative;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.app {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  color: inherit; text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), border-color .3s;
}
/* ضوء يتبع الماوس داخل البطاقة */
.app::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(420px circle at var(--x, 50%) var(--y, 0%), rgba(245,158,11,.14), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.app:hover::before { opacity: 1; }
a.app:hover { transform: translateY(-6px); border-color: rgba(245,158,11,.5); }
a.app:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.app-head { display: flex; justify-content: space-between; align-items: center; }
.app-num { color: var(--muted); font-size: .85rem; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; font-weight: 500; color: var(--ok);
  background: rgba(52,211,153,.08);
  border: 1px solid rgba(52,211,153,.25);
  padding: 3px 12px; border-radius: 999px;
}
.status-soon { color: var(--accent); background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--ok); animation: ping 1.6s ease-out infinite;
}
@keyframes ping { to { transform: scale(3); opacity: 0; } }

/* الرادار المتحرك */
.radar {
  position: relative;
  width: 150px; height: 150px;
  margin: 18px auto 14px;
  border-radius: 50%;
  border: 1px solid rgba(245,158,11,.35);
  background:
    radial-gradient(circle, transparent 32%, rgba(245,158,11,.25) 32.5%, transparent 33.5%),
    radial-gradient(circle, transparent 65%, rgba(245,158,11,.25) 65.5%, transparent 66.5%),
    linear-gradient(transparent 49.6%, rgba(245,158,11,.18) 49.6% 50.4%, transparent 50.4%),
    linear-gradient(90deg, transparent 49.6%, rgba(245,158,11,.18) 49.6% 50.4%, transparent 50.4%);
  overflow: hidden;
}
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(245,158,11,.55), rgba(245,158,11,0) 28%);
  animation: spin 3.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.blip {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
  animation: blink 3.2s ease-in-out infinite;
}
.b1 { top: 26%; left: 62%; animation-delay: .3s; }
.b2 { top: 60%; left: 24%; animation-delay: 1.5s; }
.b3 { top: 70%; left: 68%; animation-delay: 2.4s; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
@keyframes blink { 0%, 100% { opacity: .15; } 15% { opacity: 1; } }

.app h3 { font-size: 1.6rem; font-weight: 700; line-height: 1.3; }
.app p { color: var(--muted); flex: 1; }

.app-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.url { color: var(--accent); font-size: .9rem; }
.lock { font-size: .8rem; color: var(--muted); }

.app-go {
  position: absolute; top: 22px; left: 50%;
  transform: translate(-50%, -8px); opacity: 0;
  font-size: 1.4rem; color: var(--accent);
  transition: all .3s;
}
a.app:hover .app-go { opacity: 1; transform: translate(-50%, 0); }

/* البطاقة القادمة */
.app-soon {
  background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(255,255,255,.015) 14px 28px), var(--bg-2);
  border-style: dashed;
}
.soon-visual {
  height: 150px; margin: 18px 0 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: var(--ink);
}
.caret { color: var(--accent); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* ================= التذييل ================= */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.footer-giant {
  font-family: "Bungee", sans-serif;
  font-size: clamp(3.5rem, 15vw, 14rem);
  line-height: .85;
  text-align: center;
  letter-spacing: 4px;
  padding: 40px 0 10px;
  direction: ltr;
  user-select: none;
  cursor: default;
  /* مفرّغة: خط خارجي رمادي هادئ، بدون توهّج */
  color: transparent;
  -webkit-text-stroke: 2px #3A3A42;
}
/* عند مرور الماوس فقط: الخط الخارجي يتبدّل لونه باستمرار (بدون توهّج) */
.footer-giant:hover {
  -webkit-text-stroke-color: var(--neon);
  animation: neon 2.4s linear infinite;
}
@property --neon { syntax: "<color>"; inherits: true; initial-value: #39FF14; }
@keyframes neon {
  0%, 100% { --neon: #39FF14; }   /* أخضر */
  25%      { --neon: #00E5FF; }   /* أزرق */
  50%      { --neon: #FF9F1C; }   /* برتقالي */
  75%      { --neon: #FF2EC4; }   /* وردي */
}
.footer-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 22px clamp(20px, 5vw, 56px);
  color: var(--muted); font-size: .9rem;
}
.to-top { color: var(--ink); text-decoration: none; }
.to-top:hover { color: var(--accent); }

/* ظهور العناصر عند التمرير */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.apps .reveal:nth-child(2) { transition-delay: .12s; }

@media (max-width: 640px) {
  .apps-section { padding-top: 16px; }
}

/* إذا كان «تقليل الحركة» مفعّلاً في الجهاز: نوقف التحريك الكبير فقط،
   وتبقى الألوان المتبدلة والرادار والنبض تعمل */
@media (prefers-reduced-motion: reduce) {
  .hero-grid, .logo-en, .anim-ar, .hero-line, .hero-sub, .cta, .cta-arrow { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  a.app:hover { transform: none; }
}

/* تلاشٍ ناعم أسفل الواجهة حتى لا يظهر خط فاصل حاد بينها وبين قسم التطبيقات */
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 160px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none; z-index: -1;
}
