:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --line: rgba(0, 0, 0, .06);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius: 1rem;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, .1);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.5);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
  /* ثبّت السكرول على html */
  scrollbar-gutter: stable both-edges;
  /* مهم جدًا مع RTL عشان يمنع الإزاحة يمين/شمال */
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Cairo", system-ui, -apple-system, Segoe UI, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.footer {
  text-align: center;
  padding: 24px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  border-top: 1px solid var(--line);
  letter-spacing: .5px;
}


a {
  color: inherit;
}

.container {
  width: min(1100px, 92%);
  margin: auto;
}

a,
p,
h1,
h2,
h3 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* HERO */
.hero {
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  padding: 44px 0 0px;
  border-bottom: 1px solid var(--line);
}

/* ✅ FIX الحقيقي هنا */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 22px;
  align-items: flex-start;
}

.hero-text,
.hero-card {
  min-width: 0;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .6);
  font-size: 16px;
}

h1 {
  margin: 14px 0 10px;
  font-size: 44px;
  line-height: 1.15;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.9;
}

.cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border: none;
}

.btn.ghost {
  background: rgba(255, 255, 255, .7);
}

.w100 {
  width: 100%;
}

.social {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}

.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  top: -20px;
}

.avatar {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
}

.quick {
  display: grid;
  gap: 10px;
}

.q {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(37, 99, 235, .05);
}

/* NAV */
.nav {
  margin-top: 0px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

/* SECTIONS */
.section {
  padding: 5px 0;
}

.section.alt {
  background: rgba(255, 255, 255, .7);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0 0 16px;
  font-size: 30px;
}

.muted {
  color: var(--muted);
  line-height: 1.9;
}

/* ✅ FIX الحقيقي هنا كمان */
.grid3 {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.grid2 {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(37, 99, 235, .06);
  font-size: 16px;
}

/* CONTACT */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.contact-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, .12);
  flex-wrap: wrap;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .hero-card {
    top: 0;
    order: -1;
  }

  h1 {
    font-size: 30px;
  }
}

.hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ===================================================================== */
/* =======================
   Buttons & Links Interaction
   ======================= */

/* حركة ناعمة لكل الأزرار واللينكات اللي شكلها زر */
.btn,
.chip,
.nav a,
.link {
  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease,
    color .18s ease,
    border-color .18s ease;
  position: relative;
}

/* Hover */
.btn:hover,
.chip:hover,
.nav a:hover,
.link:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, .12);
}

/* Click إحساس الضغط */
.btn:active,
.chip:active,
.nav a:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, .12);
}

/* Focus مهم للموبايل والكيبورد */
.btn:focus-visible,
.chip:focus-visible,
.nav a:focus-visible,
.link:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, .35),
    0 12px 22px rgba(0, 0, 0, .12);
  transform: translateY(-3px);
}

/* تأثير إضاءة خفيف كأن فيه لمعة */
.btn::after,
.chip::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg,
      rgba(255, 255, 255, 0) 30%,
      rgba(255, 255, 255, .35) 50%,
      rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  transition: opacity .25s ease, transform .4s ease;
  transform: translateX(-60%);
}

.btn:hover::after,
.chip:hover::after {
  opacity: 1;
  transform: translateX(60%);
}

/* =======================
   EDU BOX (Education Items)
   ======================= */
.edu-box {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.edu-box h3 {
  margin: 0 0 14px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, .08);

  flex-wrap: wrap;
  /* ✅ يسمح للكلمات الطويلة تنزل سطر جديد */
  gap: 6px 10px;
  /* مسافة بين العناصر */
}

.edu-item:last-child {
  border-bottom: none;
}

.edu-item .label {
  color: var(--muted);
  font-size: 16px;
  white-space: nowrap;
  /* يمنع الاسم يصغر ويتقسم */
  flex-shrink: 0;
  /* يمنع الـ label من الانكماش */
}

.edu-item .value {
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
  /* يكسر النصوص الطويلة بدل ما تعمل overflow */
  word-break: break-word;
  text-align: right;
  /* يظبط المحاذاة للـ RTL */
  flex: 1;
  /* ياخد باقي المساحة */
}

* {
  max-width: 100%;
}

/* Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Dark Mode Toggle */
.theme-toggle {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0.75rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 1.5rem;
  transition: all 0.3s ease;
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99;
  background: var(--accent);
  color: white;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: all;
}

.back-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-3px);
}