:root {
  --navy:        #1B3A6B;
  --blue:        #2563EB;
  --blue-light:  #EBF2FF;
  --gold:        #C8A030;
  --gold-light:  #FDF6E3;
  --bg:          #F7F5F0;
  --white:       #FFFFFF;
  --ink:         #1A1A2E;
  --ink-60:      #64748B;
  --border:      #E2DDD4;
  --font-body:   'Cairo', sans-serif;
  --font-display:'Amiri', serif;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow-sm:   0 2px 12px rgba(27,58,107,0.08);
  --shadow-md:   0 8px 32px rgba(27,58,107,0.12);
  --shadow-lg:   0 24px 64px rgba(27,58,107,0.16);
  --transition:  0.35s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--ink); overflow-x: hidden; line-height: 1.7; }
img { max-width: 100%; display: block; }

/* ── Image Fade-in & Error Fallback ── */
.cert-img-wrap img,
.visual-circle-img {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.cert-img-wrap img.img-loaded,
.visual-circle-img.img-loaded {
  opacity: 1;
}
.img-error-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  color: var(--ink-60);
  font-size: 0.9rem;
  font-weight: 500;
}
.img-error-placeholder i {
  font-size: 2rem;
  color: var(--border);
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(27,58,107,0.5); backdrop-filter: blur(4px); z-index: 8888; }
.overlay.active { display: block; }

.mobile-nav { display: none; position: fixed; top: 0; right: -100%; width: min(340px, 85%); height: 100vh; background: var(--white); z-index: 9000; padding: 100px 40px 40px; border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transition: right var(--transition); }
.mobile-nav.active { right: 0; }
.mobile-close { position: absolute; top: 24px; right: 24px; background: var(--bg); border: 1px solid var(--border); width: 44px; height: 44px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; color: var(--ink); display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.mobile-close:hover { background: var(--navy); color: white; border-color: var(--navy); }
.mobile-nav-links { display: flex; flex-direction: column; gap: 8px; }
.mobile-nav-links a { font-size: 1.15rem; font-weight: 600; color: var(--ink); padding: 14px 20px; border-radius: var(--radius-sm); transition: var(--transition); }
.mobile-nav-links a:hover { background: var(--blue-light); color: var(--blue); }

#navbar { position: fixed; top: 0; width: 100%; z-index: 1000; background: rgba(247,245,240,0.92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); transition: var(--transition); }
#navbar.scrolled { background: rgba(255,255,255,0.96); box-shadow: var(--shadow-sm); }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 40px; height: 72px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 4px; }
.logo-mark { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--gold); line-height: 1; }
.logo-text { font-size: 1.25rem; font-weight: 700; color: var(--navy); letter-spacing: -0.5px; }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a { font-size: 0.95rem; font-weight: 600; color: var(--ink-60); padding: 8px 16px; border-radius: 8px; transition: var(--transition); }
.nav-links a:hover { color: var(--blue); background: var(--blue-light); }
.mobile-menu { display: none; background: none; border: 1px solid var(--border); width: 42px; height: 42px; border-radius: 10px; font-size: 1rem; cursor: pointer; color: var(--ink); align-items: center; justify-content: center; transition: var(--transition); }
.mobile-menu:hover { border-color: var(--blue); color: var(--blue); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 28px; border-radius: 10px; font-family: var(--font-body); font-size: 1rem; font-weight: 700; cursor: pointer; border: none; transition: var(--transition); white-space: nowrap; }
.btn-primary { background: var(--blue); color: white; box-shadow: 0 4px 16px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--navy); box-shadow: 0 6px 24px rgba(37,99,235,0.4); transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn-outline:hover { background: var(--navy); color: white; transform: translateY(-2px); }
.btn-wide { width: 100%; justify-content: center; }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1 !important; transform: translateY(0) !important; }
body.js-ready .reveal { opacity: 0; }
body:not(.js-ready) .reveal { opacity: 1; transform: none; transition: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1 !important; transform: none !important; transition: none; } }

.container { max-width: 1100px; margin: 0 auto; padding: 0 40px; }
.section { padding: 100px 0; }
.section-tinted { background: var(--white); }
.section-label { display: inline-flex; align-items: center; gap: 10px; font-size: 0.8rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--blue); margin-bottom: 16px; }
.section-label::before { content: ''; width: 24px; height: 2px; background: var(--gold); border-radius: 2px; }
.section-title { font-family: var(--font-display); font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 700; line-height: 1.2; color: var(--navy); margin-bottom: 20px; }
.section-intro { font-size: 1.1rem; color: var(--ink-60); max-width: 560px; margin-bottom: 60px; line-height: 1.8; }

.hero { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 60px; padding: 100px 60px 60px; max-width: 1300px; margin: 0 auto; position: relative; }
.hero-bg-grid { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(rgba(27,58,107,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(27,58,107,0.04) 1px, transparent 1px); background-size: 48px 48px; }
.hero-title { font-family: var(--font-display); font-size: clamp(2.8rem, 5vw, 4.2rem); font-weight: 700; line-height: 1.15; color: var(--navy); margin-bottom: 24px; }
.accent-word { color: var(--blue); position: relative; }
.accent-word::after { content: ''; position: absolute; bottom: 4px; right: 0; left: 0; height: 6px; background: var(--gold); opacity: 0.3; border-radius: 4px; z-index: -1; }
.hero-desc { font-size: 1.1rem; color: var(--ink-60); line-height: 1.9; margin-bottom: 40px; border-right: 3px solid var(--gold); padding-right: 20px; }
.hero-cta { display: flex; gap: 16px; margin-bottom: 60px; flex-wrap: wrap; }
.hero-stats { display: flex; align-items: center; gap: 20px; padding: 14px 22px; background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); width: fit-content; flex-wrap: nowrap; white-space: nowrap; }
.stat { text-align: center; }
.stat-num { display: block; font-size: 1.2rem; font-weight: 900; color: var(--navy); line-height: 1; letter-spacing: -0.5px; }
.stat-lbl { font-size: 0.75rem; color: var(--ink-60); font-weight: 500; }
.stat-sep { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }

.hero-visual { position: relative; height: 420px; display: flex; align-items: center; justify-content: center; }
.visual-circle { width: 320px; height: 320px; border-radius: 50%; background: linear-gradient(135deg, var(--blue-light) 0%, rgba(200,160,48,0.1) 100%); border: 2px dashed rgba(37,99,235,0.2); animation: slow-spin 20s linear infinite; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.visual-circle-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; animation: slow-spin-reverse 20s linear infinite; }
@keyframes slow-spin { to { transform: rotate(360deg); } }
@keyframes slow-spin-reverse { to { transform: rotate(-360deg); } }
.visual-card { position: absolute; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--navy); font-size: 1rem; animation: float-card 4s ease-in-out infinite; }
.visual-card i { font-size: 1.4rem; color: var(--blue); }
.vc1 { top: 30px; right: 20px; animation-delay: 0s; }
.vc2 { bottom: 60px; right: 40px; animation-delay: 1.2s; }
.vc3 { top: 50%; left: 0; animation: float-card-3 4s ease-in-out 0.6s infinite; }
@keyframes float-card { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float-card-3 { 0%, 100% { transform: translateY(-50%); } 50% { transform: translateY(calc(-50% - 10px)); } }

.timeline { position: relative; padding-right: 40px; border-right: 2px solid var(--border); display: flex; flex-direction: column; gap: 0; }
.timeline-item { position: relative; padding: 0 40px 50px 0; display: flex; flex-direction: column; gap: 6px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-header { display: flex; align-items: center; }
.timeline-dot { position: absolute; right: -9px; top: 14px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); border: 3px solid var(--blue); transition: var(--transition); }
.active-dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 6px rgba(200,160,48,0.15); }
.timeline-year { font-size: 0.75rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 1px; }
.timeline-content h3 { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.timeline-content p { font-size: 0.97rem; color: var(--ink-60); line-height: 1.8; }

.teaching-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 40px; }
.teaching-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; transition: var(--transition); }
.teaching-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-4px); }
.tc-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--blue-light); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 18px; }
.teaching-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.teaching-card p { font-size: 0.95rem; color: var(--ink-60); line-height: 1.7; }
.tools-strip { background: var(--gold-light); border: 1px solid rgba(200,160,48,0.3); border-radius: var(--radius); padding: 24px 28px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.tools-label { font-size: 0.85rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.tools-list { display: flex; gap: 10px; flex-wrap: wrap; }
.tool-tag { background: white; color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 5px 14px; font-size: 0.82rem; font-weight: 600; }

.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.proj-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); position: relative; transition: var(--transition); display: flex; flex-direction: column; overflow: hidden; }
.proj-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-4px); }
.proj-card.featured { background: var(--navy); color: white; border-color: var(--navy); }
.proj-card.featured .proj-meta, .proj-card.featured p, .proj-card.featured .proj-link { color: rgba(255,255,255,0.7); }
.proj-card.featured h3 { color: white; }
.proj-card.featured .proj-tags span { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.2); }
.proj-card.featured .proj-link { color: var(--gold); }
.proj-badge { position: absolute; top: -12px; right: 20px; background: var(--gold); color: white; font-size: 0.72rem; font-weight: 700; padding: 4px 14px; border-radius: 100px; }
.proj-img { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--bg); }
.proj-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform 0.5s ease; }
.proj-card:hover .proj-img img { transform: scale(1.04); }
.proj-card > .proj-meta, .proj-card > h3, .proj-card > p, .proj-card > .proj-tags, .proj-card > .proj-link { padding-right: 24px; padding-left: 24px; }
.proj-meta { font-size: 0.75rem; font-weight: 700; color: var(--ink-60); text-transform: uppercase; letter-spacing: 1px; margin-top: 20px; margin-bottom: 8px; }
.proj-card h3 { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.proj-card p { font-size: 0.92rem; color: var(--ink-60); line-height: 1.7; margin-bottom: 16px; flex: 1; }
.proj-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.proj-tags span { background: var(--blue-light); color: var(--blue); border: 1px solid rgba(37,99,235,0.2); padding: 3px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.proj-link { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 700; color: var(--blue); transition: var(--transition); margin-bottom: 24px; margin-top: auto; }
.proj-link:hover { gap: 12px; }

.certs-gallery { display: flex; flex-direction: column; gap: 32px; margin-bottom: 40px; }
.cert-img-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: var(--transition); display: flex; flex-direction: column; }
.cert-img-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.cert-img-wrap { position: relative; overflow: hidden; width: 100%; }
.cert-img-wrap img { width: 100%; height: auto; display: block; transition: transform 0.5s ease; }
.cert-img-card:hover .cert-img-wrap img { transform: scale(1.02); }
.cert-img-overlay { position: absolute; inset: 0; background: rgba(27,58,107,0.45); display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--transition); }
.cert-img-overlay i { color: white; font-size: 1.8rem; }
.cert-img-card:hover .cert-img-overlay { opacity: 1; }
.cert-img-info { padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.cert-tag { display: inline-block; background: var(--blue-light); color: var(--blue); border: 1px solid rgba(37,99,235,0.2); padding: 3px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; width: fit-content; }
.cert-img-info h4 { font-size: 1rem; font-weight: 700; color: var(--navy); }

.lightbox { position: fixed; inset: 0; z-index: 99999; background: rgba(10,15,30,0.95); display: none; align-items: center; justify-content: center; padding: 20px; }
.lightbox.active { display: flex; }
.lightbox-img-wrap { position: relative; max-width: 900px; width: 100%; animation: lb-in 0.3s ease; }
@keyframes lb-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.lightbox-img-wrap img { width: 100%; border-radius: var(--radius); box-shadow: 0 32px 80px rgba(0,0,0,0.6); display: block; }
.lightbox-caption { text-align: center; color: rgba(255,255,255,0.75); font-size: 0.9rem; font-weight: 600; padding: 14px 0 0; }
.lightbox-close, .lightbox-prev, .lightbox-next { position: fixed; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: white; cursor: pointer; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 1rem; transition: var(--transition); }
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: var(--blue); border-color: var(--blue); }
.lightbox-close { top: 24px; left: 24px; }
.lightbox-prev { top: 50%; right: 24px; transform: translateY(-50%); }
.lightbox-next { top: 50%; left: 24px; transform: translateY(-50%); }

.achievements-strip { background: var(--blue-light); border-radius: var(--radius); padding: 28px 32px; display: flex; gap: 32px; flex-wrap: wrap; }
.achievement { display: flex; align-items: center; gap: 12px; font-size: 0.92rem; font-weight: 600; color: var(--navy); }
.achievement i { color: var(--blue); font-size: 1rem; flex-shrink: 0; }

.contact-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.contact-text .section-title { font-size: 2.8rem; margin-bottom: 16px; }
.contact-text > p { color: var(--ink-60); margin-bottom: 36px; font-size: 1rem; }
.contact-items { display: flex; flex-direction: column; gap: 14px; }
.contact-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: var(--transition); }
.contact-item:hover { border-color: var(--blue); box-shadow: var(--shadow-sm); transform: translateX(-4px); }
.ci-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--blue-light); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.ci-label { display: block; font-size: 0.72rem; color: var(--ink-60); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ci-val { display: block; font-size: 0.95rem; font-weight: 700; color: var(--navy); }
.cta-card { background: var(--navy); color: white; border-radius: var(--radius); padding: 40px; text-align: center; box-shadow: var(--shadow-lg); }
.cta-icon { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; margin: 0 auto 20px; }
.cta-card h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; }
.cta-card p { color: rgba(255,255,255,0.7); margin-bottom: 28px; line-height: 1.7; font-size: 0.95rem; }
.cta-card .btn-primary { background: var(--gold); box-shadow: 0 4px 16px rgba(200,160,48,0.4); }
.cta-card .btn-primary:hover { background: #b08820; }

footer { background: var(--navy); color: white; padding: 40px 40px 28px; }
.footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.footer-tagline { color: rgba(255,255,255,0.3); font-size: 0.75rem; letter-spacing: 1.5px; }

@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding: 100px 40px 60px; gap: 40px; }
  .hero-visual { display: none; }
  .hero-desc { border-right: none; border-bottom: 3px solid var(--gold); padding-right: 0; padding-bottom: 20px; }
  .hero-cta { justify-content: center; }
  .hero-stats { margin: 0 auto; }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu { display: flex; }
  .mobile-nav { display: block; }
  .container { padding: 0 24px; }
  .section { padding: 70px 0; }
  .teaching-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-wrapper { grid-template-columns: 1fr; }
  .achievements-strip { flex-direction: column; gap: 16px; }
  .hero { padding: 88px 24px 50px; }
  .lightbox-prev { right: 10px; }
  .lightbox-next { left: 10px; }
  .lightbox-close { top: 16px; left: 16px; }
  .timeline-item { padding: 0 28px 36px 0; }
}
@media (max-width: 480px) {
  .hero-title { font-size: 2.4rem; }
  .hero-stats { gap: 16px; padding: 12px 18px; flex-wrap: nowrap; white-space: nowrap; justify-content: center; }
  .tools-strip { flex-direction: column; align-items: flex-start; }
  .nav-container { padding: 0 20px; }
  footer { padding: 32px 24px 20px; }
}