/* =========================================================
   nasrly — الصفحة الشخصية
   تصميم أبيض وأسود — Reem Kufi / IBM Plex Sans Arabic
   ========================================================= */

:root {
  --bg: #f4f3ef;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: rgba(10, 10, 10, 0.14);
  --card: #ebeae5;

  --font-display: 'Reem Kufi', 'IBM Plex Sans Arabic', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;

  --container: 1240px;
  --pad: clamp(20px, 4vw, 48px);
  --ease: cubic-bezier(.2, .7, .1, 1);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #f4f3ef;
  --muted: #8e8e8e;
  --line: rgba(244, 243, 239, 0.14);
  --card: #151515;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background .5s var(--ease), color .5s var(--ease);
}

/* حبيبات خفيفة فوق الصفحة لملمس ورقي */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--fg); color: var(--bg); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--pad); }

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0;
}

/* ---------------- شاشة التحميل ---------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--fg);
  color: var(--bg);
  transition: transform 1s var(--ease) .2s;
}
.loader__mark {
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 700;
  animation: pulse 1.2s var(--ease) infinite alternate;
}
.is-loaded .loader { transform: translateY(-100%); }
@keyframes pulse { from { opacity: .3; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ---------------- الشريط العلوي ---------------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding-block: 22px;
  transition: padding .4s var(--ease), background .4s var(--ease), border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  padding-block: 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.nav__logo { display: flex; align-items: center; gap: 12px; }
.nav__logo-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--fg); color: var(--bg);
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  border-radius: 50%;
  transition: transform .5s var(--ease);
}
.nav__logo:hover .nav__logo-mark { transform: rotate(-12deg) scale(1.06); }
.nav__logo-text { font-family: var(--font-display); font-size: 22px; font-weight: 600; }

.nav__links { display: flex; gap: 32px; }
.nav__links a {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  display: flex; align-items: baseline; gap: 6px;
}
.nav__links a .mono { font-size: 10px; color: var(--muted); }
.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -4px; right: 0;
  width: 0; height: 1px;
  background: currentColor;
  transition: width .4s var(--ease);
}
.nav__links a:hover::after,
.nav__links a.is-active::after { width: 100%; }

.nav__actions { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  width: 52px; height: 28px;
  border: 1px solid var(--fg);
  border-radius: 100px;
  position: relative;
}
.theme-toggle__dot {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform .5s var(--ease);
}
[data-theme="dark"] .theme-toggle__dot { transform: translateX(-24px); }

.burger { display: none; width: 40px; height: 40px; position: relative; }
.burger span {
  position: absolute; right: 8px;
  width: 24px; height: 1.5px;
  background: var(--fg);
  transition: transform .4s var(--ease), top .4s var(--ease);
}
.burger span:first-child { top: 15px; }
.burger span:last-child { top: 23px; }
.burger[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

/* ---------------- الواجهة ---------------- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-block: 140px 48px;
  position: relative;
}
.hero .container { position: relative; }

.hero__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.hero__loc { color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 14px;
}
.badge__pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg);
  position: relative;
}
.badge__pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--fg);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping { to { transform: scale(3); opacity: 0; } }

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(130px, 31vw, 440px);
  line-height: .9;
  letter-spacing: -0.01em;
  margin-bottom: 36px;
}
.hero__title .line { display: block; overflow: hidden; padding-block: .06em .1em; }
.reveal-up {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1.3s var(--ease) .9s;
}
.is-loaded .reveal-up { transform: none; }

.hero__bottom {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 48px;
  align-items: end;
  border-top: 1px solid var(--fg);
  padding-top: 28px;
}
.hero__lead { font-size: clamp(18px, 1.8vw, 23px); line-height: 1.75; max-width: 34ch; }
.hero__en { display: block; margin-top: 14px; color: var(--muted); direction: ltr; text-align: right; }
.hero__roles { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.hero__roles span {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 500;
}
.hero__roles span:not(:first-child) { color: var(--muted); }

.hero__scroll {
  position: absolute;
  left: var(--pad);
  bottom: 100%;
  margin-bottom: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--muted);
}
.hero__scroll .mono { writing-mode: vertical-rl; font-size: 11px; }
.hero__scroll-line {
  width: 1px; height: 64px;
  background: var(--line);
  position: relative; overflow: hidden;
}
.hero__scroll-line::after {
  content: ''; position: absolute; inset: 0;
  background: var(--fg);
  animation: scrollLine 2s var(--ease) infinite;
}
@keyframes scrollLine { from { transform: translateY(-100%); } to { transform: translateY(100%); } }

/* ---------------- الشريط المتحرك ---------------- */
.marquee {
  background: var(--fg);
  color: var(--bg);
  overflow: hidden;
  padding-block: 22px;
  transform: rotate(-1.2deg) scale(1.02);
  margin-block: 20px;
}
.marquee__track {
  display: flex; align-items: center; gap: 36px;
  width: max-content;
  animation: marquee 32s linear infinite;
}
.marquee__track span {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 600;
  white-space: nowrap;
}
.marquee__track i { font-style: normal; font-size: 22px; }
@keyframes marquee { to { transform: translateX(50%); } }

/* ---------------- الأقسام ---------------- */
.section { padding-block: clamp(90px, 13vw, 170px); }

.section--invert { background: var(--fg); color: var(--bg); --line: color-mix(in srgb, var(--bg) 16%, transparent); --muted: color-mix(in srgb, var(--bg) 55%, transparent); }

.section__head {
  display: flex; align-items: baseline; gap: 20px;
  margin-bottom: clamp(48px, 7vw, 90px);
}
.section__num { color: var(--muted); }
.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(44px, 7vw, 96px);
  line-height: 1;
}
.section__rule { flex: 1; height: 1px; background: var(--line); align-self: center; }

/* ---------------- نبذة ---------------- */
.about { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(40px, 7vw, 110px); align-items: start; }

.about__photo { position: sticky; top: 110px; }
.about__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  background: var(--card);
  border-radius: 4px;
  transition: filter .6s var(--ease), transform .8s var(--ease);
}
.about__photo:hover img { transform: scale(.985); }
.about__photo figcaption { margin-top: 14px; color: var(--muted); }

.about__text p { margin-bottom: 22px; color: var(--muted); max-width: 60ch; }
.about__text .about__big {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.45;
  color: var(--fg);
  font-weight: 500;
  margin-bottom: 40px;
}
.about__big em {
  font-style: normal;
  background: var(--fg); color: var(--bg);
  padding-inline: .25em;
}

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  margin-top: 56px;
}
.stat { padding: 28px 0 0; padding-inline-start: 20px; border-inline-start: 1px solid var(--line); }
.stat:first-child { border-inline-start: 0; padding-inline-start: 0; }
.stat__num, .stat__plus {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 600;
  line-height: 1;
}
.stat__label { display: block; margin-top: 10px; color: var(--muted); font-size: 15px; }

/* ---------------- الخبرات ---------------- */
.exp-list { border-top: 1px solid var(--line); }
.exp {
  display: grid;
  grid-template-columns: 180px 1.1fr 1.4fr 40px;
  gap: 32px;
  align-items: center;
  padding-block: 36px;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: padding .5s var(--ease);
}
.exp::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--bg);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .5s var(--ease);
  z-index: 0;
}
.exp > * { position: relative; z-index: 1; transition: color .4s var(--ease); }
.exp:hover { padding-inline: 24px; }
.exp:hover::before { transform: scaleY(1); }
.exp:hover > * { color: var(--fg); }
.exp:hover .exp__arrow { transform: rotate(-45deg); }

.exp__date { color: var(--muted); }
.exp__role { font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 32px); font-weight: 600; line-height: 1.3; }
.exp__org { color: var(--muted); font-size: 15px; }
a.exp__org { border-bottom: 1px solid var(--line); }
a.exp__org:hover { color: inherit; }
.exp__desc { color: var(--muted); font-size: 15px; line-height: 1.8; }
.exp__arrow { font-size: 26px; justify-self: end; transition: transform .5s var(--ease), color .4s; }

/* ---------------- المهارات ---------------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-card {
  background: var(--card);
  border-radius: 6px;
  padding: 40px 34px;
  transition: transform .5s var(--ease), background .5s var(--ease), color .5s var(--ease);
}
.skill-card:hover { transform: translateY(-6px); background: var(--fg); color: var(--bg); }
.skill-card__icon { font-size: 34px; display: block; margin-bottom: 30px; }
.skill-card h3 { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin-bottom: 18px; }
.skill-card ul { list-style: none; }
.skill-card li {
  padding-block: 10px;
  border-top: 1px solid var(--line);
  font-size: 16px;
}
.skill-card:hover li { border-color: color-mix(in srgb, var(--bg) 18%, transparent); }

.langs { margin-top: 70px; display: grid; gap: 18px; }
.langs__label { color: var(--muted); margin-bottom: 6px; }
.lang { display: grid; grid-template-columns: 140px 1fr 120px; gap: 24px; align-items: center; }
.lang > span:first-child { font-family: var(--font-display); font-size: 22px; font-weight: 500; }
.lang > .mono { color: var(--muted); text-align: left; }
.lang__bar { height: 2px; background: var(--line); position: relative; overflow: hidden; }
.lang__bar i {
  position: absolute; inset: 0 0 0 auto;
  width: 0; background: var(--fg);
  transition: width 1.6s var(--ease) .2s;
}
.lang.is-visible .lang__bar i,
.langs.is-visible .lang__bar i { width: var(--w); }

/* ---------------- الأعمال ---------------- */
.works { display: grid; grid-template-columns: repeat(2, 1fr); gap: 56px 32px; }
.work:nth-child(even) { margin-top: 110px; }
.work__media {
  aspect-ratio: 4 / 3.2;
  background: var(--fg);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.work__media::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 30%, color-mix(in srgb, var(--bg) 22%, transparent), transparent 55%);
  transition: transform 1s var(--ease);
}
.work__media--alt { background: var(--card); }
.work__media--alt .work__index { color: var(--fg); }
.work__media--lines { background: repeating-linear-gradient(-45deg, var(--fg) 0 2px, var(--card) 2px 16px); }
.work__media--dots { background: radial-gradient(var(--fg) 1.6px, var(--card) 1.6px) 0 0 / 18px 18px; }
.work__media--lines .work__index,
.work__media--dots .work__index { background: var(--bg); color: var(--fg); padding: 0 .2em; border-radius: 4px; }

.work__index {
  font-family: var(--font-mono);
  font-size: clamp(60px, 9vw, 120px);
  color: var(--bg);
  position: relative;
  transition: transform .8s var(--ease);
}
.work:hover .work__index { transform: scale(1.12) rotate(-4deg); }
.work:hover .work__media::before { transform: scale(1.5); }

.work__info {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; padding-top: 18px;
}
.work__info h3 { font-family: var(--font-display); font-size: clamp(22px, 2.2vw, 30px); font-weight: 600; }
.work__info .mono { color: var(--muted); white-space: nowrap; }

.works__more { display: flex; justify-content: center; margin-top: 90px; }
.btn {
  display: inline-flex; align-items: center; gap: 14px;
  border: 1px solid var(--fg);
  border-radius: 100px;
  padding: 18px 36px;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 500;
  transition: background .4s var(--ease), color .4s var(--ease);
}
.btn span { transition: transform .4s var(--ease); }
.btn:hover { background: var(--fg); color: var(--bg); }
.btn:hover span { transform: translate(-4px, -4px); }

/* ---------------- اقتباس ---------------- */
.quote { padding-block: clamp(70px, 10vw, 140px); border-block: 1px solid var(--line); text-align: center; }
.quote blockquote { max-width: 900px; margin-inline: auto; }
.quote__mark { font-family: var(--font-display); font-size: 140px; line-height: .6; display: block; height: 70px; }
.quote p { font-family: var(--font-display); font-size: clamp(30px, 4.6vw, 62px); line-height: 1.35; font-weight: 500; margin-bottom: 26px; }
.quote cite { color: var(--muted); font-style: normal; }

/* ---------------- تواصل ---------------- */
.contact__lead {
  font-family: var(--font-display);
  font-size: clamp(48px, 9vw, 130px);
  line-height: 1.1;
  font-weight: 600;
  margin-bottom: 56px;
}
.contact__mail {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  width: 100%;
  padding-block: 30px;
  border-block: 1px solid var(--fg);
  text-align: right;
  transition: padding .5s var(--ease);
}
.contact__mail-text {
  font-family: var(--font-mono);
  font-size: clamp(24px, 5vw, 64px);
  direction: ltr;
}
.contact__mail-hint { color: var(--muted); }
.contact__mail:hover { padding-inline: 20px; }

.socials { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 44px; }
.socials a {
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 12px 26px;
  font-size: 15px;
  transition: background .4s var(--ease), color .4s var(--ease), border-color .4s;
}
.socials a span { display: inline-block; transition: transform .4s var(--ease); }
.socials a:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.socials a:hover span { transform: translate(3px, -3px); }

/* ---------------- التذييل ---------------- */
.footer { border-top: 1px solid var(--line); padding-block: 34px; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer__name { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.footer .mono { color: var(--muted); }
.footer__name .mono { font-size: 13px; margin-inline-start: 6px; }
.footer__top:hover { color: var(--fg); }

/* ---------------- رسالة النسخ ---------------- */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translate(-50%, 220%);
  opacity: 0;
  visibility: hidden;
  background: var(--fg); color: var(--bg);
  padding: 14px 26px;
  border-radius: 100px;
  z-index: 120;
  transition: transform .5s var(--ease), opacity .4s, visibility .4s;
}
.toast.is-show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ---------------- المؤشر ---------------- */
.cursor {
  position: fixed; top: 0; left: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 150;
  transform: translate(-50%, -50%);
  transition: width .35s var(--ease), height .35s var(--ease), opacity .3s;
  opacity: 0;
}
.cursor.is-active { opacity: 1; }
.cursor.is-hover { width: 64px; height: 64px; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------------- الظهور عند التمرير ---------------- */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------------- الاستجابة ---------------- */
@media (max-width: 980px) {
  .nav__links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    padding: 100px var(--pad) 40px;
    background: var(--bg);
    clip-path: circle(0 at 30px 30px);
    transition: clip-path .8s var(--ease);
    z-index: -1;
  }
  .nav__links.is-open { clip-path: circle(150% at 30px 30px); }
  .nav__links a { font-family: var(--font-display); font-size: 44px; font-weight: 600; }
  .nav__links a .mono { font-size: 13px; }
  .burger { display: block; }

  .hero__bottom { grid-template-columns: 1fr; gap: 28px; }
  .hero__roles { align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }
  .hero__scroll { display: none; }

  .about { grid-template-columns: 1fr; }
  .about__photo { position: relative; top: 0; max-width: 440px; }

  .exp { grid-template-columns: 1fr 30px; gap: 10px 20px; }
  .exp__date { grid-column: 1 / -1; }
  .exp__main { grid-column: 1; }
  .exp__arrow { grid-column: 2; grid-row: 2; }
  .exp__desc { grid-column: 1 / -1; }

  .skills { grid-template-columns: 1fr; }
  .works { grid-template-columns: 1fr; gap: 48px; }
  .work:nth-child(even) { margin-top: 0; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero__title { font-size: 46vw; }
  .stats { grid-template-columns: 1fr; }
  .stat, .stat:first-child { border-inline-start: 0; padding-inline-start: 0; border-bottom: 1px solid var(--line); padding-block: 22px; }
  .lang { grid-template-columns: 90px 1fr; }
  .lang > .mono { display: none; }
  .section__head { gap: 12px; }
  .work__info { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .reveal-up { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
