:root {
  --bg-dark: #2d033b; /* خلفية أساسية بنفسجي غامق */
  --bg-darker: #1a001f; /* خلفية أغمق */
  --text: #f8f0ff; /* لون الكتابة أوف وايت بنفسجي فاتح */
  --muted: #c8a2c8; /* موڤ باهت للنصوص الثانوية */
  --primary: #810ca8; /* بنفسجي مشع */
  --accent: #c147e9; /* موڤ وردي (Accent) */
  --accent-2: #e5ccff; /* بنفسجي فاتح (Accent إضافي) */
  --card: #3d0c5e; /* خلفية الكروت */
  --line: #5a189a; /* خط أو حدود أفتح شوية */
  --light: #ede4f5; /* فاتح جدًا (لـ hover أو تفاصيل صغيرة) */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  color: var(--text);
  background: var(--bg-dark);
  scroll-behavior: smooth;
}

/* Top Navigation */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: linear-gradient(
    180deg,
    rgba(7, 11, 24, 0.85),
    rgba(7, 11, 24, 0.4)
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}
.brand {
  color: white;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 1px;
}
.nav-links {
  flex-wrap: wrap;
  display: flex;
  gap: 14px;
}
.nav-links a {
  color: var(--light);
  text-decoration: none;
  font-weight: 500;
}
.nav-links a:hover {
  color: white;
}

.section {
  padding: 100px 20px;
  margin: 0;
  position: relative;
  overflow: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Section spacing improvements */
.section + .section {
  margin-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 40px;
  text-align: center;
  color: var(--light);
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* Cover */
.cover {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0 20px;
  overflow: hidden;
}

.cover-bg {
  position: absolute;
  inset: 0; /* it give  top:0; right:0; bottom:0; left:0 to fill the parent */
  perspective: 1000px;
}

.grid3d {
  position: absolute;
  inset: -20vh -20vw 0 -20vw;
  background-image: radial-gradient(
      1200px 600px at 50% 120%,
      rgba(45, 125, 255, 0.35),
      transparent 60%
    ),
    radial-gradient(
      800px 400px at 80% 20%,
      rgba(255, 145, 77, 0.25),
      transparent 60%
    ),
    radial-gradient(
      600px 300px at 20% 80%,
      rgba(25, 195, 125, 0.2),
      transparent 60%
    ),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: auto, auto, auto, 60px 60px, 60px 60px;
  background-position: center, center, center, top left, top left;
  transform: rotateX(60deg) translateY(-10vh);
  transform-origin: center top;
}

@keyframes gridScroll {
  0% {
    background-position: center, center, center, 0px 0px, 0px 0px;
  }
  100% {
    background-position: center, center, center, 0px 600px, 600px 0px;
  }
}

@keyframes gridPulse {
  0%,
  100% {
    opacity: 0.8;
    transform: rotateX(60deg) translateY(-10vh) scale(1);
  }
  50% {
    opacity: 1;
    transform: rotateX(60deg) translateY(-10vh) scale(1.05);
  }
}

.glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      600px 300px at 50% 80%,
      rgba(25, 195, 125, 0.3),
      transparent 60%
    ),
    radial-gradient(
      800px 400px at 20% 70%,
      rgba(255, 145, 77, 0.25),
      transparent 60%
    );
  mix-blend-mode: screen;
  transition: transform 120ms ease-out;
}

@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Floating particles */
.cover-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
      2px 2px at 20% 30%,
      rgba(255, 255, 255, 0.8),
      transparent
    ),
    radial-gradient(2px 2px at 80% 70%, rgba(45, 125, 255, 0.6), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255, 145, 77, 0.7), transparent),
    radial-gradient(1px 1px at 90% 20%, rgba(25, 195, 125, 0.5), transparent);
  background-size: 200px 200px, 300px 300px, 150px 150px, 250px 250px;
}

@keyframes floatParticles {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  100% {
    transform: translateY(-200px) rotate(360deg);
  }
}

.cover-content {
  position: relative;
  text-align: center;
  z-index: 1;
  max-width: 900px;
  padding: 24px;
}

.profile-photo {
  width: 144px;
  height: 144px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.name {
  font-size: 40px;
  margin: 16px 0 8px;
}

.role {
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--light);
  letter-spacing: 0.3px;
}

.tagline {
  max-width: 900px;
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #5aa2ff);
  color: white;
  box-shadow: 0 10px 20px rgba(45, 125, 255, 0.3);
}

.btn.accent {
  background: linear-gradient(135deg, var(--accent), #ffb27f);
  color: #1a1a1a;
}

/* Typing caret */
.caret {
  display: inline-block;
  width: 1px;
  height: 1em;
  background: var(--light);
  margin-left: 6px;
  transform: translateY(2px);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Enhanced section transitions */
.section {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(255, 255, 255, 0.01),
    transparent
  );
}

.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--accent),
    var(--accent-2)
  );
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section.in-view::before {
  transform: scaleX(1);
}

/* Enhanced slide/stagger in when section in view */
.section .stagger {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  transition: all 700ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: blur(2px);
}

.section.in-view .stagger {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.section.in-view .stagger:nth-child(1) {
  transition-delay: 100ms;
}
.section.in-view .stagger:nth-child(2) {
  transition-delay: 200ms;
}
.section.in-view .stagger:nth-child(3) {
  transition-delay: 300ms;
}
.section.in-view .stagger:nth-child(4) {
  transition-delay: 400ms;
}
.section.in-view .stagger:nth-child(5) {
  transition-delay: 500ms;
}

/* Section entrance animation - FIXED */
.section {
  opacity: 0;
  transform: translateY(30px);
  transition: all 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Ensure proper spacing between sections */
.section {
  padding: 100px 20px;
  margin: 0;
  position: relative;
  overflow: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Section spacing improvements */
.section + .section {
  margin-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* Remove excessive spacing */
.section {
  padding: 100px 20px;
}

.section + .section {
  margin-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* Skills grid */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.skills-group {
  background: var(--card);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  text-align: center;
  transition: all 300ms ease;
}

.skills-group:hover {
  border-color: rgba(45, 125, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.skills-group h4 {
  color: var(--accent);
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
}

.skills-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.skills-group li {
  color: var(--muted);
  margin: 8px 0;
  line-height: 1.6;
}

/* experience cards */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.card {
  perspective: 1000px;
}

.card-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card:hover .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  min-height: 230px;
  backface-visibility: hidden;
  overflow-y: auto;
  scrollbar-color: #ff6600 #1a1a1a;
}

.card-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

/* Services pricing */
.pricing {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.price-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  transition: transform 300ms ease, box-shadow 300ms ease;
}

.price-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}
.price-card.featured {
  outline: 2px solid var(--accent-2);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  transition: all 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: rgba(45, 125, 255, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.project-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(
    135deg,
    rgba(45, 125, 255, 0.1),
    rgba(255, 145, 77, 0.1)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.project-card:hover .project-img {
  transform: scale(1.05);
}

.project-content {
  padding: 24px;
}

.project-content h4 {
  color: var(--light);
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
}

.project-content p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 16px;
}

.project-tech {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 20px !important;
}

.project-btn {
  background: linear-gradient(135deg, var(--primary), #5aa2ff);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: all 300ms ease;
  border: none;
  cursor: pointer;
  margin-bottom: 1rem;
}

.project-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(45, 125, 255, 0.3);
}

.github-icon {
  width: 18px;
  height: 18px;
}

/* Contact */
.contact {
  background: radial-gradient(
      1000px 400px at 50% 0%,
      rgba(45, 125, 255, 0.1),
      transparent
    ),
    var(--bg-darker);
}

.contact-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .contact-content {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.contact-info h4,
.contact-form h4 {
  color: var(--light);
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 600;
}

.contact-info p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 32px;
  font-size: 16px;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--light);
  text-decoration: none;
  transition: all 300ms ease;
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 300ms ease;
  z-index: -1;
}

.social-link:hover {
  transform: translateY(-4px);
  border-color: rgba(45, 125, 255, 0.3);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.social-link:hover::before {
  opacity: 0.1;
}

.social-link.github:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.social-link.linkedin:hover {
  border-color: rgba(0, 119, 181, 0.5);
}

.social-link.email:hover {
  border-color: rgba(234, 67, 53, 0.5);
}

.social-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.contact-form {
  background: rgba(255, 255, 255, 0.02);
  padding: 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.contact-form .field {
  margin-bottom: 20px;
}

.contact-form label {
  display: block;
  color: var(--light);
  margin-bottom: 8px;
  font-weight: 500;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  background: rgba(14, 21, 40, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 8px;
  padding: 14px 16px;
  outline: none;
  transition: all 300ms ease;
  font-family: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 125, 255, 0.2);
  background: rgba(14, 21, 40, 0.9);
}

.contact-form button {
  width: 100%;
  margin-top: 8px;
}

/* Footer */
.footer {
  background: var(--bg-darker);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 60px 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-content {
    grid-template-columns: repeat(4, 1fr);
  }
}

.footer-section h5 {
  color: var(--light);
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
}

.footer-section p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: 12px;
}

.footer-section a {
  color: var(--muted);
  text-decoration: none;
  transition: color 300ms ease;
}

.footer-section a:hover {
  color: var(--light);
}

.footer-socials {
  display: flex;
  gap: 16px;
}

.footer-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: all 300ms ease;
}

.footer-socials a:hover {
  background: rgba(45, 125, 255, 0.1);
  border-color: rgba(45, 125, 255, 0.3);
  transform: translateY(-2px);
}

.footer-socials svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.footer-socials a:hover svg {
  color: var(--light);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-bottom p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Enhanced button hover effects */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 600ms ease;
}

.btn:hover::before {
  transform: translateX(100%);
}

/* Responsive */
@media (min-width: 840px) {
  .about .about-content {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
  .skills-grid {
    grid-template-columns: 1fr 1fr;
  }
  .cards {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .pricing {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .custom-cursor {
    display: none;
  }
  * {
    cursor: auto;
  }
}

/* Remove old project styles */
.project-inner,
.project-front,
.project-back,
.project-modal {
  display: none;
}

/* Remove excessive spacing */
.section {
  padding: 100px 20px;
}

.section + .section {
  margin-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* Fix contact form field layout */
.contact-form .field:nth-child(3) {
  grid-column: 1 / -1;
}

/* About */
.about .about-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  text-align: center;
}

.about .about-content p {
  font-size: 18px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 800px;
  margin: 0 auto;
}

.skills-icons {
  display: flex;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.skills-icons li {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.skills-icons li::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 400ms ease;
  z-index: -1;
}

.skills-icons li:hover {
  transform: translateY(-6px) rotateX(15deg) rotateY(-10deg) scale(1.1);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.skills-icons li:hover::before {
  opacity: 0.15;
}

/* Education timeline */
.timeline {
  border-left: 3px solid var(--primary);
  padding-left: 24px;
  margin: 0 auto;
  max-width: 600px;
}

.timeline-item {
  margin: 24px 0;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 8px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid var(--bg-dark);
}

.timeline-year {
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 18px;
}

.timeline-body h4 {
  color: var(--light);
  margin: 0 0 8px;
  font-size: 20px;
}

.timeline-body p {
  color: var(--muted);
  margin: 4px 0;
  line-height: 1.6;
}

/* Flip page overlay */
.page-flip {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0c1328, #0a1023);
  transform-origin: left center;
  transform: rotateY(90deg);
  pointer-events: none;
  z-index: 9;
}

@keyframes flipPage {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(90deg);
  }
}
