:root {
  --bg: #08080f;
  --violet: #7c5cff;
  --violet-hover: #927aff;
  --mint: #4fd1c5;
  --text: #ededf2;
  --text-muted: rgba(237, 237, 242, 0.62);
  --glass-fill: rgba(255, 255, 255, 0.045);
  --glass-border: rgba(255, 255, 255, 0.08);
  --gutter: clamp(20px, 5vw, 48px);
  --topbar-height: 64px;
}

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

html {
  background: var(--bg);
  scroll-padding-top: calc(var(--topbar-height) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
}

/* Fixed layers: they stay put without background-attachment, which janks on mobile. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(70% 60% at 100% 0%, #1a1230 0%, transparent 100%),
    radial-gradient(70% 60% at 0% 100%, #0d1424 0%, transparent 100%);
}

body::after {
  background-image: radial-gradient(#fff 1px, transparent 1.5px);
  background-size: 24px 24px;
  opacity: 0.03;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.skip-link {
  position: absolute;
  top: 8px;
  right: var(--gutter);
  z-index: 20;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.container {
  width: 100%;
  max-width: calc(1100px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Glass */
.glass {
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass-fill);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(8, 8, 15, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

/* The page's signature light line */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--violet) 50%, transparent);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
  max-width: calc(1100px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--violet);
}

.topnav ul {
  display: flex;
  gap: 4px;
}

.topnav a {
  display: block;
  padding: 6px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.2s ease;
}

.topnav a:hover {
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding-inline: 26px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn:focus-visible {
  border-radius: 14px;
}

/* Dark label: white on #7C5CFF is only 4.35:1, below AA. */
.btn-primary {
  background: var(--violet);
  color: var(--bg);
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--violet-hover);
}

.btn-glass {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.btn-glass:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

/* After .btn so it wins: this button only shows on mobile, where the nav is hidden. */
.topbar-cta {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Hero */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--topbar-height));
  min-height: calc(100svh - var(--topbar-height));
  padding-block: 64px;
  text-align: center;
}

.eyebrow {
  color: var(--mint);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
}

.hero-title {
  margin-top: 8px;
  font-size: clamp(40px, 9vw, 88px);
  font-weight: 700;
  line-height: 1.25;
}

.hero-lines {
  margin-top: 20px;
  color: var(--text-muted);
  font-size: clamp(17px, 2.2vw, 20px);
  font-weight: 300;
  text-wrap: balance;
}

.hero .actions {
  margin-top: 36px;
}

.scroll-cue {
  position: absolute;
  right: var(--gutter);
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 300;
  transition: color 0.2s ease;
}

.scroll-cue:hover {
  color: var(--text);
}

.scroll-cue-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, transparent, var(--text-muted));
}

/* Sections */
.section {
  padding-block: clamp(64px, 7vw, 104px);
}

.section + .section {
  padding-top: 0;
}

.section-title {
  margin-bottom: 32px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.3;
}

.lead {
  max-width: 760px;
  margin-bottom: 40px;
  color: var(--text-muted);
  font-size: clamp(17px, 2vw, 19px);
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  padding: clamp(24px, 3vw, 32px);
}

.card h3 {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.5;
}

.card-small p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 15px;
}

.meta {
  color: var(--text-muted);
  font-size: 13px;
}

/* Education */
.education {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 28px;
}

.education-degree {
  margin-top: 2px;
}

.education .pills {
  margin-top: 10px;
}

/* Pills */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  padding: 6px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-fill);
  font-size: 14px;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

/* Skills */
.skills {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.skills li {
  font-size: 15px;
}

.bar {
  position: relative;
  display: block;
  height: 2px;
  margin-top: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}

.bar::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--level);
  border-radius: inherit;
  background: rgba(124, 92, 255, 0.75);
}

/* Projects */
.project {
  display: flex;
  flex-direction: column;
}

.project h3 {
  margin-top: 4px;
}

.project-desc {
  margin-top: 8px;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 16px;
}

/* Pushes the stack line down so it aligns across a row of uneven cards. */
.tech {
  margin-top: auto;
  color: var(--mint);
  font-size: 13px;
}

/* Contact */
.contact {
  max-width: 720px;
  margin-inline: auto;
  padding-block: clamp(40px, 6vw, 64px);
  text-align: center;
}

.contact-title {
  margin-bottom: 12px;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.3;
}

.contact p {
  color: var(--text-muted);
  text-wrap: balance;
}

.contact .actions {
  margin-top: 28px;
}

.footer {
  padding: 0 var(--gutter) 32px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* Reveal on scroll. The .js class comes from main.js, so content stays visible without JS. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn,
  .topnav a,
  .scroll-cue {
    transition: none;
  }
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .education {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .topnav,
  .scroll-cue {
    display: none;
  }

  .topbar-cta {
    display: inline-flex;
    padding-inline: 20px;
    font-size: 15px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .card h3 {
    font-size: 19px;
  }

  .section-title {
    margin-bottom: 24px;
  }
}

/* ===== شريط تمرير مخصص (بدل شريط المتصفح) ===== */
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sb-rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 9px;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.sb-rail.is-visible { opacity: 1; }

.sb-thumb {
  position: absolute;
  inset-inline-start: 0;
  width: 5px;
  min-height: 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7c5cff 0%, #8b7bff 45%, #4fd1c5 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 14px rgba(124, 92, 255, 0.45);
  pointer-events: auto;
  cursor: grab;
  transition: width 0.18s ease, box-shadow 0.18s ease;
}
.sb-rail:hover .sb-thumb,
.sb-thumb.is-dragging {
  width: 7px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 20px rgba(124, 92, 255, 0.65);
}
.sb-thumb.is-dragging { cursor: grabbing; }

@media (max-width: 720px), (pointer: coarse) {
  .sb-rail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-rail, .sb-thumb { transition: none; }
}

/* ===== أزرار إضافية + بطاقات المستودعات ===== */
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(237, 237, 242, 0.82);
}
.btn-ghost:hover {
  border-color: rgba(124, 92, 255, 0.55);
  color: #ededf2;
}

.repo {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.repo:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 255, 0.42);
  background: rgba(255, 255, 255, 0.06);
}
.repo h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  direction: ltr;
  text-align: right;
}
.repo .meta {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.repo-go {
  position: absolute;
  inset-block-start: 18px;
  inset-inline-start: 20px;
  color: rgba(124, 92, 255, 0.9);
  font-size: 0.9rem;
  opacity: 0.55;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.repo:hover .repo-go {
  opacity: 1;
  transform: translate(1px, -1px);
}
#repos .actions {
  margin-top: clamp(28px, 4vw, 44px);
  justify-content: center;
}

/* بطاقات المستودعات أكثر إحكامًا */
.repo {
  padding: 18px 22px;
  gap: 6px;
  justify-content: flex-start;
  min-height: 0;
}
.repo-go { inset-block-start: 20px; inset-inline-end: 22px; }

/* سهم الرابط: على يسار البطاقة (نهاية السطر في RTL) */
.repo .repo-go {
  inset-inline-start: auto;
  inset-inline-end: 22px;
  inset-block-start: 20px;
  width: auto;
  line-height: 1;
}

.education-level {
  margin-bottom: 2px;
}

/* ===== إضافات المحتوى الجديد ===== */
.card .pills {
  margin-top: 14px;
  gap: 8px;
}
.card .pill {
  font-size: 13px;
  padding: 5px 13px;
}
.project-go {
  align-self: flex-start;
  margin-top: 10px;
  color: rgba(124, 92, 255, 0.95);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid rgba(124, 92, 255, 0.28);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.project-go:hover,
.project-go:focus-visible {
  color: #b7a6ff;
  border-color: rgba(183, 166, 255, 0.6);
}
.contact-handles {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(237, 237, 242, 0.55);
}
.contact-handles span {
  color: rgba(237, 237, 242, 0.85);
  direction: ltr;
  display: inline-block;
}

/* Shared multi-page components; retain the original palette and glass identity. */
body{font-size:17px}button,input{font:inherit}button{color:inherit;cursor:pointer}[hidden]{display:none!important}
h1,.hero-title{font-size:40px;line-height:1.3}h2,.section-title,.contact-title{font-size:28px}h3,.card h3{font-size:20px}.lead,.hero-lines{font-size:20px}
.brand,.btn,.eyebrow,.card-small p,.skills li,.project-desc{font-size:17px}
.meta,.tech,.scroll-cue,.footer,.repo .meta,.card .pill,.project-go,.contact-handles,.badge,.breadcrumb,.stats-note{font-size:14px}
.meta,.tech,.project-go,.contact-handles,.hero-lines,.lead,.topnav a,.footer{color:#bcb9cd}
.project-go{color:#c4b5ff}.contact-handles span{color:var(--text)}
.hero{min-height:520px;padding-block:80px}.status{display:inline-flex;margin-top:24px;color:var(--mint)}
.badge{border:1px solid var(--glass-border);border-radius:999px;padding:4px 12px;background:var(--glass-fill)}
.card{min-width:0;overflow-wrap:anywhere}.card-meta{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:16px}.private{color:var(--mint)}
.project .btn{margin-top:auto;align-self:flex-start}.win{color:var(--mint);font-size:14px;margin-bottom:20px}.project-desc{font-size:17px}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:24px}.stats-section{padding-top:0}.stat{display:flex;flex-direction:column;align-items:center;text-align:center}.stat strong{font-size:40px;color:var(--mint);line-height:1.3}.stat span{font-size:14px}.stats-note{margin-top:16px;text-align:center}
.section-heading{display:flex;gap:20px;align-items:center;justify-content:space-between;margin-bottom:28px;flex-wrap:wrap}.section-heading .section-title{margin:0}.text-link{color:var(--mint)}
.page-intro{padding-bottom:40px}.page-intro h1{margin:16px 0}.page-intro .lead{margin-bottom:0}.breadcrumb a{text-decoration:underline;text-underline-offset:5px}
.catalog-controls label{display:block;margin-bottom:12px}.search{display:flex;gap:12px}.search input{min-width:0;width:100%;border:1px solid #77718c;border-radius:14px;background:var(--bg);color:var(--text);padding:12px 16px}.search input::placeholder{color:#bcb9cd}.filters{display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.chip{font-size:17px;padding:8px 20px;border-radius:999px;border:1px solid #77718c;background:transparent;min-height:44px}.chip[aria-pressed=true]{background:var(--violet);color:var(--bg);border-color:var(--violet);font-weight:700}.result-count{margin:24px 0}.empty-state{text-align:center}.empty-state p{margin:12px 0 24px}
.footer{padding:32px 0;border-top:1px solid var(--glass-border)}.footer .container{display:flex;gap:24px;align-items:center;justify-content:space-between;flex-wrap:wrap}.footer nav{display:flex;flex-wrap:wrap;gap:20px}.footer p{font-size:14px}.topnav a[aria-current=page]{color:var(--mint);background:var(--glass-fill)}
.menu-toggle{display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.error-page{display:flex;gap:16px;flex-wrap:wrap;padding-bottom:64px}
html{scrollbar-width:auto}html::-webkit-scrollbar,body::-webkit-scrollbar{width:auto;height:auto}.js [data-reveal]{opacity:1;transform:none;transition:none}.entered{animation:enter 180ms ease-out}@keyframes enter{from{opacity:.5;transform:translateY(8px)}to{opacity:1;transform:none}}
.repo,.repo-go,.repo:hover .repo-go{transition-duration:180ms}.repo-go{color:#c4b5ff;opacity:1}.repo h3{font-size:20px}
@media(max-width:900px){.grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.grid-3,.grid-2{grid-template-columns:minmax(0,1fr)}.stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}.menu-toggle:not([hidden]){display:inline-flex;padding-inline:16px}.topbar-inner{gap:12px}.topnav{display:block;position:absolute;top:calc(100% + 8px);inset-inline:20px;border:1px solid var(--glass-border);border-radius:20px;padding:12px;background:#151320;box-shadow:0 8px 32px #0004;backdrop-filter:blur(18px)}.topnav ul{flex-direction:column}.topnav a{padding:12px;font-size:17px}.topbar:has(.menu-toggle:not([hidden])) .topnav:not(.is-open){display:none}.topnav.is-open{animation:enter 180ms ease-out}.topbar:has(.menu-toggle[hidden]){height:auto;min-height:64px}.topbar:has(.menu-toggle[hidden]) .topbar-inner{flex-wrap:wrap;padding-block:12px}.topbar:has(.menu-toggle[hidden]) .topnav{position:static;width:100%}.search{flex-direction:column}.hero{min-height:500px}.hero-lines,.lead{font-size:17px}.section{padding-block:56px}.section+.section{padding-top:0}.hero-title{font-size:40px}.footer .container{flex-direction:column;align-items:flex-start}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
