/* ============ style.css ============ */
/* =========================================================
   Ali Ahmad Alkasem — Portfolio
   ثيم Blueprint / Terminal · RTL · وضع ليلي/نهاري
   ملاحظة: المحتوى يظهر افتراضيًا، وحركات الكشف تُفعَّل فقط
   عندما يضيف JS الصنف "js" إلى عنصر html.
========================================================= */

/* ---------- المتغيّرات ---------- */
:root {
  --bg: #070f1e;
  --bg2: #0b1628;
  --surface: #0e1b31;
  --surface2: #12223c;
  --border: rgba(148, 163, 184, .16);
  --text: #e8eefb;
  --muted: #9db0c9;
  --teal: #2dd4bf;
  --cyan: #38bdf8;
  --amber: #fbbf24;
  --grid: rgba(148, 163, 184, .05);
  --grad: linear-gradient(135deg, var(--teal), var(--cyan));
  --shadow: 0 22px 55px rgba(2, 8, 20, .55);
  --radius: 14px;
  --font-display: 'Noto Kufi Arabic', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --nav-h: 72px;
}
[data-theme="light"] {
  --bg: #f2f6fc;
  --bg2: #e9eff8;
  --surface: #ffffff;
  --surface2: #f5f9fd;
  --border: rgba(15, 40, 70, .12);
  --text: #0d1b2e;
  --muted: #4d617c;
  --teal: #0d9488;
  --cyan: #0284c7;
  --amber: #d97706;
  --grid: rgba(13, 40, 80, .05);
  --shadow: 0 18px 45px rgba(13, 35, 70, .12);
}

/* ---------- إعادة الضبط ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 14px);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  width: 100%;
  transition: background .4s ease, color .4s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--teal); color: #04121f; }

.mono { font-family: var(--font-mono); }
.container { width: min(1160px, 92%); margin-inline: auto; }

/* ---------- شريط تمرير مخصّص ---------- */
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--teal), var(--cyan)); border-radius: 9px; border: 3px solid var(--bg2); }

/* ---------- طبقات الخلفية ---------- */
#bgCanvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
[data-theme="light"] #bgCanvas { opacity: .55; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
}
.glow { position: fixed; z-index: 0; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.glow-1 { width: 540px; height: 540px; top: -150px; inset-inline-start: -130px; background: radial-gradient(circle, rgba(45, 212, 191, .20), transparent 65%); }
.glow-2 { width: 520px; height: 520px; bottom: -160px; inset-inline-end: -140px; background: radial-gradient(circle, rgba(251, 191, 36, .14), transparent 65%); }
header, main, footer { position: relative; z-index: 1; }

/* ---------- رابط التخطّي ---------- */
.skip-link { position: absolute; top: -60px; inset-inline-start: 12px; background: var(--teal); color: #04121f; padding: 10px 16px; border-radius: 8px; font-weight: 700; z-index: 100; transition: top .25s; }
.skip-link:focus { top: 12px; }

/* ---------- شريط التنقّل ---------- */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 50; transition: background .3s, border-color .3s, box-shadow .3s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: var(--bg); background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(12px); border-bottom-color: var(--border); box-shadow: 0 8px 30px rgba(0, 0, 0, .18); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); gap: 18px; }
.logo { font-family: var(--font-mono); font-weight: 600; font-size: 1.15rem; color: var(--teal); letter-spacing: .5px; }
.logo:hover { color: var(--cyan); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a { position: relative; padding: 8px 12px; font-size: .95rem; color: var(--muted); font-weight: 500; border-radius: 8px; transition: color .25s; }
.nav-links a::after { content: ""; position: absolute; inset-inline: 12px; bottom: 2px; height: 2px; background: var(--teal); transform: scaleX(0); transform-origin: right; transition: transform .3s; border-radius: 2px; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--teal); }
.nav-links a.active::after { transform: scaleX(1); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); transition: color .25s, border-color .25s, transform .3s; }
.icon-btn:hover { color: var(--teal); border-color: var(--teal); transform: rotate(12deg); }
.icon-moon { display: none; }

/* زر القائمة (موبايل) */
.nav-toggle { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.nav-toggle span { width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s, opacity .3s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- الأزرار ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 24px; border-radius: 11px; font-weight: 600; font-size: .97rem; transition: transform .25s, box-shadow .25s, background .25s, border-color .25s, color .25s; position: relative; overflow: hidden; white-space: nowrap; }
.btn-sm { padding: 9px 16px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--grad); color: #04121f; box-shadow: 0 10px 26px rgba(45, 212, 191, .28); }
.btn-primary::after { content: ""; position: absolute; top: 0; inset-inline-start: -120%; width: 60%; height: 100%; background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg); transition: inset-inline-start .6s; }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(45, 212, 191, .4); }
.btn-primary:hover::after { inset-inline-start: 130%; }
.btn-outline { border: 1px solid var(--amber); color: var(--amber); }
.btn-outline:hover { background: rgba(251, 191, 36, .12); transform: translateY(-3px); }
.btn-ghost { border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--teal); transform: translateY(-3px); }

/* ---------- Hero ---------- */
.hero {
  padding: calc(var(--nav-h) + 40px) 0 110px;
  min-height: calc(100vh - var(--nav-h));
  min-height: calc(100svh - var(--nav-h));
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 24px;
}
.hero-grid { display: grid; gap: 36px; align-items: start; width: 100%; }
.hero-header { width: 100%; }
.hero-grid { display: grid; gap: 36px; align-items: center; width: 100%; }
.kicker { color: var(--amber); font-size: .88rem; letter-spacing: 1px; margin-bottom: 12px; }
.hero-title, .hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.75rem, 3.8vw, 2.65rem);
  line-height: 1.2;
  font-size: clamp(1.85rem, 3.2vw, 2.7rem);
  line-height: 1.22;
  letter-spacing: -.3px;
  position: relative;
  z-index: 0;
}
.hl { color: var(--teal); position: relative; }
.hl::after { content: ""; position: absolute; inset-inline: 0; bottom: .06em; height: 6px; background: var(--amber); border-radius: 4px; opacity: .45; z-index: -1; }
.type-line { font-size: 1.05rem; color: var(--text); margin-top: 14px; min-height: 1.6em; }
.type-line .prompt { color: var(--amber); }
.caret { display: inline-block; width: .55ch; height: 1.1em; background: var(--teal); vertical-align: text-bottom; margin-inline-start: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-sum { color: var(--muted); max-width: 56ch; margin-top: 18px; font-size: 1.05rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px 22px; margin-top: 28px; color: var(--muted); font-size: .9rem; }
.hero-meta li { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { color: var(--teal); flex-shrink: 0; }
.avail { display: inline-flex; align-items: center; gap: 9px; margin-top: 22px; font-size: .9rem; color: var(--muted); padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.avail .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(45, 212, 191, .55); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, .5); } 70% { box-shadow: 0 0 0 10px rgba(45, 212, 191, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); } }

/* الطرفية */
.hero-visual { position: relative; }
.term { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.hero-visual { position: relative; padding-inline-start: 12px; padding-inline-end: 20px; }
.term { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.6), 0 0 25px rgba(45, 212, 191, 0.08); overflow: hidden; position: relative; margin-inline: 4px; }
.term::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--grad); }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.tdot, .bdot { width: 12px; height: 12px; border-radius: 50%; }
.tdot.r, .bdot.r { background: #ff5f57; }
.tdot.y, .bdot.y { background: #febc2e; }
.tdot.g, .bdot.g { background: #28c840; }
.term-title { margin-inline-start: 10px; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.term-body { padding: 18px 18px 22px; font-family: var(--font-mono); font-size: .86rem; line-height: 1.85; min-height: 290px; }
.t-line { white-space: pre-wrap; word-break: break-word; }
.t-prompt { color: var(--teal); }
.t-cmd { color: var(--text); }
.t-out { color: var(--muted); padding-inline-start: 14px; }
.t-caret { display: inline-block; width: 8px; height: 1.05em; background: var(--teal); vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }

/* بطاقة الصورة الشخصية المحسّنة والرقائق العائمة */
.avatar-chip {
  position: absolute;
  bottom: -30px;
  inset-inline-start: -16px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 20px;
  padding: 12px 18px 12px 12px;
  box-shadow: 0 20px 45px rgba(2, 8, 20, 0.6), 0 0 25px rgba(45, 212, 191, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
  transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow .3s ease, border-color .3s ease;
}
.avatar-chip:hover {
  transform: translateY(-4px);
  border-color: var(--teal);
  box-shadow: 0 24px 50px rgba(2, 8, 20, 0.7), 0 0 35px rgba(45, 212, 191, 0.22);
}

.avatar-frame {
  position: relative;
  width: 82px;
  height: 82px;
  flex-shrink: 0;
  border-radius: 18px;
  padding: 3px;
  background: linear-gradient(135deg, var(--teal), var(--cyan), var(--amber));
  box-shadow: 0 8px 20px rgba(45, 212, 191, 0.25);
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 15px;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  background: var(--surface2);
}

.avatar-status {
  position: absolute;
  bottom: -3px;
  inset-inline-end: -3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #10b981;
  border: 3px solid var(--surface);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.avatar-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.avatar-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .2px;
}

.avatar-title {
  display: block;
  font-size: .8rem;
  color: var(--teal);
  font-weight: 500;
}

.avatar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  color: var(--muted);
  margin-top: 2px;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  display: inline-block;
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(0.85); }
}

.float-chip { position: absolute; padding: 6px 13px; border-radius: 999px; font-size: .78rem; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 8px 20px rgba(0, 0, 0, .25); animation: float 6s ease-in-out infinite; }
.fc-1 { top: -16px; inset-inline-end: 6%; color: var(--teal); border-color: var(--teal); }
.fc-2 { bottom: 30%; inset-inline-end: -14px; color: var(--amber); border-color: var(--amber); animation-delay: 1.4s; }
.fc-3 { top: 36%; inset-inline-start: -16px; color: var(--cyan); border-color: var(--cyan); animation-delay: 2.6s; }
.fc-4 { bottom: -18px; inset-inline-end: 18%; color: var(--cyan); border-color: var(--cyan); animation-delay: 3.2s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.scroll-hint { position: absolute; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); color: var(--muted); animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(50%, 0); } 50% { transform: translate(50%, 8px); } }

/* ---------- شريط التقنيات ---------- */
.marquee {
  position: relative;
  z-index: 5;
  margin-top: 24px;
  clear: both;
  overflow: hidden;
  border-block: 1px solid var(--border);
  background: var(--bg2);
  direction: ltr;
  padding-block: 15px;
}
.marquee-track { display: flex; gap: 2.4rem; width: max-content; animation: scrollX 30s linear infinite; align-items: center; }
.marquee-track span { font-family: var(--font-mono); color: var(--muted); font-size: .92rem; letter-spacing: .5px; }
.marquee-track .sep { color: var(--amber); }
@keyframes scrollX { to { transform: translateX(-50%); } }

/* ---------- رؤوس الأقسام ---------- */
section { padding-block: clamp(72px, 9vw, 104px); }
.sec-head { display: flex; align-items: center; gap: 16px; margin-bottom: 48px; }
.sec-num { font-family: var(--font-mono); color: var(--teal); font-size: 1rem; }
.sec-head h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.5rem); white-space: nowrap; }
.sec-line { flex: 1; height: 1px; background: linear-gradient(to left, transparent, var(--border)); }

/* ---------- نبذة عنّي ---------- */
.about-grid { display: grid; gap: 40px; }
.about-text p { color: var(--muted); margin-bottom: 16px; font-size: 1.04rem; }
.about-text strong { color: var(--teal); font-weight: 600; }
.lang-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.lang-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .9rem; }
.dot-sm { width: 8px; height: 8px; border-radius: 50%; }
.dot-sm.teal { background: var(--teal); }
.dot-sm.amber { background: var(--amber); }
.about-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.mini-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; transition: transform .3s, border-color .3s, box-shadow .3s; }
.mini-card:hover { transform: translateY(-5px); border-color: var(--teal); box-shadow: var(--shadow); }
.mini-ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: rgba(45, 212, 191, .14); color: var(--teal); margin-bottom: 14px; }
.mini-card h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 8px; }
.mini-card p { color: var(--muted); font-size: .92rem; }

/* ---------- المهارات ---------- */
.skills-grid { display: grid; gap: 22px; }
.skill-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; overflow: hidden; transition: transform .3s, border-color .3s, box-shadow .3s; }
.skill-card::before { content: ""; position: absolute; top: 0; inset-inline-start: 0; width: 60px; height: 3px; background: var(--grad); }
.skill-card:hover { transform: translateY(-6px); border-color: var(--teal); box-shadow: var(--shadow); }
.skill-ic { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 13px; background: rgba(45, 212, 191, .14); color: var(--teal); margin-bottom: 16px; }
.skill-card h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 18px; }
.skill-group { margin-bottom: 16px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group h4 { font-size: .82rem; color: var(--amber); font-weight: 600; margin-bottom: 10px; letter-spacing: .3px; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { font-family: var(--font-mono); font-size: .82rem; padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface2); color: var(--muted); transition: color .25s, border-color .25s, transform .25s; }
.chip:hover { color: var(--teal); border-color: var(--teal); transform: translateY(-2px); }

/* ---------- الخبرات (Timeline) ---------- */
.timeline { position: relative; padding-inline-start: 36px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 9px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--teal), rgba(45, 212, 191, .08)); }
.t-item { position: relative; margin-bottom: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; transition: transform .3s, border-color .3s, box-shadow .3s; }
.t-item:last-child { margin-bottom: 0; }
.t-item::before { content: ""; position: absolute; inset-inline-start: -33px; top: 26px; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 3px solid var(--teal); box-shadow: 0 0 0 4px rgba(45, 212, 191, .18); }
.t-item:hover { transform: translateX(-4px); border-color: var(--teal); box-shadow: var(--shadow); }
.t-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.t-year { display: inline-block; font-size: .8rem; color: var(--amber); background: rgba(251, 191, 36, .12); padding: 4px 11px; border-radius: 7px; }
.t-tag { font-size: .72rem; color: var(--muted); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; }
.t-item h3 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 4px; }
.t-org { color: var(--cyan); font-size: .92rem; margin-bottom: 10px; }
.t-item p { color: var(--muted); font-size: .95rem; }
.t-ach { color: var(--text) !important; margin-top: 10px; padding: 10px 13px; border-inline-start: 3px solid var(--amber); background: var(--surface2); border-radius: 8px; }

/* ---------- المشاريع ---------- */
.project { display: grid; gap: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px; margin-bottom: 36px; transition: border-color .3s, box-shadow .3s; }
.project:last-child { margin-bottom: 0; }
.project:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.browser { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg2); }
.browser-bar { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.url { flex: 1; font-family: var(--font-mono); font-size: .74rem; background: var(--surface2); border-radius: 7px; padding: 5px 11px; color: var(--muted); text-align: left; margin-inline-start: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-media { overflow: hidden; border-radius: 12px; }
.project-media img { aspect-ratio: 16 / 11; width: 100%; object-fit: cover; background: linear-gradient(135deg, var(--surface2), var(--bg2)); transition: transform .5s; }
.project:hover .project-media img { transform: scale(1.04); }
.project-info h3 { font-family: var(--font-display); font-size: 1.4rem; }
.proj-sub { color: var(--amber); font-size: .82rem; margin: 4px 0 14px; }
.project-info > p { color: var(--muted); margin-bottom: 16px; }
.cs-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.cs-list li { color: var(--muted); font-size: .92rem; padding-inline-start: 18px; position: relative; }
.cs-list li::before { content: ""; position: absolute; inset-inline-start: 0; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.hl-p { color: var(--amber); font-weight: 600; }
.hl-s { color: var(--teal); font-weight: 600; }
.proj-tech { margin-bottom: 18px; }
.proj-links { display: flex; flex-wrap: wrap; gap: 12px; }

/* تفاعلات بطاقة المشروع ومعاينة المعرض */
.gallery-clickable {
  cursor: pointer;
}
.media-preview-wrap {
  position: relative;
  overflow: hidden;
}
.gallery-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 15, 30, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
  pointer-events: none;
}
[data-theme="light"] .gallery-hover-overlay {
  background: rgba(240, 245, 252, 0.72);
}
.project-media:hover .gallery-hover-overlay,
.project-media:focus-visible .gallery-hover-overlay {
  opacity: 1;
}
.gallery-hover-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--teal);
  border: 1px solid var(--teal);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45), 0 0 20px rgba(45, 212, 191, 0.25);
  transform: translateY(8px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.project-media:hover .gallery-hover-btn,
.project-media:focus-visible .gallery-hover-btn {
  transform: translateY(0);
}

/* ملاحظة خصوصية المشروع */
.proj-note {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--surface2);
  border-inline-start: 3px solid var(--amber);
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.proj-note-ic {
  color: var(--amber);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
}
.proj-note-text {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}
.proj-note-text strong {
  color: var(--amber);
  margin-inline-end: 4px;
}
.proj-note-link {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
  font-weight: 600;
}
.proj-note-link:hover {
  color: var(--cyan);
}

/* ---------- التعليم والشهادات ---------- */
.edu-grid { display: grid; gap: 24px; }
.edu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; position: relative; overflow: hidden; }
.edu-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.edu-ic { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 14px; background: rgba(45, 212, 191, .14); color: var(--teal); margin-bottom: 18px; }
.edu-card h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 6px; }
.edu-org { color: var(--cyan); margin-bottom: 22px; }
.edu-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.edu-facts div { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.edu-facts strong { display: block; font-family: var(--font-display); color: var(--teal); font-size: 1rem; }
.edu-facts span { font-size: .78rem; color: var(--muted); }
.edu-side { display: grid; gap: 24px; }
.cert-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.cert-card h3 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 18px; }
.cert-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .95rem; }
.cert-list li:last-child { border-bottom: none; }
.cert-list svg { color: var(--amber); flex-shrink: 0; }
.lang-list { display: flex; flex-direction: column; gap: 12px; }
.lang-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; }
.lang-level { font-family: var(--font-mono); font-size: .82rem; color: var(--teal); }

/* ---------- الإنجازات ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 36px; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
  max-width: 900px;
  margin-inline: auto;
  justify-content: center;
}
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 18px; text-align: center; transition: transform .3s, border-color .3s; }
.stat:hover { transform: translateY(-5px); border-color: var(--teal); }
.stat-num { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.2rem, 6vw, 3rem); color: var(--teal); line-height: 1; display: inline-flex; align-items: baseline; }
.stat-suf { font-size: .9rem; color: var(--amber); margin-inline-start: 4px; }
.stat-label { display: block; color: var(--muted); font-size: .9rem; margin-top: 10px; }
.highlights { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1040px;
  margin-inline: auto;
  justify-content: center;
}
.hl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; transition: transform .3s, border-color .3s, box-shadow .3s; }
.hl-card:hover { transform: translateY(-5px); border-color: var(--amber); box-shadow: var(--shadow); }
.hl-ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: rgba(251, 191, 36, .14); color: var(--amber); margin-bottom: 14px; }
.hl-card h3 { font-family: var(--font-display); font-size: 1.08rem; margin-bottom: 8px; }
.hl-card p { color: var(--muted); font-size: .92rem; }

/* ---------- التواصل ---------- */
.con-intro { color: var(--muted); max-width: 60ch; margin: -22px auto 40px; text-align: center; font-size: 1.05rem; }
.contact-grid { display: grid; gap: 28px; }
.contact-grid > * { min-width: 0; }
.contact-info { display: grid; gap: 14px; }
.c-card { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; transition: transform .3s, border-color .3s; }
.c-card:hover { transform: translateX(-5px); border-color: var(--teal); }
.c-card > div { min-width: 0; }
.c-ic { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: rgba(45, 212, 191, .14); color: var(--teal); flex-shrink: 0; }
.c-ic.whatsapp-ic { background: rgba(37, 211, 102, .14); color: #25d366; }
.c-card:hover .whatsapp-ic { box-shadow: 0 0 16px rgba(37, 211, 102, .3); }
.c-label { display: block; font-size: .78rem; color: var(--muted); }
.c-val { display: block; font-weight: 600; overflow-wrap: anywhere; }
.contact-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: .88rem; color: var(--muted); font-weight: 500; }
.field input, .field textarea { font-family: inherit; font-size: .98rem; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; transition: border-color .25s, box-shadow .25s; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .7; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45, 212, 191, .18); }
.form-note { font-size: .8rem; color: var(--muted); text-align: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg2); padding-block: 50px 26px; margin-top: 30px; }
.footer-inner { display: grid; gap: 28px; align-items: start; }
.footer-brand .logo { font-size: 1.3rem; }
.footer-brand p { color: var(--muted); margin-top: 12px; max-width: 38ch; font-size: .92rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-nav a { color: var(--muted); font-size: .92rem; transition: color .25s; }
.footer-nav a:hover { color: var(--teal); }
.footer-social { display: flex; gap: 12px; }
.footer-social a { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; color: var(--muted); transition: color .25s, border-color .25s, transform .25s; }
.footer-social a:hover { color: var(--teal); border-color: var(--teal); transform: translateY(-3px); }
.footer-social a.footer-whatsapp:hover { color: #25d366; border-color: #25d366; box-shadow: 0 0 15px rgba(37, 211, 102, .35); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: .84rem; }

/* ---------- زر العودة للأعلى ---------- */
.back-top { position: fixed; bottom: 24px; inset-inline-end: 24px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--teal); box-shadow: var(--shadow); z-index: 40; opacity: 0; pointer-events: none; transform: translateY(14px); transition: opacity .3s, transform .3s, background .25s, color .25s; }
.back-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-top:hover { background: var(--teal); color: #04121f; }

/* ---------- حركات الكشف (تُفعَّل فقط مع JS) ---------- */
.reveal { transition: opacity .7s ease, transform .7s ease; transition-delay: var(--d, 0s); }
.js .reveal { opacity: 0; transform: translateY(26px); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- الاستجابة ---------- */
@media (max-width: 980px) {
  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 60;
  }
  .nav-toggle span {
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, background-color 0.25s;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: var(--teal);
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: var(--teal);
  }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    inset-inline: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(11, 22, 40, 0.95);
    background: color-mix(in srgb, var(--bg2) 92%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(45, 212, 191, 0.25);
    border-bottom-left-radius: 26px;
    border-bottom-right-radius: 26px;
    padding: 24px 20px 30px;
    gap: 8px;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.75), 0 0 35px rgba(45, 212, 191, 0.12);
    z-index: 49;
    
    /* أنيميشن ظهور واختفاء تدريجي */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-16px) scale(0.98);
    transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1), transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.32s ease;
  }

  [data-theme="light"] .nav-links {
    background: rgba(245, 249, 253, 0.96);
    border-bottom-color: rgba(13, 148, 136, 0.25);
    box-shadow: 0 20px 45px -10px rgba(13, 35, 70, 0.18);
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .nav-links li {
    width: 100%;
    max-width: 290px;
    display: flex;
    justify-content: center;
  }

  .nav-links a {
    width: 100%;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    border: 1px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-links a::after {
    display: none;
  }

  .nav-links a:hover {
    color: var(--teal);
    background: rgba(45, 212, 191, 0.08);
    border-color: rgba(45, 212, 191, 0.2);
    transform: translateY(-1px);
  }

  .nav-links a.active {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(56, 189, 248, 0.12));
    color: var(--teal);
    border-color: rgba(45, 212, 191, 0.35);
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.15);
    font-weight: 700;
  }
}
@media (min-width: 760px) {
  .about-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .skills-grid .skill-card:first-child { grid-column: 1 / -1; }
  .edu-grid { grid-template-columns: 1.1fr .9fr; align-items: start; }
  .contact-grid { grid-template-columns: 1fr 1.1fr; align-items: start; }
  .footer-inner { grid-template-columns: 1.4fr 1fr auto; align-items: center; }
}
@media (min-width: 900px) {
  .project { grid-template-columns: 1.05fr 1fr; align-items: center; }
  .project.flip .project-media { order: 2; }
}
@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1.08fr .92fr;
    column-gap: 56px;
    row-gap: 32px;
    align-items: center;
  }
  .hero-header {
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 6px;
  }
  .hero-visual {
    padding-inline-start: 16px;
    padding-inline-end: 28px;
  }
  .hero-title, .hero h1 {
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    letter-spacing: -.2px;
    width: 100%;
  }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
  .skills-grid .skill-card:first-child { grid-column: auto; }
  .stats {
    grid-template-columns: repeat(3, 1fr);
    max-width: 880px;
    margin-inline: auto;
    justify-content: center;
  }
  .highlights {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1040px;
    margin-inline: auto;
    justify-content: center;
  }
}
@media (max-width: 760px) {
  .hero-grid { gap: 40px; }
  .about-grid, .edu-grid, .contact-grid { gap: 32px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; text-align: center; }
  .footer-social { justify-content: center; }
  .footer-nav { justify-content: center; }
}
@media (max-width: 560px) {
  .about-cards { grid-template-columns: 1fr; }
  .edu-facts { grid-template-columns: 1fr; }
  .stats {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin-inline: auto;
  }
  .highlights {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-inline: auto;
  }
  .contact-form { padding: 20px 16px; }
  .fc-2, .fc-3, .fc-4 { display: none; }
  .hero-visual {
    margin-bottom: 34px;
    padding-inline: 4px;
  }
  .avatar-chip {
    left: 50% !important;
    right: auto !important;
    inset-inline-start: auto !important;
    transform: translateX(-50%) !important;
    bottom: -32px;
    width: calc(100% - 24px);
    max-width: 340px;
    padding: 10px 14px 10px 10px;
    gap: 12px;
  }
  .avatar-chip:hover {
    transform: translateX(-50%) translateY(-2px) !important;
  }
  .avatar-frame {
    width: 68px;
    height: 68px;
    border-radius: 15px;
  }
  .avatar-img {
    border-radius: 12px;
  }
  .avatar-name {
    font-size: .95rem;
  }
  .avatar-title {
    font-size: .74rem;
  }
}
@media (max-width: 480px) {
  .hero {
    padding-top: calc(var(--nav-h) + 24px);
    padding-bottom: 72px;
  }
  .hero h1 {
    font-size: clamp(1.95rem, 8.5vw, 2.5rem);
  }
  .hero-cta {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }
  .hero-meta {
    flex-direction: column;
    gap: 9px;
  }
  .term-body {
    padding: 14px 14px 18px;
    font-size: .78rem;
    min-height: 240px;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .highlights {
    grid-template-columns: 1fr;
  }
  .sec-head {
    margin-bottom: 32px;
  }
  .sec-head h2 {
    font-size: 1.6rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .back-top {
    bottom: 16px;
    inset-inline-end: 16px;
    width: 42px;
    height: 42px;
  }
}
@media (max-width: 360px) {
  .avatar-chip {
    width: calc(100% - 16px);
    max-width: 100%;
    gap: 10px;
    padding: 8px 10px;
  }
  .avatar-frame {
    width: 58px;
    height: 58px;
  }
  .avatar-name {
    font-size: .9rem;
  }
  .avatar-title {
    font-size: .7rem;
  }
  .chips .chip {
    font-size: .74rem;
    padding: 5px 10px;
  }
}

/* ============ معرض الصور الاحترافي ثلاثي الأبعاد (3D Gallery Modal) ============ */
body.gallery-open {
  overflow: hidden !important;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5vw, 24px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.32s ease;
}

.gallery-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.32s ease;
}

[data-theme="light"] .gallery-backdrop {
  background: rgba(230, 238, 248, 0.88);
}

.gallery-dialog {
  position: relative;
  width: min(1140px, 100%);
  max-height: 96vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 35px 100px -15px rgba(0, 0, 0, 0.8),
              0 0 50px rgba(45, 212, 191, 0.1);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 1;
  transform: scale(0.93) translateY(18px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-modal.is-open .gallery-dialog {
  transform: scale(1) translateY(0);
}

/* شريط رأس المعرض */
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.gallery-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gallery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(45, 212, 191, 0.12);
  color: var(--teal);
  border: 1px solid rgba(45, 212, 191, 0.3);
  white-space: nowrap;
}

.gallery-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.gallery-counter {
  font-size: 0.88rem;
  color: var(--amber);
  background: rgba(251, 191, 36, 0.12);
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  font-weight: 600;
}

.gallery-btn-close {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s ease;
}

.gallery-btn-close:hover,
.gallery-btn-close:focus-visible {
  color: #ff5f57;
  border-color: #ff5f57;
  background: rgba(255, 95, 87, 0.12);
  transform: translateY(-1px);
}

.key-hint {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* مسرح العرض ثلاثي الأبعاد */
.gallery-stage-container {
  position: relative;
  width: 100%;
  height: clamp(340px, 52vh, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  -webkit-perspective: 1200px;
  overflow: hidden;
  user-select: none;
  background: radial-gradient(circle at 50% 50%, rgba(45, 212, 191, 0.05) 0%, transparent 70%);
}

.gallery-stage {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.gallery-track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  pointer-events: none;
}

.gallery-track.no-transition .gallery-slide {
  transition: none !important;
}

/* شرائح العرض ثلاثية الأبعاد */
.gallery-slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max-content;
  max-width: min(85vw, 760px);
  height: 92%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform-origin: center center;
  transition: transform 0.52s cubic-bezier(0.2, 0.85, 0.32, 1.05),
              opacity 0.45s ease,
              filter 0.45s ease;
  pointer-events: none;
  outline: none;
}

.gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
}

.gallery-slide.active .gallery-card {
  border-color: rgba(45, 212, 191, 0.6);
  box-shadow: 0 25px 65px -10px rgba(0, 0, 0, 0.7),
              0 0 35px rgba(45, 212, 191, 0.22);
  cursor: default;
}

.gallery-slide:not(.active) .gallery-card:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: scale(1.02);
}

.gallery-card-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: calc(clamp(320px, 48vh, 500px) * 0.92 - 20px);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
}

.gallery-card img {
  max-width: 100%;
  max-height: calc(clamp(320px, 48vh, 500px) * 0.92 - 20px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.4s ease;
}

.gallery-card-badge {
  position: absolute;
  top: 18px;
  inset-inline-start: 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(7, 15, 30, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--teal);
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .gallery-card-badge {
  background: rgba(255, 255, 255, 0.88);
  color: var(--teal);
  border-color: rgba(13, 148, 136, 0.35);
}

/* أزرار التنقل الجانبية */
.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(14, 27, 49, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text);
  z-index: 30;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] .gallery-nav-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-color: rgba(15, 40, 70, 0.18);
  box-shadow: 0 10px 25px rgba(13, 35, 70, 0.15);
}

.gallery-nav-btn:hover,
.gallery-nav-btn:focus-visible {
  background: var(--teal);
  color: #04121f;
  border-color: var(--teal);
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 0 25px rgba(45, 212, 191, 0.5);
}

/* في RTL: اليمين هو السابق، واليسار هو التالي */
.gallery-prev {
  inset-inline-start: 18px;
}
.gallery-next {
  inset-inline-end: 18px;
}

/* تفاصيل الشريحة */
.gallery-info {
  text-align: center;
  padding: 6px 24px 2px;
  max-width: 720px;
  margin-inline: auto;
  min-height: 60px;
}

.gallery-slide-title {
  font-family: var(--font-display);
  font-size: 1.06rem;
  color: var(--text);
  margin-bottom: 4px;
}

.gallery-slide-desc {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.6;
}

/* شريط الصور المصغرة (Thumbnails) */
.gallery-thumbs-wrap {
  width: 100%;
  max-width: min(88vw, 840px);
  margin-inline: auto;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 12px 10px;
  display: flex;
  justify-content: center;
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px;
}

.gallery-thumb {
  position: relative;
  width: 66px;
  height: 48px;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.5;
  padding: 0;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
  opacity: 0.9;
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--teal);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.55);
  transform: scale(1.12);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* إرشادات لوحة المفاتيح */
.gallery-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px 14px;
  font-size: 0.74rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.gallery-hints strong {
  color: var(--teal);
}

/* استجابة شاشات الموبايل للمعرض */
@media (max-width: 640px) {
  .gallery-dialog {
    border-radius: 18px;
  }
  .gallery-header {
    padding: 12px 16px;
  }
  .gallery-title {
    font-size: 0.98rem;
  }
  .gallery-stage-container {
    height: clamp(280px, 46vh, 400px);
  }
  .gallery-slide {
    width: 88vw;
  }
  .gallery-card-img-wrap {
    max-height: calc(clamp(280px, 46vh, 400px) * 0.9 - 16px);
  }
  .gallery-card img {
    max-height: calc(clamp(280px, 46vh, 400px) * 0.9 - 16px);
  }
  .gallery-nav-btn {
    width: 40px;
    height: 40px;
  }
  .gallery-prev {
    inset-inline-start: 8px;
  }
  .gallery-next {
    inset-inline-end: 8px;
  }
  .gallery-thumb {
    width: 54px;
    height: 40px;
  }
  .gallery-hints {
    font-size: 0.68rem;
    gap: 8px;
    padding: 8px 12px;
  }
  .key-hint {
    display: none;
  }
}

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

/* ---------- الطباعة ---------- */
@media print {
  .nav, #bgCanvas, .glow, .back-top, .scroll-hint, .marquee, .hero-cta, .contact-form, .float-chip, #themeToggle, #navToggle, body::before, .gallery-modal { display: none !important; }
  body { background: #fff; color: #000; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  section { padding-block: 16px; }
  .project:hover .project-media img { transform: none; }
}
