/* ====== Design System & Variables ====== */
:root {
  --bg-main: #050714;
  --bg-elevated: rgba(16, 20, 40, 0.6);
  --bg-glass: rgba(5, 7, 20, 0.7);
  --accent: #5f7bff;
  --accent-soft: rgba(95, 123, 255, 0.18);
  --accent-gradient: linear-gradient(135deg, #5f7bff, #9b51e0);
  --accent-gradient-hover: linear-gradient(135deg, #7a91ff, #af6df0);
  --text-main: #f5f7ff;
  --text-muted: #a5adcd;
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(95, 123, 255, 0.3);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 25px rgba(95, 123, 255, 0.4);
  --transition-fast: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1200px;
}

/* ====== Resets & Global ====== */
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(95, 123, 255, 0.15), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(155, 81, 224, 0.15), transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.8;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

ul {
  list-style: none;
}

/* ====== Typography ====== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5em;
}

.highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ====== Layout ====== */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

main {
  flex: 1;
}

.section {
  padding-block: 80px;
  position: relative;
}

.section-header {
  margin-bottom: 48px;
  text-align: center;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 16px;
}

.section-subtitle {
  font-size: clamp(16px, 2vw, 18px);
  color: var(--text-muted);
  max-width: 600px;
  margin-inline: auto;
}

/* ====== Components ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 8px 25px rgba(95, 123, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
  background: var(--accent-gradient-hover);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(10px);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
  transform: translateY(-3px);
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-glow);
  transform: translateY(-5px);
}

/* ====== Header & Navigation ====== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition-fast);
}

header.scrolled {
  background: rgba(5, 7, 20, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border: 1px solid var(--border-soft);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text .name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-text .title {
  font-size: 13px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding-block: 8px;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-fast);
  border-radius: 2px;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-link:hover::after, .nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-cta {
  display: flex;
  gap: 16px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 24px;
  cursor: pointer;
}

/* ====== Hero Section ====== */
.hero {
  padding-top: 120px;
  padding-bottom: 80px;
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(49, 227, 180, 0.1);
  border: 1px solid rgba(49, 227, 180, 0.3);
  color: #31e3b4;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.hero-title {
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.5;
  margin-bottom: 24px;
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 600px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 48px;
}

/* ====== Stats Banner ====== */
.stats-banner {
  padding-block: 40px;
  background: rgba(16, 20, 40, 0.4);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.stats-grid {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 32px;
  transition: transform var(--transition-fast);
}

.stat-item:hover {
  transform: translateY(-5px);
}

.stat-value {
  font-size: clamp(36px, 4vw, 48px);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.stat-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

/* Hero Visual */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.portrait-container {
  position: relative;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portrait-glow {
  position: absolute;
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(95, 123, 255, 0.4) 0%, transparent 70%);
  filter: blur(40px);
  z-index: 0;
  animation: pulseGlow 4s infinite alternate;
}

@keyframes pulseGlow {
  0% { opacity: 0.6; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1.05); }
}

.portrait-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 6px;
  background: var(--accent-gradient);
  z-index: 1;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: spinRing 10s linear infinite;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.portrait-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-main);
  animation: spinRingReverse 10s linear infinite; /* Counter spin to keep image upright */
}

@keyframes spinRingReverse {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.portrait-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.1); /* Zoom slightly */
}

.floating-badge {
  position: absolute;
  padding: 12px 20px;
  background: rgba(16, 20, 40, 0.85);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 2;
  animation: float 6s ease-in-out infinite;
}

.floating-badge i {
  color: var(--accent);
  font-size: 18px;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

.badge-1 { top: 10%; right: -20px; animation-delay: 0s; }
.badge-2 { bottom: 15%; left: -30px; animation-delay: 2s; }
.badge-3 { bottom: 5%; right: 10%; animation-delay: 4s; }

/* ====== About Section ====== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.service-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  padding: 24px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.service-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  transform: translateY(-5px);
}

.service-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}

.service-card h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

.service-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ====== Projects Section ====== */
.filter-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

.filter-btn {
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-glow);
}

.filter-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(95, 123, 255, 0.3);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 32px;
}

.project-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  transition: all var(--transition-slow), opacity 0.4s ease, transform 0.4s ease;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.project-card.hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  display: none;
}

.project-card:hover {
  transform: translateY(-10px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-soft);
}

.project-image {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #000;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), filter 0.5s ease;
  filter: saturate(0.7) brightness(0.8);
}

.project-card:hover .project-image img {
  transform: scale(1.1);
  filter: saturate(1.1) brightness(1);
}

.project-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(5, 7, 20, 0.95) 0%,
    rgba(5, 7, 20, 0.2) 50%,
    transparent 100%
  );
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.project-card:hover .project-overlay {
  opacity: 0.9;
}

.project-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 30px 24px;
  z-index: 2;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(10px);
}

.project-card:hover .project-content {
  transform: translateY(0);
}

.project-tag {
  display: inline-block;
  padding: 5px 12px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-radius: 6px;
  margin-bottom: 12px;
  box-shadow: 0 4px 15px rgba(95, 123, 255, 0.4);
  backdrop-filter: blur(5px);
}

.project-title {
  font-size: 24px;
  color: #fff;
  margin-bottom: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.project-card:hover .project-meta {
  opacity: 1;
}

.project-meta i {
  color: var(--accent);
  margin-left: 4px;
}

/* Add a glass effect to the content background on hover */
.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-slow);
  z-index: 1;
  pointer-events: none;
}

.project-card:hover::before {
  opacity: 0.4;
}

.project-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
}

/* ====== Clients Marquee ====== */
.clients-marquee-container {
  overflow: hidden;
  padding-block: 40px;
  position: relative;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.clients-marquee {
  display: flex;
  gap: 32px;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.clients-marquee:hover {
  animation-play-state: paused;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.client-item i {
  font-size: 20px;
  color: var(--accent);
}

.client-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-50% - 16px)); /* Adjust based on duplication */ }
}

/* ====== Contact Section ====== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.contact-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent);
  transition: all var(--transition-fast);
}

.contact-item:hover .contact-icon {
  background: var(--accent-gradient);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.contact-details h4 {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.contact-details p, .contact-details a {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-control {
  width: 100%;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea.form-control {
  min-height: 150px;
  resize: vertical;
}

/* ====== Footer ====== */
footer {
  background: #03040a;
  padding-block: 40px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  color: var(--text-muted);
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.social-link:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-3px);
}

.footer-tech-stack {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 0;
  padding: 10px 10px 0 10px;
}

footer p {
  margin-top: 5px;
}

.tech-item {
  font-size: 20px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  opacity: 0.6;
}

.tech-item:hover {
  color: var(--accent);
  opacity: 1;
  transform: scale(1.2);
}

/* ====== Scroll Reveal Animations ====== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal.fade-left {
  transform: translateX(-50px);
}
.reveal.fade-right {
  transform: translateX(50px);
}
.reveal.fade-left.active, .reveal.fade-right.active {
  transform: translateX(0);
}

/* ====== Mobile Menu Global (Hidden on Desktop) ====== */
.mobile-menu {
  display: none;
}

/* ====== Responsive Design ====== */
@media (max-width: 1024px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }
  
  .hero-content {
    order: 2;
  }
  
  .hero-visual {
    order: 1;
  }
  
  .hero-subtitle {
    margin-inline: auto;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .hero-stats {
    justify-content: center;
  }
  
  .about-grid, .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  
  .nav-links, .nav-cta {
    display: none;
  }
  
  /* Mobile Menu */
  .mobile-menu {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-soft);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-fast);
    z-index: 999;
  }
  
  .mobile-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  
  .mobile-menu .nav-link {
    display: block;
    font-size: 18px;
    padding: 12px;
    border-radius: 8px;
  }
  
  .mobile-menu .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
  }
  
  .portrait-container {
    width: 300px;
    height: 300px;
  }
  
  .floating-badge {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .section {
    padding-block: 60px;
  }
}
