:root {
  --bg: #ffffff;
  --bg-soft: #f5f8fd;
  --ink: #0b2a5b;
  --text: #34425a;
  --muted: #6d7b92;
  --rule: #e2e8f2;
  --blue: #1c4fd8;
  --blue-soft: #eaf0fd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 42, 91, .04), 0 8px 24px -14px rgba(11, 42, 91, .18);
  --font-ar: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-lat: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1120px;
  --ease: cubic-bezier(.22, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
html:not([lang="ar"]) body { font-family: var(--font-lat); line-height: 1.7; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand { font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand::before { content: ""; width: 9px; height: 26px; border-radius: 2px; background: var(--blue); }
.nav { display: flex; gap: 22px; font-size: .9rem; margin-inline-start: auto; }
.nav a { text-decoration: none; color: var(--muted); white-space: nowrap; transition: color .2s; }
.nav a:hover { color: var(--blue); }
.langs { display: flex; background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 8px; padding: 3px; }
.langs button {
  font: 600 .8rem/1 var(--font-lat); color: var(--muted); background: none; border: 0; border-radius: 6px;
  padding: 7px 11px; cursor: pointer; transition: background .2s, color .2s;
}
.langs button[data-lang="ar"] { font-family: var(--font-ar); font-size: .9rem; padding: 5px 12px; }
.langs button[aria-pressed="true"] { background: var(--blue); color: #fff; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 64px; }
.hero .wrap { display: grid; grid-template-columns: 1.25fr .75fr; gap: 56px; align-items: center; }
.kicker { margin: 0 0 12px; color: var(--blue); font-weight: 600; font-size: .85rem; }
html:not([lang="ar"]) .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.22; font-weight: 700; margin-bottom: 20px; }
.titles { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.titles li { font-size: .9rem; font-weight: 500; color: var(--ink); background: var(--blue-soft); border-radius: 6px; padding: 4px 12px; }
.titles li:first-child { background: var(--ink); color: #fff; }
.intro { margin: 0 0 30px; max-width: 620px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { text-decoration: none; font-weight: 500; font-size: .95rem; padding: 12px 26px; border-radius: 8px; transition: background .2s, color .2s, border-color .2s; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--ink); }
.btn-line { border: 1px solid var(--rule); color: var(--ink); }
.btn-line:hover { border-color: var(--blue); color: var(--blue); }

.portrait { position: relative; margin: 0; justify-self: center; width: min(100%, 340px); }
.portrait img {
  position: relative; width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}

/* ---------- Figures ---------- */
.figures { padding: 0 0 72px; }
.figures .wrap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.fig { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 24px 22px; }
.fig b { display: block; font: 600 2.1rem/1.15 var(--font-lat); direction: ltr; text-align: start; }
html[dir="rtl"] .fig b { text-align: right; }
.fig span { font-size: .88rem; color: #bccbe8; line-height: 1.6; display: block; margin-top: 6px; }

/* ---------- Sections ---------- */
.block { padding: 84px 0; }
.block.soft { background: var(--bg-soft); }
.sec-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 36px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.sec-head .no { font: 600 .85rem/1 var(--font-lat); color: var(--blue); }
.sec-head h2 { font-size: clamp(1.5rem, 2.8vw, 2rem); font-weight: 600; line-height: 1.4; }
.period { margin-inline-start: auto; font: 500 .88rem/1 var(--font-lat); color: var(--muted); }

.card { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow); }
.card h3 { font-size: 1.08rem; font-weight: 600; line-height: 1.55; margin-bottom: 8px; }
.card p { margin: 0 0 10px; font-size: .95rem; }
.card p:last-child { margin-bottom: 0; }
.card-blue { background: var(--ink); border-color: var(--ink); }
.card-blue h3 { color: #fff; }
.card-blue p { color: #c9d6ef; }
.card-soft { background: var(--blue-soft); border-color: transparent; box-shadow: none; }
.org { color: var(--muted); font-size: .9rem; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; color: var(--blue); margin-bottom: 6px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-skills { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 40px; }
.grid-skills > :nth-child(-n + 3) { grid-column: span 2; }
.grid-skills > :nth-child(n + 4) { grid-column: span 3; }
.wide { grid-column: 1 / -1; }

.about { display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; align-items: start; }
.quote { margin: 0; font-size: clamp(1.3rem, 2.4vw, 1.7rem); font-weight: 500; line-height: 1.65; color: var(--ink); border-inline-start: 3px solid var(--blue); padding-inline-start: 22px; }
.about-text p { font-size: 1rem; }

.names { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.names li { padding: 9px 0; border-bottom: 1px solid var(--rule); font-weight: 500; color: var(--ink); font-size: .93rem; }
.names li:last-child { border-bottom: 0; padding-bottom: 0; }

.dots { list-style: none; margin: 0; padding: 0; }
.dots li { position: relative; padding: 6px 0; padding-inline-start: 18px; font-size: .95rem; }
.dots li::before { content: ""; position: absolute; inset-inline-start: 0; top: calc(6px + .9em - 3px); width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }

.role .when, .timeline .when { display: inline-block; font: 600 .82rem/1.4 var(--font-lat); color: var(--blue); background: var(--blue-soft); border-radius: 6px; padding: 4px 10px; margin-bottom: 12px; }
html[lang="ar"] .role .when { font-family: var(--font-ar); }
.role.feature { border-top: 3px solid var(--blue); }

/* Timeline */
.career { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 6px; bottom: 6px; inset-inline-start: 7px; width: 2px; background: var(--rule); }
.timeline > li { position: relative; padding-inline-start: 36px; padding-bottom: 20px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; inset-inline-start: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); box-sizing: border-box; }
.timeline > li > .when { margin-bottom: 8px; }
.timeline .card { padding: 18px 22px; }
.timeline .card .org { margin: 0 0 6px; }
.committees { position: sticky; top: 92px; }

/* Skills */
.group-title { font-size: 1rem; font-weight: 600; color: var(--blue); margin: 0 0 16px; }
.skill h4 { font-size: 1.02rem; font-weight: 600; line-height: 1.5; margin-bottom: 6px; }
.skill p { font-size: .93rem; }

/* Education & languages */
.lang-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--rule); }
.lang-row:first-of-type { border-top: 0; padding-top: 4px; }
.lang-row b { font-weight: 600; color: var(--blue); }

/* ---------- Contact ---------- */
.contact { background: var(--ink); color: #fff; padding: 84px 0; }
.contact .wrap { display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px; align-items: center; }
.contact h2 { color: #fff; font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 600; }
.contact p { color: #bccbe8; margin: 10px 0 0; }
.contact-list { margin: 0; display: grid; gap: 10px; }
.contact-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 14px 20px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.contact-list dt { color: #bccbe8; font-size: .88rem; }
.contact-list dd { margin: 0; font-weight: 500; }
.contact-list a { text-decoration: none; }
.contact-list a:hover { text-decoration: underline; text-underline-offset: 4px; }

.footer { padding: 22px 0; font-size: .85rem; color: var(--muted); }
.footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Motion ----------
   .rv blocks and .split words animate in when they enter the viewport and
   back out when they leave, from whichever edge they cross. */
.js .rv {
  opacity: 0; transform: translateY(calc(var(--dir, 1) * 28px));
  transition: opacity .7s var(--ease), transform .8s var(--ease);
  transition-delay: calc(var(--k, 0) * 70ms);
}
.js .rv.in { opacity: 1; transform: none; }
.js .split .w {
  display: inline-block; opacity: 0; transform: translateY(calc(var(--dir, 1) * .6em)); filter: blur(4px);
  transition: opacity .6s var(--ease), transform .7s var(--ease), filter .6s var(--ease);
  transition-delay: calc(var(--i) * 45ms);
}
.js .split.in .w { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv, .js .split .w { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .nav { display: none; }
  .langs { margin-inline-start: auto; }
}
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 28px; }
  .portrait { order: -1; width: 230px; justify-self: start; }
  .figures .wrap { grid-template-columns: repeat(2, 1fr); }
  .about, .career, .contact .wrap { grid-template-columns: 1fr; gap: 24px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-skills { grid-template-columns: 1fr; }
  .grid-skills > * { grid-column: auto !important; }
  .committees { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0 48px; }
  .block, .contact { padding: 60px 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .fig { padding: 18px 16px; }
  .fig b { font-size: 1.7rem; }
  .card { padding: 20px; }
  .period { margin-inline-start: 0; width: 100%; }
}
