/* ============================================
   الموقع — تصميم تحريري بسيط (أبيض وأسود)
   ============================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f3;
  --surface: #ffffff;
  --ink: #111111;
  --ink-soft: #3d3d3d;
  --muted: #767676;
  --line: #e7e7e5;
  --accent: #111111;
  --accent-ink: #ffffff;
  --good: #1f7a55;
  --c1: #e8553e; --c2: #1f7a55; --c3: #2e4fd6; --c4: #d9a21b; --c5: #7a3fd1; --c6: #222222;
  --max: 1200px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f; --bg-soft: #1a1a1a; --surface: #141414; --ink: #f2f2f0; --ink-soft: #cfcfcc;
    --muted: #8c8c88; --line: #2a2a28; --accent: #f2f2f0; --accent-ink: #0f0f0f; --good: #4cc793;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f0f; --bg-soft: #1a1a1a; --surface: #141414; --ink: #f2f2f0; --ink-soft: #cfcfcc;
  --muted: #8c8c88; --line: #2a2a28; --accent: #f2f2f0; --accent-ink: #0f0f0f; --good: #4cc793;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.85; font-size: 17px;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input { font: inherit; color: inherit; }
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 700px) { .container { padding-inline: 32px; } }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }

.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 16px; top: 16px; background: var(--ink); color: var(--bg); padding: 8px 14px; z-index: 100; }

/* ---------- Header ---------- */
#header { position: sticky; top: 0; z-index: 50; }
.site-header { position: relative; background: var(--bg); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 28px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: .9rem; }
.logo > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.logo small { font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { font-weight: 500; color: var(--muted); transition: color .2s; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a.active { border-color: var(--ink); }
.nav-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); transition: .2s; }
.icon-btn:hover { border-color: var(--ink); }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .nav-links { position: absolute; top: 72px; inset-inline: 0; flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; display: none; }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-links a.active { border-color: var(--line); }
  .nav-links.open { display: flex; }
}

/* ---------- Buttons & labels ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 999px; font-weight: 600; transition: .2s; white-space: nowrap; border: 1px solid var(--ink); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: .85; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.chip { font-size: .85rem; font-weight: 600; color: var(--muted); }
.chip.sky { font-size: .78rem; border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 48px; border-bottom: 1px solid var(--line); }
.hero-title { font-size: clamp(2.4rem, 7vw, 5.2rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; max-width: 14ch; }
.hero-sub { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-top: 28px; }
.hero-sub p { font-size: 1.2rem; color: var(--ink-soft); max-width: 560px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section { padding: 64px 0; }
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.sec-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.sec-head p { color: var(--muted); }
.eyebrow { color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.soft { background: var(--bg-soft); }



/* أغلفة ملونة */
.bg-orange { background: var(--c1); } .bg-mint { background: var(--c2); } .bg-sky { background: var(--c3); }
.bg-sun { background: var(--c4); } .bg-lilac { background: var(--c5); } .bg-rose { background: var(--c6); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 32px; margin-top: 32px; color: var(--ink-soft); }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; }
.foot-grid h5 { font-size: .9rem; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.foot-grid ul { list-style: none; display: grid; gap: 8px; }
.foot-grid a:hover { color: var(--ink); text-decoration: underline; }
.copy { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr; } }


/* ============================================
   الصفحة التعريفية
   ============================================ */
.pf-hero { padding: 80px 0 56px; }
.pf-role { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 600; color: var(--muted); margin-top: 8px; }
.facts { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .95rem; }
.avail { display: inline-flex; align-items: center; gap: 8px; }
.avail i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: ring 2s infinite; }
@keyframes ring { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.split { display: grid; grid-template-columns: 1fr 2fr; gap: 48px; }
.split-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; gap: 20px; } }
.pf-about p { font-size: 1.2rem; color: var(--ink-soft); margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 32px; border-top: 1px solid var(--line); }
.stats div { padding: 20px 0; }
.stats b { display: block; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.2; }
.stats span { color: var(--muted); font-size: .9rem; }

.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
@media (max-width: 860px) { .skills { grid-template-columns: 1fr; gap: 8px; } }
.skill-group { padding-top: 8px; }
.skill-group .num { color: var(--muted); font-size: .85rem; font-weight: 600; }
.skill-group h3 { font-size: 1.3rem; margin: 4px 0 12px; }
.skill-group ul { list-style: none; }
.skill-group li { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }

.name-en { letter-spacing: .02em; }
.intro-en { font-size: 1rem !important; color: var(--muted) !important; margin-top: 6px; text-align: right; }

/* المشاريع: صف لكل مشروع، والأول أكبر */
.projects { display: grid; gap: 64px; }
.project { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.project:nth-child(even) .project-cover { order: 2; }
.project-cover { aspect-ratio: 16/11; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; color: #fff; overflow: hidden; }
.project-cover .cover-ar { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 700; line-height: 1.1; transition: transform .6s cubic-bezier(.2,.7,.2,1); text-align: center; padding: 0 16px; }
.project-cover .cover-en { font-size: 1rem; letter-spacing: .08em; opacity: .75; }
.project:hover .cover-ar { transform: scale(1.05); }
.project.lead { grid-template-columns: 1fr; gap: 28px; }
.project.lead .project-cover { aspect-ratio: 21/9; }
.project.lead .cover-ar { font-size: clamp(3.4rem, 11vw, 8rem); }
.project.lead .project-body { display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; }
.project.lead .project-body > .chip, .project.lead h3 { grid-column: 1; }
.project.lead .project-body > p { grid-column: 1; }
.project.lead .points, .project.lead .tags, .project.lead .btn { grid-column: 2; }
.project.lead .points { grid-row: 1 / span 3; align-self: start; }
.project-body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.project-body h3 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.project-body h3 small { display: block; font-size: .5em; color: var(--muted); font-weight: 500; letter-spacing: .02em; margin-top: 2px; }
.project-body p { color: var(--ink-soft); font-size: 1.08rem; }
.points { list-style: none; display: flex; flex-wrap: wrap; gap: 0 18px; width: 100%; }
.points li { padding: 8px 0; border-bottom: 1px solid var(--line); flex: 1 1 40%; color: var(--ink-soft); }
.points li::before { content: "—"; color: var(--muted); margin-inline-end: 8px; }
.project .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
@media (max-width: 800px) {
  .project, .project.lead .project-body { grid-template-columns: 1fr; gap: 18px; }
  .project:nth-child(even) .project-cover { order: 0; }
  .project.lead .project-body > * { grid-column: 1 !important; grid-row: auto !important; }
  .project.lead .project-cover { aspect-ratio: 16/10; }
}

.stats span { display: block; line-height: 1.5; }
.timeline ul { list-style: none; margin-top: 8px; }
.timeline ul li { color: var(--ink-soft); padding: 3px 0; }
.timeline ul li::before { content: "—"; color: var(--muted); margin-inline-end: 8px; }

.extras { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.extras h3 { font-size: 1.2rem; margin-bottom: 12px; }
.langs { list-style: none; }
.langs li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.langs span { color: var(--muted); font-size: .92rem; text-align: end; }
.interests { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
@media (max-width: 800px) { .extras { grid-template-columns: 1fr; } }

.timeline { list-style: none; border-top: 1px solid var(--line); }
.timeline > li { display: grid; grid-template-columns: 180px 1fr; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.timeline .period { color: var(--muted); font-size: .95rem; padding-top: 3px; }
.timeline h3 { font-size: 1.2rem; }
.timeline h3 small { font-weight: 500; color: var(--muted); font-size: 1rem; }
.timeline p { color: var(--ink-soft); margin-top: 4px; }
@media (max-width: 560px) { .timeline > li { grid-template-columns: 1fr; gap: 4px; } }

.contact { text-align: start; padding-block: 24px 16px; }
.contact h2 { font-size: clamp(2.2rem, 6vw, 4.2rem); line-height: 1.2; letter-spacing: -0.03em; margin: 8px 0 28px; }
.contact-email { display: inline-block; font-size: clamp(1.3rem, 3.5vw, 2rem); font-weight: 600; border-bottom: 2px solid var(--ink); padding-bottom: 2px; direction: ltr; unicode-bidi: isolate; transition: opacity .2s; word-break: break-all; }
.contact-email:hover { opacity: .6; }
.contact-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 32px; }



/* ============================================
   الأنيميشن
   ============================================ */
:root { --ease: cubic-bezier(.2, .7, .2, 1); }

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

/* دخول الهيرو */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .08em; }
.w > span { display: inline-block; transform: translateY(110%); }
.loaded .w > span { transform: none; transition: transform 1.1s var(--ease) calc(var(--d) * 120ms); }
.intro-anim { opacity: 0; transform: translateY(40px); }
.loaded .intro-anim { opacity: 1; transform: none; transition: opacity 1s ease calc(var(--d) * 110ms), transform 1.1s var(--ease) calc(var(--d) * 110ms); }
.facts { position: relative; border-top-color: transparent; }
.facts::before { content: ""; position: absolute; top: -1px; inset-inline: 0; height: 1px; background: var(--line); transform: scaleX(0); transform-origin: right; }
.loaded .facts::before { transform: none; transition: transform 1.4s var(--ease) .9s; }

/* شريط الكلمات المتحرك */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: 18px 0; }
.marquee-track { display: flex; gap: 48px; width: max-content; animation: marquee 45s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { font-size: clamp(1.1rem, 2.4vw, 1.6rem); font-weight: 600; white-space: nowrap; color: var(--ink); }
.marquee-track span::after { content: "✦"; margin-inline-start: 48px; font-size: .7em; color: var(--muted); vertical-align: middle; }
@keyframes marquee { to { transform: translateX(50%); } }

/* الأقسام */
.reveal .sec-head, .reveal .split-head, .reveal .pf-about, .reveal .contact > * { opacity: 0; transform: translateY(50px); transition: opacity .9s ease, transform .9s var(--ease); }
.reveal.in .sec-head, .reveal.in .split-head, .reveal.in .pf-about, .reveal.in .contact > * { opacity: 1; transform: none; }
.reveal.in .pf-about { transition-delay: .15s; }
.reveal.in .contact > :nth-child(2) { transition-delay: .1s; }
.reveal.in .contact > :nth-child(3) { transition-delay: .2s; }
.sec-head { border-bottom: 0; position: relative; }
.sec-head::after { content: ""; position: absolute; bottom: 0; inset-inline: 0; height: 2px; background: var(--ink); transform: scaleX(0); transform-origin: right; transition: transform 1.2s var(--ease) .2s; }
.reveal.in .sec-head::after { transform: none; }

/* عناصر تظهر بالتتابع */
.st { opacity: 0; transform: translateY(36px); transition: opacity .8s ease, transform .9s var(--ease); transition-delay: calc(var(--i) * 90ms + .15s); }
.in .st, .in.st { opacity: 1; transform: none; }

/* المشاريع: الغلاف ينفتح من الأسفل والاسم يستقر */
.project.st { opacity: 1; transform: none; }
.project-cover { clip-path: inset(100% 0 0 0); transition: clip-path 1.2s var(--ease); }
.project.in .project-cover { clip-path: inset(0 0 0 0); }
.project-cover .cover-ar, .project-cover .cover-en { transform: scale(1.4) translateY(20px); opacity: 0; transition: transform 1.4s var(--ease) .25s, opacity 1s ease .25s; }
.project.in .cover-ar, .project.in .cover-en { transform: none; opacity: 1; }
.project.in:hover .cover-ar { transform: scale(1.05); transition-delay: 0s; }
.project-body > * { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s var(--ease); }
.project.in .project-body > * { opacity: 1; transform: none; }
.project.in .project-body > :nth-child(2) { transition-delay: .35s; }
.project.in .project-body > :nth-child(3) { transition-delay: .45s; }
.project.in .project-body > :nth-child(n+4) { transition-delay: .55s; }
.project.in .project-body > :first-child { transition-delay: .25s; }

/* تفاعلات صغيرة */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn-ghost:hover { background: transparent; color: var(--bg); }
.btn-ghost::before { content: ""; position: absolute; inset: 0; background: var(--ink); transform: translateY(101%); transition: transform .45s var(--ease); z-index: -1; }
.btn-ghost:hover::before { transform: none; }
.pill { transition: background .3s, color .3s, border-color .3s, transform .3s var(--ease); }
.pill:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: translateY(-2px); }
.skill-group li { transition: padding .3s var(--ease), color .3s; }
.skill-group li:hover { padding-inline-start: 10px; color: var(--ink); }
.contact-email { background: linear-gradient(var(--ink), var(--ink)) no-repeat right bottom / 0 2px; border-bottom-color: var(--line); transition: background-size .5s var(--ease); }
.contact-email:hover { background-size: 100% 2px; opacity: 1; }

/* تقليل الحركة: تلاشي ناعم فقط بدون تحريك أو انزلاق */
@media (prefers-reduced-motion: reduce) {
  .w > span, .intro-anim, .st, .project-body > *, .project-cover .cover-ar, .project-cover .cover-en,
  .reveal .sec-head, .reveal .split-head, .reveal .pf-about, .reveal .contact > * { transform: none !important; }
  .w > span { opacity: 0; transition: opacity 1s ease !important; }
  .loaded .w > span { opacity: 1; }
  .project-cover { clip-path: none !important; opacity: 0; transition: opacity 1s ease; }
  .project.in .project-cover { opacity: 1; }
  .sec-head::after, .facts::before { transform: none !important; }
  .marquee-track { animation-duration: 120s; }
  .intro { display: none; }
}


/* الشاشة الافتتاحية */
.intro { position: fixed; inset: 0; z-index: 100; background: var(--ink); color: var(--bg); display: grid; place-content: center; justify-items: center; gap: 18px; transition: transform 1s cubic-bezier(.7, 0, .2, 1); }
.intro.lift { transform: translateY(-100%); }
.intro-name { font-size: clamp(2.4rem, 8vw, 5rem); font-weight: 700; letter-spacing: -0.02em; }
.intro .w > span { transform: translateY(110%); }
.intro.play .w > span { transform: none; transition: transform .9s var(--ease); }
.intro.play .w:nth-child(2) > span { transition-delay: .12s; }
.intro-line { width: 160px; height: 2px; background: color-mix(in srgb, var(--bg) 25%, transparent); position: relative; overflow: hidden; }
.intro-line::after { content: ""; position: absolute; inset: 0; background: var(--bg); transform: scaleX(0); transform-origin: right; }
.intro.play .intro-line::after { transform: none; transition: transform 1.1s var(--ease) .3s; }
