* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #a855f7;
  --border: #334155;
}
.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #a855f7;
  --border: #cbd5e1;
}
body {
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
}
/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: 
    opacity 0.9s ease-out,
    transform 0.9s ease-out;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
/* Gradual delay for elements within the same section (optional - makes the display look better) */
.hero-text .reveal:nth-child(1) { transition-delay: 0.1s; }
.hero-text .reveal:nth-child(2) { transition-delay: 0.25s; }
.hero-text .reveal:nth-child(3) { transition-delay: 0.4s;  }
.hero-text .reveal:nth-child(4) { transition-delay: 0.55s; }
.hero-text .reveal:nth-child(5) { transition-delay: 0.7s;  }
.skills-grid .skill-card:nth-child(1) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(3) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(4) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(5) { transition-delay: 0.1s; }
.projects-grid .project-card:nth-child(1) { transition-delay: 0.25s; }
.projects-grid .project-card:nth-child(2) { transition-delay: 0.25s; }
.projects-grid .project-card:nth-child(3) { transition-delay: 0.25s;  }
.projects-grid .project-card:nth-child(4) { transition-delay: 0.25s; }
/* =================== Back to Top =================== */
#back-to-top {
  position: fixed;
  bottom: 70px;
  right: 30px;
  width: 52px;
  height: 52px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  z-index: 9999;
}
#back-to-top:hover {
  background: #4f46e5;
  transform: translateY(35px);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
}
#back-to-top.show {
  opacity: 1;
  visibility: visible;
}
.light-theme #back-to-top {
  background: #6366f1;
}
/* Header Styling */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background 0.4s, border-color 0.4s;
}
.light-theme header {
  background: rgba(248, 250, 252, 0.95);
}
header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  flex-direction: row-reverse;
}
.logo img{
  width: 60px;
  height: auto;
}
.logo span {
  color: var(--accent-light);
}
.nav-links {
  display: flex;
  flex-direction: row-reverse;
  list-style: none;
  gap: 40px;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 20px;
  text-decoration: none;
  font-weight: bolder;
  transition: color 0.3s;
}
.nav-links a:hover {
  color: var(--accent);
}
/* Mobile menu */
.nav-links {
  transition: all 0.35s ease;
}
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  }
  .nav-links.active {
    display: flex;
  }
  .nav-links li {
    margin: 18px 0;
    text-align: center;
  }
  .theme-toggle-li {
    margin: 30px 0 10px;
  }
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--accent);
  cursor: pointer;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
/* Theme button */
.theme-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.4s;
}
.theme-btn:hover {
  background: var(--bg-secondary);
  transform: rotate(-20deg) scale(1.1);
}
.desktop-only { 
  display: none; 
}
.mobile-only  { 
  display: none; 
}
@media (min-width: 769px) {
  .desktop-only { display: block; }
  .menu-toggle   { display: none; }
}
@media (max-width: 768px) {
  .mobile-only   { display: block; }
  .menu-toggle   { display: block; }
  .desktop-only  { display: none; }
}
/* Hero Styling */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 80px 0 60px;
}
.hero-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px 100px;
  flex-wrap: wrap;
}
.hero-image,
.hero-text {
  flex: 1;
  min-width: 320px;
}
.hero-image {
  text-align: center;
}
.image-wrapper {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
}
.profile-photo {
  width: 100%;
  height: auto;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 8px rgba(99, 102, 241, 0.12);
  transition: all 0.4s ease;
}
.profile-photo:hover {
  transform: scale(1.03) translateY(-8px);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 0 12px rgba(99, 102, 241, 0.18);
}
.hero-text {
  text-align: left;
}
.greeting {
  font-size: 24px;
  color: var(--text-light);
  margin-bottom: 8px;
}
.hero-text span{
  color: var(--accent-light);
}
h1 {
  font-size: clamp(3.8rem, 9vw, 6.2rem);
  margin: 0 0 12px;
  line-height: 1;
  color: var(--accent);
}
.hero-text h2{
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  color: var(--primary);
  margin-bottom: 28px;
}
.lead {
  font-size: 1.35rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 40px;
}
.hero-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 32px 0 40px;
  justify-content: flex-end;
}
.btn {
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.28s ease;
}
.btn-primary {
  border: 2px solid var(--accent-light);
  background: var(--accent-light);
  color: white;
  font-weight: bold;
}
.btn-primary:hover {
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}
.btn-outline {
  border: 2px solid var(--accent-dark);
  background: var(--accent-dark);
  color: white;
  font-weight: bold;
}
.btn-outline:hover {
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}
.social-icons {
  display: flex;
  gap: 24px;
  font-size: 1.9rem;
  justify-content: center;
}
.social-icons a {
  color: var(--text-light);
  transition: all 0.5s;
}
.social-icons a:hover {
  color: var(--accent);
  transform: translateY(-3px);
}
/* Mobile → صورة فوق، نصوص تحت */
@media (max-width: 960px) {
  .hero-split {
    flex-direction: column-reverse;
    text-align: center;
    gap: 50px;
  }

  .hero-text {
    text-align: center;
  }

  .hero-buttons,
  .social-icons {
    justify-content: center;
  }
}
/* Sections Styling */
.section {
  padding: 120px 0;
  background: var(--bg-primary);
  transition: background 0.4s;
}
h2 {
  font-size: 3.5rem;
  text-align: center;
  margin-bottom: 80px;
}
h2 span { 
  color: var(--accent);
}
/* About Styling */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 60px;
  align-items: center;
}
.photo-frame {
  width: 380px;
  height: 380px;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  margin: 0 auto;
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about-text p {
  text-align: end;
  font-size: 22px;
  margin-bottom: 20px;
  color: var(--text-secondary);
}
/* Skills  Styling */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 28px;
}
.skill-card {
  background: var(--bg-secondary);
  padding: 32px 20px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.3s;
}
.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-8px);
}
.skill-card i {
  font-size: 3.8rem;
  margin-bottom: 16px;
  color: var(--accent);
}
.skill-card h3 { 
  font-size: 1.3rem; 
}
/* Projects  styling */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 32px;
}
.project-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s;
}
.project-card:hover {
  transform: translateY(-12px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  border-color: var(--accent);
}
.project-img img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.project-info { 
  padding: 24px;
  text-align: end; 
}
.project-info h3 { 
  font-size: 1.6rem;
  margin-bottom: 12px;
}
.project-info p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: end;
}
.tags span {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
}
.project-link {
  font-size: 20px;
  color: var(--accent);
  text-decoration: none;
  font-weight: bolder;
}
.project-link:hover { 
  text-decoration: underline; 
}
.btn-project{
  display: block;
  margin: 0 auto;
  width: fit-content;
  margin-top: 80px;
  padding: 14px 32px;
  border-radius: 8px;
  border: 2px solid var(--accent-dark);
  font-size: 20px;
  font-weight: bold;
  background: var(--accent-dark);
  color: white;
  text-decoration: none;
  transition: all 0.4s;
}
.btn-project:hover{
  background: var(--bg-secondary);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  transform: translateY(-5px);
}
/* Contact  styling */
.contact { 
  text-align: center;
}
.contact-lead {
  font-size: 1.4rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
}
.contact .large {
  border: 2px solid var(--accent);
  padding: 18px 48px;
  font-size: 20px;
  background: var(--accent);
  color: var(--text-primary);
  transition: all 0.4s;
}
.contact .large:hover{
  background: var(--bg-secondary);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  transform: translateY(-5px);
}
.social-big {
  margin-top: 60px;
  display: flex;
  justify-content: center;
  gap: 40px;
  font-size: 3.2rem;
}
.social-big a {
  color: var(--text-secondary);
  transition: all 0.3s;
}
.social-big a:hover {
  color: var(--accent);
  transform: translateY(-4px);
}
/* Footer styling */
footer {
  font-size: 20px;
  background: var(--bg-primary);
  padding: 20px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  transition: background 0.4s, border-color 0.4s;
}
/* Mobile adjustments */
@media (max-width: 768px) {
  h1 { font-size: 3.8rem; }
  h2 { font-size: 2.8rem; }
  .about-grid { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; }
}
@media (max-width: 768px) {
  .container{
    padding: 10px 15px;
  }
  .hero .container{
    margin-top: 20px;
  }
  .mobile-only{
    display: block;
    position: absolute;
    top: 23px;
    right: 13%;
  }
  .about-text P{
    text-align: center;
  }
  footer{
    padding: 13px 0;
  }
}