/* =========================================================
   عبد المجيد — CV
   ========================================================= */

:root {
  --bg: #06080c;
  --bg-2: #0a0e15;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eef5;
  --muted: #8a96a8;
  --dim: #5d6878;
  --accent: #2ee6c5;
  --accent-rgb: 46, 230, 197;
  --accent-2: #7b6dff;
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));

  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --nav-h: 72px;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* خلفية شبكية خفيفة على كامل الصفحة */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(800px 500px at 85% -10%, rgba(var(--accent-rgb), .07), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(123, 109, 255, .07), transparent 60%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 56px 56px;
}

::selection { background: rgba(var(--accent-rgb), .3); color: #fff; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
svg { width: 1em; height: 1em; flex-shrink: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }

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

.container {
  width: min(1160px, 100% - 32px);
  margin-inline: auto;
}

.mono { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--dim); }
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- شريط التقدم ---------- */
.progress {
  position: fixed;
  top: 0;
  inset-inline: 0;
  height: 2px;
  z-index: 60;
  background: var(--grad);
  transform-origin: right;
  transform: scaleX(var(--p, 0));
}

/* ---------- الشريط العلوي ---------- */
.nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 50;
  height: var(--nav-h);
  transition: background .35s var(--ease), border-color .35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(6, 8, 12, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--border);
}
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand__logo {
  width: 38px;
  height: 38px;
  transition: transform .5s var(--ease);
}
.brand:hover .brand__logo { transform: rotate(-8deg) scale(1.06); }
.brand__dot { color: var(--accent); }

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
  position: relative;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .95rem;
  transition: color .25s, background .25s;
}
.nav__links a:hover,
.nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  inset-inline: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}
.nav__links .nav__cta {
  margin-inline-start: 8px;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.nav__links .nav__cta:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), .08); }
.nav__links .nav__cta::after { display: none; }

/* ---------- الأزرار ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 26px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 1rem;
  overflow: hidden;
  isolation: isolate;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s, background .3s;
}
.btn--primary {
  background: var(--grad);
  color: #04110e;
  box-shadow: 0 10px 30px -10px rgba(var(--accent-rgb), .55);
}
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  transform: translateX(120%);
  transition: transform .7s var(--ease);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(var(--accent-rgb), .7); }
.btn--primary:hover::before { transform: translateX(-120%); }
.btn--ghost { border: 1px solid var(--border-strong); background: rgba(255,255,255,.02); }
.btn--link { padding: 0 10px; color: var(--muted); font-weight: 500; }
.btn--link svg { width: 18px; height: 18px; color: var(--accent); }
.btn--link:hover { color: var(--text); }
.btn--ghost:hover { transform: translateY(-2px); border-color: var(--accent); background: rgba(var(--accent-rgb), .06); }

/* ---------- الواجهة الرئيسية ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 40px) 0 90px;
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 40%, transparent 100%);
}
.hero__glow {
  position: absolute;
  width: 640px;
  height: 640px;
  top: 10%;
  inset-inline-start: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .13), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
  animation: float 14s ease-in-out infinite;
}
@keyframes float {
  50% { transform: translate(-40px, 40px) scale(1.08); }
}

.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 56px;
}

.hero__hello {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 500;
  animation: rise .8s var(--ease) both;
}
.hero__hello .line {
  width: 36px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}

.hero__name {
  margin-top: 10px;
  font-size: clamp(3rem, 9vw, 6.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  background: linear-gradient(180deg, #fff 30%, #9aa6b8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: reveal-name 1.2s var(--ease) .15s both;
}
@keyframes reveal-name {
  from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(20px); filter: blur(8px); }
  to   { opacity: 1; clip-path: inset(0 0 -10% 0); transform: none; filter: none; }
}

.hero__role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 14px;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 500;
  color: var(--text);
  animation: rise .9s var(--ease) .35s both;
}
.hero__role i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.hero__rotate {
  margin-top: 22px;
  min-height: 1.6em;
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 600;
  color: var(--text);
  animation: rise .9s var(--ease) .45s both;
}
.rotator {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__rotate .caret { width: 3px; margin-inline-start: 4px; border-radius: 2px; }

.hero__lead {
  max-width: 580px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 1.08rem;
  animation: rise .9s var(--ease) .5s both;
}
.hero__lead strong { color: var(--text); font-weight: 600; }
.hero__lead { line-height: 1.95; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
  animation: rise .9s var(--ease) .65s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* بطاقة الملخص */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
.profile {
  position: relative;
  padding: 30px;
  border: 1px solid transparent;
  border-radius: 24px;
  background:
    linear-gradient(rgba(11, 15, 22, .92), rgba(11, 15, 22, .92)) padding-box,
    conic-gradient(from var(--angle), rgba(255,255,255,.08) 0deg, rgba(255,255,255,.08) 200deg, var(--accent) 260deg, var(--accent-2) 320deg, rgba(255,255,255,.08) 360deg) border-box;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 40px 90px -40px rgba(0,0,0,.9), 0 0 70px -30px rgba(var(--accent-rgb), .3);
  animation: rise 1s var(--ease) .6s both, spin 7s linear infinite;
}
@keyframes spin { to { --angle: 360deg; } }

.profile__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  padding: 3px;
  border-radius: 50%;
  background: var(--grad);
}
.avatar > span,
.avatar > img {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-2);
  object-fit: cover;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}
.avatar::after {
  content: "";
  position: absolute;
  bottom: 3px;
  inset-inline-end: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-2);
}
.profile__name { font-size: 1.3rem; font-weight: 700; }
.profile__title { margin-top: 2px; color: var(--muted); font-size: .9rem; }

.profile__info { display: grid; gap: 4px; padding: 18px 0; }
.profile__info li {
  display: grid;
  grid-template-columns: 20px 64px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .94rem;
  transition: background .25s;
}
.profile__info li:hover { background: var(--surface-2); }
.profile__info svg { width: 18px; height: 18px; color: var(--accent); }
.profile__info span { color: var(--dim); font-size: .86rem; }
.profile__info b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile__info a { color: var(--text); transition: color .2s; }
.profile__info a:hover { color: var(--accent); }

.profile__fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.field {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .85rem;
  font-weight: 500;
  text-align: center;
  transition: transform .3s var(--ease), border-color .3s, background .3s;
}
.field svg { width: 22px; height: 22px; color: var(--accent); }
.field:hover { transform: translateY(-3px); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .06); }

.caret {
  display: inline-block;
  width: .6em;
  height: 1.1em;
  vertical-align: -.2em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
}
.scroll-cue span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 3px;
  height: 8px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--accent);
  animation: wheel 1.8s var(--ease) infinite;
}
@keyframes wheel {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

/* ---------- الأقسام ---------- */
.section { padding: 120px 0; position: relative; }

.section__head { margin-bottom: 56px; max-width: 680px; }
.kicker {
  color: var(--accent);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  direction: ltr;
  display: inline-block;
}
.kicker span { color: var(--dim); }
.section h2 {
  margin-top: 10px;
  font-size: clamp(2rem, 4.5vw, 3rem);
}
.section__sub { margin-top: 14px; color: var(--muted); font-size: 1.05rem; }

/* ---------- البطاقة الأساسية ---------- */
.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  transition: transform .45s var(--ease), border-color .35s, box-shadow .45s var(--ease);
  isolation: isolate;
}
/* إضاءة تتبع مؤشر الفأرة */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--accent-rgb), .09), transparent 45%);
  opacity: 0;
  transition: opacity .4s;
}
.card:hover { border-color: rgba(var(--accent-rgb), .28); }
.card:hover::before { opacity: 1; }

/* ---------- نبذة ---------- */
.about {
  display: grid;
  gap: 48px;
}
.about__text { max-width: 820px; }
.about__text p + p { margin-top: 18px; }
.about__text p { color: var(--muted); }
.about__text .lead { font-size: 1.3rem; line-height: 1.75; color: var(--text); font-weight: 500; }
.about__text strong { color: var(--text); font-weight: 600; }
.about__text em { color: var(--accent); font-style: normal; }

.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pillar { padding: 26px; }
.pillar:hover { transform: translateY(-4px); box-shadow: 0 24px 50px -30px rgba(var(--accent-rgb), .45); }
.pillar h3 { margin-top: 16px; font-size: 1.18rem; }
.pillar p { margin-top: 6px; color: var(--muted); font-size: .97rem; }
.pillar__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), .08);
  border: 1px solid rgba(var(--accent-rgb), .2);
}
.pillar__icon svg { width: 22px; height: 22px; }

/* ---------- الشرائح (Chips) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #cfd7e3;
  font-size: .9rem;
  line-height: 1.6;
  transition: border-color .25s, color .25s, background .25s, transform .25s var(--ease);
}
.chips li:hover {
  border-color: rgba(var(--accent-rgb), .45);
  color: #fff;
  background: rgba(var(--accent-rgb), .07);
  transform: translateY(-2px);
}

/* ---------- المهارات ---------- */
.skills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.skill { padding: 28px; }
.skill:hover { transform: translateY(-4px); }
.skill__head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.skill__head h3 { font-size: 1.2rem; }

/* ---------- التذييل ---------- */
.footer { padding: 36px 0 44px; border-top: 1px solid var(--border); }
.footer__mail { color: var(--accent); direction: ltr; }
.footer__mail:hover { text-decoration: underline; }
.footer__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  color: var(--muted);
  font-size: .9rem;
}

/* ---------- ظهور العناصر مع التمرير ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity .8s var(--ease) calc(var(--d, 0) * 90ms),
    transform .8s var(--ease) calc(var(--d, 0) * 90ms),
    border-color .35s, box-shadow .45s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }
/* بعد الظهور ترجع حركة البطاقة عند المرور لسرعتها الطبيعية */
.reveal.is-done { transition: transform .45s var(--ease), border-color .35s, box-shadow .45s var(--ease); }

/* =========================================================
   التجاوب مع كل المقاسات
   ========================================================= */

/* شاشات كبيرة جداً */
@media (min-width: 1600px) {
  .container { width: min(1280px, 100% - 64px); }
  body { font-size: 18px; }
}

/* لابتوب صغير وتابلت أفقي */
@media (max-width: 1100px) {
  .hero__inner { gap: 40px; grid-template-columns: 1fr 1fr; }
}

/* تابلت عمودي */
@media (max-width: 900px) {
  .hero { min-height: auto; padding-bottom: 110px; }
  .hero__inner { grid-template-columns: 1fr; gap: 48px; }
  .hero__text { text-align: center; }
  .hero__hello, .hero__role, .hero__actions { justify-content: center; }
  .hero__lead { margin-inline: auto; }
  .profile { width: 100%; max-width: 560px; margin-inline: auto; }

  .about__text { margin-inline: auto; }
  .pillar { padding: 22px; }

  .section { padding: 96px 0; }
  .section__head { margin-inline: auto; text-align: center; }
}

/* جوال */
@media (max-width: 640px) {
  :root { --nav-h: 62px; }
  body { font-size: 16px; }
  .container { width: calc(100% - 32px); }

  .nav__links a { padding: 8px 10px; font-size: .92rem; }
  .nav__links .nav__cta { margin-inline-start: 4px; padding: 7px 14px; }
  .nav__links a.is-active::after { inset-inline: 10px; }

  .hero { padding: calc(var(--nav-h) + 36px) 0 96px; }
  .hero__lead { font-size: 1rem; }
  .hero__actions { gap: 10px; }
  .hero__actions .btn { flex: 1 1 0; padding: 0 16px; }
  .profile { padding: 22px 18px; border-radius: 20px; }
  .avatar { width: 62px; height: 62px; }
  .profile__name { font-size: 1.15rem; }
  .profile__info li { grid-template-columns: 20px 56px 1fr; padding: 8px 6px; }
  .field { padding: 12px 4px; font-size: .8rem; }

  .section { padding: 72px 0; }
  .section__head { margin-bottom: 36px; }
  .about__text { text-align: start; }
  .about__text .lead { font-size: 1.12rem; }
  .pillars, .skills { grid-template-columns: 1fr; }
  .pillar { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: center; }
  .pillar h3 { margin-top: 0; }
  .pillar p { grid-column: 2; }
  .pillar__icon { grid-row: span 2; }
  .skill { padding: 22px 18px; }
  .chips li { font-size: .86rem; padding: 5px 12px; }

  .footer__inner { flex-direction: column; align-items: center; text-align: center; }
}

/* جوالات صغيرة جداً */
@media (max-width: 345px) {
  .brand__text { display: none; }
  .hero__actions .btn { flex-basis: 100%; }
  .profile__info li { grid-template-columns: 18px 1fr; }
  .profile__info span { display: none; }
}

/* جوال بالعرض (ارتفاع قصير) */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: auto; }
  .scroll-cue { display: none; }
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .reveal { opacity: 1; transform: none; }
}
