:root {
  --bg-primary: #0b1021;
  --bg-secondary: rgba(255, 255, 255, 0.04);
  --bg-tertiary: rgba(255, 255, 255, 0.06);
  --text-primary: #f4f6fb;
  --text-secondary: #c6c8d6;
  --text-muted: #9aa1b5;
  --accent-primary: #6c63ff;
  --accent-secondary: #00d4ff;
  --border-color: rgba(255, 255, 255, 0.15);
  --surface: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-blur: 16px;
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
  --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.4);
  --font-en: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-body: var(--font-en);
  --section-padding: 96px;
  --container-width: 1200px;
  --nav-height: 72px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: rgba(0, 0, 0, 0.04);
  --bg-tertiary: rgba(0, 0, 0, 0.06);
  --text-primary: #0f172a;
  --text-secondary: #1f2937;
  --text-muted: #4b5563;
  --accent-primary: #5b4bff;
  --accent-secondary: #0ac5ff;
  --border-color: rgba(15, 23, 42, 0.12);
  --surface: rgba(255, 255, 255, 0.8);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 12px 44px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

[lang="ar"] {
  --font-body: var(--font-ar);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-secondary);
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(90%, var(--container-width));
  margin-inline: auto;
}

.section {
  padding: var(--section-padding) 0;
}

.section-header {
  margin-bottom: 32px;
}

.section-header.center {
  text-align: center;
  margin-inline: auto;
  max-width: 760px;
}

h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-secondary);
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--accent-secondary);
  margin-bottom: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, color 0.3s ease;
}

.btn.primary {
  background: var(--gradient-primary);
  color: #0b1021;
  box-shadow: 0 10px 30px rgba(108, 99, 255, 0.35);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(108, 99, 255, 0.45);
}

.btn.ghost {
  border-color: var(--border-color);
  color: var(--text-primary);
  background: transparent;
}

.btn.ghost:hover {
  border-color: transparent;
  background: var(--glass-bg);
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  z-index: 1000;
  background: transparent;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--glass-border);
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 18px;
  align-items: center;
}

.nav-links a {
  font-weight: 500;
  color: var(--text-secondary);
}

.nav-links a:hover {
  color: var(--accent-secondary);
}

.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  cursor: pointer;
  justify-content: center;
}

.nav-toggle span {
  height: 2px;
  width: 100%;
  background: var(--text-primary);
  border-radius: 999px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: absolute;
  top: calc(var(--nav-height) + 8px);
  inset-inline: 5%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 16px;
  flex-direction: column;
  gap: 12px;
}

.mobile-menu.open { display: flex; }

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-top: calc(var(--nav-height) + 40px);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(108, 99, 255, 0.25), transparent 35%),
              radial-gradient(circle at 80% 10%, rgba(0, 212, 255, 0.25), transparent 30%),
              radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.05), transparent 40%);
  filter: blur(0px);
  z-index: 0;
  animation: gradientShift 16s ease infinite;
}

@keyframes gradientShift {
  0% { transform: translate3d(0,0,0); }
  50% { transform: translate3d(0, -10px, 0); }
  100% { transform: translate3d(0,0,0); }
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: float 10s ease-in-out infinite;
}

.shape-1 { width: 280px; height: 280px; background: var(--accent-primary); top: 10%; inset-inline-start: 8%; animation-duration: 12s; }
.shape-2 { width: 220px; height: 220px; background: var(--accent-secondary); bottom: 10%; inset-inline-end: 12%; animation-duration: 14s; }
.shape-3 { width: 180px; height: 180px; background: #ff8fb1; top: 35%; inset-inline-end: 35%; animation-duration: 16s; }

@keyframes float {
  0% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-16px) scale(1.02); }
  100% { transform: translateY(0px) scale(1); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  text-align: center;
  padding: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  font-size: clamp(2.2rem, 3vw, 3.3rem);
  margin-bottom: 16px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .subtitle {
  margin-bottom: 24px;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat {
  padding: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
}

.stat-value { font-weight: 700; font-size: 1.2rem; }
.stat-label { color: var(--text-secondary); font-size: 0.95rem; }

/* Grids and cards */
.split {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: center;
}

.grid {
  display: grid;
  gap: 18px;
}

.services-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.portfolio-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.pricing-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: stretch; }

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.25);
}

.icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--gradient-primary);
  color: #0b1021;
  font-size: 1.2rem;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px rgba(108, 99, 255, 0.28);
}

.service p { color: var(--text-secondary); }

.project {
  padding: 0;
  overflow: hidden;
  position: relative;
}

.project img { width: 100%; height: 240px; object-fit: cover; transition: transform 0.4s ease; }

.project:hover img { transform: scale(1.06); }

.project figcaption {
  padding: 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.72));
  color: #f4f6fb;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
}

.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pricing-card ul { list-style: none; color: var(--text-secondary); display: grid; gap: 8px; }
.pricing-card .price { font-size: 1.5rem; font-weight: 700; }

.pricing-card .btn { margin-top: auto; }

.pricing-card.recommended {
  border: 1px solid var(--accent-primary);
  box-shadow: 0 18px 48px rgba(108, 99, 255, 0.3);
  transform: translateY(-4px);
}

.pricing-card .badge {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gradient-primary);
  color: #0b1021;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Testimonials */
.testimonial-slider {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-md);
}

.slider-track {
  display: flex;
  width: 300%;
  transition: transform 0.5s ease;
}

.slide {
  min-width: 100%;
  padding: 28px;
  display: grid;
  gap: 14px;
}

.slide p { color: var(--text-secondary); }

.stars { color: #f6c344; letter-spacing: 2px; }

.slider-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
}

.slider-controls button {
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.dots { display: flex; gap: 8px; }

.dots button {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.dots button.active { background: var(--gradient-primary); border-color: transparent; }

/* Contact */
.contact-form .form-group {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

input, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.error { color: #ff6b6b; font-size: 0.9rem; min-height: 18px; }

.form-success { color: #3dd598; margin-top: 8px; }

.contact-info .map iframe {
  width: 100%;
  border: 0;
  border-radius: 12px;
  height: 240px;
}

/* Footer */
.footer {
  padding: 28px 0 36px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.footer-links { display: flex; gap: 14px; }

/* Back to top */
#back-to-top {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-primary);
  color: #0b1021;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  z-index: 800;
}

#back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: grid;
  place-items: center;
  z-index: 2000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loader.hidden { opacity: 0; visibility: hidden; }

.spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 5px solid var(--border-color);
  border-top-color: var(--accent-secondary);
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Reveal animations */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: transform, opacity;
}

[data-reveal="fade-left"] { transform: translateX(-40px); }
[data-reveal="scale"] { transform: scale(0.94); }

.revealed {
  opacity: 1 !important;
  transform: translate(0) scale(1) !important;
  will-change: auto;
}

/* Responsive */
@media (max-width: 1024px) {
  .hero-content { padding: 26px; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-actions .btn { display: none; }
  .section { padding: 72px 0; }
  .hero { min-height: 90vh; }
  .footer-content { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .slider-track { transition: none !important; }
}

/* RTL overrides */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .nav-content { direction: rtl; }
[dir="rtl"] .nav-actions { flex-direction: row-reverse; }
[dir="rtl"] .nav-toggle { order: 2; }
[dir="rtl"] .logo { order: 1; }
[dir="rtl"] .nav-links { direction: rtl; }

[dir="rtl"] [data-reveal="fade-left"] { transform: translateX(40px); }

[dir="rtl"] .slider-controls { direction: ltr; }
[dir="rtl"] .slider-track { direction: rtl; }

/* Utility */
strong { font-weight: 700; }
