/* ============================================================
   DESIGN TOKENS
============================================================ */
:root {
  --bg: #070b14; --bg2: #0c1220; --card: rgba(15,23,42,0.86);
  --text: #e5eefc; --muted: #b4c2da; --line: rgba(148,163,184,0.18);
  --accent: #7dd3fc; --accent2: #a78bfa; --success: #34d399;
  --shadow: 0 30px 80px rgba(0,0,0,0.35); --radius: 28px; --max: 1180px;
  --transition: 0.25s ease;
}

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top left, rgba(125,211,252,0.20), transparent 30%),
              radial-gradient(circle at top right, rgba(167,139,250,0.18), transparent 28%),
              linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text); min-height: 100vh; overflow-x: hidden; line-height: 1.6;
}

/* التوافق مع اللغة العربية (RTL) للـ Background */
[dir="rtl"] body {
  background: radial-gradient(circle at top right, rgba(125,211,252,0.20), transparent 30%),
              radial-gradient(circle at top left, rgba(167,139,250,0.18), transparent 28%),
              linear-gradient(180deg, var(--bg), var(--bg2));
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   LAYOUT & COMPONENTS
============================================================ */
.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; position: relative; z-index: 1; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 0 8px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.05rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

.lang-switch { display: inline-flex; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(15,23,42,0.55); }
.lang-switch a { padding: 8px 18px; border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 0.9rem; transition: var(--transition); }
.lang-switch a.active { background: linear-gradient(135deg, rgba(125,211,252,0.18), rgba(167,139,250,0.18)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }

.hero { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; padding: 18px 0 24px; }
.panel { background: linear-gradient(180deg, rgba(15,23,42,0.86), rgba(15,23,42,0.62)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.hero-main { padding: 36px; }

h1 { margin: 14px 0 5px; font-size: clamp(2.4rem, 4vw, 3.8rem); font-weight: 900; line-height: 1.1; }
h2.hero-sub { font-size: clamp(1.2rem, 2vw, 1.6rem); color: var(--accent); margin: 0 0 15px; font-weight: 600; }

.meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.pill { display: inline-flex; padding: 10px 16px; border-radius: 999px; background: rgba(148,163,184,0.10); border: 1px solid var(--line); color: #d7e6ff; font-size: 0.9rem; font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 0 22px; height: 48px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.10); font-weight: 700; cursor: pointer; transition: var(--transition); }
.btn.primary { background: linear-gradient(135deg, rgba(125,211,252,0.20), rgba(167,139,250,0.22)); border-color: rgba(125,211,252,0.25); color: #fff; }
.btn.ghost { background: rgba(148,163,184,0.08); }
.btn:hover { transform: translateY(-2px); }

.hero-side { padding: 22px; display: grid; gap: 16px; }
.avatar { width: min(132px, 30vw); aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: linear-gradient(135deg, rgba(125,211,252,0.18), rgba(167,139,250,0.18)); display: grid; place-items: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.8); }

.section { margin-top: 22px; padding: 32px; }
.section h2 { margin: 0 0 15px; font-size: 1.8rem; font-weight: 800; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.card { padding: 22px; border-radius: 20px; background: rgba(15,23,42,0.65); border: 1px solid rgba(255,255,255,0.08); }
.card h3 { margin: 0 0 10px; font-size: 1.2rem; color: var(--accent); }

.project-deep { display: flex; flex-direction: column; gap: 8px; }
.project-deep strong { color: #fff; }
.project-deep a.github-link { color: var(--accent); text-decoration: underline; font-size: 0.9rem; margin-top: 10px; display: inline-block; }

.tagrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { display: inline-flex; padding: 6px 13px; border-radius: 999px; background: rgba(125,211,252,0.08); border: 1px solid rgba(125,211,252,0.16); color: #d6f3ff; font-size: 0.85rem; font-weight: 500; }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 24px; }
.social-link { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 18px; background: rgba(15,23,42,0.55); border: 1px solid rgba(255,255,255,0.08); font-weight: 600; transition: var(--transition); min-height: 72px; }
.social-link:hover { transform: translateY(-4px); background: rgba(125,211,252,0.10); border-color: rgba(125,211,252,0.28); box-shadow: 0 12px 36px rgba(0,0,0,0.22); }
.social-link svg { width: 28px; height: 28px; fill: currentColor; opacity: 0.88; }
.social-link .details { display: flex; flex-direction: column; gap: 3px; }
.social-link .details .label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; }
.social-link .details .value { font-size: 1rem; font-weight: 700; color: #fff; }

.footer { padding: 32px 0 52px; text-align: center; color: var(--muted); font-size: 0.92rem; }
.footer a { color: var(--accent); font-weight: bold; }

/* ============================================================
   RTL OVERRIDES (يتم تطبيقها تلقائياً عند قراءة lang="ar")
============================================================ */
[dir="rtl"] .actions, [dir="rtl"] .meta-row, [dir="rtl"] .tagrow, [dir="rtl"] .topbar { direction: rtl; }
[dir="rtl"] .grid-2, [dir="rtl"] .grid-3, [dir="rtl"] .contact-grid { direction: rtl; }

/* ============================================================
   SCROLL ANIMATIONS (JS Intersection Observer)
============================================================ */
.anim { opacity: 0; transform: translateY(24px); transition: opacity 0.55s ease, transform 0.55s ease; }
.anim.visible { opacity: 1; transform: translateY(0); }
.anim[data-delay="1"] { transition-delay: 0.06s; }
.anim[data-delay="2"] { transition-delay: 0.12s; }
.anim[data-delay="3"] { transition-delay: 0.18s; }

/* ============================================================
   RESPONSIVE DESIGN
============================================================ */
@media (max-width: 980px) {
  .hero, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-main { padding: 26px; }
  .hero-side { padding: 18px; }
  .section { padding: 24px; }
}
@media (max-width: 640px) {
  .wrap { width: min(var(--max), calc(100% - 20px)); }
  .topbar { flex-direction: column; gap: 12px; }
  h1 { line-height: 1.02; }
  .contact-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; justify-content: center; }
}